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
updates the currentTime div
function updateCurrentTime() { $('#current_time').html(formatTime(getCurrentTime())); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCurrentTime() {\n elapsedSeconds++;\n $('.current-time').text(getTimeString(elapsedSeconds));\n }", "function updateTime() {\n var nowTime = moment().format('LTS');\n $(\"#currentTime\").html(nowTime);\n}", "function updateClock() {\n\tdocument.getElementById(\"time\").innerHTML = timeSinceStart();\n}", "_updateTime() {\r\n // Determine what to append to time text content, and update time if required\r\n let append = \"\";\r\n if (this.levelNum <= MAX_LEVEL && !this.paused) {\r\n this.accumulatedTime += Date.now() - this.lastDate;\r\n }\r\n this.lastDate = Date.now();\r\n\r\n // Update the time value in the div\r\n let nowDate = new Date(this.accumulatedTime);\r\n let twoDigitFormat = new Intl.NumberFormat('en-US', {minimumIntegerDigits: 2});\r\n if (nowDate.getHours() - this.startHours > 0) {\r\n this.timerDisplay.textContent = `Time: ${nowDate.getHours() - this.startHours}:`+\r\n `${twoDigitFormat.format(nowDate.getMinutes())}:` +\r\n `${twoDigitFormat.format(nowDate.getSeconds())}${append}`;\r\n }\r\n else {\r\n this.timerDisplay.textContent = `Time: ${twoDigitFormat.format(nowDate.getMinutes())}:` +\r\n `${twoDigitFormat.format(nowDate.getSeconds())}${append}`;\r\n }\r\n }", "function updateCurrentTime() {\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime);\n currentTime = fancyTimeFormat(currentTime);\n var duration = Math.floor(song.duration);\n duration = fancyTimeFormat(duration);\n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n }", "function update()\n\t\t{\n\t\t\tdocument.getElementById('songTime').innerHTML = millisToMins(player.currentTime);\n\t\t\tslider.value = player.currentTime;\n\t\t}", "function currentTime() {\n var current = moment().format('LT');\n $(\"#current-time\").html(current);\n setTimeout(currentTime, 1000);\n }", "function updateTimerDisplay(){\n // Update current time text display.\n $('#current-time').text(formatTime( player.getCurrentTime() ));\n $('#duration').text(formatTime( player.getDuration() ));\n }", "function updateCurrentTime() {\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime);\n currentTime = fancyTimeFormat(currentTime);\n var duration = Math.floor(song.duration);\n duration = fancyTimeFormat(duration)\n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n\n }", "function currentTime() {\n var timeNow = moment().format('h:mm a')\n $(\"#currentTime\").text(timeNow)\n }", "updateCurrentTimeDisplay() {\n const minutes = Math.floor(this.video.currentTime / 60);\n let seconds = Math.floor(this.video.currentTime);\n // Pad a leading 0 for display purposes\n if (seconds < 10) {\n seconds = \"0\" + seconds;\n }\n this.durationText.textContent = minutes + \":\" + seconds;\n }", "function updateTimer() {\n //console.log(currentTime);\n formatTimeDuration(currentTime);\n var timeString = formatTime(currentTime);\n $stopwatch.html(timeString);\n currentTime += incrementTime;\n }", "function updateTime() {\n var time = 0;\n if (global.startTime != null) {\n time = (new Date()).getTime() - global.startTime;\n time = (time/1000)|0;\n }\n var timeDiv = document.getElementById(\"timeDisplay\");\n timeDiv.innerHTML = formatTime(time);\n}", "function timeupdate() {\n var lastBuffered = video.buffered.end(video.buffered.length-1);\n seekbar.min = video.startTime;\n seekbar.max = lastBuffered;\n seekbar.value = video.currentTime;\n $('#timer').html(formatTime(video.currentTime));\n if(review == true)\n {\n\t sk.min = video.startTime;\n\t sk.max = lastBuffered;\n\t sk.value = video.currentTime;\n\t reviewText();\n }\n}", "function updatetime() {\n time.innerHTML = new Date;\n \n}", "function updateTimerDisplay() {\n // Update current time text display.\n //$('#current-time').text(formatTime(player.getCurrentTime()))\n //$('#duration').text(formatTime(player.getDuration()))\n}", "function updateClock() {\n let date = new Date();\n let curr = pad(date.getHours(), 2) + \":\" + pad(date.getMinutes(), 2);\n document.getElementById(\"currentTime\")\n .innerText = curr;\n}", "function updateTimer() {\n\t\t\tvar timeString = formatTime(currentTime);\n\t\t\t$stopwatch.html(timeString);\n\t\t\tcurrentTime += incrementTime;\n\t\t}", "function updateClock() {\n newDate = new Date();\n newStamp = newDate.getTime();\n var diff = Math.round((newStamp-startStamp)/1000);\n\n var d = Math.floor(diff/(24*60*60));\n diff = diff-(d*24*60*60);\n var h = Math.floor(diff/(60*60));\n diff = diff-(h*60*60);\n var m = Math.floor(diff/(60));\n diff = diff-(m*60);\n var s = diff;\n\n document.getElementById(item.id).innerHTML = d+\" day(s), \"+h+\" hour(s), \"+m+\" minute(s), \"+s+\" second(s) active\";\n }", "function updateTimerDisplay(){\n // Update current time text display.\n $('#current-time').text(formatTime(player.getCurrentTime() ));\n $('#duration').text(formatTime( player.getDuration() ));\n}", "function updateTimeDisplay(newTime) {\n $(\".timer\").text(time);\n time = newTime;\n}", "function displayCurrentTime() {\n setInterval(function(){\n $('#current-time').html(moment().format('HH:mm'))\n }, 1000);\n }", "function displayCurrentTime() {\n\tsetInterval(function(){\n\t\t$('#current-time').html(moment().format('hh:mm A'))\n\t }, 1000);\n\t}", "function updateTime() {\n //Fetch the state from the main class\n let state = ipcRenderer.sendSync('state');\n\n let left = state.time_left;\n if (!state.paused) left -= new Date().getTime() - state.status_changed;\n\n document.getElementById(\"timeleft\").textContent = formatTime(left);\n}", "function updateTime() {\n let date = getToday();\n let hours = date.getHours();\n let minutes = date.getMinutes();\n let seconds = date.getSeconds();\n\n hours = addZero(hours);\n minutes = addZero(minutes);\n seconds = addZero(seconds);\n\n document.querySelector(\".date .time\").innerText = hours + \":\" + minutes + \":\" + seconds;\n // $('.date .time').text(`${hours}:${minutes}:${seconds}`);\n update = setTimeout(function () { updateTime() }, 500)\n}", "function updateVideoCurrentTime() {\n let curtime = convertSecondsToMinutes(video.currentTime);\n videotime.innerHTML = curtime+' / '+videoduration;\n }", "function update() {\n clock += change();\n render();\n }", "function currentTime() {\r\n let time = new Date();\r\n let h = time.getHours();\r\n let m = time.getMinutes();\r\n let s = time.getSeconds();\r\n if (m < 10) m = \"0\" + m;\r\n if (s < 10) s = \"0\" + s;\r\n document.getElementById('currentTime').innerHTML = h + \":\" + m + \":\" + s;\r\n}", "function updateTime() {\n\n}", "function updateTime() {\n\t\tvar dateTime = tizen.time.getCurrentDateTime(), secondToday = dateTime.getSeconds() + dateTime.getMinutes() * 60 + dateTime.getHours() * 3600,\n\t\tminDigitLeft = document.querySelector(\"#time-min-digit-left\"),\n\t\tminDigitRight = document.querySelector(\"#time-min-digit-right\"),\n\t\thourDigitLeft = document.querySelector(\"#time-hour-digit-left\"), \n\t\thourDigitRight = document.querySelector(\"#time-hour-digit-right\");\n\n\t\tvar minutesNow = (secondToday % 3600) / 60;\n\t\tvar hourNow = (secondToday / 3600);\n\t\tslideDigit(minDigitRight, minutesNow % 10.0);\n\t\tslideDigit(minDigitLeft, minutesNow / 10.0);\n\t\tslideDigit(hourDigitRight, hourNow % 10.0);\n\t\tslideDigit(hourDigitLeft, hourNow / 10.0);\n\t}", "function updateTime() {\n scorePanel.playTime = Math.trunc((performance.now() - scorePanel.startTime) / 1000);\n $(\".time\").text(scorePanel.playTime.toString().padStart(3, \"0\").concat(\" seconds\"));\n}", "updateTimer() {\n\t\tlet timer = parseInt((Date.now() - this.gameStartTimestamp)/1000);\n\t\tthis.gameinfoElement.childNodes[1].innerHTML = \"<h1>Time: \" + timer + \" s</h1>\";\n\t}", "updateCurrentMSecs () {\n this.currentMSecs = Date.now();\n }", "function currentTime() {\n let current = moment().format(\"HH:mm:ss A\");\n $(\"#clock\").html(\"<i class='far fa-clock'></i> \" + current);\n setTimeout(currentTime, 1000);\n }", "function updateTimeElapsed() {\n const time = formatTime(Math.round(video.currentTime));\n timeElapsed.innerText = `${time.minutes}:${time.seconds}`;\n timeElapsed.setAttribute('datetime', `${time.minutes}m ${time.seconds}s`)\n}", "function updateClock() {\r\n\tvar date = new Date();\r\n\tvar timer = document.getElementById(\"currTimer\");\r\n\ttimer.textContent = msToTime(date.getTime() - state.starting_time);\r\n}", "function updateTime(){\r\n if(!song_playing.ended){\r\n var currentMin = parseInt(song_playing.currentTime/60);\r\n var currentSec = parseInt(song_playing.currentTime%60);\r\n\r\n var size = parseInt(song_playing.currentTime * barSize/song_playing.duration);\r\n progressBar.style.width = size + \"px\";\r\n if($(\".current-song\").text().length > 27){\r\n song_to_display.innerHTML = $(\".current-song\").text().substring(0,24) + '...';\r\n }else{\r\n song_to_display.innerHTML = $(\".current-song\").text();\r\n }\r\n\r\n if (currentSec > 9) {\r\n\r\n duration.innerHTML = currentMin + \":\" + currentSec;\r\n }else{\r\n duration.innerHTML = currentMin + \":0\" + currentSec;\r\n }\r\n }else{\r\n song_playing.currentTime = 0;\r\n progressBar.style.width = \"0px\";\r\n }\r\n }", "async updateTimebar() {\n this.timeText = await this.time.getCurrentTime();\n this.tag('Time').patch({ text: { text: this.timeText } });\n }", "function update() {\n $(\"#currentT-input\").html(moment().format(\"H:mm:ss\"));\n}", "function showCurrentTime(time) {\n document.querySelector(\".time p\").textContent = currentTime(time);\n}", "function updateTimerDisplay(){\n // Update current time text display.\n $('#current-time').text(formatTime( r.getCurrentTime() ));\n $('#duration').text(formatTime( r.getDuration() ));\n}", "function updateTime() {\n element.text(dateFilter(new Date(), format, dateformat));\n }", "function updateTimeDisplay()\n{\n\t//the following code for getting the current beat time was written by melonking - https://wiki.melonland.net/swatch_time\n\t//get date in UTC/GMT\n var date = new Date();\n var hours = date.getUTCHours();\n var minutes = date.getUTCMinutes();\n var seconds = date.getUTCSeconds();\n var milliseconds = date.getUTCMilliseconds();\n //add hour to get time in Switzerland\n hours = (hours + 1) % 24;\n //time in seconds\n var timeInMilliseconds = ((hours * 60 + minutes) * 60 + seconds) * 1000 + milliseconds;\n //there are 86.4 seconds in a beat\n var millisecondsInABeat = 86400;\n //calculate beats to two decimal places\n\tvar current_beat_time = Math.abs(timeInMilliseconds / millisecondsInABeat).toFixed(2).padStart(6, \"0\");\n\t\n\t//display current beat time\n\tdocument.getElementById(\"current-beats\").childNodes[0].textContent = current_beat_time.split(\".\")[0];\n\tdocument.getElementById(\"current-centibeats\").innerText = current_beat_time.split(\".\")[1];\n}", "function updateTime() {\n element.text(dateFilter(new Date(), format));\n }", "function updateTime() {\n element.text(dateFilter(new Date(), format));\n }", "function updateTime() {\n element.text(dateFilter(new Date(), format));\n }", "function handleUpdate(){\n pCounter = audio.currentTime / audio.duration * 100;\n progress.style.width = pCounter + '%';\n\n durmins = Math.floor(audio.duration / 60);\n dursecs = Math.floor(audio.duration - durmins * 60);\n\n curmins = Math.floor(audio.currentTime / 60);\n cursecs = Math.floor(audio.currentTime - curmins * 60);\n\n // if durmins & curmins are less than 10\n // add an empty string\n if(durmins < 10){\n durmins = '' + durmins\n }else if(curmins < 10){\n curmins = '' + curmins\n }\n\n // add zero (0) if the dursecs & cursecs are less than 10\n if(dursecs < 10){\n dursecs = '0' + dursecs\n }else if(cursecs < 10){\n cursecs = '0' + cursecs\n }\n\n // Add the value of the mins and secs to our span elements\n dur__time.innerHTML = `${durmins}:${dursecs}`;\n cur__time.innerHTML = `${curmins}:${cursecs}`;\n }", "function updateClock() {\n let today = new Date();\n time = hours_with_leading_zeros(today) + \":\" + minutes_with_leading_zeros(today);\n\n clockLabel.text = time;\n datum.text = dateview;\n }", "function updateTime() {\n\t element.text(dateFilter(new Date(), format));\n\t }", "function updateTime() {\n element.text(dateFilter(new Date(), format));\n }", "function updateCurrentTime()\n {\n $(\"#currentDay\").text(now);\n\n minuteInterval = setInterval(function() \n {\n if(timeFormat === \"12\")\n {\n now = moment().format(\"dddd, MMMM Do YYYY, h:mm a\");\n }\n else\n {\n now = moment().format(\"dddd, MMMM Do YYYY, H:mm\");\n }\n currentHour = parseInt(moment().format(\"H\"));\n $(\"#currentDay\").text(now);\n updatePastPresent();\n }, 1000);\n\n }", "function timeUpdate() {\n // timeline width adjusted for playhead\n var timelineWidth = timeline_begin.offsetWidth - playhead_begin.offsetWidth;\n var playPercent = timelineWidth * (audio_begin.currentTime / duration_begin);\n playhead_begin.style.marginLeft = playPercent + \"px\";\n if (audio_begin.currentTime == duration_begin) {\n pButton_begin.className = \"\";\n pButton_begin.className = \"play\";\n }\n currentTime_begin.textContent = formatTime(audio_begin.currentTime);\n }", "function UpdateTheTime() {\n var sec = track1.currentTime;\n track1.volume = 1;\n var min = Math.floor(sec / 60);\n sec = Math.floor(sec % 60);\n if (sec.toString().length < 2) sec = \"0\" + sec;\n if (min.toString().length < 2) min = \"0\" + min;\n document.getElementById('timer').innerHTML = min + \":\" + sec + \"/\";\n var bar = document.getElementById(\"progressBar\");\n bar.setAttribute(\"max\", track1.duration.toString());\n bar.setAttribute(\"value\", track1.currentTime.toString());\n }", "function updateTime() {\n element.text(dateFilter(new Date(), format));\n }", "function currentTime(){\n var getHour = moment().format('HH');\n var getMin = moment().format('mm');\n var getMonth = moment().format('MMMM');\n var getDay = moment().format('Do');\n var getYear = moment().format('YYYY');\n $('.month').text(getMonth);\n $('.day').text(getDay);\n $('.year').text(getYear);\n $('.hours').text(getHour);\n $('.min').text(getMin);\n }", "function currentTimeInterval() {\n currentTime = moment().format(\"MMMM Do YYYY, h:mm:ss a\");\n $(\"#currentTime\").text(currentTime);\n}", "function updateDisplayTime() {\n\t\tvar date = new Date();\n\n\t\tvar hours = date.getHours();\n\t\tvar minutes = date.getMinutes();\n\t\tvar seconds = date.getSeconds();\n\t\tvar year = date.getFullYear();\n\t\tvar month = date.getMonth() + 1;\n\t\tvar day = date.getDate();\n\t\tvar ampm = \"AM\";\n\n\t\tif (hours > 11) {\n\t\t\tampm = \"PM\";\n\t\t}\n\n\t\tif (hours > 12) {\n\t\t\thours -=12;\n\t\t}\n\n\t\tif(minutes < 10) {\n\t\t\tminutes = \"0\" + minutes;\n\t\t}\n\n\t\tif (seconds < 10) {\n\t\t\tseconds = \"0\" + seconds;\n\t\t}\n\n\t\tvar displayTime = hours + \":\" + minutes + \":\" + seconds + \" \" + ampm;\n\n\t\t$(\"#displayTime\").html(displayTime)\n\t}", "function currentTime(el){\n\tvar date = new Date().toJSON().slice(0,10); \n\t\n\tel.html(date);\n}", "function updateTime() {\n let d = new Date();\n let hours;\n if (d.getHours() > 12)\n hours = (d.getHours() - 12 + \"\")\n else if (d.getHours() > 0)\n hours = (d.getHours() + \"\")\n else\n hours = '12';\n let minutes = (d.getMinutes() + '').padStart(2, 0);\n let seconds = (d.getSeconds() + '').padStart(2, 0);\n let amPm = (d.getHours > 12) ? 'PM' : 'AM';\n let timeString = hours + ':' + minutes + ':' + seconds + ':' + amPm;\n document.getElementById('currentTime').innerHTML = timeString;\n}", "update() {\n\t\tthis.node.innerText = this.getTime(this.ticks);\n\t}", "function displayTime() {\n //Calculate the number of minutes and seconds based on the current time\n var min = Math.floor(currentTime / 60);\n var sec = Math.floor(currentTime % 60);\n \n //Add a 0 to the front of the second when appropriate\n if (sec < 10) {\n sec = \"0\" + sec;\n }\n \n $(\"#time-text\").text(min + \":\" + sec);\n }", "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 updateCurrentTime()\n{\n var song = document.querySelector('audio');\n var currentTime = Math.floor(song.currentTime);\n currentTime = fancyTimeFormat(currentTime);\n \n var duration = Math.floor(song.duration);\n duration = fancyTimeFormat(duration);\n \n $('.time-elapsed').text(currentTime);\n $('.song-duration').text(duration);\n \n}", "function updateTime() {\n var video = document.getElementById(\"video\");\n var i = this.getAttribute(\"id\");\n var clickedCaption = captions[i];\n video.currentTime = clickedCaption.startTime;\n }", "function getTime(){\n let currentDate = new Date();\n let time = currentDate.toLocaleTimeString();\n $(\".currentTime\").html(time);\n}", "function changePresentation(){\n document.getElementById('labelTimeDiv_id').innerHTML=getNewTimeDisplay(videoDiv.currentTime)\n document.getElementById('labelTimeDivLast_id').innerHTML=\"/\" + getNewTimeDisplay(videoDiv.duration) \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}", "function updateTime() {\r\n const date = new Date();\r\n const hour = formatTime(date.getHours());\r\n const minutes = formatTime(date.getMinutes());\r\n const seconds = formatTime(date.getSeconds());\r\n\r\n display.innerText=`${hour} : ${minutes} : ${seconds}`\r\n}", "function update() {\n me.stop();\n\n // determine interval to refresh\n var scale = me.body.range.conversion(me.body.domProps.center.width).scale;\n var interval = 1 / scale / 10;\n if (interval < 30) interval = 30;\n if (interval > 1000) interval = 1000;\n\n me.redraw();\n me.body.emitter.emit('currentTimeTick');\n\n // start a renderTimer to adjust for the new time\n me.currentTimeTimer = setTimeout(update, interval);\n }", "function processCurrentTimePosition(ms){\n setPosition(ms); //seekbar.js\n $(\"#currentTime\").text(msToTime(ms)); //utils.js\n}", "function updateTime() {\r\n element.text(dateFilter(new Date(), format));\r\n }", "function refreshClock() {\n $('#timer').html(CustomTime.getTime);\n}", "function timeUpdate() {\r\n var $playPercent = (song.currentTime / song.duration) * 100;\r\n\r\n $('#playhead').css({\r\n \"margin-left\": $playPercent + \"%\"\r\n });\r\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "function updateClock() {\n let today = new Date();\n let hours = today.getHours();\n let mins = util.zeroPad(today.getMinutes());\n\n myLabel.text = `${hours}:${mins}`;\n \n triggerDownload();\n}", "function updateTime() {\n time++;\n $('#timer').text('Game time: ' + time);\n}", "function updateCurrentTime () {\n\n\t\tglobalCurrentTime = [];\n\n\t\tvar date = new Date();\n\n\t\t\tvar hours = date.getHours();\n\t\t\tvar minutes = date.getMinutes();\n\t\t\tvar seconds = date.getSeconds();\n\t\t\tvar year = date.getFullYear();\n\t\t\tvar month = date.getMonth() + 1;\n\t\t\tvar day = date.getDate();\n\t\t\tvar ampm = \"AM\";\n\n\t\t\tif (month < 10) {\n\t\t\t\tmonth = \"0\" + month;\n\t\t\t}\n\n\t\t\tif (hours > 11) {\n\t\t\t\tampm = \"PM\";\n\t\t\t}\n\n\t\t\tif (ampm === \"PM\") {\n\t\t\t\tswitch(hours) {\n\t\t\t\t\tcase 200 > 1:\n\t\t\t\t\tconsole.log(\"its a 1\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ampm === \"AM\") {\n\t\t\t\tif (hours < 10) {\n\t\t\t\t\thours = \"0\" + hours;\n\t\t\t\t}\n\t\t\t} else if (ampm = \"PM\") {\n\t\t\t\t\tif (hours > 12) {\n\t\t\t\t\t\thours -=12;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tif(minutes < 10) {\n\t\t\t\tminutes = \"0\" + minutes;\n\t\t\t}\n\n\t\t\tif (seconds < 10) {\n\t\t\t\tseconds = \"0\" + seconds;\n\t\t\t}\n\n\t\t\tif (ampm === \"PM\") {\n\t\t\t\thours += 12;\n\t\t\t}\n\n\n\t//this displays the current time on a 24 hour clock\n\n\t\tvar currentTime = year + \"-\" + month + \"-\" + day + \"T\" + hours + \":\" + minutes;\n\n\t\tglobalCurrentTime.push(currentTime);\n\n\t}", "function updateAgo() {\n $(\"#agolabel\").text(\"Updated \" + getTimeSinceLastRead());\n\n var today = new Date();\n var h = today.getHours();\n var m = today.getMinutes();\n h = checkTime(h);\n m = checkTime(m);\n\n var clockString = h + \":\" + m;\n $(\"#clock\").html(clockString);\n setTimeout(\"updateAgo();\", 1000);\n}", "function updateClock() {\n node = document.getElementById(\"clock\");\n now = new Date();\n node.innerHTML = now.toLocaleString();\n}", "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 }", "function updateTime() {\n time -= 1000;\n showTime(); \n}", "function showCurrentTime(player,span) { \n //var span=document.getElementById(spanId);\n span.innerHTML = secondsToTimeText(player.getCurrentTime()); \n}", "function updateTime() {\n\n // code to update progress bars and clock\n if (working) {\n completed += 1;\n if (completed > work_time*60) {\n working = false;\n progress = 0;\n completed = 0;\n }\n progress = (completed / parseFloat(work_time)) * (100/60);\n\n // calculate minutes and seconds to display\n var total_seconds = work_time*60;\n var time_remaining = total_seconds - completed;\n mins = Math.floor(time_remaining/60);\n seconds = time_remaining - mins*60;\n\n\n $(\"#time_left\").html(mins + \":\" + display_time(seconds))\n $(\"#work_progress\").attr('aria-valuenow', progress).css('width', progress + \"%\");\n\n }\n else {\n completed += 1;\n if (completed > break_time*60) {\n working = true;\n progress = 0;\n completed = 0;\n }\n progress = (completed / parseFloat(break_time))*(100/60);\n\n // calculate minutes and seconds to display\n var total_seconds = break_time*60;\n var time_remaining = total_seconds - completed;\n mins = Math.floor(time_remaining/60);\n seconds = time_remaining - mins*60;\n\n\n $(\"#time_left\").html(mins + \":\" + display_time(seconds))\n $(\"#break_progress\").attr('aria-valuenow', progress).css('width', progress + \"%\");\n\n }\n }", "function displayTime() {\n var timerInterval = setInterval(function() {\n var currentTime = moment().format('MMMM Do YYYY, h:mm:ss a');\n $(\"#current\").text(currentTime);\n secondsLeft--;\n \n if (secondsLeft === 0) {\n clearInterval(timerInterval);\n displayTime();\n }\n }, 1000); \n }", "function updateClock() {\n var dateTime = Date().match(/(.*)\\(/);\n $('#dateTime').html(dateTime[1]);\n }", "function update_clock(time)\r\n{\r\n clock_time = time;\r\n document.getElementById('clock').innerHTML = hh_mm_ss(time);\r\n check_old_records(time);\r\n}", "function updateClock(){\n var ahora = new Date();\n var hora = ahora.getHours();\n\tif(hora < 10) hora = \"0\" + hora;\n var min = ahora.getMinutes();\n\tif(min < 10) min = \"0\" + min;\n var sec = ahora.getSeconds();\n\tif(sec < 10) sec = \"0\" + sec;\n/* Se muestra por pantalla el reloj actualizando por segundo */\n\tclock.html(hora + \" : \" + min + \" : \" + sec);}", "function updateTime(){\n var currentSeconds = (Math.floor(activeSong.currentTime % 60) < 10 ? '0' : '') + Math.floor(activeSong.currentTime % 60);\n var currentMinutes = Math.floor(activeSong.currentTime / 60);\n //Sets the current song location compared to the song duration.\n /* document.getElementById('songTime').innerHTML = currentMinutes + \":\" + currentSeconds + ' / ' \n + Math.floor(activeSong.duration / 60) + \":\" + (Math.floor(activeSong.duration % 60) < 10 ? '0' : '') \n + Math.floor(activeSong.duration % 60); */\n document.getElementById('songTime').innerHTML = currentMinutes + \":\" + currentSeconds;\n document.getElementById(\"tiempoTotal\").innerHTML = Math.floor(activeSong.duration / 60) + \":\" + \n (Math.floor(activeSong.duration % 60) < 10 ? '0' : '') \n + Math.floor(activeSong.duration % 60);\n\n //Fills out the slider with the appropriate position.\n var percentageOfSong = (activeSong.currentTime/activeSong.duration);\n var percentageOfSlider = document.getElementById('songSlider').offsetWidth * percentageOfSong;\n \n //Updates the track progress div.\n document.getElementById('trackProgress').style.width = Math.round(percentageOfSlider) + \"px\";\n}", "function updateTime() {\n document.getElementById('uren_minuten').innerHTML = moment().format('H:mm');\n document.getElementById('dag_datum').innerHTML = moment().format('dddd, MMMM Do');\n document.getElementById(\"tijd\").classList.add('fadeInDown');\n}", "function displayCurrentTime()\r\n\t{\r\n\t\t//display current playback time in minutes and seconds - MinutesMinutes:SecondsSeconds\r\n\t\tlet minutes = Math.floor ( myVideo.currentTime / 60 ); //divides the current playback time by 60 & uses Math.floor to round the real number into an integer (whole number)\r\n\t\tlet seconds = Math.floor ( myVideo.currentTime % 60 ); //gets the remainder of the currentTime of the video and thus will represent the seconds - uses Math.floor to round the real number into an integer (whole number)\r\n\t\t\r\n\t\t//if statements; outcome differs depending on conditions\r\n\t\tif ( minutes < 10 )\r\n\t\t{\r\n\t\t\tminutes = \"0\" + minutes; //current time is less than 10 minutes: a zero is in front e.g. \"01:00\", instead of \"1:00\"\r\n\t\t} //end if statement\r\n\t\t\r\n\t\tif ( seconds < 10 )\r\n\t\t{\r\n\t\t\tseconds = \"0\" + seconds; //current time is less than 10 seconds: a zero is in front e.g. \"00:09\", instead of \"00:9\"\r\n\t\t} //end if statement\r\n\t\tcurrentTimeDisplay.setAttribute ( \"value\", ( minutes + \":\" + seconds) ); //sets value for currentTimeDisplay to the minutes and seconds of the current playback time\r\n\t}", "function updateTimeDisplay()\n{\n // Get the current time in seconds and then get the difference from the stop seconds.\n var diff = globalStopSeconds - currentSeconds();\n\n // Set the time on the screen.\n $(\"#timer-display\").text( secondsToMinutes( diff));\n\n // Update the sand column graph. \n sandColumnUpdate( diff);\n\n}", "function updateTime() {\n seconds += 1;\n document.querySelector(\"#timer\").innerText = \"Time elapsed: \" + seconds;\n}", "function updateTime() {\r\n getWeatherInfo();\r\n var currentTimeStamp = new Date();\r\n var currentMonth = getMonth();\r\n var currentDay = getDate();\r\n var currentDate = currentTimeStamp.getDate();\r\n var currentHour = currentTimeStamp.getHours();\r\n var currentMin = currentTimeStamp.getMinutes();\r\n // Last updated time\r\n $(\"#update-time\").text(currentHour + ':' + currentMin);\r\n $(\".date-display\").text(currentDay + ', ' + currentMonth +' ' + currentDate );\r\n }", "refreshTime() {\n if (this._game.isRun()) {\n this._view.setValue(\"time\", this._game.timeElapsed);\n }\n }", "function updateClock(){\n\tlet dt = new Date();\n\t\n\tlet month = ((\"0\"+(dt.getMonth()+1)).slice(-2));\n\t\n\tlet day = ((\"0\"+dt.getDate()).slice(-2));\n\t\n\tlet year = (dt.getFullYear());\n\t\n\tdocument.getElementById(\"date\").innerHTML = month + \"/\" + day + \"/\" + year;\n\t\n\tlet hour = ((\"0\"+dt.getHours()).slice(-2));\n\t\n\tlet min = ((\"0\"+dt.getMinutes()).slice(-2) );\n\t\n\tlet sec = ((\"0\"+dt.getSeconds()).slice(-2) )\n\t\n\tdocument.getElementById(\"time\").innerHTML = hour + \":\" + min + \":\" + sec;\n}", "function updateClock() {\n // get element to update time\n let datetime = document.querySelector(\"#datetime\");\n // get time now\n //let _timeNow = moment(new Date());\n let _timeNow = moment();\n // set current time on screen\n datetime.textContent = _timeNow.format('dddd, MMMM Do YYYY, HH:mm:ss');\n // update train times every minute\n if (_timeNow.format('ss') == '00') {\n updateTimes();\n }\n}", "function updateTime() {\n const now = moment();\n const ourTime = now.format('MMMM Do YYYY, h:mm:ss a');\n // Print the time into the element that we set to clock\n clock.text(ourTime);\n}", "function updateTime() {\n if (counter >= 0) {\n timer.innerHTML = counter;\n --counter;\n setTimeout(updateTime, 1000);\n }\n if (counter <= 0) {\n $('#over').modal('show')\n }\n }", "function updateTrackTime(){\n var currTimeDiv = document.getElementById('currentTime');\n var durationDiv = document.getElementById('duration');\n \n var currTime = (Math.floor(audio.currentTime * 1000)/1000).toString(); \n var duration = (Math.floor(audio.duration * 1000)/1000).toString();\n \n currTimeDiv.innerHTML = formatSecondsAsTime(currTime);\n \n if (isNaN(duration)){\n durationDiv.innerHTML = '00:00';\n } \n else{\n durationDiv.innerHTML = formatSecondsAsTime(duration);\n }\n }" ]
[ "0.81584877", "0.769983", "0.7687978", "0.76541966", "0.7652305", "0.7642832", "0.76030326", "0.75755495", "0.7524246", "0.75111204", "0.74489784", "0.7438156", "0.74332947", "0.7433109", "0.7400165", "0.73962677", "0.7380856", "0.7374665", "0.7363083", "0.73384935", "0.7275627", "0.7271698", "0.7270388", "0.72461754", "0.7225923", "0.7225751", "0.7224317", "0.72130764", "0.72006136", "0.7193615", "0.71824795", "0.71719486", "0.716667", "0.716237", "0.7149419", "0.714055", "0.7126822", "0.7117355", "0.71149594", "0.7108822", "0.7101173", "0.7088219", "0.70804614", "0.70729315", "0.70643944", "0.70643944", "0.7057537", "0.70567787", "0.704695", "0.70422786", "0.7036669", "0.7020061", "0.7018424", "0.7018125", "0.70105135", "0.70011526", "0.6992388", "0.6990444", "0.69792444", "0.69771475", "0.6975614", "0.6973825", "0.6966187", "0.6963665", "0.6953688", "0.69423467", "0.69418395", "0.69341004", "0.69266766", "0.69243217", "0.6922659", "0.6917138", "0.691457", "0.690878", "0.690878", "0.69005835", "0.68960726", "0.68843836", "0.6875089", "0.68717664", "0.68642926", "0.68641263", "0.6853072", "0.6851749", "0.6848197", "0.6844525", "0.6837849", "0.6833676", "0.681428", "0.68108624", "0.6800698", "0.6791125", "0.6764711", "0.6759302", "0.6752739", "0.67485213", "0.67470413", "0.6742962", "0.67368436", "0.67283064" ]
0.78983414
1
split handler for hover in events on split segements and list
function splitHoverIn(evt) { var id = $(this).prop('id'); id = id.replace('splitItem-', ''); id = id.replace('splitItemDiv-', ''); id = id.replace('splitSegmentItem-', ''); $('#splitItem-' + id).addClass('hover'); $('#splitSegmentItem-' + id).addClass('hover'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function splitHoverOut(evt) {\n var id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n\n $('#splitItem-' + id).removeClass('hover');\n $('#splitSegmentItem-' + id).removeClass('hover');\n}", "setShowInnerListLayer(liElement) {\n liElement.addEventListener(\"mouseenter\", (activeEle) => {\n this.setShowAttText(activeEle);\n\n // deactive Element Display Show\n if (this.checkSlope(this.clientXY.stayMouse, this.clientXY.moveMouse)) {\n if (this.checkMouseInTriangle) return activeEle.preventDefault();\n else this.resetStayMousePosition;\n }\n else this.setShowAttribute(activeEle);\n });\n }", "function handleMouseOverLines(lambdaList) {\n\n canvas.addEventListener(\"mousemove\", e => showLineNumberInBox(e, lambdaList));\n canvas.addEventListener(\"mouseleave\", unshowLineNumberInBox);\n}", "function handleMouseOverLines(lambdaList) {\n\n canvas.addEventListener(\"mousemove\", e => showLineNumberInBox(e, lambdaList));\n canvas.addEventListener(\"mouseleave\", unshowLineNumberInBox);\n}", "function xiborder(obj){\n var xilis=$('li',obj);\nfor(var i=0;i<xilis.length;i++){\n xilis[i].onmouseover=function(){\n this.style.border=\"1px solid red\";\n }\n xilis[i].onmouseout=function(){\n this.style.border=\"1px solid #fff\";\n }\n \n }\n}", "function handlePaletteHover()\r\n{\r\n\t$(document).on('mouseover', '.palette-swatch, #comp-swatch, .split-swatch', function() {\r\n\t\t$(this).addClass('palette-swatch-hover');\r\n\t});\r\n\t\r\n\t$(document).on('mouseleave', '.palette-swatch, #comp-swatch, .split-swatch', function() {\r\n\t\t$(this).removeClass('palette-swatch-hover');\r\n\t});\r\n}", "function mouseOverLi(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.target.style.background = \"gray\";\r\n\r\n}", "_handleMouseEnter() {\n this._hovered.next(this);\n }", "function handleMouseOverDist(e) {\n\t\t\t\te.currentTarget.addClassName('active');\n\t\t\t\tvar parent = $(e.currentTarget).parent().get(0);\n\n\t\t\t\ttheInterface.emit('ui:emphElement', {\n\t\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\t\tlayer : parent.getAttribute('data-layer')\n\t\t\t\t});\n\n\t\t\t}", "_itemOnMouseEnter() {\n const that = this;\n\n if (that.disabled || !that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging && that.ownerListBox.allowDrop) {\n JQX.ListBox.DragDrop.DropDetails = { item: that, position: 'bottom' };\n }\n\n if (that.ownerListBox.$.verticalScrollBar.thumbCapture || that.ownerListBox.$.horizontalScrollBar.thumbCapture) {\n return;\n }\n\n that.setAttribute('hover', '');\n }", "function hoverPanelRelated () {\n $('.browseview .relatedContainer .panel').on({\n mouseenter: function () {\n $(this).children().css({'background-color': '#68C3A3', 'color': 'black', 'transition': 'all 0.3s ease', '-webkit-transform': 'scale(1.05)', '-ms-transform': 'scale(1.05)', 'transform': 'scale(1.05)'})\n },\n mouseleave: function () {\n $(this).children().css({'background-color': '#f5f5f5', 'color': '#717f86', 'transition': 'all 0.3s ease', '-webkit-transform': 'scale(1.0)', '-ms-transform': 'scale(1.0)', 'transform': 'scale(1.0)'})\n },\n click: function () {\n window.location = $(this).children('.viewbutton').attr('href')\n }\n })\n }", "function addInteractionEvents() {\n\n // bar group hover\n $(\"g.barGroup\").hover(function(e) {\n showInfoBox( e, $(this).attr(\"index\"), $(this).attr(\"membership\") );\n }\n );\n $(\".vis .background, .vis .mouseLine\").hover(function(e) {\n showInfoBox( e, null);\n });\n\n\n\n\n}", "setOpenListLayer() {\n this.layer.titleEle.addEventListener(\"mouseenter\", () => window.setTimeout(() => this.setDisplayBlock()), 350);\n }", "function mouseLeaveLi(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.target.style.background = \"white\";\r\n}", "function hovering() {\n\n}", "_itemOnMouseLeave() {\n const that = this;\n\n if (!that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging) {\n that.$.removeClass('jqx-list-item-line-feedback');\n that.$.removeClass('jqx-list-item-bottom-line-feedback');\n }\n\n that.removeAttribute('hover');\n }", "setHiddenInnerListLayer(liElement) {\n liElement.addEventListener(\"mouseleave\", (activeEle) => {\n this.setHiddenAttText(activeEle);\n\n // deactive Element Display Hidden\n if (this.checkSlope(this.clientXY.stayMouse, this.clientXY.moveMouse)) {\n if (this.checkMouseInTriangle) return activeEle.preventDefault();\n else this.resetStayMousePosition;\n }\n else this.setHiddenAttribute(activeEle);\n });\n }", "function mouseInAndOut(element) {\n //Mouse in\n element.addEventListener(\"mouseenter\", (e) => {\n e.target.style.backgroundColor = \"bisque\";\n e.target.children[0].style.display = \"inline-block\";\n e.target.children[2].style.display = \"inline-block\";\n e.target.children[3].style.display = \"inline-block\";\n });\n //Mouse out\n element.addEventListener(\"mouseleave\", (e) => {\n e.target.style.backgroundColor = \"white\";\n //If item is in liked list unchange\n if (e.target.children[0].className === \"fa fa-star unchecked\") {\n e.target.children[0].style.display = \"none\";\n }\n e.target.children[2].style.display = \"none\";\n e.target.children[3].style.display = \"none\";\n });\n\n}", "function mouseoverPartition(d) {\n switch (d.depth) {\n case 3:\n mouseoverCompany(d);\n break;\n case 4:\n mouseoverCompany(d.parent);\n mouseoverGender(d);\n break;\n default:\n return;\n }\n}", "function enableHover(prof){\n\n\t$(prof).parent('.mainListItem').bind({\n\t\tmouseenter: function() {\n\t\t$(this).animate({\"backgroundColor\":\"#252525\"}, 100);\n\t\t//alert(\"IN\");\n\t\t},\n\t\tmouseleave: function() {\n\t\t$(this).animate({\"backgroundColor\":\"#494949\"}, 100);\n\t\t//alert(\"OUT\");\n\t\t}\n\t});\n}", "_handleHoveredState(ownerElement, type) {\n const that = this;\n\n switch (type) {\n case 'mouseenter':\n if (!ownerElement._getTargetItem(that, 'previousElementSibling') || !(ownerElement.resizeMode === 'adjacent' ?\n ownerElement._getTargetItem(that, 'nextElementSibling') : ownerElement._getTargetItem(that, 'previousElementSibling', true))) {\n return;\n }\n\n that.setAttribute('hover', '');\n break;\n case 'mouseleave': {\n that.removeAttribute('hover');\n break;\n }\n }\n }", "function MakeHovers() {\n var liElements = $(\".serialization li\");\n liElements.each(function () {\n var buttons = $(this).children(\"button.transperent\");\n\n //using mouseenter&mouse lived due to lags on hover\n $(this).mouseenter(function () {\n buttons.each(function () {\n $(this).removeClass(\"hidden\");\n });\n\n var parentButtons = $(this).parent().parent().children(\"button.transperent\");\n parentButtons.each(function () {\n $(this).addClass(\"hidden\");\n });\n });\n\n $(this).mouseleave(function () {\n buttons.each(function () {\n $(this).addClass(\"hidden\");\n });\n\n var parentButtons = $(this).parent().parent().children(\"button.transperent\");\n parentButtons.each(function () {\n $(this).removeClass(\"hidden\");\n });\n });\n });\n}", "function listItemOnHover(listItem) {\n\tlistItem.addEventListener('mouseover', () => {\n\t\tlistItem.style.color = 'gray';\n\t});\n\tlistItem.addEventListener('mouseleave', () => {\n\t\tlistItem.style.color = 'black';\n\t});\n}", "mouseenter(e) {\n e.preventDefault();\n const $listItem = this.$el.prev('tr.list-item');\n $listItem.addClass('hover');\n }", "getHovered() {}", "function hovering(e) {\n console.log('enter');\n $(e.target).css('color', 'red');\n}", "hoverListenersOn() {\n for (const button of this.buttonsAsArray.filter(x => x.type !== 'label')) {\n button.hoverListenerOn();\n }\n }", "function addClasEdge() {\n $('.list-wrap li').on('mouseenter mouseleave', function(e) {\n if ($('ul', this).length) {\n var off = $('ul .list-wrap-inner', this).offset();\n if (off) {\n var t = off.top;\n var l = off.left;\n var h = $(this).height();\n var w = $(this).width();\n var docH = $(window).height();\n var docW = $(window).width();\n\n var isEntirelyVisible =\n t > 0 && l > 0 && t + h < docH && l + w < docW;\n if (!isEntirelyVisible) {\n $('.list-wrap-inner li > .list-wrap-inner').addClass('edge');\n } else {\n $('.list-wrap-inner li > .list-wrap-inner').removeClass('edge');\n }\n }\n }\n });\n }", "function addEvents(){\n\t$(\".mainListItem\").hover(\n\t\tfunction() {\n\t\t\t$(this).animate({\"backgroundColor\":\"#252525\"}, 100);\n\t\t\t//alert(\"IN\");\n\t\t},\n\t\tfunction() {\n\t\t\t$(this).animate({\"backgroundColor\":\"#494949\"}, 100);\n\t\t\t//alert(\"OUT\");\n\t\t}\n\t);\n\n\t// $(\".mainListItem\").click(\n\t// \tfunction() {\n\t// \t\twindow.open('https://instagram.com/igor.mec', '_blank'); \t\t\n\t// \t}\n\t// );\n\n\t$(\".profimg\").click(\n\t\tfunction() {\n\t\t\tselectProfile(this);\t\t\t\n\t\t}\n\t);\n}", "function hoverStart()\n\t\t{\n\t\t\t\tvar $hoverLi = $( \".tree_cat>ul>li\" );\n\t\t\t\t$hoverLi.hover(\n\t\t\t\t function() {\n\t\t\t\t\t\t\tvar id = $(this).attr('id');\n\t\t\t\t\t\t\t$('.activeButtons').hide();\n\t\t\t\t\t\t\t$('#buttom_plus_trash_' + id).show();\n\t\t\t\t }, function() {\n\t\t\t\t\t\t$('.activeButtons').hide();\n\t\t\t\t }\n\t\t\t\t);\n\n\t\t\t\tvar $hoverLi = $( \".innerUl div\" );\n\t\t\t\t$hoverLi.hover(\n\t\t\t\t function() {\n\t\t\t\t\t\t\tvar id = $(this).attr('id');\n\n\t\t\t\t\t\t\t$('.activeButtons').hide();\n\t\t\t\t\t\t\t$('#buttom_plus_trash_' + id).show();\n\t\t\t\t }\n\t\t\t\t);\n\t\t}", "function mousemoveEvents(e) {\n if (isSuggestion(e) && !autoScrolled) {\n unselect(selectedLi);\n selectedLi = getSelectionMouseIsOver(e);\n select(selectedLi);\n }\n\n mouseHover = true;\n autoScrolled = false;\n }", "function setupGroupLinkHover(elem) {\n $(elem).on(\"mouseenter\", function() {\n $(this).find(\".alert-group-link > a\").finish().animate({\n opacity: 100\n }, 200);\n });\n $(elem).on(\"mouseleave\", function() {\n $(this).find(\".alert-group-link > a\").finish().animate({\n opacity: 0\n }, 200);\n });\n}", "function navigateImgOnMouseOver(objNode) {\n //Get the HovervisibleUl\n var HovervisibleUL = objNode.nextElementSibling.nextElementSibling;\n var collectNum = parseInt(objNode.getAttribute('collectNum'));\n\n //Clear all the childnode\n for(var eleCount=HovervisibleUL.childElementCount;\n eleCount>0;--eleCount){\n HovervisibleUL.removeChild(HovervisibleUL.firstElementChild);\n }\n\n //create new panel\n var collectionContent = StoreManagePort.getCollectionContent_array(collectNum);\n var workRow = null;\n\n for(var index=0;index<collectionContent.length;++index){\n\n if(index % 4 == 0){\n //create an row workBranch\n workRow = document.createElement('li');\n HovervisibleUL.appendChild(workRow);\n }\n //at the end of row Branch add Col\n var colBlock = document.createElement('div');\n workRow.appendChild(colBlock);\n var colhref = generateNewElementFromMsg(collectionContent[index]);\n colBlock.appendChild(colhref);\n }\n\n}", "function splitButtonClick() {\n if (!continueProcessing && editor.splitData && editor.splitData.splits) {\n var currentTime = getCurrentTime();\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n var splitItem = editor.splitData.splits[i];\n\n splitItem.clipBegin = parseFloat(splitItem.clipBegin);\n splitItem.clipEnd = parseFloat(splitItem.clipEnd);\n if ((splitItem.clipBegin < currentTime) && (currentTime < splitItem.clipEnd)) {\n newEnd = 0;\n if (editor.splitData.splits.length == (i + 1)) {\n newEnd = splitItem.clipEnd;\n } else {\n newEnd = editor.splitData.splits[i + 1].clipBegin;\n }\n var newItem = {\n clipBegin: parseFloat(currentTime),\n clipEnd: parseFloat(newEnd),\n enabled: true\n }\n\n splitItem.clipEnd = currentTime;\n editor.splitData.splits.splice(i + 1, 0, newItem);\n // TODO Make splitSegments clickable when zoomed in\n editor.updateSplitList(false, !zoomedIn());\n selectSegmentListElement(i + 1);\n return;\n }\n }\n }\n selectCurrentSplitItem();\n}", "function mouseMovedOnListItem(hashId) {\n\t return function (dispatch, getState) {\n\t if (getState().Search.Map.BalloonState.MouseIsOnListItem)\n\t return;\n\t mouseEnteredListItem(hashId)(dispatch, getState);\n\t };\n\t}", "function mouseleave(d) {\n\n // Hide the breadcrumb trail\n d3.select(\"#trail\")\n .style(\"visibility\", \"hidden\");\n\n // Deactivate all segments during transition.\n d3.selectAll(\"path\").on(\"mouseover\", null);\n\n d3.select(\"#list\").style(\"visibility\", \"hidden\");\n\n // Transition each segment to full opacity and then reactivate it.\n d3.selectAll(\"path\")\n .transition()\n .duration(1000)\n .style(\"opacity\", 0.5)\n .each(\"end\", function() {\n d3.select(this).on(\"mouseover\", mouseover);\n });\n\n d3.select(\"#explanation\")\n .transition()\n .duration(1000)\n .style(\"visibility\", \"hidden\");\n }", "function addListeners(){\n \n\n Array.from(gridItem_div).forEach(function (e){\n e.addEventListener('mouseenter', function (e) {\n //console.log(e.target);\n this.classList.add(\"divChanged\");\n });\n });\n}", "function attachHovers() {\n\t\t$('.sml-media-box a').live('mouseenter', function() {\n\t\t\t$($(this).children('.media-box-rollover'))\n\t\t\t\t.stop().animate({left: -160, top: -160}, 250);\n\t\t}).live('mouseleave', function() {\n\t\t\t$($(this).children('.media-box-rollover'))\n\t\t\t\t.stop().animate({left: 0, top: 0}, 200);\n\t\t});\n\t}", "function optionHoverInit(){\n $(document).on('mouseenter', '.b-detail-option', function(){\n var offsetLeft = $(this)[0].offsetLeft;\n var offsetTop = $(this)[0].offsetTop;\n var hover = $(this).parents('.b-detail-option-cont').find('.b-detail-option-hover');\n \n if ($(this).parents('.b-detail-option-cont').hasClass('b-detail-color')) {\n var borderColor = ($(this).hasClass('black-tick')) ? '#B7968B' : '#FFFFFF';\n hover.css('border-color', borderColor);\n }\n\n hover.stop().animate({\n left : offsetLeft,\n top : offsetTop,\n }, 300, \"swing\");\n });\n\n $(document).on('mouseleave', '.b-detail-option-list-cont', function(){\n var offsetLeft = $(this).parents('.b-detail-option-cont').find('.active')[0].offsetLeft;\n var offsetTop = $(this).parents('.b-detail-option-cont').find('.active')[0].offsetTop;\n var hover = $(this).parents('.b-detail-option-cont').find('.b-detail-option-hover');\n \n if ($(this).parents('.b-detail-option-cont').hasClass('b-detail-color')) {\n var borderColor = ($(this).parents('.b-detail-option-cont').find('.active').hasClass('black-tick')) ? '#B7968B' : '#FFFFFF';\n hover.css('border-color', borderColor);\n }\n\n hover.stop().animate({\n left : offsetLeft,\n top : offsetTop\n }, 300, \"swing\");\n });\n\n $(document).on('click', '.b-detail-size input', function(){\n var cont = $(this).parents('.b-detail-option-cont');\n cont.find('.active').removeClass('active');\n cont.find('.option-text').text($(this).attr('data-option'));\n $(this).parents('.b-detail-option').addClass('active');\n })\n\n $(document).find('.b-detail-option-list-cont').each(function(){\n var offsetLeft = $(this).find('.active')[0].offsetLeft;\n var offsetTop = $(this).find('.active')[0].offsetTops;\n var hover = $(this).parents('.b-detail-option-cont').find('.b-detail-option-hover');\n hover.css({\n 'left' : offsetLeft,\n 'top' : offsetTop,\n 'opacity' : '1'\n });\n });\n }", "function handlePointHoverEnter (e) {\n var point = $(this).data(\"point\");\n point.style = pointStyleHover;\n point.redraw();\n }", "function handlePointHoverEnter (e) {\n var point = $(this).data(\"point\");\n point.style = pointStyleHover;\n point.redraw();\n }", "function dragEnter(e) {\n e.target.closest(\"li\").classList.add(\"over\");\n}", "function handleMouseOverElement(e) {\n\t\t\te.currentTarget.addClassName('highlight');\n\t\t\ttheInterface.emit('ui:emphElement', {\n\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\tlayer : e.currentTarget.getAttribute('data-layer')\n\t\t\t});\n\t\t}", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n Object.keys(scope_Events).forEach(function (targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function (callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function siMouseOver(e){\n //on mouse over, add class to bottom line of content card which widens it\n e.parentNode.children[3].classList.add('content-line-hover');\n}", "function addListener(child) {\n child.addEventListener(\"mouseenter\", () => {\n colorChange(child);\n });\n}", "function lineMouseOutHandler() {\n for (i = 0; i < dynamicFileList.length; i++) {\n var id = filenameToId(dynamicFileList[i]);\n if (\"line\" + id != this.id) {\n turnOn(filenameToId(dynamicFileList[i]), colorMap.get(id));\n\n }\n }\n}", "function itoolPreviewMouseOver(className, callback) {\n var iframeJQuery = window.frames[0].jQuery;\n var iframeContents = _iframe.contents();\n var selElems = iframeJQuery(\".perc-itool-selected-elem\");\n //As this function gets fired on mouse over which can happen more than once as user moves the mouse on the menu\n //The following code is put in to detect whether we already handled the mouse over if yes then returns\n //If the selected elements length is zero return from here or\n //if selected element is only one and if it is div and if it has perc-itools-wrapper return from here\n //if the selected element's parent has a perc-itools-wrapper return from here.\n if(selElems.length === 0 ||\n (selElems.length === 1 && selElems.is(\"div\") && iframeJQuery(selElems).hasClass(\"perc-itools-wrapper\")) ||\n (iframeJQuery(selElems[0]).parent().hasClass(\"perc-itools-wrapper\")))\n return;\n\n selElems.siblings(\":not('.perc-itool-selected-elem')\").each(function(){\n if(iframeJQuery(this).is(\"div\"))\n {\n iframeJQuery(this).addClass('perc-itools-wrapper perc-make-me-region').addClass(className);\n }\n else\n {\n iframeJQuery(this).wrap(\"<div class='perc-widget perc-itool-nov-div-wrapper perc-itools-wrapper perc-itool-region-puff'></div>\");\n }\n });\n\n iframeContents.find('.perc-sibling-div').remove();\n if(selElems.length === 1 && selElems.is(\"div\"))\n {\n selElems.addClass('perc-itool-region-puff-self perc-make-me-region perc-self-wrapper perc-itools-wrapper').addClass(className);\n highlightSiblings(selElems);\n }\n else\n {\n selElems.wrapAll(\"<div class='perc-widget perc-itool-multi-wrapper perc-itool-nov-div-wrapper perc-itool-region-puff-self perc-self-wrapper perc-itools-wrapper \" + className + \"'></div>\");\n highlightSiblings(iframeJQuery(selElems[0]).parent());\n }\n //Change border color of all siblings to blue from grey.\n iframeContents.find('.perc-sibling-div').css({'border-color':'#00afea'});\n iframeJQuery('.perc-itool-selected-green-border').remove();\n iframeJQuery(selElems).each(function()\n {\n highlightSelectedElements(iframeJQuery(this), false);\n });\n\n // If user performs 'Side by Side' action - add the overflow:auto and height 100% to its parent so that below content don't overlap on columns\n if(className === 'perc-col') {\n if(selElems.length === 1) {\n\n selElems.parent().addClass('perc-clear');\n }\n\n else {\n\n selElems.parent().parent().addClass('perc-clear');\n }\n\n }\n\n // If there is only one selected element,turn its border into blue. If there are mulitple selected element keep their border green but turn its wrapper div border to blue\n if(selElems.length === 1) {\n iframeJQuery('.perc-itool-selected-green-border').css('border-color', '#00afea');\n }\n else {\n highlightSelectedElements(iframeJQuery('.perc-itool-multi-wrapper'), true);\n iframeJQuery('.perc-itool-selected-green-border').parent('.perc-itool-selected-green-border').css('border-color', '#00afea');\n }\n\n if (callback) {\n callback();\n }\n }", "function callback() {\n let list = document.querySelectorAll(\":hover\");\n curElement = list[list.length - 1];\n addBorder(curElement);\n if (!same(curElement, prevElement)) {\n removeBorder(prevElement);\n }\n prevElement = curElement;\n}", "_delegateHover(_ctrl, x, y) {\n const _hoverItems = (_byEvent => {\n const {_area, _matchMethod} = (() => {\n // find by point containment:\n if (!_byEvent.rectHover.includes(_ctrl.viewId)) {\n return {\n _area: HPoint.new(x, y),\n _matchMethod: 'contains'\n };\n }\n // find by rect intersection:\n else if (!this._listeners._rectHoverIntersectMode.includes(_ctrl.viewId)) {\n return {\n _area: HRect.new(x, y, _ctrl.rect.width, _ctrl.rect.height),\n _matchMethod: 'intersects',\n };\n }\n // find by rect containment:\n else {\n return {\n _area: HRect.new(x, y, _ctrl.rect.width, _ctrl.rect.height),\n _matchMethod: 'contains',\n };\n }\n })();\n // find all:\n if (_byEvent.multiDrop.includes(_ctrl.viewId)) {\n return this._findAllDroppable(_area, _matchMethod, _ctrl.viewid);\n }\n // find only topmost:\n else {\n return this._findTopmostDroppable(_area, _matchMethod, _ctrl.viewId);\n }\n })(this._listeners.byEvent);\n // delegate startHover:\n _hoverItems.filter(_hoverId => {\n return !this._listeners.hovered.includes(_hoverId);\n }).forEach(_viewId => {\n this._views[_viewId].startHover(_ctrl);\n });\n // delegate hover:\n _hoverItems.forEach(_viewId => {\n this._views[_viewId].hover(_ctrl);\n });\n // delegate endHover:\n this._listeners.hovered.filter(_hoverId => {\n return !_hoverItems.includes(_hoverId);\n }).forEach(_viewId => {\n this._views[_viewId].endHover(_ctrl);\n });\n // finally store hovered items for the next time:\n this._listeners.hovered = _hoverItems;\n }", "_delegateHover(_ctrl, x, y) {\n const _hoverItems = (_byEvent => {\n const {_area, _matchMethod} = (() => {\n // find by point containment:\n if (!_byEvent.rectHover.includes(_ctrl.viewId)) {\n return {\n _area: HPoint.new(x, y),\n _matchMethod: 'contains'\n };\n }\n // find by rect intersection:\n else if (!this._listeners._rectHoverIntersectMode.includes(_ctrl.viewId)) {\n return {\n _area: HRect.new(x, y, _ctrl.rect.width, _ctrl.rect.height),\n _matchMethod: 'intersects',\n };\n }\n // find by rect containment:\n else {\n return {\n _area: HRect.new(x, y, _ctrl.rect.width, _ctrl.rect.height),\n _matchMethod: 'contains',\n };\n }\n })();\n // find all:\n if (_byEvent.multiDrop.includes(_ctrl.viewId)) {\n return this._findAllDroppable(_area, _matchMethod, _ctrl.viewid);\n }\n // find only topmost:\n else {\n return this._findTopmostDroppable(_area, _matchMethod, _ctrl.viewId);\n }\n })(this._listeners.byEvent);\n // delegate startHover:\n _hoverItems.filter(_hoverId => {\n return !this._listeners.hovered.includes(_hoverId);\n }).forEach(_viewId => {\n this._views[_viewId].startHover(_ctrl);\n });\n // delegate hover:\n _hoverItems.forEach(_viewId => {\n this._views[_viewId].hover(_ctrl);\n });\n // delegate endHover:\n this._listeners.hovered.filter(_hoverId => {\n return !_hoverItems.includes(_hoverId);\n }).forEach(_viewId => {\n this._views[_viewId].endHover(_ctrl);\n });\n // finally store hovered items for the next time:\n this._listeners.hovered = _hoverItems;\n }", "function handleHover() {\n const innerDivArray = Array.from(document.querySelectorAll(\".innerDiv\"));\n innerDivArray.forEach((innerDiv) => {\n innerDiv.addEventListener(\"mouseover\", (event) => {\n event.target.style.backgroundColor = \"#91ff91\";\n });\n });\n}", "hover() {}", "function eventHover(event) {\n\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function (targetEvent) {\n if ('hover' === targetEvent.split('.')[0]) {\n scope_Events[targetEvent].forEach(function (callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "_strikeMouseMove() {\n for (let i = 0; i < this._mouseMoveCallbacks.length; i++) {\n let currentCallback = this._mouseMoveCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._mouseMoveCallbacks.length; i++) {\n if (this._mouseMoveCallbacks[i][1])\n this._mouseMoveCallbacks.splice(i--, 1);\n }\n }", "function addItemToListHandler (e) {\n\t\tvar curElement = this;\n\t\tshowOverlay(curElement,addItemToList);\n\t\te.preventDefault();\n\t}", "_itemOnMouseMove(event) {\n const that = this;\n\n if (!that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging && that.ownerListBox.allowDrop && !JQX.Utilities.Core.isMobile) {\n const itemsWithFeedback = [].slice.call(that.ownerListBox.getElementsByClassName('jqx-list-item-bottom-line-feedback'));\n\n for (let i = 0; i < itemsWithFeedback.length; i++) {\n itemsWithFeedback[i].$.removeClass('jqx-list-item-line-feedback');\n itemsWithFeedback[i].$.removeClass('jqx-list-item-bottom-line-feedback');\n }\n\n JQX.ListBox.DragDrop.DropDetails = { item: that, position: 'top' };\n if (!that.ownerListBox._areCSSVarsSupported) {\n if (that.ownerListBox._indexOf(that) === that.ownerListBox._items.length - 1 || that.parentNode.lastElementChild === that) {\n const rect = that.getBoundingClientRect();\n\n if (event.pageY - window.pageYOffset > rect.top + (rect.height / 2) - 1) {\n JQX.ListBox.DragDrop.DropDetails = { item: that, position: 'bottom' };\n }\n }\n return;\n }\n\n that.$.removeClass('jqx-list-item-line-feedback');\n that.$.removeClass('jqx-list-item-bottom-line-feedback');\n\n if (that.ownerListBox.sorted && that.ownerListBox.autoSort) {\n return;\n }\n\n const visibleItems = that.ownerListBox._items.filter(item => !item.hidden);\n\n if (visibleItems.indexOf(that) === visibleItems.length - 1 || that.parentNode.lastElementChild === that) {\n const rect = that.getBoundingClientRect();\n\n if (event.pageY - window.pageYOffset > rect.top + (rect.height / 2) - 1) {\n that.$.addClass('jqx-list-item-bottom-line-feedback');\n JQX.ListBox.DragDrop.DropDetails = { item: that, position: 'bottom' };\n }\n else if (!arguments[1]) {\n that.$.addClass('jqx-list-item-line-feedback');\n }\n }\n else if (!arguments[1]) {\n that.$.addClass('jqx-list-item-line-feedback');\n }\n }\n }", "function Hover() {\n // loop through every task container and add mouse listner to it to show and hide buttons\n TaskContainer.forEach(container => {\n container.addEventListener('mouseenter', function () {\n if(container.getElementsByClassName('edit-icon')[0].classList.contains('hides')){\n container.getElementsByClassName('complete')[0].classList.remove('hides');\n container.getElementsByClassName('link')[0].classList.remove('hides');\n }\n \n })\n container.addEventListener('mouseleave', function () {\n container.getElementsByClassName('complete')[0].classList.add('hides');\n container.getElementsByClassName('link')[0].classList.add('hides');\n })\n })\n\n}", "function onListWidgetHover(id) {\r\n $(id).addClass('list-item-selected')\r\n $(id).find('.list-poster-frame').addClass('list-poster-frame-selected');\r\n }", "function shareHover() {\n\t\t$('#share-tab').mouseenter(function() {\n\t\t\t$(this).transition({ scale: 1.2 }).transition({ scale: 1.0 });\n\t\t});\n\t}", "function hoverOverSub(e) {\n\tvar target = this.getElementsByTagName(\"UL\")[0];\n\t$(target).css('height','auto');\n\tvar totalHeight = $(target).css('height');\n\t$(target).css('height','0px');\n\t$(target).stop(true,false).animate({height:totalHeight},350,\"easeInOutQuart\");\n}", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function(targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function(callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function(targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function(callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function(targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function(callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function(targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function(callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function hoverOutSub(e) {\n\tvar target = this.getElementsByTagName(\"UL\")[0];\n\t$(target).stop(true,false).animate({height:'0px'},350,\"easeInOutQuart\");\n}", "mouseEnter(event) {\n this.setHover();\n }", "function mouseOverHandler2(d) {\n\t\tsetItsHover(!itsHover);\n\t\tsetToolTip({\n\t\t\tisShow: true,\n\t\t\tx: +d.target.attributes.cx.value,\n\t\t\ty: +d.target.attributes.cy.value,\n\t\t\tvalue: d.target.attributes.val.value,\n\t\t\tcolor: d.target.attributes.fill.value\n\t\t});\n\n\t\tsetRad(d.target.attributes.circleId.value);\n\n\t\tconsole.log('hover', d.target.attributes.circleId.value);\n\t}", "function eventTabsWidgetMouseOver(widgetObject, element, event)\n{\n\tdhtml.addClassName(element, \"hover\");\n}", "function basicHoverEffect() {\nconst boxes = document.querySelector('.grid').querySelectorAll('div');\n//var x = document.getElementById(\"myDIV\").querySelectorAll(\".example\"); \nboxes.forEach(box => {\n box.addEventListener('mouseover', () => {\n box.setAttribute('style', 'background-color: black;');\n });\n});\n\n// Create onMouseLeave event to rever the colour back to origina state\nboxes.forEach(box => {\n box.addEventListener('mouseout', () => {\n box.setAttribute('style', 'background-color: white;');\n });\n});\n}", "function processMouseEvent (e) {\n var curMenuItem = document.querySelector('.mouse-movement-menu-item.active'),\n eventType = e.type;\n\n switch (eventType) {\n case 'mouseover':\n case 'mouseenter':\n case 'mouseleave':\n if (curMenuItem.classList.contains(eventType)) {\n displayEventObject(e, false);\n }\n }\n}", "function onMouse_Item(event, source, typeView) {\r\n\tif (typeView == 'border') {\r\n\t\tif (event.type == 'mouseover') {\r\n\t\t\t//mouseover\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn showBorder(source);\r\n\t\t} else {\r\n\t\t\t//mouseout\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn removeBorder(source);\r\n\t\t}\r\n\t} else {\r\n\t\tif (event.type == 'mouseover') {\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn highlight(source);\r\n\t\t} else {\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn lowlight(source);\r\n\t\t}\r\n\t}\r\n}", "function start()\n{\n var splitButton = document.getElementById( \"splitButton\" );\n splitButton.addEventListener( \"click\", splitButtonPressed, false );\n} // end function start", "function splitItemClick() {\n if (!continueProcessing) {\n if (!isSeeking || (isSeeking && ($(this).prop('id').indexOf('Div-') == -1))) {\n now = new Date();\n }\n\n if ((now - lastTimeSplitItemClick) > 80) {\n lastTimeSplitItemClick = now;\n\n if (editor.splitData && editor.splitData.splits) {\n // if not seeking\n if ((isSeeking && ($(this).prop('id').indexOf('Div-') == -1)) || !isSeeking) {\n // get the id of the split item\n id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n $('#splitUUID').val(id);\n\n if (id != lastId) {\n if (!inputFocused) {\n lastId = id;\n\n // remove all selected classes\n $('.splitSegmentItem').removeClass('splitSegmentItemSelected');\n $('.splitItem').removeClass('splitItemSelected');\n $('.splitItemDiv').removeClass('splitSegmentItemSelected');\n\n $('#clipItemSpacer').remove();\n $('#clipBegin').remove();\n $('#clipEnd').remove();\n\n $('.segmentButtons', '#splitItem-' + id).append('<span class=\"clipItem\" id=\"clipBegin\"></span><span id=\"clipItemSpacer\"> - </span><span class=\"clipItem\" id=\"clipEnd\"></span>');\n setSplitListItemButtonHandler();\n\n $('#splitSegmentItem-' + id).removeClass('hover');\n\n // load data into the segment\n var splitItem = editor.splitData.splits[id];\n editor.selectedSplit = splitItem;\n editor.selectedSplit.id = parseInt(id);\n setTimefieldTimeBegin(splitItem.clipBegin);\n setTimefieldTimeEnd(splitItem.clipEnd);\n $('#splitIndex').html(parseInt(id) + 1);\n\n // add the selected class to the corresponding items\n $('#splitSegmentItem-' + id).addClass('splitSegmentItemSelected');\n $('#splitItem-' + id).addClass('splitItemSelected');\n $('#splitItemDiv-' + id).addClass('splitSegmentItemSelected');\n\n currSplitItem = splitItem;\n\n if (!timeoutUsed) {\n if (!currSplitItemClickedViaJQ) {\n setCurrentTime(splitItem.clipBegin);\n }\n // update the current time of the player\n $('.video-timer').html(formatTime(getCurrentTime()) + \"/\" + formatTime(getDuration()));\n }\n }\n }\n }\n }\n }\n }\n}", "onLineMouseOver(part) {\n this.setState({...this.state,selectedPart: part})\n }", "function lineMouseOver(l, i) {\n var major = getMajorAsClass(l[0].major);\n\n changeElementOpacityForDifferentMajors(\"vis2-line\", major, '.1');\n changeElementOpacityForDifferentMajors(\"vis2-dot\", major, '.1');\n\n // this makes the tooltip visible\n div.transition()\n .duration(50)\n .style(\"opacity\", .9);\n\n var string = \"Women majoring in <i>\" + l[0]['major'] + '</i>';\n\n // this sets the location and content of the tooltip to the point's location/coordinates\n div.html(string)\n .style(\"left\", (d3.event.pageX) + \"px\")\n .style(\"top\", (d3.event.pageY - 28) + \"px\");\n}", "function blMouseOver(e){\n //on mouse over, add class which lighten color of arrows and slide them right\n e.children[0].classList.add('bl-hover');\n}", "onGroceryListItemHover() {\n this.setState({\n hover: !this.state.hover\n });\n }", "function hover(parentSelector, childSelector, mouseEnter, mouseLeave) {\n $(parentSelector).on({\n mouseenter: function() {\n if(mouseEnter != null) {\n mouseEnter(this);\n }\n },\n mouseleave: function() {\n if(mouseLeave != null) {\n mouseLeave(this);\n }\n }\n }, childSelector);\n}", "hoverPlyr() {\n // Remove hover listener to avoid recall hover state.\n this.container.removeEventListener('mouseover', this.hoverPlyrHandler, false);\n this.startPlyr(true);\n }", "_mouseEventsHandler(event) {\n const that = this;\n\n event.type === 'mouseenter' ? that.setAttribute('hover', '') : that.removeAttribute('hover');\n }", "_strikeMouseDown() {\n for (let i = 0; i < this._mouseDownCallbacks.length; i++) {\n let currentCallback = this._mouseDownCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._mouseDownCallbacks.length; i++) {\n if (this._mouseDownCallbacks[i][1])\n this._mouseDownCallbacks.splice(i--, 1);\n }\n }", "onMouseEnter() {}", "function hoverOverSubelement(e) {\n\tif(this.className != \"selected\"){\n\t\t$(this).addClass('hovered');\n\t\tvar tamano;\n\t\tvar a = this.getElementsByTagName(\"A\")[0];\n\t\tif($(this).css('text-align') == \"right\"){\n\t\t\ttamano=-400-$(a).innerWidth();\n\t\t}else{\n\t\t\ttamano=$(a).innerWidth()-400;\n\t\t};\n\t\t$(a).stop(true,true).animate({backgroundPosition:'('+tamano+'px 0px)'},(-350*(tamano/400)),\"easeInOutQuart\");\n\t}\n}", "function createGrid() {\nfor (i = 0; i < slider.value * slider.value; i++) {\n const gridItem = document.createElement('div');\n gridItem.classList.add('gridBox');\n gridItem.addEventListener('mouseenter', function(e) {\n e.target.style.backgroundColor = chosenColor;\n gridItem.classList.add('gridBoxOnHover');\n })\n // This is just a cool mouse tracking function I accidently made\n /*gridItem.addEventListener('mouseleave', function(e) {\n e.target.style.backgroundColor = 'white';\n gridItem.classList.remove('gridBoxOnHover');\n })*/\n gridWrapper.appendChild(gridItem);\n gridBoxesArray.push(gridItem);\n }\n}", "handleHoverOn () {\n /**\n * Reset the container timeout now a new hover is taking place\n */\n clearTimeout(this.timeout);\n }", "function addMouseoverEventListener() { \n for (let i = 0; i < paint.length; i++)\n {\n paint[i].addEventListener('mouseover', function() {\n this.style.backgroundColor = \"black\";\n });\n }\n }", "function eventHover ( event ) {\r\n\r\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\r\n\r\n\t\tvar to = scope_Spectrum.getStep(proposal);\r\n\t\tvar value = scope_Spectrum.fromStepping(to);\r\n\r\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\r\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\r\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\r\n\t\t\t\t\tcallback.call( scope_Self, value );\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t}", "handleHover(data) {\n return (event) => {\n const {left, top, width, height} = this.nodeRefs[data.id].getBoundingClientRect();\n\n this.props.onHover(event, left + width, top + height / 2, data);\n };\n }", "hover(props, monitor, component) {\n if (!component) { return }\n\n const dragFieldIndex = monitor.getItem().fieldData.fieldIndex // 被拖拽的 Field 的在卡片中的顺序索引\n const dragFieldFromAreaIndex = monitor.getItem().fromAreaIndex // 被拖拽的 Field 原所处卡片的卡片索引\n const hoverFieldIndex = props.fieldData.fieldIndex // hover 放置目标 Field 的在卡片中的顺序索引\n\n if (dragFieldFromAreaIndex !== props.fromAreaIndex) { return } // 跨卡片拖放字段情况下,Hover 不做处理\n if (dragFieldIndex === hoverFieldIndex) { return } // 在同一卡片内,拖拽与放置目标索引一致则不做处理\n\n // 碰撞检测 - 水平与垂直方向的卡片内字段替换\n const hoverBoundingRect = findDOMNode(component).getBoundingClientRect()\n const hoverMiddleX = (hoverBoundingRect.right - hoverBoundingRect.left) / 2 // Hover 放置目标的水平中轴线坐标\n const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2\n const DragclientOffset = monitor.getClientOffset() // 拖拽源的 clientOffset\n const hoverClientX = DragclientOffset.x - hoverBoundingRect.left\n const hoverClientY = DragclientOffset.y - hoverBoundingRect.top\n\n // 碰撞情况未达到要修改字段顺序的条件时不做处理\n if (dragFieldIndex < hoverFieldIndex && hoverClientX < hoverMiddleX && hoverClientY < hoverMiddleY) { return }\n if (dragFieldIndex > hoverFieldIndex && hoverClientX > hoverMiddleX && hoverClientY > hoverMiddleY) { return }\n\n // 处理调整顺序\n props.changeFieldOrderInCardCb(dragFieldIndex, hoverFieldIndex)\n\n // Note: we're mutating the monitor item here!\n // Generally it's better to avoid mutations,\n // but it's good here for the sake of performance\n // to avoid expensive index searches.\n monitor.getItem().fieldData.fieldIndex = hoverFieldIndex\n }", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function eventHover ( event ) {\n\n\t\tvar proposal = calcPointToPercentage(event.calcPoint);\n\n\t\tvar to = scope_Spectrum.getStep(proposal);\n\t\tvar value = scope_Spectrum.fromStepping(to);\n\n\t\tObject.keys(scope_Events).forEach(function( targetEvent ) {\n\t\t\tif ( 'hover' === targetEvent.split('.')[0] ) {\n\t\t\t\tscope_Events[targetEvent].forEach(function( callback ) {\n\t\t\t\t\tcallback.call( scope_Self, value );\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}" ]
[ "0.69761634", "0.6102542", "0.6068386", "0.6068386", "0.60046405", "0.59980476", "0.5975997", "0.59030133", "0.57930505", "0.5785852", "0.5771492", "0.5761145", "0.5751516", "0.5723944", "0.56981593", "0.56934965", "0.569103", "0.56706506", "0.5670305", "0.5633904", "0.56277883", "0.5626969", "0.5606622", "0.56030107", "0.55702055", "0.55318", "0.5528137", "0.55272365", "0.5522087", "0.5512928", "0.5488005", "0.54754233", "0.5473178", "0.546625", "0.5465069", "0.54619414", "0.5453654", "0.54459023", "0.54423934", "0.5425709", "0.5425709", "0.5416399", "0.540129", "0.53995854", "0.53959906", "0.5393494", "0.5379048", "0.53782284", "0.53639454", "0.5360106", "0.5360106", "0.53588617", "0.53571707", "0.5343725", "0.53391725", "0.5330653", "0.532447", "0.53231263", "0.5321789", "0.5316909", "0.53137296", "0.53134894", "0.53134894", "0.53134894", "0.53134894", "0.53101575", "0.5307897", "0.530501", "0.53001", "0.5297297", "0.5297015", "0.52957654", "0.52949286", "0.5293413", "0.5291053", "0.5288094", "0.5281782", "0.52724713", "0.5269764", "0.5266221", "0.5259014", "0.52556074", "0.5255198", "0.5253324", "0.5247372", "0.5247036", "0.5246538", "0.5245342", "0.5245103", "0.5245013", "0.5241275", "0.5241275", "0.5241275", "0.5241275", "0.5241275", "0.5241275", "0.5241275", "0.5241275", "0.5241275", "0.5241275" ]
0.7622045
0
handler for hover out events on split segements and list
function splitHoverOut(evt) { var id = $(this).prop('id'); id = id.replace('splitItem-', ''); id = id.replace('splitItemDiv-', ''); id = id.replace('splitSegmentItem-', ''); $('#splitItem-' + id).removeClass('hover'); $('#splitSegmentItem-' + id).removeClass('hover'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function splitHoverIn(evt) {\n var id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n\n $('#splitItem-' + id).addClass('hover');\n $('#splitSegmentItem-' + id).addClass('hover');\n}", "onMouseOut_() {\n this.updateHoverStying_(false);\n }", "_itemOnMouseLeave() {\n const that = this;\n\n if (!that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging) {\n that.$.removeClass('jqx-list-item-line-feedback');\n that.$.removeClass('jqx-list-item-bottom-line-feedback');\n }\n\n that.removeAttribute('hover');\n }", "function hoverOutSub(e) {\n\tvar target = this.getElementsByTagName(\"UL\")[0];\n\t$(target).stop(true,false).animate({height:'0px'},350,\"easeInOutQuart\");\n}", "function handleMouseOverDist(e) {\n\t\t\t\te.currentTarget.addClassName('active');\n\t\t\t\tvar parent = $(e.currentTarget).parent().get(0);\n\n\t\t\t\ttheInterface.emit('ui:emphElement', {\n\t\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\t\tlayer : parent.getAttribute('data-layer')\n\t\t\t\t});\n\n\t\t\t}", "setShowInnerListLayer(liElement) {\n liElement.addEventListener(\"mouseenter\", (activeEle) => {\n this.setShowAttText(activeEle);\n\n // deactive Element Display Show\n if (this.checkSlope(this.clientXY.stayMouse, this.clientXY.moveMouse)) {\n if (this.checkMouseInTriangle) return activeEle.preventDefault();\n else this.resetStayMousePosition;\n }\n else this.setShowAttribute(activeEle);\n });\n }", "function mouseleave(d) {\n\n // Hide the breadcrumb trail\n d3.select(\"#trail\")\n .style(\"visibility\", \"hidden\");\n\n // Deactivate all segments during transition.\n d3.selectAll(\"path\").on(\"mouseover\", null);\n\n d3.select(\"#list\").style(\"visibility\", \"hidden\");\n\n // Transition each segment to full opacity and then reactivate it.\n d3.selectAll(\"path\")\n .transition()\n .duration(1000)\n .style(\"opacity\", 0.5)\n .each(\"end\", function() {\n d3.select(this).on(\"mouseover\", mouseover);\n });\n\n d3.select(\"#explanation\")\n .transition()\n .duration(1000)\n .style(\"visibility\", \"hidden\");\n }", "function mouseleave(d) {\r\n ctrl.data.name = \"Mouse Pointer Outside\";\r\n d3.selectAll(\"path\").on(\"mouseover\", null).style(\"opacity\", 1); // Deactivate all segments\r\n d3.select(\"#disNamePlaceholder\").transition().duration(1000);\r\n }", "_itemOnMouseEnter() {\n const that = this;\n\n if (that.disabled || !that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging && that.ownerListBox.allowDrop) {\n JQX.ListBox.DragDrop.DropDetails = { item: that, position: 'bottom' };\n }\n\n if (that.ownerListBox.$.verticalScrollBar.thumbCapture || that.ownerListBox.$.horizontalScrollBar.thumbCapture) {\n return;\n }\n\n that.setAttribute('hover', '');\n }", "mouseOutPileHandler () {\n fgmState.hoveredPile = undefined;\n\n if (fgmState.previousHoveredPile) {\n const zoomed = this.pilesZoomed[fgmState.previousHoveredPile.id];\n fgmState.previousHoveredPile.elevateTo(zoomed ? Z_HIGHLIGHT : undefined);\n fgmState.previousHoveredPile.previewMatrix();\n fgmState.previousHoveredPile.setCoverDispMode(this.coverDispMode);\n this.highlightFrame.visible = false;\n fgmState.previousHoveredPile.draw();\n fgmState.previousHoveredPile = undefined;\n }\n\n this.removePileArea();\n }", "function hovering() {\n\n}", "function mouseLeaveLi(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.target.style.background = \"white\";\r\n}", "function mouseOverLi(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.target.style.background = \"gray\";\r\n\r\n}", "function handlePaletteHover()\r\n{\r\n\t$(document).on('mouseover', '.palette-swatch, #comp-swatch, .split-swatch', function() {\r\n\t\t$(this).addClass('palette-swatch-hover');\r\n\t});\r\n\t\r\n\t$(document).on('mouseleave', '.palette-swatch, #comp-swatch, .split-swatch', function() {\r\n\t\t$(this).removeClass('palette-swatch-hover');\r\n\t});\r\n}", "_handleHoveredState(ownerElement, type) {\n const that = this;\n\n switch (type) {\n case 'mouseenter':\n if (!ownerElement._getTargetItem(that, 'previousElementSibling') || !(ownerElement.resizeMode === 'adjacent' ?\n ownerElement._getTargetItem(that, 'nextElementSibling') : ownerElement._getTargetItem(that, 'previousElementSibling', true))) {\n return;\n }\n\n that.setAttribute('hover', '');\n break;\n case 'mouseleave': {\n that.removeAttribute('hover');\n break;\n }\n }\n }", "function mouseInAndOut(element) {\n //Mouse in\n element.addEventListener(\"mouseenter\", (e) => {\n e.target.style.backgroundColor = \"bisque\";\n e.target.children[0].style.display = \"inline-block\";\n e.target.children[2].style.display = \"inline-block\";\n e.target.children[3].style.display = \"inline-block\";\n });\n //Mouse out\n element.addEventListener(\"mouseleave\", (e) => {\n e.target.style.backgroundColor = \"white\";\n //If item is in liked list unchange\n if (e.target.children[0].className === \"fa fa-star unchecked\") {\n e.target.children[0].style.display = \"none\";\n }\n e.target.children[2].style.display = \"none\";\n e.target.children[3].style.display = \"none\";\n });\n\n}", "setHiddenInnerListLayer(liElement) {\n liElement.addEventListener(\"mouseleave\", (activeEle) => {\n this.setHiddenAttText(activeEle);\n\n // deactive Element Display Hidden\n if (this.checkSlope(this.clientXY.stayMouse, this.clientXY.moveMouse)) {\n if (this.checkMouseInTriangle) return activeEle.preventDefault();\n else this.resetStayMousePosition;\n }\n else this.setHiddenAttribute(activeEle);\n });\n }", "function handleMouseOverLines(lambdaList) {\n\n canvas.addEventListener(\"mousemove\", e => showLineNumberInBox(e, lambdaList));\n canvas.addEventListener(\"mouseleave\", unshowLineNumberInBox);\n}", "function handleMouseOverLines(lambdaList) {\n\n canvas.addEventListener(\"mousemove\", e => showLineNumberInBox(e, lambdaList));\n canvas.addEventListener(\"mouseleave\", unshowLineNumberInBox);\n}", "function hoverOutSubelement(e) {\n\tif(this.className != \"selected\"){\n\t\t$(this).removeClass('hovered');\n\t\tvar tamano;\n\t\tvar a = this.getElementsByTagName(\"A\")[0];\n\t\tif($(this).css('text-align') == \"right\"){\n\t\t\ttamano=$(a).innerWidth()-400;\n\t\t}else{\n\t\t\ttamano=-400;\n\t\t};\n\t\t$(a).stop(true,true).animate({backgroundPosition:'('+tamano+'px 0px)'},(-350*(tamano/400)),\"easeInOutQuart\");\n\t}\n}", "_handleMouseEnter() {\n this._hovered.next(this);\n }", "function addClasEdge() {\n $('.list-wrap li').on('mouseenter mouseleave', function(e) {\n if ($('ul', this).length) {\n var off = $('ul .list-wrap-inner', this).offset();\n if (off) {\n var t = off.top;\n var l = off.left;\n var h = $(this).height();\n var w = $(this).width();\n var docH = $(window).height();\n var docW = $(window).width();\n\n var isEntirelyVisible =\n t > 0 && l > 0 && t + h < docH && l + w < docW;\n if (!isEntirelyVisible) {\n $('.list-wrap-inner li > .list-wrap-inner').addClass('edge');\n } else {\n $('.list-wrap-inner li > .list-wrap-inner').removeClass('edge');\n }\n }\n }\n });\n }", "function xiborder(obj){\n var xilis=$('li',obj);\nfor(var i=0;i<xilis.length;i++){\n xilis[i].onmouseover=function(){\n this.style.border=\"1px solid red\";\n }\n xilis[i].onmouseout=function(){\n this.style.border=\"1px solid #fff\";\n }\n \n }\n}", "function handleMouseOutDist(e) {\n\t\t\t\te.currentTarget.removeClassName('active');\n\t\t\t\tvar parent = $(e.currentTarget).parent().get(0);\n\n\t\t\t\ttheInterface.emit('ui:deEmphElement', {\n\t\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\t\tlayer : parent.getAttribute('data-layer')\n\t\t\t\t});\n\t\t\t}", "hoverPlyr() {\n // Remove hover listener to avoid recall hover state.\n this.container.removeEventListener('mouseover', this.hoverPlyrHandler, false);\n this.startPlyr(true);\n }", "function hoverOverSub(e) {\n\tvar target = this.getElementsByTagName(\"UL\")[0];\n\t$(target).css('height','auto');\n\tvar totalHeight = $(target).css('height');\n\t$(target).css('height','0px');\n\t$(target).stop(true,false).animate({height:totalHeight},350,\"easeInOutQuart\");\n}", "function mouseoverPartition(d) {\n switch (d.depth) {\n case 3:\n mouseoverCompany(d);\n break;\n case 4:\n mouseoverCompany(d.parent);\n mouseoverGender(d);\n break;\n default:\n return;\n }\n}", "function navigateImgOnMouseOver(objNode) {\n //Get the HovervisibleUl\n var HovervisibleUL = objNode.nextElementSibling.nextElementSibling;\n var collectNum = parseInt(objNode.getAttribute('collectNum'));\n\n //Clear all the childnode\n for(var eleCount=HovervisibleUL.childElementCount;\n eleCount>0;--eleCount){\n HovervisibleUL.removeChild(HovervisibleUL.firstElementChild);\n }\n\n //create new panel\n var collectionContent = StoreManagePort.getCollectionContent_array(collectNum);\n var workRow = null;\n\n for(var index=0;index<collectionContent.length;++index){\n\n if(index % 4 == 0){\n //create an row workBranch\n workRow = document.createElement('li');\n HovervisibleUL.appendChild(workRow);\n }\n //at the end of row Branch add Col\n var colBlock = document.createElement('div');\n workRow.appendChild(colBlock);\n var colhref = generateNewElementFromMsg(collectionContent[index]);\n colBlock.appendChild(colhref);\n }\n\n}", "function NavBar_Item_MouseOut(event)\n{\n\t//get html\n\tvar html = Browser_GetEventSourceElement(event);\n\t//this a sub component?\n\tif (html.Style_Parent)\n\t{\n\t\t//use the parent\n\t\thtml = html.Style_Parent;\n\t}\n\t//valid?\n\tif (html && html.Style_MouseOver)\n\t{\n\t\t//trigger style\n\t\thtml.style.backgroundPosition = html.IsSelected ? html.Style_Selected : html.Style_Unselected;\n\t}\n}", "handleMouseOut() {\n this.IsHover = false;\n }", "handleHoverOn () {\n /**\n * Reset the container timeout now a new hover is taking place\n */\n clearTimeout(this.timeout);\n }", "function addInteractionEvents() {\n\n // bar group hover\n $(\"g.barGroup\").hover(function(e) {\n showInfoBox( e, $(this).attr(\"index\"), $(this).attr(\"membership\") );\n }\n );\n $(\".vis .background, .vis .mouseLine\").hover(function(e) {\n showInfoBox( e, null);\n });\n\n\n\n\n}", "function hovering(e) {\n console.log('enter');\n $(e.target).css('color', 'red');\n}", "function handleMouseOutElement(e) {\n\t\t\te.currentTarget.removeClassName('highlight');\n\t\t\ttheInterface.emit('ui:deEmphElement', {\n\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\tlayer : e.currentTarget.getAttribute('data-layer')\n\t\t\t});\n\t\t}", "function hoverPanelRelated () {\n $('.browseview .relatedContainer .panel').on({\n mouseenter: function () {\n $(this).children().css({'background-color': '#68C3A3', 'color': 'black', 'transition': 'all 0.3s ease', '-webkit-transform': 'scale(1.05)', '-ms-transform': 'scale(1.05)', 'transform': 'scale(1.05)'})\n },\n mouseleave: function () {\n $(this).children().css({'background-color': '#f5f5f5', 'color': '#717f86', 'transition': 'all 0.3s ease', '-webkit-transform': 'scale(1.0)', '-ms-transform': 'scale(1.0)', 'transform': 'scale(1.0)'})\n },\n click: function () {\n window.location = $(this).children('.viewbutton').attr('href')\n }\n })\n }", "mouseleave() {\n\t\t\t// Hide the breadcrumb trail\n\t\t\td3.select(\"#trail\")\n\t\t\t\t.style(\"visibility\", \"hidden\");\n\n\t\t\t// Deactivate all segments during transition.\n\t\t\td3.selectAll(\".icicleNode\").on(\"mouseover\", null);\n\n\t\t\t// Transition each segment to full opacity and then reactivate it.\n\t\t\td3.selectAll(\".icicleNode\")\n\t\t\t\t.transition()\n\t\t\t\t.duration(1000)\n\t\t\t\t.style(\"opacity\", 1)\n\t\t\t\t.each(\"end\", function () {\n\t\t\t\t\t// d3.select(this).on(\"mouseover\", this.mouseover);\n\t\t\t\t});\n\t\t}", "function mouseOverHandler2(d) {\n\t\tsetItsHover(!itsHover);\n\t\tsetToolTip({\n\t\t\tisShow: true,\n\t\t\tx: +d.target.attributes.cx.value,\n\t\t\ty: +d.target.attributes.cy.value,\n\t\t\tvalue: d.target.attributes.val.value,\n\t\t\tcolor: d.target.attributes.fill.value\n\t\t});\n\n\t\tsetRad(d.target.attributes.circleId.value);\n\n\t\tconsole.log('hover', d.target.attributes.circleId.value);\n\t}", "function enableHover(prof){\n\n\t$(prof).parent('.mainListItem').bind({\n\t\tmouseenter: function() {\n\t\t$(this).animate({\"backgroundColor\":\"#252525\"}, 100);\n\t\t//alert(\"IN\");\n\t\t},\n\t\tmouseleave: function() {\n\t\t$(this).animate({\"backgroundColor\":\"#494949\"}, 100);\n\t\t//alert(\"OUT\");\n\t\t}\n\t});\n}", "function mouseoutEvents(e) {\n if (isSuggestion(e) && !autoScrolled) {\n unselect(selectedLi);\n resetSelection();\n } else if ($(':focus').attr('id') !== context.attr('id')) {\n // We're out of the suggestion box so re-focus on search\n context.focus();\n }\n mouseHover = false;\n }", "_onHoverItemMouseLeave(evt) {\n $(evt.target).closest('.infobox-hover-item')\n .removeClass('infobox-hover-item-opened');\n }", "function mouseoutHandler(e) {\n var layer = e.target;\n if (!plugin.selectionLegend.isSelected(layer)) {\n plugin.unhighlightFeature(layer);\n }\n }", "onElementMouseOut(event) {\n super.onElementMouseOut(event);\n\n const me = this;\n\n // We must be over the event bar\n if (\n event.target.closest(me.eventInnerSelector) &&\n me.resolveTimeSpanRecord(event.target) &&\n me.hoveredEventNode\n ) {\n // out to child shouldn't count...\n if (\n event.relatedTarget &&\n DomHelper.isDescendant(event.target.closest(me.eventInnerSelector), event.relatedTarget)\n )\n return;\n\n me.unhover(event);\n }\n }", "function listItemOnHover(listItem) {\n\tlistItem.addEventListener('mouseover', () => {\n\t\tlistItem.style.color = 'gray';\n\t});\n\tlistItem.addEventListener('mouseleave', () => {\n\t\tlistItem.style.color = 'black';\n\t});\n}", "function handleMouseOverElement(e) {\n\t\t\te.currentTarget.addClassName('highlight');\n\t\t\ttheInterface.emit('ui:emphElement', {\n\t\t\t\tid : e.currentTarget.getAttribute('id'),\n\t\t\t\tlayer : e.currentTarget.getAttribute('data-layer')\n\t\t\t});\n\t\t}", "function siMouseOver(e){\n //on mouse over, add class to bottom line of content card which widens it\n e.parentNode.children[3].classList.add('content-line-hover');\n}", "mouseleave(d) {\n var that = this;\n // Hide the breadcrumb trail\n // Hide the breadcrumb trail\n d3.select(\"#trail\")\n .style(\"visibility\", \"hidden\");\n // Deactivate all segments during transition.\n this.svg.selectAll(\"path\").on(\"mouseover\", null);\n // Transition each segment to full opacity and then reactivate it.\n this.svg.selectAll(\"path\")\n .transition()\n .duration(550)\n .style(\"opacity\", 1);\n // .on(\"end\",this.mouseover.bind(this));\n this.svg.selectAll(\"path\").on(\"mouseover\", that.mouseover.bind(that));\n d3.select(this.opt.selectors.description)\n .style(\"visibility\", \"hidden\");\n }", "function MakeHovers() {\n var liElements = $(\".serialization li\");\n liElements.each(function () {\n var buttons = $(this).children(\"button.transperent\");\n\n //using mouseenter&mouse lived due to lags on hover\n $(this).mouseenter(function () {\n buttons.each(function () {\n $(this).removeClass(\"hidden\");\n });\n\n var parentButtons = $(this).parent().parent().children(\"button.transperent\");\n parentButtons.each(function () {\n $(this).addClass(\"hidden\");\n });\n });\n\n $(this).mouseleave(function () {\n buttons.each(function () {\n $(this).addClass(\"hidden\");\n });\n\n var parentButtons = $(this).parent().parent().children(\"button.transperent\");\n parentButtons.each(function () {\n $(this).removeClass(\"hidden\");\n });\n });\n });\n}", "function eventTabsWidgetMouseOut(widgetObject, element, event)\n{\n\tdhtml.removeClassName(element, \"hover\");\n}", "mouseover(d) {\n\t\t\t// const percentage = (100 * d.value / this.totalSize).toPrecision(3);\n\t\t\t// let percentageString = `${percentage}%`;\n\t\t\t// if (percentage < 0.1) {\n\t\t\t// \tpercentageString = '< 0.1%';\n\t\t\t// }\n\n\t\t\t// const sequenceArray = this.getAncestors(d);\n\t\t\t// this.updateBreadcrumbs(sequenceArray, percentageString);\n\n\t\t\t// Fade all the segments.\n\t\t\t// d3.selectAll('.icicleNode')\n\t\t\t// \t.style('opacity', 0.3);\n\n\t\t\t// Then highlight only those that are an ancestor of the current segment.\n\t\t\t// this.hierarchy.selectAll('.icicleNode')\n\t\t\t// \t.filter(node => (sequenceArray.indexOf(node) >= 0))\n\t\t\t// \t.style('opacity', 1)\n\n\t\t\t// this.drawGuides(d)\n\t\t\tthis.$refs.ToolTip.render(d);\n\t\t}", "getHovered() {}", "function mouseOutOfRegion(e) {\n // reset the hover state, returning the border to normal\n e.feature.setProperty(\"state\", \"normal\");\n}", "setOpenListLayer() {\n this.layer.titleEle.addEventListener(\"mouseenter\", () => window.setTimeout(() => this.setDisplayBlock()), 350);\n }", "function comparePageRowHoverOut() {\n var $pageRow = $(this);\n $pageRow.children(\".leftCompareDetails\").children(\".detailText\").children(\".unchangedDetails\").removeClass(\"unchangedDetailsVisible\");\n $pageRow.children(\".rightCompareDetails\").children(\".detailText\").children(\".unchangedDetails\").removeClass(\"unchangedDetailsVisible\");\n $pageRow.children(\".pageRowChild\").children(\".leftCompareDetails\").children(\".detailText\").children(\".unchangedDetails\").removeClass(\"unchangedDetailsVisible\");\n $pageRow.children(\".pageRowChild\").children(\".rightCompareDetails\").children(\".detailText\").children(\".unchangedDetails\").removeClass(\"unchangedDetailsVisible\");\n }", "onElementMouseOut(event) {\n super.onElementMouseOut(event);\n const me = this; // We must be over the event bar\n\n if (event.target.closest(me.eventInnerSelector) && me.resolveTimeSpanRecord(event.target) && me.hoveredEventNode) {\n // out to child shouldn't count...\n if (event.relatedTarget && DomHelper.isDescendant(event.target.closest(me.eventInnerSelector), event.relatedTarget)) return;\n me.unhover(event);\n }\n }", "hover() {}", "function handlePointHoverLeave (e) {\n var point = $(this).data(\"point\");\n point.style = pointStyleDefault;\n point.redraw();\n }", "function handlePointHoverLeave (e) {\n var point = $(this).data(\"point\");\n point.style = pointStyleDefault;\n point.redraw();\n }", "function pointer_overIN(e){\n e.currentTarget.Sprites.d._filters = [new PIXI.filters.OutlineFilter (4, 0x16b50e, 1)];\n $mouse.onCase = e.currentTarget;\n }", "function hoverStart()\n\t\t{\n\t\t\t\tvar $hoverLi = $( \".tree_cat>ul>li\" );\n\t\t\t\t$hoverLi.hover(\n\t\t\t\t function() {\n\t\t\t\t\t\t\tvar id = $(this).attr('id');\n\t\t\t\t\t\t\t$('.activeButtons').hide();\n\t\t\t\t\t\t\t$('#buttom_plus_trash_' + id).show();\n\t\t\t\t }, function() {\n\t\t\t\t\t\t$('.activeButtons').hide();\n\t\t\t\t }\n\t\t\t\t);\n\n\t\t\t\tvar $hoverLi = $( \".innerUl div\" );\n\t\t\t\t$hoverLi.hover(\n\t\t\t\t function() {\n\t\t\t\t\t\t\tvar id = $(this).attr('id');\n\n\t\t\t\t\t\t\t$('.activeButtons').hide();\n\t\t\t\t\t\t\t$('#buttom_plus_trash_' + id).show();\n\t\t\t\t }\n\t\t\t\t);\n\t\t}", "mouseenter(e) {\n e.preventDefault();\n const $listItem = this.$el.prev('tr.list-item');\n $listItem.addClass('hover');\n }", "_onPointerOut() {\n this.removeState(\"hovered\");\n }", "setCloseListLayer() {\n this.layer.titleEle.addEventListener(\"mouseleave\", () => this.setDisplayNone());\n }", "function dragEnter(e) {\n e.target.closest(\"li\").classList.add(\"over\");\n}", "function callback() {\n let list = document.querySelectorAll(\":hover\");\n curElement = list[list.length - 1];\n addBorder(curElement);\n if (!same(curElement, prevElement)) {\n removeBorder(prevElement);\n }\n prevElement = curElement;\n}", "function workItemHoverEffectIn() {\n var bg_image = $(this).attr('data-image-col');\n var label = \"#\" + $(this).find('.work_item_label').attr('id');\n var link = \"#\" + $(this).find('.work_item_link').attr('id');\n\n $(this).css({backgroundImage: \"url(\" + bg_image + \")\", cursor: \"pointer\"});\n $(label).css({height: \"45%\", clipPath: \"polygon(0 0, 100% 0, 100% 58%, 0 58%)\", backgroundColor: \"rgba(231, 231, 231, 0.7)\", color: \"#084e96\"});\n $(link).css({opacity: \"1\"});\n $(label).children(\"p\").hide(1000);\n }", "function itoolPreviewMouseOver(className, callback) {\n var iframeJQuery = window.frames[0].jQuery;\n var iframeContents = _iframe.contents();\n var selElems = iframeJQuery(\".perc-itool-selected-elem\");\n //As this function gets fired on mouse over which can happen more than once as user moves the mouse on the menu\n //The following code is put in to detect whether we already handled the mouse over if yes then returns\n //If the selected elements length is zero return from here or\n //if selected element is only one and if it is div and if it has perc-itools-wrapper return from here\n //if the selected element's parent has a perc-itools-wrapper return from here.\n if(selElems.length === 0 ||\n (selElems.length === 1 && selElems.is(\"div\") && iframeJQuery(selElems).hasClass(\"perc-itools-wrapper\")) ||\n (iframeJQuery(selElems[0]).parent().hasClass(\"perc-itools-wrapper\")))\n return;\n\n selElems.siblings(\":not('.perc-itool-selected-elem')\").each(function(){\n if(iframeJQuery(this).is(\"div\"))\n {\n iframeJQuery(this).addClass('perc-itools-wrapper perc-make-me-region').addClass(className);\n }\n else\n {\n iframeJQuery(this).wrap(\"<div class='perc-widget perc-itool-nov-div-wrapper perc-itools-wrapper perc-itool-region-puff'></div>\");\n }\n });\n\n iframeContents.find('.perc-sibling-div').remove();\n if(selElems.length === 1 && selElems.is(\"div\"))\n {\n selElems.addClass('perc-itool-region-puff-self perc-make-me-region perc-self-wrapper perc-itools-wrapper').addClass(className);\n highlightSiblings(selElems);\n }\n else\n {\n selElems.wrapAll(\"<div class='perc-widget perc-itool-multi-wrapper perc-itool-nov-div-wrapper perc-itool-region-puff-self perc-self-wrapper perc-itools-wrapper \" + className + \"'></div>\");\n highlightSiblings(iframeJQuery(selElems[0]).parent());\n }\n //Change border color of all siblings to blue from grey.\n iframeContents.find('.perc-sibling-div').css({'border-color':'#00afea'});\n iframeJQuery('.perc-itool-selected-green-border').remove();\n iframeJQuery(selElems).each(function()\n {\n highlightSelectedElements(iframeJQuery(this), false);\n });\n\n // If user performs 'Side by Side' action - add the overflow:auto and height 100% to its parent so that below content don't overlap on columns\n if(className === 'perc-col') {\n if(selElems.length === 1) {\n\n selElems.parent().addClass('perc-clear');\n }\n\n else {\n\n selElems.parent().parent().addClass('perc-clear');\n }\n\n }\n\n // If there is only one selected element,turn its border into blue. If there are mulitple selected element keep their border green but turn its wrapper div border to blue\n if(selElems.length === 1) {\n iframeJQuery('.perc-itool-selected-green-border').css('border-color', '#00afea');\n }\n else {\n highlightSelectedElements(iframeJQuery('.perc-itool-multi-wrapper'), true);\n iframeJQuery('.perc-itool-selected-green-border').parent('.perc-itool-selected-green-border').css('border-color', '#00afea');\n }\n\n if (callback) {\n callback();\n }\n }", "function handleHover(e) {\r\n\t\t\t// Check if mouse(over|out) are still within the same parent element\r\n\t\t\tvar p = (e.type == \"mouseover\" ? e.fromElement : e.toElement) || e.relatedTarget;\r\n\t\r\n\t\t\t// Traverse up the tree\r\n\t\t\twhile ( p && p != this ) p = p.parentNode;\r\n\t\t\t\r\n\t\t\t// If we actually just moused on to a sub-element, ignore it\r\n\t\t\tif ( p == this ) return false;\r\n\t\t\t\r\n\t\t\t// Execute the right function\r\n\t\t\treturn (e.type == \"mouseover\" ? f : g).apply(this, [e]);\r\n\t\t}", "_mouseEventsHandler(event) {\n const that = this;\n\n event.type === 'mouseenter' ? that.setAttribute('hover', '') : that.removeAttribute('hover');\n }", "function handlePointHoverEnter (e) {\n var point = $(this).data(\"point\");\n point.style = pointStyleHover;\n point.redraw();\n }", "function handlePointHoverEnter (e) {\n var point = $(this).data(\"point\");\n point.style = pointStyleHover;\n point.redraw();\n }", "function hoverOut(){\n //Mouseout\n $(\".main-nav ul\").finish();\n\n $('.st-menu').css({ \n \t'-webkit-transform' : 'translate3d(-200px, 0, 0)',\n \t'-moz-transform' : 'translate3d(-200px, 0, 0)',\n \t'-ms-transform' : 'translate3d(-200px, 0, 0)',\n \t'-o-transform' : 'translate3d(-200px, 0, 0)'\n });\n\n //Magic webkit 3D pan-tilt out\n\t$('.st-container').removeClass(\"st-menu-open\");\n\t$('.st-pusher').removeClass('magic').addClass('reverse-magic');\n\n\t//Scroll to top-left\n\t$.scrollTo({top: 0, left:0});\n\n\t$(\".main-nav ul\").animate({ 'width' : 50 }, 150);\n\n\t//pointer outside .main-nav\n\thover = false;\n}", "function mouseleave(d) {\r\n \r\n // Hide the breadcrumb trail\r\n d3.select(\"#trail\")\r\n .style(\"visibility\", \"hidden\");\r\n \r\n // Deactivate all segments during transition.\r\n d3.selectAll(\"path\").on(\"mouseover\", null);\r\n \r\n // Transition each segment to full opacity and then reactivate it.\r\n d3.selectAll(\"path\")\r\n .transition()\r\n .duration(1000)\r\n .style(\"opacity\", 1)\r\n .each(\"end\", function() {\r\n d3.select(this).on(\"mouseover\", mouseover);\r\n });\r\n \r\n d3.select(\"#explanation\")\r\n .style(\"visibility\", \"hidden\");\r\n }", "function handleMouseOver(d, i) {\n\t\tlet v = d3.select(this)\n\t\tif(!v.attr('clique-part'))\n\t\t\tv.attr('fill', nodesMouseOverFillColor)\n\t\tshowNodeLabelText(v.attr('label'))\n\t\tfillNeighborhoodNodes(v.attr('index'), nodesMouseOverNeighborsFillColor) // Fill neighborhood second option\n\t}", "function mouseoutHandler (d) {\n tooltip.transition().style('opacity', 0);\n }", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n Object.keys(scope_Events).forEach(function (targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function (callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "e_mouseOut(e)\n\t{\n\n\t}", "function mousemoveEvents(e) {\n if (isSuggestion(e) && !autoScrolled) {\n unselect(selectedLi);\n selectedLi = getSelectionMouseIsOver(e);\n select(selectedLi);\n }\n\n mouseHover = true;\n autoScrolled = false;\n }", "function mouseover(d) {\n // call the update function of histogram with new data.\n hG.update(data.map(function(v) {\n return [v.Range, v.freq[d.data.type]];\n }), segColor(d.data.type));\n }", "function hoverIn(){\n\t//Hide independent \n\thideDesc();\n\n\n\t$(\".content\").animate({scrollLeft:0}, '500', 'swing', function(){ /* do nothing */ });\n\t//Mouseover\n\t$('.st-menu').css({ \n\t\t'-webkit-transform' : 'translate3d(0, 0, 0)',\n\t\t'-moz-transform' : 'translate3d(0, 0, 0)',\n\t\t'-ms-transform' : 'translate3d(0, 0, 0)',\n\t\t'-o-transform' : 'translate3d(0, 0, 0)' \n\t});\n\n\t//Magic webkit 3D pan-tilt in\n\t$('.st-container').addClass(\"st-menu-open\");\n\t$('.st-pusher').removeClass('reverse-magic').addClass('magic');\n\t$(\".main-nav ul\").animate({ 'width' : 250 }, 450);\n\n\t//pointer inside .main-nav\n\thover = true;\n}", "function eventTabsWidgetMouseOver(widgetObject, element, event)\n{\n\tdhtml.addClassName(element, \"hover\");\n}", "function lineMouseOutHandler() {\n for (i = 0; i < dynamicFileList.length; i++) {\n var id = filenameToId(dynamicFileList[i]);\n if (\"line\" + id != this.id) {\n turnOn(filenameToId(dynamicFileList[i]), colorMap.get(id));\n\n }\n }\n}", "function mouseover(d){\n // call the update function of histogram with new data.\n hGW.update(fData.map(function(v){ \n return [v.State,v.freq[d.data.type]];}),segColor(d.data.type));\n hGR.update(fData.map(function(v){ \n return [v.State,v.rate[d.data.type]];}),segColor(d.data.type));\n hGC.update(fData.map(function(v){ \n return [v.State,v.count[d.data.type]];}),segColor(d.data.type));\n }", "function mouseleave(d) {\n // Hide the breadcrumb trail\n d3.select(\"#trail\")\n .style(\"visibility\", \"hidden\");\n\n var breadcrumbs = d3.select('#sequence').selectAll('.breadcrumb-custom')\n .data(d);\n breadcrumbs.exit().remove();\n\n // Deactivate all segments during transition.\n d3.selectAll(\"path\").on(\"mouseover\", null);\n\n // Transition each segment to full opacity and then reactivate it.\n d3.selectAll(\"path\")\n .transition()\n .duration(1000)\n .style(\"opacity\", 1)\n .on(\"end\", function() {\n d3.select(this).on(\"mouseover\", mouseover);\n });\n\n d3.select(\"#explanation\")\n .style(\"visibility\", \"hidden\");\n}", "function onMouseOut(d,i) {\n d3.selectAll(\".vz-halo-label\").remove();\n}", "function lineMouseOut(l, i) {\n var major = getMajorAsClass(l[0].major);\n\n changeElementOpacityForDifferentMajors(\"vis2-line\", major, '1');\n changeElementOpacityForDifferentMajors(\"vis2-dot\", major, '1');\n\n div.transition()\n .duration(100)\n .style(\"opacity\", 0);\n}", "function hoverOverSubelement(e) {\n\tif(this.className != \"selected\"){\n\t\t$(this).addClass('hovered');\n\t\tvar tamano;\n\t\tvar a = this.getElementsByTagName(\"A\")[0];\n\t\tif($(this).css('text-align') == \"right\"){\n\t\t\ttamano=-400-$(a).innerWidth();\n\t\t}else{\n\t\t\ttamano=$(a).innerWidth()-400;\n\t\t};\n\t\t$(a).stop(true,true).animate({backgroundPosition:'('+tamano+'px 0px)'},(-350*(tamano/400)),\"easeInOutQuart\");\n\t}\n}", "function hoverLeave(e) {\n $(e.target).closest(\"div\").css(BACKGROUND_COLOR, \"transparent\");\n }", "function mouseover(d) {\n // call the update function of histogram with new data.\n hG.update(fData.map(function(v) {\n return [v.State, v.freq[d.data.type]];\n }), segColor(d.data.type));\n }", "_onPointerOver() {\n this.addState(\"hovered\");\n }", "onMouseOver_() {\n if (this.isOpenable_()) {\n this.updateHoverStying_(true);\n }\n }", "function hover_over(item) {\n item.style.background = \"#ccc\";\n}", "_headerMouseLeaveHandler() {\n const that = this;\n\n if (that.disabled) {\n return;\n }\n\n that.removeAttribute('hovered');\n }", "function eventHover(event) {\n\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function (targetEvent) {\n if ('hover' === targetEvent.split('.')[0]) {\n scope_Events[targetEvent].forEach(function (callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function mouseleave(d) {\n\n // Hide the breadcrumb trail\n d3.select(\"#trail\")\n .style(\"visibility\", \"hidden\");\n\n // Deactivate all segments during transition.\n d3.selectAll(\"path\").on(\"mouseover\", null);\n\n // Transition each segment to full opacity and then reactivate it.\n d3.selectAll(\"path\")\n .transition()\n .duration(1000)\n .style(\"opacity\", 1)\n .each(\"end\", function() {\n d3.select(this).on(\"mouseover\", mouseover);\n });\n\n d3.select(\"#explanation\")\n .style(\"visibility\", \"hidden\");\n }", "function over(e) {\n // Set the cursor to 'move' wihle hovering an element you can reposition\n e.target.style.cursor = 'move';\n\n // Add a green box-shadow to show what container your hovering on\n e.target.style.boxShadow = 'inset lime 0 0 1px, lime 0 0 1px';\n}", "function masterbarLinkHoverEvent() {\n\t\t$(\"#masterbar a\").hover(\n\t\t\tfunction () {\n\t\t\t\tbounceEffect(this);\n\t\t\t}, function () {});\n\t}", "function handleMouseOut(d, i) {\n tooltip.style('display', 'none');\n }", "function onContainerMouseleave(e) {\n // publish\n fileEditor.hDev.publish('mouse-position-change', {\n f: fileEditor.filepath,\n p: {},\n c: null,\n astNode: false\n });\n }", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function(targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function(callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }", "function eventHover(event) {\n var proposal = calcPointToPercentage(event.calcPoint);\n\n var to = scope_Spectrum.getStep(proposal);\n var value = scope_Spectrum.fromStepping(to);\n\n Object.keys(scope_Events).forEach(function(targetEvent) {\n if (\"hover\" === targetEvent.split(\".\")[0]) {\n scope_Events[targetEvent].forEach(function(callback) {\n callback.call(scope_Self, value);\n });\n }\n });\n }" ]
[ "0.7321176", "0.64159054", "0.63890785", "0.63087773", "0.62385017", "0.62046254", "0.6202698", "0.6108902", "0.60995233", "0.60985976", "0.6089905", "0.6078049", "0.60747147", "0.6044304", "0.6033784", "0.59992296", "0.5947394", "0.5927225", "0.5927225", "0.59102654", "0.5907952", "0.5892528", "0.58834887", "0.58534336", "0.5843677", "0.58380324", "0.5819024", "0.58147806", "0.5787845", "0.578549", "0.5781789", "0.5780193", "0.57743865", "0.5764782", "0.576196", "0.5757945", "0.5737413", "0.5736552", "0.5735766", "0.5715928", "0.57156545", "0.5709689", "0.5709351", "0.57010615", "0.5700495", "0.5697363", "0.56911224", "0.568875", "0.5685039", "0.5684474", "0.5683644", "0.5678041", "0.56694674", "0.5666202", "0.566574", "0.5665389", "0.5665389", "0.56487316", "0.5637225", "0.5632672", "0.5627804", "0.56164104", "0.5615925", "0.5615313", "0.5612691", "0.5611434", "0.5605879", "0.56054527", "0.5603352", "0.5603352", "0.55977726", "0.5591158", "0.5585545", "0.55854213", "0.55853397", "0.55840015", "0.55804956", "0.5568168", "0.5566818", "0.5561733", "0.5560413", "0.5559064", "0.5557579", "0.5547789", "0.55433476", "0.55430454", "0.5539929", "0.5538909", "0.55350816", "0.5526962", "0.55265313", "0.552614", "0.55239797", "0.5523652", "0.55230564", "0.5519526", "0.551609", "0.55142385", "0.55121726", "0.55121726" ]
0.7597612
0
function executed when play event was thrown
function onPlay(evt) { if (timeout1 == null) { currEvt = evt; timeout1 = window.setTimeout(onTimeout, evt.data.duration); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function endPlay() {\n\n}", "onPlayStateChange() {}", "function play() {\n \n}", "play()\n {\n\n }", "play(){\n\n\n }", "play() {\n\t\tthis.trigger('play', this);\n\t}", "play() {\n\t\tthis.trigger('play', this);\n\t}", "function Play() {}", "Play() {}", "function onGamePlay(EightBitter) {\n EightBitter.AudioPlayer.resumeAll();\n EightBitter.ModAttacher.fireEvent(\"onGamePlay\");\n }", "function onPlayStart(){\n\t\t\n\t\tg_objThis.trigger(t.events.PLAY_START);\n\t\t\n\t\tif(g_objButtonClose)\n\t\t\tg_objButtonClose.hide();\n\t}", "resume () {\n this.player.play()\n }", "gameOver() {\n this.stopMusic();\n this.gameOverSound.play();\n }", "playIncorrectSound() {\n this.incorrectSound.play();\n }", "playController() {\n // If ready to play\n if (readyPlay)\n play();\n else {\n stop();\n }\n }", "onPlayButtonClick() {\n\t\tif ( this.target ) this.target.play();\n\t\tthis.trigger( 'play' );\n\t}", "_onPlayPauze() {\n if (!this.howl) {\n this._playSong(this.props.songs[0]);\n } else {\n this.state.playing ? this.howl.pause() : this.howl.play()\n this.setState({playing: !this.state.playing})\n }\n }", "function addPlayListener(){\n vid.onplay = function(){\n \ttry{\n\t\t\tvar toastElement = $('.toast').first()[0];\n\t\t\tconsole.log(toastElement);\n\t\t\tconsole.log($('.toast'));\n\t\t\ttoastElement.remove();\n\t\t\t$('.toast').remove();\n\t\t}\n\t\tcatch(e){\n\t\t\tconsole.log(e);\n\t\t}\n \tvar event = \"play\";\n \tvidPlayBack(event);\n }\n}", "function onPlayStop(){\n\t\t\n\t\tg_objThis.trigger(t.events.PLAY_STOP);\n\t\t\n\t\tif(g_objButtonClose)\n\t\t\tg_objButtonClose.show();\n\t}", "playCallback(e) {\n if (this.isCurrentTrack()) {\n this.setBigPlay()\n } else {\n this.bigPlayLoaded = false\n Rails.fire(this.loadTrackTarget, 'click')\n }\n this.registeredListen = false\n this.playTarget.classList.replace('play_button', 'pause_button')\n this.playTarget.firstElementChild.setAttribute('data-icon', 'pause')\n }", "function playpause(event) {\n player.play();\n player.pause();\n }", "playHandler() {\n this.startRefreshing();\n this.setStatus({isPlaying: true});\n }", "play(){\n super.play();\n this.isPlaying = true;\n }", "function justplay(){\r\n if(Playing_song==false){ //Verifica si se está reproduciendo\r\n playsong(); //Llama a la funcion playsong\r\n () => console.log('i injected');\r\n }else{\r\n pausesong();//Pausa la canción en otro caso\r\n }\r\n}", "function emitPlayPause() {\n if ($('#play').hasClass('playing')) {\n emitPause();\n } else {\n emitPlay();\n }\n }", "function loaded() {\n\tsong.play();\n}", "function pauseOrPlay(event) {\n\n\tconsole.log(\"enter pauseOrPlay\" + playerElem.paused);\n\tif (!playerElem.paused) {\n\t\tplayerElem.pause();\n\t\tmain_play_image.src = \"images/play.png\";\n\t\tclearInterval(seekAnimation);\n\t}\n\telse {\n\t\tplayerElem.play();\n\t\tconsole.log(\"play\");\n\t}\n}", "function callBackOK() {\n playGame();\n }", "function play() {\r\n player.play();\r\n }", "function play() {\r\n player.play();\r\n }", "function playAgain(){\n \n }", "function onPlayerReady(e) {\n}", "function playingHandler() {\n\n console.log(getTime() + ' Player.Playing');\n\n if (currentOptions.display.playControl) {\n var playButton = document.getElementById(\"play-pause\");\n playButton.style.backgroundImage = 'url(/public/images/player/player-pause.svg)';\n }\n\n }", "function play() {\r\n audio.play();\r\n}", "function on_playback_finished(event) {\n console.log(obj_ivr_play.intro_ivr_play_current_indx)\n \n \n \n \n \n if (obj_ivr_play.intro_ivr_play_current_indx < obj_ivr_play.intro_ivr_play.length - 1 && obj_ivr_play.intro_ivr_play_current_indx != -1) {\n \n obj_ivr_play.intro_ivr_play_current_indx += 1;\n \n console.log('Playing file : ' + obj_ivr_play.intro_ivr_play[obj_ivr_play.intro_ivr_play_current_indx]);\n \n \n \n \n channeloutivr.play({ media: 'sound:custom/' + obj_ivr_play.intro_ivr_play[obj_ivr_play.intro_ivr_play_current_indx] }, playbackIVR).then(function (playback) {\n\n }).catch(function (err) {\n \n obj_ivr_play.intro_ivr_play_current_indx = -1;\n console.log('Error Playback ivr');\n });\n \n\n\n\n\n\n\n\n\n }\n\n }", "function handleMediaEnd(app) {\n playMedia(app, findSong(), true);\n}", "play(){this.__stopped=!0;this.toggleAnimation()}", "playAudio() {}", "function handlePlayPouse() {\n if(hours===0 && minutes===0 && seconds===0) {\n setPause(true);\n return;\n }\n setPause(!pause);\n }", "play(note) {\n throw new Error('You have to implement the \"play\" method!');\n }", "function onPlayerReady(event) { \n //event.target.playVideo();\n detenerVideo();\n}", "Resume() {\n if(this.isPlaying) {\n this.dispatcher.resume();\n }\n }", "function playButtonListener(){\r\n\t\t\tconsole.log(\"play button hit\");\r\n\t\t\tgame.state.start(\"Game\");\r\n\t\t}", "function handlePlay(){\n if(audio.paused){\n audio.play();\n player.innerHTML = hdlPause\n }else{\n audio.pause();\n player.innerHTML = hdlPlay\n }\n }", "async play() {\n // Get the game launcher\n const launcherPath = await this._getGameLauncher(this._info.gameDir);\n\n // Raise the event\n const playClickEvent = new CustomEvent(\"play\", {\n detail: {\n launcher: launcherPath,\n },\n });\n this.dispatchEvent(playClickEvent);\n }", "_relayPlayedEvent(sound) {\n this._relayEvent('audio-played', sound);\n }", "play() {\n\t\t\t\tthis.playing = true;\n\t\t\t\tthis.targetFrame = -1;\n\t\t\t}", "function pp(){\n if(config.site ==='twitch'){\n $(\".qa-pause-play-button\").click();\n } else if(config.site ==='netflix'){\n return;\n }\n else {\n if(myPlayer.paused){\n myPlayer.play();\n } else {\n myPlayer.pause();\n }\n }\n log(\"play/pause triggered\");\n}", "play() {\n this.paused = false;\n }", "function playhandler() {\n // disable play and step till play is complete\n $('#play').attr('disabled', true);\n $('#step').attr('disabled', true);\n if (queryPosition === query.length -1) {\n startSearch(true);\n } else {\n advance(true);\n }\n}", "$mediaplayerError() {\n console.log('stomediaplayerErrorp');\n}", "function playSound(name) {\n sounds[name].currentTime = 0;\n sounds[name].play();\n sounds[name].onended = function () {\n playSound(name);\n };\n } //end playSound", "_setEvent_play(){\n let playButton = this._carousel.find(this._controlSelectors.play);\n $(playButton).click(()=>{\n this.play();\n });\n }", "function onPlayerLoaded() {\n\t\tvideo.fp_play(0);\n\t\t//installControlbar();\n\t}", "function dailyPlay(){\r\n\tif (dailyPlayer.paused){\r\n dailyPlayer.play();\r\n }\r\n\telse\r\n\t\tdailyPlayer.pause();\r\n}", "function pause(){\n activeSong.pause();\n}", "function justplay(){\n if (playing_song==false){\n playsong();\n }else{\n pausesong();\n }\n}", "function play() {\n\t\t\n\t\t//this function (defined below) will continue to the next turn\n\t\tadvance();\n\t}", "function trackplaybackstarted(){\n printNowPlaying();\n}", "function onPlayerReady(event) {\n //event.target.playVideo();\n event.target.pauseVideo();\n }", "function onPlayerPlayed () {\n\t\t\tfireMetricsEvent(1);\n\t\t}", "function onPlayerReady(event) {\r\n //event.target.playVideo();\r\n}", "function onPlayerReady(event) {\n \n}", "function mousePressed() {\n if(!song.isPlaying()){ song.play(); } else{ song.pause(); }}", "playSong (song) {\n this.stop()\n let preloadedSong = false\n // Check for preloaded song\n if (this.nextSong && this.nextSong.id === song.id) {\n this.currentSong = this.nextSong.id\n this.player = this.nextSong.player\n preloadedSong = true\n if (process.env.NODE_ENV !== 'production') {\n console.log('use preloaded song')\n }\n } else {\n this.currentSong = song.id\n this.player = this.createHowl(song.src)\n }\n this.nextSong = null\n // Attach events for the player\n this.player.on('load', () => {\n if (process.env.NODE_ENV !== 'production') {\n console.log('song loaded')\n }\n this.duration = this.player.duration()\n this.dispatchEvent('loaded', this.duration)\n })\n\n this.player.on('play', () => {\n if (preloadedSong) {\n this.duration = this.player.duration()\n this.dispatchEvent('loaded', this.duration)\n }\n const self = this\n this.dispatchEvent('play')\n requestAnimationFrame(self.seekUpdate.bind(self))\n })\n this.player.on('end', () => {\n if (process.env.NODE_ENV !== 'production') {\n console.log('song ended')\n }\n this.stop()\n this.dispatchEvent('end', null)\n })\n this.player.on('loaderror', () => this.handleAudioResourceError())\n\n this.restart()\n }", "play() {\n if (this._playingState === 'play') {\n return;\n }\n\n this._playByIndex(this.index);\n this._playingState = 'play';\n }", "function setPlayEvent(data){\n\t\tvar theID = '#play_' + data.doc.index;\n\n\t\t$(theID).click(function(){\n\t\t\tvar theObj = _.find(jsonData.rows, function(d){\n\t\t\t\treturn d.doc.index == data.doc.index;\n\t\t\t});\n\t\t\tconsole.log(\"we are PLAYING \" + data.doc.index);\n\n\t\t\tvar play_video_name= \"avatar-garden/\" + document.getElementById(\"nameForSaving\").innerHTML + \"/videos/\" + document.getElementById(\"nameForSaving\").innerHTML+\"_\" + data.doc.index +\n \"_\"+ theObj.doc._id + \".mp4\";\n\n\t\t\trecordingPlayer.src = play_video_name;\n\t\t\trecordingPlayer.play();\n\t});\n}", "function onPlayerReady(event) {\n // event.target.playVideo();\n }", "function playThemeSong() {\n themeSong.play();\n}", "play() {\r\n\t\tthis.startedPlayingAt = Date.now();\r\n\t\tthis.shouldStopPlayingAt = this.startedPlayingAt + this.duration;\r\n\t}", "function userPlay(){\n\t\tvar target = $(event.target).attr('id');\n\t\tif (target == hole){\n\t\t\tbark.play();\n\t\t\tscore++;\n\t\t\ttallyScore();\n\t\t} else {\n\t\t\twoof.play();\t\n\t\t}\n\t}", "function VideoPausedEvent() {}", "function playPause(e) {\n if (trjs.param.isContinuousPlaying === true) {\n endContinuousPlay();\n return;\n }\n setMedia();\n if (media.paused) {\n setTimer('standard');\n media.play();\n } else {\n // console.log(\"pause playPause\");\n setTimer('standard');\n media.pause();\n }\n }", "IsPlaying() {}", "function onPlaying() {\n if (element && isStalled() && element.playbackRate === 0) {\n const event = document.createEvent('Event');\n event.initEvent('waiting', true, false);\n element.dispatchEvent(event);\n }\n }", "function PlayHitSound() { \n \n hitSound.play()\n console.log(\"play\")\n}", "play() {\n this._source.play();\n }", "function callPlay() {\n bgLog(\"playButton\")\n let message = 1;\n chrome.runtime.sendMessage(message);\n}", "function playEvent( ctx, event )\n {\n switch ( event.type )\n {\n case \"draw\":\n drawCurve( ctx, event);\n break;\n case \"erase\":\n eraseCurve( ctx, event );\n break;\n }\n }", "function play(e){\n\te.cancelBubble = true;\n\tspeedReadGlobals.isPlaying = true;\n\ttoggleVisability('speedread-pause');\n\tsetTimeout(incrementWord, minsToMillis());\n}", "function touchStarted(){\n song.play();\n}", "function onPlayback() {\n if (self.player.getPlayerState() === YT.PlayerState.PLAYING) {\n self.dispatch(\"playback\");\n } else {\n clearInterval(playbackTimer);\n }\n }", "function clickPlay() {\n getPlayButton().addEventListener('click', function(){actionAfterClickPlay()});\n}", "function startOver(event, response, model) {\n const pb = model.getPlaybackState();\n if (playbackState.isValid(pb)) {\n response.audioPlayerPlay('REPLACE_ALL', pb.token.url, contentToken.serialize(pb.token), null, 0);\n }\n else {\n // otherwise, there was no audio there to restart\n response.speak(speaker.get(\"EmptyQueueMessage\"))\n .listen(speaker.get(\"WhatToDo\"));\n }\n response.send();\n}", "play() {\n this.scriptOwner.parentClip.play();\n }", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "play() {\n this.player.play();\n this.shadowRoot.querySelector(\"#play\").className = \"playerClicked\";\n this.shadowRoot.querySelector(\"#pause\").className = \"\";\n }", "play() {\n this._playing = true;\n }", "function mousePressed() {\n // if the song is not playing\n if (!song.isPlaying()) {\n song.play(); // play the song\n }\n}", "play () {\n this.playing = true;\n }", "function playSongPlayList(song,play){\r\n\ttry{\t\t\r\n\t\tjQuery.each($('#header-profile .songTitle'), function (index, obj){\r\n\t $(obj).removeClass('orange');\r\n\t });\t\r\n\t\tvar title = $('#pl_'+song.objectId+' .songTitle').html();\r\n\t\tvar mp3 = $('#pl_'+song.objectId+' input[name=\"song\"]').val();\r\n\t\tvar index = parseInt($('#pl_'+song.objectId+' input[name=\"index\"]').val());\r\n\t\t$('#header-box-thum img').attr('src',song.pathCover);\r\n\t\t$('#header-box-menu .title-player').html(title);\r\n\t\tif(play) myPlaylist.play(index);\t\t\r\n\t\t$('#pl_'+song.objectId+' .songTitle').addClass('orange');\r\n\t\t$('#play').hide();\r\n\t\t$('#pause').show();\r\n\t}catch(err){\r\n\t\twindow.console.error(\"playSongPlayList a | An error occurred - message : \" + err.message);\r\n\t}\r\n}", "function playAgain(){\n\t// add code here\n}", "function play(e) {\n let playerSelection = e.target.attributes[2].value;\n let computerSelection = computerPlay();\n playRound(playerSelection, computerSelection);\n}", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerReady(event) {\nevent.target.playVideo();\n}", "function playFromMedia(e) {\n if (trjs.param.isContinuousPlaying === true) {\n endContinuousPlay();\n return;\n }\n setMedia();\n trjs.events.goToTime('wave'); // synchronizes the partition and transcription with the current time in the media : the wave is already set\n if (media.paused) {\n setTimer('standard');\n media.play();\n } else {\n // console.log(\"pause playFromMedia\");\n setTimer('standard');\n media.pause();\n }\n }", "function playerLoop(){\n //...//\n }", "function onPlayerReady(event) {\n // event.target.playVideo();\n event.target.loadPlaylist(listeVideosNature);\n}", "function onPlayerReady(event) {\n player.loadPlaylist(viewmodel.Hindivideolist());\n player.setShuffle(true);\n player.setLoop(true);\n //event.target.playVideo();\n}", "function playEnding() {\n var splitItem = getCurrentSplitItem();\n if (splitItem != null) {\n pauseVideo();\n var clipEnd = splitItem.clipEnd;\n setCurrentTime(clipEnd - 2);\n\n clearEvents();\n editor.player.on(\"play\", {\n duration: 2000,\n endTime: clipEnd\n }, onPlay);\n playVideo();\n }\n}" ]
[ "0.76172125", "0.74029696", "0.73764765", "0.73378026", "0.7324837", "0.73092407", "0.73092407", "0.7073385", "0.70722157", "0.70416516", "0.698551", "0.692875", "0.6887163", "0.6877705", "0.68339777", "0.68087876", "0.6783341", "0.6780168", "0.67756224", "0.6763177", "0.67553824", "0.6752917", "0.6734544", "0.67131925", "0.66894895", "0.6687684", "0.6686652", "0.66818213", "0.6667621", "0.6667621", "0.6657532", "0.66505504", "0.6630821", "0.6617983", "0.6608181", "0.6605593", "0.6604967", "0.66014576", "0.6587792", "0.65672266", "0.65544593", "0.65496415", "0.654633", "0.6542098", "0.6537105", "0.65336007", "0.6531371", "0.65291584", "0.652832", "0.6515241", "0.6513658", "0.6501526", "0.6500118", "0.6493762", "0.6488974", "0.6487423", "0.64859295", "0.6476838", "0.64705443", "0.6469833", "0.64672923", "0.64645857", "0.6464536", "0.64588344", "0.645641", "0.6449553", "0.64399165", "0.643931", "0.6437712", "0.64369524", "0.6434017", "0.6433616", "0.64265406", "0.6422191", "0.64137423", "0.64128095", "0.6411373", "0.6409718", "0.64078707", "0.64059436", "0.6405532", "0.63951916", "0.6393122", "0.63876444", "0.63865787", "0.6381956", "0.6380822", "0.6373843", "0.6372898", "0.63698334", "0.6362951", "0.63625515", "0.6362398", "0.63608736", "0.63563144", "0.63555425", "0.6355346", "0.6351218", "0.6346473", "0.6342821" ]
0.67181647
23
the timeout function pausing the video again
function onTimeout() { if (!timeoutUsed) { pauseVideo(); var check = function() { endTime = currEvt.data.endTime; if (endTime > getCurrentTime()) { playVideo(); timeout2 = window.setTimeout(check, 10); timeoutUsed = true; } else { clearEvents(); pauseVideo(); if ((timeout3 == null) && (timeout4 == null)) { editor.player.on("play", { duration: 0, endTime: getDuration() }, onPlay); } jumpBackTime = currEvt.data.jumpBackTime; jumpBackTime = ((jumpBackTime == null) || (jumpBackTime == undefined)) ? null : jumpBackTime; if (jumpBackTime != null) { setCurrentTime(jumpBackTime); jumpBackTime = null; } } } check(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function videoPause() {\n video.pause();\n }", "function videoPause() {\n video.pause();\n }", "function pause() {\n paused = true;\n clearTimeout(timeout);\n }", "pause() {\n this.video.pause();\n }", "function _pause()\n {\n cancelAnimationFrame(timeout_handle);\n }", "function piloteVideo() {\r\n\t\tif (roi.paused) {\r\n\t\t\troi.play();\r\n \r\n\t\t} else {\r\n\t\t\troi.pause();}\r\n }", "function piloteVideo2() {\r\n\t\tif (LCCMA.paused) {\r\n\t\t\tLCCMA.play();\r\n \r\n\t\t} else {\r\n\t\t\tLCCMA.pause();}\r\n }", "_pauseVideo() {\n this.e.target.pauseVideo();\n console.log('Pausing the video');\n }", "function pause_video()\n {\n if (video_elt.pause) { // A VIDEO or AUDIO element\n video_elt.pause();\n } else { // An IFRAME\n video_elt.contentWindow.postMessage([\"pause\"], \"*\");\n video_elt.paused = true;\n video_elt.dispatchEvent(new Event(\"pause\")); // Synthesize our own event\n }\n }", "function pauseCurrentVideo() {\n \tisPlaying = false;\n \tvideo.pauseVideo();\n }", "function setVideoTime() {\r\n togglePlayPause();\r\n video.currentTime = (progress.value / 100) * video.duration;\r\n togglePlayPause();\r\n}", "pause() {\n this._isPaused = true;\n }", "pause() {\n this._isPaused = true;\n }", "function pause() {\r\n player.pause();\r\n }", "pause() {\n this._isPaused = true;\n }", "pause() {\n clearTimeout(this.currentTimeout);\n this.paused = true;\n this.timeleft = this.expected - new Date().getTime();\n }", "resetVideo() {\n this.videoElt.pause();\n this.videoElt.currentTime = 0;\n this.videoElt.style.display = 'none';\n }", "pause() { this.setPaused(true); }", "$mediaplayerPause() {\n console.log('mediaplayerPause');\n this.showControls();\n // setTimeout(alert('Test'), 5000);\n}", "function restoreTime () {\n const restoreTime = thiz.$videoPlayerRestoreTime(\n videoUrl,\n videoProgress\n )\n if (restoreTime > 0) {\n player.mute()\n player.playVideo()\n setTimeout(function () {\n player.pauseVideo()\n player.seekTo(restoreTime, true)\n player.unMute()\n }, 2000)\n }\n }", "function VideoPause() {\n var iframeContent = videoData.$iframe[0].contentWindow;\n\n if( videoData.type == 'youtube' ) {\n iframeContent.postMessage('{ \"event\": \"command\", \"func\": \"pauseVideo\", \"args\": \"\" }', '*');\n }\n\n else if( videoData.type == 'vimeo' ) {\n\n // API pause not work in file offline\n if( is.online ) iframeContent.postMessage('{ \"method\": \"pause\" }', '*');\n else IframeRemove();\n }\n }", "pause () {\n if (this.current) {\n this.current.video.pause()\n }\n }", "function stopVideo() {\r\n player.pauseVideo();\r\n }", "pause() { this._pause$.next(true); }", "pause () {}", "pause () {}", "pause () {}", "function pause() {\n if (!paused) {\n paused = true;\n } else {\n paused = false;\n }\n}", "function btnComenzar() {\n vid.currentTime = 0;\n vid.play();\n}", "function goToTimeDuration(id_video, time) {\n $(\".img_play_video\").hide();\n var vid = document.getElementById(id_video);\n vid.currentTime = time;\n vid.play();\n}", "pause() {\n paused = true;\n }", "function pausefunc() {\n pause = true;\n}", "function forceVideoInPause(vid,killiframe,player,vidtype) {\n\n\t\t\t\tvid.removeClass(\"isplaying\");\n\n\n\t\t\t\tvar item=vid.closest('.tp-esg-item');\n\n\n\t\t\t\tif (item.find('.esg-media-video').length>0 && !jQuery(\"body\").data('fullScreenMode')) {\n\t\t\t\t\t var cover = item.find('.esg-entry-cover');\n\t\t\t\t\t var poster = item.find('.esg-media-poster');\n\t\t\t\t\t if (poster.length>0) {\n\t\t\t\t\t \t if (!is_mobile()) {\n\t\t\t\t\t\t\t punchgs.TweenLite.to(cover,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t punchgs.TweenLite.to(poster,0.5,{autoAlpha:1});\n\t\t\t\t\t\t\t punchgs.TweenLite.to(vid,0.5,{autoAlpha:0});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpunchgs.TweenLite.set(cover,{autoAlpha:1});\n\t\t\t\t\t\t\t punchgs.TweenLite.set(poster,{autoAlpha:1});\n\t\t\t\t\t\t\t punchgs.TweenLite.set(vid,{autoAlpha:0});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t if (killiframe) {\n\t\t\t\t\t\t if (vidtype==\"youtube\")\n\t\t\t\t\t\t\t\ttry { player.destroy(); } catch(e) {}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t if (vidtype==\"vimeo\")\n\t\t\t\t\t\t\ttry { player.api(\"unload\"); } catch(e) {}\n\t\t\t\t\t\t else\n\t\t\t\t\t\t\tif (vidtype==\"wistia\")\n\t\t\t\t\t\t\t\ttry { player.end(); } catch(e) {}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t if (vidtype!=\"html5vid\") {\n\t\t\t\t\t\t\t vid.removeClass(\"haslistener\");\n\t\t\t\t\t\t\t vid.removeClass(\"readytoplay\");\n\t\t\t\t\t\t\t }\n\n\t\t\t\t\t } else {\n\t\t\t\t\t\t\t setTimeout(function() {\n\t\t\t\t\t\t\t \tif (!is_mobile())\n\t\t\t\t\t\t\t\t\tvid.css({display:\"none\"});\n\t\t\t\t\t\t\t },500);\n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}", "function theTimeout(){\n\t\t//clear timeout and remove the playing event listener (so it doesnt fire later on)\n\t\tclearTimeout(Ad.config.testVidTimeout);\n\t\tAd.dom.testVideo.removeEventListener('playing', listener);\n\n\t\t// remove the test video if it is in the dom (it might not have\n\t\t// actually been added yet, because of Googles RAD video implementation)\n\t\tif (Ad.dom.testVideo.parentNode){\n\t\t\tAd.dom.testVideo.parentNode.removeChild(Ad.dom.testVideo);\n\t\t}\n\n\t\tAd.bgVid.processComplete = true;\n\n\t\tif (Ad.config.canAutoplayVideo){\n\t\t\tcallbackFnPos.call();\n\t\t} else {\n\t\t\tcallbackFnNeg.call();\n\t\t}\n\t}", "function stopVideo() {\n // Reset the time to zero\n video.currentTime = 0;\n video.pause();\n\n}", "function pause(delta) {\n}", "resume() { this.setPaused(false); }", "function VideoPausedEvent() {}", "function outVideoControl() {\n videoCtrlTl.play();\n }", "function piloteVideo4() {\r\n\t\tif (LGDM.paused) {\r\n\t\t\tLGDM.play();\r\n \r\n\t\t} else {\r\n\t\t\tLGDM.pause();}\r\n }", "function reiniciar() {\n\n video.load();\n playPause();\n}", "_pauseTimeout() {\n\t\tif (this._timer) {\n\t\t\tclearTimeout(this._timer);\n\t\t\tthis._timer = undefined;\n\t\t\tthis._delayTime -= new Date() - this._startDelayTime;\n\t\t}\n\t}", "resume() {this.paused = false;}", "function playPauseVideo() {\n // Check if video is paused or playing\n if ( video.paused ) {\n // if video is paused, play the video\n video.play();\n } else {\n // if video is playing, pause the video\n video.pause();\n }\n\n}", "pause(time) {\r\n return new Promise((resolve) => setTimeout(resolve, time * 1000));\r\n }", "pause() {\n this._isPaused = true;\n this.stopRecording();\n }", "function endOfVideo() {\n\n\tif(videoOne.currentTime > 144 && videoOne.currentTime < 145) {\n\n\t\tendingWindow.classList.add(\"move-content-ending\");\n\n\t\tvideoOne.pause();\n\t\tvideoTwo.pause();\n\t\tvideoThree.pause();\n\n\t\taudioThree.pause();\n\t\taudioOne.pause();\n\n\n\n\t} else {\n\n\t}\n\n}", "function pause() {\n\t\t\t$progressBar.stop();\n\t\t\tisPaused = true;\n\t\t\tpauseProgress = $progressBar.innerWidth() / imageWidth;\n\t\t}", "function setVideoProgress(){\n // return true;\n video.currentTime = (+progress.value * video.duration) / 100;\n}", "pause () {\n this.playing = false;\n }", "pause () {\n this.playing = false;\n }", "function pause() {\n if (playIndex) {\n cancelAnimationFrame(playIndex);\n }\n}", "function onPause() {\n pauseTime = video.currentTime;\n if (seekerRange) {\n if (video.currentTime != 0 && !isNaN(video.duration)) {\n seekerRange.value = (video.currentTime / video.duration) * seekerRange.max;\n seekerElapsed.textContent = createMediaTimestamp(parseInt(video.currentTime));\n seekerRemaining.textContent = `-${createMediaTimestamp(parseInt(video.duration - video.currentTime))}`;\n }\n }\n video.load();\n }", "function resetVid(data){\n\n myPlayer.currentTime(0);\n myPlayer.loop(true);\n myPlayer.play();\n console.log(\"video reset \");\n\n\n}", "function startParade() {\n player.playVideo();\n // Lets the video start for a brief moment before the GIF cycling is called\n setTimeout(function(){\n imgCycle(0);\n $('#chyron h1').text(paradeTitle);\n $('#wrapper').removeClass('loading');\n },400);\n \n }", "function pauseVideo_01() { \r\n var video = \"video/PSICOALIANZA_SITP_Testimonial_evaluación_psicotécnica.mp4\";\r\n $(\"#video-01\").attr(\"src\",\"\");\r\n $(\"#video-01\").attr(\"src\",video);\r\n}", "function pause(){\n\tfor( let i = 0; i < subplanes.length ; i++ ){\n\t\tsubplanes[i].pause();\n\t}\n\tpaused = true;\n}", "function timeout() {\r\n buzz.play();\r\n recordAttempt();\r\n reset();\r\n }", "pause(options) {\n return __awaiter(this, void 0, void 0, function* () {\n let playerId = options.playerId;\n if (playerId == null || playerId.length === 0) {\n playerId = 'fullscreen';\n }\n if (this._players[playerId]) {\n if (!this._players[playerId].videoEl.pause)\n yield this._players[playerId].videoEl.pause();\n return Promise.resolve({ method: 'pause', result: true });\n }\n else {\n return Promise.resolve({\n method: 'pause',\n result: false,\n message: 'Given PlayerId does not exist)',\n });\n }\n });\n }", "function ___pause(ms) {\n\t\t\tvar date = new Date(); \n\t\t\tcurDate = null;\n\t\t\tdo { var curDate = new Date(); }\n\t\t\twhile ( curDate - date < ms);\n\t\t }", "function finalVideo(mensaje)\n{\n\tvideo.pause();\n\t$(\"#video\").css(\"width\",\"0px\").css(\"height\",\"0px\")\n\t$(\"#video\").addClass(\"hidden\");\n\t$(\"#accion\").text(\"Repetir Aventura.\");\n\t$(\"#mensaje\").text(mensaje);\n\t$(\"#mensaje\").removeClass(\"hidden\");\n\t$(\"#accion\").removeClass(\"hidden\");\n}", "function presionar() {\t\n\n\tmostrarDuracion(medio.duration, duracion)\n\t// if ( medio.canPlayType(\"mp4\")) { // BUSCAR COMO USAR EL METODO ==> canPlayType\n\tif( !medio.paused && !medio.ended ) {\n\t\tmedio.pause()\n\t\treproducir.innerHTML = \"Reproducir\"\n\t\twindow.clearInterval(bucle)\n\t} else {\t\t\n\t\tmedio.play()\n\t\treproducir.innerHTML = \"Pausar\"\n\t\tbucle = setInterval(estado, 1000)\n\t}\n\t// } else {\n\t// \talert(\"El video no se puede reproducir. Formato no válido\")\n\t// }\n}", "function pauseVid() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function ___pause(ms) {\r\n\t\t\tvar date = new Date(); \r\n\t\t\tcurDate = null;\r\n\t\t\tdo { var curDate = new Date(); }\r\n\t\t\twhile ( curDate - date < ms);\r\n\t\t }", "function finishVid() {\n $('#FlashWrapper').css('visibility', 'hidden');\n $('#FlashEndFrameSection').css('visibility', 'visible');\n $('#FlashSection').html('');\n setUpTabIndex();\n $(\".vjs-playing\").trigger(\"click\");\n}", "function pauseBGAudio()\n\t{\n\n\t}", "function onPlayerReady() {\r\n player.playVideo();\r\n /*let time = player.getCurrentTime();\r\n if(player.stopVideo()){\r\n let time2 = player.getCurrentTime();\r\n \r\n player.playVideo(time2);\r\n }*/\r\n \r\n }", "function stop(){\n p.currentTime = 0;\n p.pause();\n}", "function unpausefunc() {\n pause = false;\n}", "function stopVideo() {\n if (vid.currentTime >= stopTime && state == 1) {\n \tvid.pause();\n state = 0;\n }\n}", "function resume() {\n paused = false;\n timeout = setTimeout(executeNext, stepDelay);\n }", "pause() {\n this.paused = true;\n }", "function pauseSlideshow () {\n isRunning = false;\n control.className = \"fa fa-play\";\n clearInterval(play);\n play = 0;\n }", "pause() {\n const self = this;\n const { element, options } = self;\n if (!self.isPaused && options.interval) {\n addClass(element, pausedClass);\n Timer.set(element, () => {}, 1, pausedClass);\n }\n }", "paused() {\n\n }", "paused() {\n\n }", "paused() {\n\n }", "paused() {\n\n }", "paused() {\n\n }", "function hoverVideo(e) { \n\t $('video', this).get(0).play(); \n $('video', this).removeClass('gris');\n // $('video', this).get(0).currentTime = 3;\n \n\n\t}", "function endEarly() {\n var seconds = self.video.time();\n if (seconds >= self.endpoint) {\n console.log(\"end early\");\n self.hide(function () {\n self.video.pause();\n self.video.rewind();\n self.video.dispatch(\"end\");\n });\n }\n }", "function pause(ms) { return new Promise(resolve => { setTimeout(resolve, ms)}) }", "function ___pause(ms) {\r\n var date = new Date();\r\n curDate = null;\r\n do { var curDate = new Date(); }\r\n while ( curDate - date < ms);\r\n }", "function pauseVideo() {\n var video = document.getElementsByTagName( \"video\" )[0];\n if( video != null ) {\n video.pause();\n return true;\n }\n return false;\n}", "function onPlayerReady(event) {\r\n event.target.pauseVideo();\r\n }", "set Pause(value) {}", "videoCondition() {\n let { player } = this.refs\n if (this.state.pauseCondition) {\n if (player.currentTime === player.duration) {\n player.currentTime = 0\n player.play();\n }\n player.play();\n this.setState(\n {\n videoConditionText: 'Pause',\n pauseCondition: false\n }\n )\n } else {\n player.pause();\n this.setState(\n {\n videoConditionText: 'Play',\n pauseCondition: true\n }\n )\n }\n }", "function diapo_pause()\r\n{\r\n\tif(many_pics == true)\r\n\t{\r\n\t\tstarted = false;\r\n\t\tvar max1 = img_array.length;\r\n\t\t//stop the timeout\r\n\t\tclearTimeout(slide_timeout);\r\n\t\t//display 'play' instead of 'pause'\r\n\t\tobj2_play = document.getElementById('diapo_play');\r\n\t\tobj2_pause = document.getElementById('diapo_pause');\r\n\t\tobj2_play.style.top = 0+'px';\r\n\t\tobj2_pause.style.top = 50+'px';\r\n\t\t//reset the ID to the current pic\r\n\t\tid_img -= 1;\r\n\t\tif(id_img == -1){\r\n\t\t\tid_img = max1;\r\n\t\t}\r\n\t}\r\n}", "function startVideo($elm) {\n setTimeout(() => {\n var elm = $elm.find('video')[0];\n elm.play();\n }, 500);\n}", "function playRun(){ \n if(curFrame < frames.length && paused == false){\n drawCurFrame();\n timeOutID = setTimeout(playRun, time); \n }\n}", "function ___pause(ms) {\n var date = new Date();\n curDate = null;\n do { var curDate = new Date(); }\n while ( curDate - date < ms);\n }", "function startVideoProgress(){\n var progressTime = document.getElementById('videoProgressTime');\n var currentVideoTime = player.getCurrentTime();\n var videoDuration = player.getDuration();\n progressTime.innerHTML = formatTime(currentVideoTime) + \" / \" + formatTime(videoDuration);\n updateProgressBar(currentVideoTime, videoDuration);\n videoProgress = setTimeout(function() {\n startVideoProgress();\n }, 1000);\n }", "function vimeoready(player_id) {\n\n var froogaloop = $f(player_id);\n\n froogaloop.addEvent('play', function(data) {\n var bt = $('body').find('.tp-bannertimer');\n var opt = bt.data('opt');\n bt.stop();\n opt.videoplaying = true;\n });\n\n froogaloop.addEvent('finish', function(data) {\n var bt = $('body').find('.tp-bannertimer');\n var opt = bt.data('opt');\n if (opt.conthover == 0)\n bt.animate({ 'width': \"100%\" }, { duration: ((opt.delay - opt.cd) - 100), queue: false, easing: \"linear\" });\n opt.videoplaying = false;\n });\n\n froogaloop.addEvent('pause', function(data) {\n var bt = $('body').find('.tp-bannertimer');\n var opt = bt.data('opt');\n if (opt.conthover == 0)\n bt.animate({ 'width': \"100%\" }, { duration: ((opt.delay - opt.cd) - 100), queue: false, easing: \"linear\" });\n opt.videoplaying = false;\n });\n\n\n }", "function checkAndUpdate() {\n\t\tconsole.log('playing video'+vm_playingVideoId);\n\t\tvar video = document.getElementById(vm_playingVideoId);\n\t\tconsole.log(currentClip[\"end\"]);\n\t\tif(video.currentTime > currentClip[\"end\"]) {\n\t\t\n\t\t\tif(i < intervals.length-1) {\n\t\t\t\ti = i+1;\n\t\t\t\tcurrentClip = intervals[i];\t\t\t\n\t\t\t\tstartTime = currentClip[\"start\"];\n\t\t\t\tvideo.currentTime = startTime;\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\tvideo.pause();\n\t\t\t}\n\t\t}\n\t}", "function startVideo() {\n\n // start video\n vid.play();\n // start tracking\n ctrack.start(vid);\n trackingStarted = true;\n // start loop to draw face\n// drawLoop();\t\n\tvar t2 = setTimeout(\"drawLoop()\",10000);\t\n setCommandValue(\"System is loading ...\");\n var t2 = setTimeout(\"setCommandValue('Round 1, ready? 😎')\",4000);\n var t2 = setTimeout(\"setCommandValue('Now, follow my order 😜')\",7000);\n var t2 = setTimeout(\"setCommandValue('Show your happy to endless work 😅')\",10000);\n var t9 = setTimeout(\" round1 = true\",10000);\n\n}", "pause(){\n\t\tvar _self = this\n\t\twindow.clearTimeout( _self.timer )\n\t\tconsole.log(\"timer paused\")\n\t}", "function pauseOn()\n\t\t\t{\n\t\t\t\tpause = true;\n\t\t\t\tq.find(\".x-controls .pause\").hide();\n\t\t\t\tq.find(\".x-controls .play\").show();\n\t\t\t}", "pause() {\n this._source.pause();\n }", "pause() {\n\n clearTimeout(this.movementTimer);\n this.moving = false;\n this.game.controls.classList.add('paused');\n\n }", "function onPause() {\n}" ]
[ "0.76567954", "0.76567954", "0.7426883", "0.72823894", "0.7147945", "0.7115879", "0.7100321", "0.7071351", "0.7021771", "0.6960464", "0.69397086", "0.6872244", "0.6872244", "0.6867334", "0.68225664", "0.6813283", "0.6809177", "0.67841893", "0.67815304", "0.6778185", "0.6778075", "0.67636335", "0.67509353", "0.67387635", "0.6733447", "0.6733447", "0.6733447", "0.6720688", "0.67201304", "0.6716425", "0.6706453", "0.6703324", "0.6695469", "0.66938096", "0.6686908", "0.66637033", "0.6645032", "0.66191244", "0.6613587", "0.66081214", "0.6607679", "0.65974253", "0.65915525", "0.65814304", "0.65734315", "0.6533928", "0.6528649", "0.65259844", "0.65172476", "0.65142316", "0.65142316", "0.6511962", "0.6506064", "0.65017074", "0.64866495", "0.6480113", "0.64770883", "0.6476356", "0.6461073", "0.6459462", "0.64539546", "0.6451881", "0.6436225", "0.6433281", "0.64273775", "0.64178324", "0.6415941", "0.6411796", "0.64067024", "0.64046514", "0.6384216", "0.6381121", "0.63743854", "0.63634574", "0.63416874", "0.63416874", "0.63416874", "0.63416874", "0.63416874", "0.63358253", "0.63351285", "0.6325764", "0.632125", "0.63124216", "0.63123244", "0.630477", "0.6301493", "0.62969255", "0.6286632", "0.6284797", "0.628185", "0.6279415", "0.62792796", "0.6274589", "0.62711495", "0.62669986", "0.626168", "0.6261266", "0.6260401", "0.6258019" ]
0.6796101
17
play/pause play the video
function playVideo() { if (getPlayerPaused()) { editor.player[0].play(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playPlayer() {\n console.log(\"play\");\n player.internalPlayer.playVideo();\n whenUnPause();\n }", "function togglePlay() {\n video.paused ? video.play() : video.pause();\n}", "function toggleplay() {\n if (video.paused) {\n video.play();\n } else {\n video.pause();\n }\n}", "playPauseVideo() {\n if (this.state.showPlay) {\n this.refs.video.play();\n this.setState({\n showPlay: false\n })\n }\n else {\n this.refs.video.pause();\n this.setState({\n showPlay: true\n })\n }\n }", "play() {\n this.video.play();\n }", "function playPauseVideo() {\n // Check if video is paused or playing\n if ( video.paused ) {\n // if video is paused, play the video\n video.play();\n } else {\n // if video is playing, pause the video\n video.pause();\n }\n\n}", "function togglePlayPause() {\r\n if (video.paused) {\r\n playVideo();\r\n } else {\r\n pauseVideo();\r\n }\r\n}", "function togglePlay() {\n const isPaused = video.paused ? true : false; //paused is a property on video\n \n if (isPaused) { \n video.play();\n } else {\n video.pause();\n }\n}", "function playpause(event) {\n player.play();\n player.pause();\n }", "function videoClick(){\n\tif(video.paused){\n\t\tplayVideo();\n\t}else{\n\t\tpauseVideo();\n\t}\n}", "function play(that) {\n\t\tvar video = that.find('video').get(0),\n\t\t\tcontroller;\n\t\tif (that.settings.controlPosition) {\n\t\t\tcontroller = $(that.settings.controlPosition).find('.ui-video-background-play a');\n\t\t} else {\n\t\t\tcontroller = that.find('.ui-video-background-play a');\n\t\t}\n\t\tif (video.paused) {\n\t\t\tvideo.play();\n\t\t\tcontroller.toggleClass('ui-icon-pause ui-icon-play').text(that.settings.controlText[1]);\n\t\t} else {\n\t\t\tif (video.ended) {\n\t\t\t\tvideo.play();\n\t\t\t\tcontroller.toggleClass('ui-icon-pause ui-icon-play').text(that.settings.controlText[1]);\n\t\t\t} else {\n\t\t\t\tvideo.pause();\n\t\t\t\tcontroller.toggleClass('ui-icon-pause ui-icon-play').text(that.settings.controlText[0]);\n\t\t\t}\n\t\t}\n\t}", "function playVideo() { \n\tif($video[0].paused) {\n\t\t$video[0].play();\n\t\t$playButton.find(\"img\").attr(\"src\", \"icons/pause-icon.png\"); \n\t\t$buttonControls.hide();\n\t\t$videoControls.css(\"margin-top\", \"5%\");\t \t\n\t} else {\n\t\t$video[0].pause();\n\t\t$playButton.find(\"img\").attr(\"src\", \"icons/play-icon.png\");\t\t\t\n\t}\t\t\n}", "function togglePlayVideo() {\n let icon = playbtn.querySelector('.video-ctrl-bt');\n if(video.paused) {\n videoduration = convertSecondsToMinutes(video.duration);\n overvideo.style.backgroundColor = 'transparent';\n video.play();\n playToPauseBtn(icon);\n videobtn.style.display = 'none';\n addVideoListeners();\n outVideoControl();\n videoPlaying = true;\n }\n else {\n video.pause();\n pauseToPlayBtn(icon);\n videobtn.style.display = 'block';\n removeVideoListeners();\n videoCtrlTl.reverse();\n videoPlaying = false;\n }\n }", "function videoPause() {\n video.pause();\n }", "function videoPause() {\n video.pause();\n }", "function togglePlay() {\n video[video.paused ? 'play' : 'pause']();\n}", "function action_toggle_play() {\n if (video.paused) {\n video.play();\n change_icon('play'); \n } else {\n video.pause();\n change_icon('pause'); \n }\n delay = delay_value;\n}", "function togglePlay() {\n const playPause = document.querySelector('.play-pause');\n\n if (video.paused === true) {\n video.play();\n playPause.classList.add('state-pause');\n playPause.classList.remove('state-play');\n } else {\n video.pause();\n playPause.classList.add('state-play');\n playPause.classList.remove('state-pause');\n }\n}", "resume () {\n this.player.play()\n }", "toggle () {\n if (this.video.paused) {\n this.play();\n }\n else {\n this.pause();\n }\n }", "function play_video()\n {\n if (video_elt.play) { // A VIDEO or AUDIO element, or a proxy object\n video_elt.play().catch(function(err) {console.log(err)});\n } else { // An IFRAME\n video_elt.contentWindow.postMessage([\"play\"], \"*\");\n video_elt.paused = false;\n video_elt.dispatchEvent(new Event(\"play\")); // Synthesize our own event\n }\n }", "function playCurrentVideo() {\n \tisPlaying = true;\n \tvideo.playVideo();\n }", "toggleVideo() {\n var self = this;\n\n if (self.get('isPlaying')) {\n self.get('Player').pauseVideo();\n self.set('isPlaying', false);\n\n self.get('$progressBar').stop();\n Ember.run.cancel(self.vidClock);\n } else {\n self.get('Player').playVideo();\n self.set('isPlaying', true);\n }\n }", "function btnComenzar() {\n vid.currentTime = 0;\n vid.play();\n}", "function piloteVideo() {\r\n\t\tif (roi.paused) {\r\n\t\t\troi.play();\r\n \r\n\t\t} else {\r\n\t\t\troi.pause();}\r\n }", "function playVideo() { \n myVideo.play(); \n return false;\n }", "pause() {\n this.video.pause();\n }", "function togglePlay() {\n const method = video.paused ? 'play' : 'pause' ;\n video[method]();\n}", "function VideoPlayPause() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function togglePlayback() {\n let video_is_cued = player.getPlayerState() == states.video_cued;\n let video_is_paused = player.getPlayerState() == states.paused;\n let video_is_playing = player.getPlayerState() == states.playing;\n if (video_is_cued || video_is_paused) {\n player.playVideo();\n } else if (video_is_playing) {\n player.pauseVideo();\n }\n}", "function togglePlay() {\n const method = video.paused ? 'play' : 'pause';\n video[method]();\n}", "function pauseVid() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function togglePlay() {\n if (elements.video.paused) {\n elements.video.play();\n elements.playBtn.classList.replace('fa-play', 'fa-pause');\n elements.playBtn.setAttribute('title', 'Pause');\n } else {\n elements.video.pause();\n showPlayIcon();\n }\n}", "function playVideo() { \n\t\t$(\"#index-vid-a\").removeClass(\"hidden\"); \n\t \t$(\"#vid-pic\").css('display', 'none');\n\t \t$(\"#index-vid-b\").css('display', 'none');\n\t \tvar vid = $(\"#index-vid-a\");\n\t vid.controls = false;\n\t vid.load();\n\t vid.on('ended',function(){\n\t \t$(vid).css('display', 'none');\n\t\t\t$(\"#index-vid-b\").css('display', 'inline-block');\n\t\t\tvar vidb = $(\"#index-vid-b\");\n\t\t\tvidb.controls = false;\n\t \tvidb.load();\n\t \tvidb.on('ended',function(){ \n\t \t\t\t$(vidb).css('display', 'none');\n\t\t\t\t$(\"#vid-pic\").css('display', 'inline-block');\n\t\t\t});\n\t}); \n\n\t}", "function togglePlay() {\n if(isPlaying) {\n domVideo.pause();\n isPlaying = false;\n playButton.innerHTML = '<img src=\"video-plugin/video-img/play.png\" />';\n } else {\n domVideo.play();\n isPlaying = true;\n playButton.innerHTML = '<img src=\"video-plugin/video-img/pause.png\" />';\n }\n}", "function onPlayerReady() {\r\n player.playVideo();\r\n /*let time = player.getCurrentTime();\r\n if(player.stopVideo()){\r\n let time2 = player.getCurrentTime();\r\n \r\n player.playVideo(time2);\r\n }*/\r\n \r\n }", "function togglePlay() {\n // if (selectors.video.paused) {\n // selectors.video.play();\n // } else {\n // selectors.video.pause();\n // }\n\n const method = selectors.video.paused ? \"play\" : \"pause\";\n selectors.video[method]();\n}", "play() {\n this.paused = false;\n }", "function play() {\r\n player.play();\r\n }", "function play() {\r\n player.play();\r\n }", "function myFunction() {\r\nif (video.paused) {\r\n video.play();\r\n btn.innerHTML = \"Pause\";\r\n} else {\r\n video.pause();\r\n btn.innerHTML = \"Play\";\r\n}\r\n}", "function myFunction() {\r\n if (video.paused) {\r\n video.play();\r\n btn.innerHTML = \"Pause\";\r\n } else {\r\n video.pause();\r\n btn.innerHTML = \"Play\";\r\n }\r\n}", "function playVideo1(){\nvar button=document.getElementById(\"playVideo1Button\");\n\n if(video1.paused){\n video1.play();\n }\n else{\n video1.pause();\n }\n}", "function togglePlay() {\n\t// Selecting the right method\n\tconst method = video.paused ? 'play' : 'pause';\n\t// Calling the finction\n\tvideo[method]();\n}", "function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Pause\";\n } else {\n video.pause();\n btn.innerHTML = \"Play\";\n }\n}", "function play() {\n video.play();\n play_pause_button.setAttribute('title', 'Pause');\n play_pause_snap_button.toState(1);\n\n var is_hover_bottom_bar = el.querySelector('.mp-bottom-bar:hover');\n if (!is_hover_bottom_bar) {\n setTimeout(hideControls, 2000);\n }\n }", "function toggleVid() {\n if (playing) {\n currVid.pause();\n //currVid.hide()\n } else {\n //currVid.show()\n currVid.play();\n }\n playing = !playing;\n}", "function toggleVideoState() {\n if (video.paused) {\n video.play();\n } else {\n video.pause();\n }\n\n }", "function toggle_play_pause(ev)\n {\n ev.preventDefault();\n if (video_elt.paused || video_elt.ended) play_video(); else pause_video();\n }", "function play(v_index){\r\n\r\n\t//plays the right video : index 1 -> videoT, index 2 -> videoGP\r\n\r\n\tif(v_index == 1){\r\n\t\tif(videoT.paused)\r\n\t\t\tvideoT.play()\r\n\r\n\t}\r\n\telse if(v_index == 2){\r\n\t\tif(videoGP.paused)\r\n\t\t\tvideoGP.play();\r\n\r\n\t}\r\n\telse{\r\n\t\talert(\"Error play(): video index invalid\");\r\n\t}\r\n\r\n}", "function player(){\n\t\tif(!isPlaying){\n\t\t\tvid.play();\n\t\t\tisPlaying = true;\n\t\t\t$('#play_video').attr('value', 'Pause!');\n\t\t}\n\t\telse{\n\t\t\tvid.pause();\n\t\t\tisPlaying = false;\n\t\t\t$('#play_video').attr('value', 'Play!');\n\t\t}\n\t\t$('#note').text(\"\");\n\t\ttimer();\n\t\t$('#vol').val(vid.volume * 100);\n\t}", "togglePlayback() {\n if (this.player.isPlaying()) {\n this.player.stop();\n } else {\n this.player.play();\n }\n }", "function toggleVideoStatus(){\n if(video.paused){\n video.play();\n }else {\n video.pause();\n }\n}", "function play() {\n player.playVideo();\n launch_progress_timer();\n play_pause_button.setAttribute('title', 'Pause');\n play_pause_snap_button.toState(1);\n\n var is_hover_bottom_bar = el.querySelector('.mp-bottom-bar:hover');\n if (!is_hover_bottom_bar) {\n setTimeout(hideControls, 2000);\n }\n }", "function landingPlayVideo(e) {\n\n\t\t\t// play all videos\n\t\t\tvideoOne.play();\n\t\t\tvideoTwo.play();\n\t\t\tvideoThree.play();\n\n\t\t\taudioThree.play();\n\t\t\taudioOne.play();\n\n\t\t\taudioThree.volume = 0.15;\n\n\t\t\tvideoWindow.classList.add(\"move-content\");\n\n\t\t\t// change videoPlay button text to pause\n\t\t\tvideoPlay.innerHTML = \"Pause\";\n\t\t\t// add \"playing\" class to video play button\n\t\t\tvideoPlay.classList.add(\"playing\");\n\n\t\t}", "function togglePlay(){\n console.log(\"working? togglePlay fn\")\n const method = video.paused ? 'play' : 'pause';\n video[method]();\n}", "function playPause(e) {\n if (trjs.param.isContinuousPlaying === true) {\n endContinuousPlay();\n return;\n }\n setMedia();\n if (media.paused) {\n setTimer('standard');\n media.play();\n } else {\n // console.log(\"pause playPause\");\n setTimer('standard');\n media.pause();\n }\n }", "function playVid(){\n vlcPlayer.hidden=false;\n if (vlcPlayer.src == this.href) {\n console.log('resume video:'+this.href);\n vlcPlayer.play();\n return false;\n }\n console.log('play video:'+this.href);\n vlcPlayer.src=this.href;\n vlcPlayer.play();\n //event.preventDefault();\n return false;\n}", "function stopVideo() {\r\n player.pauseVideo();\r\n }", "function toggleVid() {\n if (playing) {\n myVideo.pause();\n button.html('play');\n } else {\n myVideo.loop();\n button.html('pause');\n }\n playing = !playing;\n}", "function togglePlay() {\n // If video is paused play it or pause it\n // `.paused` property is used because there is no play property\n return video.paused ? video.play() : video.pause(); // My solution\n // Wes's solution\n // const method = video.paused ? 'play' : 'pause';\n // video[method]();\n}", "play() {\n\t\t\t\tthis.playing = true;\n\t\t\t\tthis.targetFrame = -1;\n\t\t\t}", "function videoPlayVideo(e) {\n\t\t// change video play button text to play\n\t\tvideoPlay.innerHTML = \"Play\";\n\n\t\t// if videoplay button contains playing class, pause all videos if button is pressed\n\t\tif(videoPlay.classList.contains(\"playing\")) {\n\t\t\tvideoOne.pause();\n\t\t\tvideoTwo.pause();\n\t\t\tvideoThree.pause();\n\n\t\t\taudioThree.pause();\n\n\t\t\t// add paused class to video play button\n\t\t\tvideoPlay.classList.add(\"paused\");\n\t\t\t// remove the playing class to play button\n\t\t\tvideoPlay.classList.remove(\"playing\");\n\n\t\t\t// if videoPlay button contains paused class, play all video if button is pressed\n\t\t} else if (videoPlay.classList.contains(\"paused\")) {\n\t\t\tvideoOne.play();\n\t\t\tvideoTwo.play();\n\t\t\tvideoThree.play();\n\n\t\t\taudioThree.play()\n\n\t\t\t// add playing class to video play button\n\t\t\tvideoPlay.classList.add(\"playing\");\n\n\t\t\t// remove paused class to video play button\n\t\t\tvideoPlay.classList.remove(\"paused\");\n\n\t\t\t// change video play button to \"pause\";\n\t\t\tvideoPlay.innerHTML = \"Pause\";\n\n\t\t}\n\t}", "function pause() {\r\n player.pause();\r\n }", "function pauseOrPlay(event) {\n\n\tconsole.log(\"enter pauseOrPlay\" + playerElem.paused);\n\tif (!playerElem.paused) {\n\t\tplayerElem.pause();\n\t\tmain_play_image.src = \"images/play.png\";\n\t\tclearInterval(seekAnimation);\n\t}\n\telse {\n\t\tplayerElem.play();\n\t\tconsole.log(\"play\");\n\t}\n}", "function toggleVideoStatus() {\n if (video.paused) {\n video.play();\n } else {\n video.pause();\n }\n}", "function togglePlay() {\r\n if (player.paused === false) {\r\n player.pause();\r\n isPlaying = false;\r\n $('#play-btn').removeClass('pause');\r\n\r\n } else {\r\n player.play();\r\n $('#play-btn').addClass('pause');\r\n isPlaying = true;\r\n }\r\n }", "function play() {\r\n if ($('#play').hasClass('pause')) {\r\n $musicPlayer.pause()\r\n } else {\r\n $musicPlayer.play()\r\n }\r\n $('#play').toggleClass('pause');\r\n }", "function piloteVideo2() {\r\n\t\tif (LCCMA.paused) {\r\n\t\t\tLCCMA.play();\r\n \r\n\t\t} else {\r\n\t\t\tLCCMA.pause();}\r\n }", "function playPauseVideo(slick, control){\n\t var currentSlide, slideType, startTime, player, video;\n\n\t currentSlide = slick.find(\".slick-current\");\n\t slideType = currentSlide.attr(\"class\").split(\" \")[1];\n\t player = currentSlide.find(\"iframe\").get(0);\n\t startTime = currentSlide.data(\"video-start\");\n\n\t if (slideType === \"youtube\") {\n\t switch (control) {\n\t case \"play\":\n\t postMessageToPlayer(player, {\n\t \"event\": \"command\",\n\t \"func\": \"mute\"\n\t });\n\t postMessageToPlayer(player, {\n\t \"event\": \"command\",\n\t \"func\": \"playVideo\"\n\t });\n\t break;\n\t case \"pause\":\n\t postMessageToPlayer(player, {\n\t \"event\": \"command\",\n\t \"func\": \"pauseVideo\"\n\t });\n\t break;\n\t }\n\t } else if (slideType === \"video\") {\n\t video = currentSlide.children(\"video\").get(0);\n\t if (video != null) {\n\t if (control === \"play\"){\n\t video.play();\n\t } else {\n\t video.pause();\n\t }\n\t }\n\t }\n\t }", "function togglePlayback() {\n if(vm.mediaElement.paused) {\n vm.mediaElement.play();\n } else {\n vm.mediaElement.pause();\n }\n }", "function togglePlayPause() {\n var video = document.getElementById(\"Video\");\n if (video.paused || video.ended) {\n video.play();\n }\n else {\n video.pause();\n }\n}", "function pauseToggle(){\n\n\t\t//test if the video is currently playign or paused\n\t\t// posted propter - boolen\n\n\t\tif(vid.paused){\n\n\t\t\t//if paused then play the video\n\t\t\tvid.play();\n\n\t\t}else{\n\n\t\t\t//video is the\n\t\t}\n}", "function onPlayerReady(event) {\n //event.target.playVideo();\n event.target.pauseVideo();\n }", "function pause() {\n if (running) {\n togglePlay();\n }\n}", "function play_pause(event) {\n video = event.target.previousSibling\n\n button = event.target\n if (video.paused == true) {\n // $('body > *').find('video').not(video).pause()\n\n //Play the video\n video.play();\n //Change to pause button\n $(button).removeClass('play').addClass('pause');\n\n if (settings.fullscreen) {\n if (video.requestFullscreen) {\n video.requestFullscreen();\n } else if (video.mozRequestFullScreen) {\n video.mozRequestFullScreen(); // Firefox\n } else if (video.webkitRequestFullscreen) {\n video.webkitRequestFullscreen(); // Chrome and Safari\n }\n }\n } else {\n video.pause();\n //Change to play button\n $(button).removeClass('pause').addClass('play');\n }\n }", "function myFunction() {\n if (video.paused) {\n video.play();\n btn.innerHTML = \"Stop video\";\n } else {\n video.pause();\n btn.innerHTML = \"Watch video\";\n }\n}", "play(){\n this.setState({sentinel : true});\n this.state.video.play();\n this.state.video2.play();\n this.setState({ duration: document.getElementById('v1').duration });\n }", "function pauseCurrentVideo() {\n \tisPlaying = false;\n \tvideo.pauseVideo();\n }", "function togglePlayPause() {\n if (video.paused || video.ended) {\n playpause.title = 'pause';\n playpause.innerHTML = '<img src=\"icons/pause-icon.png\">';\n playpause.className = 'pause';\n video.play();\n}\n else {\n playpause.title = 'play';\n playpause.innerHTML = '<img src=\"icons/play-icon.png\">';\n playpause.className = 'play';\n video.pause();\n }\n}", "function playYtVideo() {\n player.playVideo();\n if (this.classList.value === playFaClass) {\n $('.playButton').tooltip('hide')\n $('.playButton').removeClass(playFaClass).toggleClass(pauseFaClass);\n $(this).attr('data-original-title','Pause')\n } else {\n $('.pauseButton').tooltip('hide');\n $('.pauseButton').removeClass(pauseFaClass).toggleClass(playFaClass);\n $(this).attr('data-original-title','Play')\n player.pauseVideo()\n }\n }", "play() {\n this.player.play();\n this.shadowRoot.querySelector(\"#play\").className = \"playerClicked\";\n this.shadowRoot.querySelector(\"#pause\").className = \"\";\n }", "function playPause() {\n\t\tvar myVideo = document.getElementById(\"v\");\n\t\t//myVideo.webkitEnterFullscreen();\n\t if (myVideo.requestFullscreen) {\n\t \t myVideo.requestFullscreen();\n\t } else if (myVideo.mozRequestFullScreen) {\n\t \t myVideo.mozRequestFullScreen();\n\t } else if (myVideo.webkitRequestFullscreen) {\n\t \t myVideo.webkitRequestFullscreen();\n\t }\n\t\t\n\t\tif (myVideo.paused)\n\t\t\tmyVideo.play();\n\t\telse\n\t\t\tmyVideo.pause();\n\t\t\n\t\tvar video = $('video')[0];\n video.addEventListener('ended', function () {\n $.mobile.changePage(\"#pageEndSplash\", \"fade\");\n\t\t\t});\t\n\t}", "play() {\n this._source.play();\n }", "function playVideo() {\r\n video.play();\r\n play.innerHTML = '<i class=\"fas fa-pause fa-2x\"></i>';\r\n}", "play(){\n\n\n }", "pause () {\n if (this.current) {\n this.current.video.pause()\n }\n }", "function playPause(){\n scope.playing ? scope.audio.pause() : scope.audio.play();\n }", "function toggleVideoPlayback(e){\n\tif (e.source.playing) {\n\t\te.source.pause();\n\t} else {\n\t\te.source.play();\n\t}\n}", "function togglePlayVideo()\r\n\t{\r\n\t\t //if statement; outcome differs depending on conditions\r\n\t\tif ( myVideo.paused === true ) //video is paused\r\n\t\t{\r\n\t\t\tmyVideo.play(); //the DOM play method plays the video, when clicked\r\n\t\t\tplayButton.innerHTML = \"&#9616;&#9616;\"; //updates inside HTML button selector: turns into a pause icon made from two same Unicode characters\r\n\t\t\tisPaused = false; //boolean variable is assigned to false\r\n\t\t}\r\n\t\telse //if the video is playing\r\n\t\t{\r\n\t\t\tmyVideo.pause(); //the DOM pause method pauses the video, when clicked\r\n\t\t\tplayButton.innerHTML = \"&#9658;\" ; //updates inside HTML button selector when clicked: turns into a right-pointing pointer made from single Unicode character\r\n\t\t\tisPaused = true; //boolean variable is assigned to true\r\n\t\t} //ends if statement\r\n\t} //ends function \"togglePlayVideo\"", "function togglePauseVideo() {\n const videoEl = document.querySelector('video');\n if(videoEl) {\n if (videoEl.paused) videoEl.play();\n else videoEl.pause();\n }\n }", "function togglePlay() {\n if (video.paused) {\n video.play();\n } else {\n video.pause();\n }\n\n // or other way to do this same thing \n /*const method =video.paused?'play':'pause';\n video[method]();*/\n}", "function toggleVid() {\n if (playing) {\n earring.pause();\n button.html('play');\n } else {\n earring.loop();\n button.html('pause');\n }\n playing = !playing;\n}", "function togglePlay() {\r\n\tif (video.paused) { //paused is a video property, not play\r\n\t\tvideo.play();\r\n\t} else {\r\n\t\tvideo.pause();\r\n\t}\r\n//the short way:\r\n//const method = video.paused ? 'play' : 'pause';\r\n//video[method]();\r\n}", "function togglePlay() {\n if(!downloadFinished){\n return;\n }\n if(playing){\n player.pause();\n }else{\n player.play();\n }\n }", "playController() {\n // If ready to play\n if (readyPlay)\n play();\n else {\n stop();\n }\n }" ]
[ "0.7994133", "0.7979896", "0.79714286", "0.79132104", "0.79126847", "0.7876656", "0.78223777", "0.78058803", "0.7794952", "0.7678039", "0.7673985", "0.7646283", "0.76155514", "0.7607019", "0.7607019", "0.7579778", "0.75761205", "0.7571025", "0.75569654", "0.755566", "0.75084573", "0.7501566", "0.74939656", "0.74883884", "0.7486084", "0.7482432", "0.7481357", "0.74602395", "0.74483734", "0.7447374", "0.74402237", "0.74118704", "0.740329", "0.74006665", "0.7390148", "0.73629314", "0.7356192", "0.73418134", "0.73410565", "0.73410565", "0.73316664", "0.7324641", "0.73155457", "0.7304697", "0.728939", "0.728939", "0.728939", "0.728939", "0.728939", "0.727994", "0.7267385", "0.72643703", "0.72538817", "0.7251701", "0.7251375", "0.7241117", "0.72409886", "0.72342724", "0.72327167", "0.7228209", "0.72178835", "0.72122717", "0.7199662", "0.7195405", "0.71923196", "0.71905124", "0.7190333", "0.71835107", "0.7180887", "0.718039", "0.7176028", "0.7162738", "0.7149588", "0.71469635", "0.71411115", "0.71289784", "0.7117526", "0.71100324", "0.71067536", "0.7105999", "0.71002614", "0.709284", "0.70783144", "0.70737386", "0.706751", "0.7066486", "0.7056672", "0.70487046", "0.70485413", "0.70465547", "0.7045887", "0.704578", "0.7045276", "0.70403075", "0.7038657", "0.7034975", "0.70305824", "0.70289654", "0.7023861", "0.6982102" ]
0.7687975
9
plays the current split item from it's beginning
function playCurrentSplitItem() { var splitItem = getCurrentSplitItem(); if (splitItem != null) { pauseVideo(); var duration = (splitItem.clipEnd - splitItem.clipBegin) * 1000; setCurrentTime(splitItem.clipBegin); clearEvents(); editor.player.on("play", { duration: duration, endTime: splitItem.clipEnd }, onPlay); playVideo(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stepForward(){\n if(index === (playList.length - 1) ){\n index = 0\n }else{\n index++\n }\n box.innerHTML = `Track ${index + 1} - ${playList[index]}${ext}`;\n audio.src = dir + playList[index] + ext;\n audio.play()\n }", "function firstItem() {\n\t\tstopSlideshow();\n\t\tchangeItem(0);\n\t}", "next(){\n let targetItem = this._currentItem + 1;\n let nextItem = targetItem >= this._itemCount ? 0 : targetItem;\n this._changeActive_keepPlayState(nextItem);\n }", "function playFirstSong() {\n setTrack(tempPlaylist[0], tempPlaylist, true);\n}", "advance() {\n if (this._forceNextFrame) {\n this.playheadPosition = this._forceNextFrame;\n this._forceNextFrame = null;\n } else if (this._playing) {\n this.playheadPosition++;\n\n if (this.playheadPosition > this.length) {\n this.playheadPosition = 1;\n }\n }\n }", "skipPrev() {\n let id = this.props.trackId;\n const nodes = this.props.audioNodes;\n\n if ( (id + 1) <= (nodes.length) && (id - 1) >= 0 ) {\n nodes[id].item.pause();\n\n id = id - 1;\n setCurrTrack(id);\n\n this.play(id);\n this.props.onItemActive(id);\n }\n\n }", "start () {\n while (this.dom.firstChild) {\n this.dom.removeChild(this.dom.firstChild)\n }\n\n this.current = this.preloadList.shift()\n\n if (!this.current || this.current.index === null) {\n this.emit('endedAll')\n return\n }\n\n if (this.current.index > this.list.length) {\n return\n }\n\n const entry = this.list[this.current.index]\n\n if (entry.video) {\n this.dom.appendChild(this.current.video)\n }\n\n this.emit('next', entry)\n\n if (this.requestedCurrentTime) {\n this.currentTime = this.requestedCurrentTime\n } else {\n this.actionTime = 0\n this.current.actionIndex = 0\n this.current.pauseIndex = 0\n this.update()\n }\n }", "play() {\n if (this._playingState === 'play') {\n return;\n }\n\n this._playByIndex(this.index);\n this._playingState = 'play';\n }", "goToFirst() {\n this.stream.goToFirst();\n this.updateScrubberValues({ animate: true, forceHeightChange: true });\n }", "previous(){\n let targetItem = this._currentItem - 1;\n let previousItem = targetItem < 0 ? this._itemCount - 1 : targetItem;\n this._changeActive_keepPlayState(previousItem);\n }", "function playPrevShuffled() {\n\t\tif (plsShuffledIndex > 0) {\n\t\t\tplsShuffledIndex -= 1;\n\t\t\tplay(plsShuffled[plsShuffledIndex]);\n\t\t}\n\t}", "skipNext() {\n let id = this.props.trackId;\n const nodes = this.props.audioNodes;\n\n if ( (id + 1) <= (nodes.length - 1) ) {\n\n nodes[id].item.pause();\n\n id = id + 1;\n setCurrTrack(id);\n\n this.play(id);\n this.props.onItemActive(id);\n }\n\n }", "start () {\n this.stop();\n\n if (this._items.length < 2 || this._items.length <= this._visible) {\n return\n }\n this._setContentTransitionDuration('');\n this._interval = setInterval(this.next.bind(this), this.interval);\n }", "function next_song(){\r\n if(index_no<All_song.length - 1){ //Verifica que el indice no sea mayor que el largo de la lista\r\n index_no+=1;//Cambia el indice en 1 al siguiente indice\r\n load_track(index_no);//Carga la canción\r\n playsong();//Reproduce la cancion\r\n }else{\r\n index_no = 0;//Cuando el indice supera la longitud de la lista se vuelve 0\r\n load_track(index_no);//Carga la canción\r\n playsong();//Reproduce la cancion\r\n }\r\n }", "function prevSong(){\n songIndex--\n if(songIndex<0)\n {\n songIndex=songs.length-1\n }\n PickSong(songs[songIndex]);\n playSong()\n}", "function playNextShuffled() {\n\n\t\tif (plsShuffledIndex < (plsShuffled.length - 1)) {\n\t\t\tplsShuffledIndex += 1;\n\t\t\tplay(plsShuffled[plsShuffledIndex]);\n\t\t} else {\n\t\t\tif (isContinuous) {\n\t\t\t\tsetPlsShuffled();\n\t\t\t\tplay(plsShuffled[0]);\n\t\t\t} else {\n\t\t\t\tif (Amplitude.getSongPlayedPercentage() === 100) {\n\t\t\t\t\tcurTrack.classList.remove('selected');\n\t\t\t\t\tfirePlayEnd();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "_nextSong() {\n try {\n this.currentIndex = Math.max(this.indexPlayList, 0);\n this.indexPlayList = (this.indexPlayList + 1) % this.currentPlaylist.length;\n this._playSound(`./assets/audio/${this.currentPlaylist[this.indexPlayList]}`);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n }", "function prev_song(){\r\n if(index_no>0){//Verifica que el indice no sea menor que 0\r\n index_no-=1;//Cambia el indice en 1 al indice anterior\r\n load_track(index_no);//Carga la canción\r\n playsong();//Reproduce la cancion\r\n }else{\r\n index_no = All_song.length;//Cuando el indice supera la longitud de la lista se vuelve el valor maximo de la longitud de la lista\r\n load_track(index_no);//Carga la canción\r\n playsong();//Reproduce la cancion\r\n }\r\n }", "function Start(){//We start with no items\n\titems[0]=0;\n\titems[1]=0;\n}", "skipAhead() {\n assert(this.playlist, 'Cannot advance without a playlist.');\n // This skips to the next module in the current layout.\n // We need to cancel any existing timer, because we are disrupting the\n // normal timing.\n this.resetTimer_();\n\n // Now, force the next module to play.\n this.nextModule();\n }", "play() {\n const delay = this.props.delay || 6000;\n const interval = setInterval(() => {\n this.nextItem();\n }, delay);\n this.interval = interval;\n this.setState({ playing: true });\n }", "play () {\n if (!this.current) {\n this.start()\n }\n\n if (this.list[this.current.index].videoDuration === 0) {\n return this.next()\n }\n\n this.update()\n }", "play(index) {\n if(this.measures.length == 0 || index >= this.measures.length) {\n return;\n }\n // this helps make recursive calls later\n let self = this;\n let curSong = this.measures[index];\n curSong.playSong();\n \n if(index != (this.measures.length - 1)) {\n curSong.getCurNote() != null ? curSong.getCurNote().onended = function() { self.play(index + 1); } : self.play(index + 1);\n }\n }", "stateLoop () {\n const clip = this.clips.shift();\n\n if (clip !== undefined) {\n if (clip.loop) {\n // Eventually advance will be called\n this.play(clip);\n } else {\n // Call stateloop when the clip is done playing\n this.play(clip).then(() => {\n this.stateLoop();\n });\n }\n }\n }", "function nextSong() {\r\n musicIndex = musicIndex + 1;\r\n if (musicIndex > music.length - 1) {\r\n musicIndex = 0;\r\n loadSong(musicIndex);\r\n playSong();\r\n } else {\r\n loadSong(musicIndex);\r\n playSong();\r\n }\r\n}", "function play() {\n\t\t\n\t\t//this function (defined below) will continue to the next turn\n\t\tadvance();\n\t}", "function nextSong(){\n stopSong();\n songIndex= songIndex + 1;\n if(songIndex>songs.length-1){\n songIndex =0;\n }\n // songIndex>songs.length-1 ? songIndex = 0 : songIndex;\n loadSong(songs[songIndex]);\n playSong(songs[songIndex]);\n // console.log(songIdex);\n \n console.log(songs[sonIndex]);\n \n}", "function nextSong() {\r\n if (index_no < All_songs.length - 1) {\r\n index_no += 1;\r\n loadTrack(index_no);\r\n playSong();\r\n } else {\r\n index_no = 0;\r\n loadTrack(index_no);\r\n playSong();\r\n }\r\n}", "function playNext(i) {\n if ((currentSound + 1) == soundsCount) {\n soundManager.play('0');\n } else {\n soundManager.play((currentSound + 1).toString());\n }\n }", "function playNextSong() {\n currentSongIndex = (currentSongIndex + 1) % 2;\n songs[currentSongIndex].play();\n }", "function playWithoutDeleted_helper(full) {\n full = full || false;\n clearEvents2();\n if (editor.splitData && editor.splitData.splits) {\n var splitItem = getCurrentSplitItem();\n\n if (splitItem != null) {\n pauseVideo();\n\n var clipStartFrom = -1;\n var clipStartTo = -1;\n var segmentStart = splitItem.clipBegin;\n var segmentEnd = splitItem.clipEnd;\n var clipEndFrom = -1;\n var clipEndTo = -1;\n var hasPrevElem = true;\n var hasNextElem = true;\n var duration = getDuration();\n\n // check previous item to be played, get start time\n if ((splitItem.id - 1) >= 0) {\n hasPrevElem = true;\n if ((splitItem.id - 1) >= 0) {\n var prevSplitItem = editor.splitData.splits[splitItem.id - 1];\n while (!prevSplitItem.enabled) {\n if ((prevSplitItem.id - 1) < 0) {\n hasPrevElem = false;\n break;\n } else {\n prevSplitItem = editor.splitData.splits[prevSplitItem.id - 1];\n }\n }\n } else {\n hasPrevElem = false;\n }\n if (hasPrevElem) {\n clipStartTo = prevSplitItem.clipEnd;\n clipStartFrom = clipStartTo - prePostRoll;\n }\n }\n if (hasPrevElem) {\n clipStartFrom = (clipStartFrom < 0) ? 0 : clipStartFrom;\n }\n\n if (full) {\n if ((splitItem.id + 1) < editor.splitData.splits.length) {\n hasNextElem = true;\n var nextSplitItem = editor.splitData.splits[splitItem.id + 1];\n while (!nextSplitItem.enabled) {\n if ((nextSplitItem.id + 1) >= editor.splitData.splits.length) {\n hasNextElem = false;\n break;\n } else {\n nextSplitItem = editor.splitData.splits[nextSplitItem.id + 1];\n }\n }\n if (hasNextElem) {\n clipEndFrom = nextSplitItem.clipBegin;\n clipEndTo = clipEndFrom + prePostRoll;\n }\n }\n if (hasNextElem) {\n clipEndTo = (clipEndTo > duration) ? duration : clipEndTo;\n }\n } else {\n clipEndFrom = -1;\n clipEndTo = -1;\n var splBP2 = splitItem.clipBegin + prePostRoll;\n segmentEnd = (splBP2 <= splitItem.clipEnd) ? splBP2 : splitItem.clipEnd;\n segmentEnd = (segmentEnd > duration) ? duration : segmentEnd;\n }\n\n ocUtils.log(\"Play Times: \" +\n clipStartFrom + \" - \" +\n clipStartTo + \" | \" +\n segmentStart + \" - \" +\n segmentEnd + \" | \" +\n clipEndFrom + \" - \" +\n clipEndTo);\n\n if (hasPrevElem && ((full && hasNextElem) || !full)) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n }, (clipStartTo - clipStartFrom) * 1000);\n\n if (full) {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + (segmentEnd * 1000));\n }\n } else if (!hasPrevElem && hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n\n if (full) {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (segmentEnd * 1000));\n }\n } else if (hasPrevElem && !hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (clipStartTo - clipStartFrom) * 1000);\n } else if (!hasPrevElem && !hasNextElem) {\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n }\n }\n }\n}", "_playByIndex(index = 0) {\n if (index === this.length) {\n this.stop();\n this.onended && this.onended(this);\n return;\n }\n\n const playbackRate = this._audio.playbackRate;\n const currentChunk = this.chunks[index];\n this._loadAudio(index);\n if (index !== this.length - 1) {\n this._loadAudio(index + 1);\n }\n\n this._audio.src = currentChunk.audio.src;\n this._audio.play();\n this._audio.playbackRate = playbackRate;\n this._audio.onended = () => {\n this._playByIndex(index + 1)\n };\n\n this.index = index;\n }", "function stepBackward(){\n if(index === 0){\n index = playList.length - 1\n }else{\n index--\n }\n\n box.innerHTML = `Track ${index + 1} - ${playList[index]}${ext}`;\n audio.src = dir + playList[index] + ext;\n audio.play()\n }", "function nextSong(){\n songIndex++\n if(songIndex> songs.length-1)\n {\n songIndex=0\n }\n PickSong(songs[songIndex]);\n playSong()\n}", "function mycarousel_itemFirstInCallback(carousel, item, idx, state) {\r\n //alert(idx);\r\n //display('Item #' + idx + ' is now the first item');\r\n featureFirstIndex = idx;\r\n }", "function prevTrack() {\n if(track_index > 0) track_index -= 1;\n else track_index = track_list.length - 1;\n\n // Load and play the new track\n loadTrack(track_index);\n playTrack();\n}", "function next() {\n // Check for last media in the playlist\n if (current === files.length - 1) {\n current = 0;\n } else {\n current++;\n }\n\n // Change the audio element source\n playlistPlayer.src = files[current];\n}", "function playNext() {\n\n\t\tif (isPlayOne) return playStop();\n\n\t\tif (isShuffle) return playNextShuffled();\n\n\t\tvar curTrack = pls.querySelector('.selected');\n\t\tif (!curTrack) return play(pls.children[0]);\n\n\t\tif (isRepeat) return playAgain(curTrack);\n\n\t\tvar nextTrack = curTrack.nextElementSibling;\n\n\t\tif (nextTrack) {\n\t\t\tplay(nextTrack);\n\t\t} else {\n\t\t\tif (isContinuous) {\n\t\t\t\tplay(pls.children[0]);\n\t\t\t} else {\n\t\t\t\tif (Amplitude.getSongPlayedPercentage() === 100) {\n\t\t\t\t\tcurTrack.classList.remove('selected');\n\t\t\t\t\tfirePlayEnd();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function advanceToNextSong () {\n // Remove current song from the playlist\n self.playlist.pop();\n\n // Pick next song and play it\n if (self.playlist.size()) {\n var song = self.playlist.front();\n updateCurrentSong(song);\n }\n }", "function nextSong() {\n i++;\n if (i > songs.length - 1) {\n i = 0;\n }\n loadSong(songs[i]);\n playSong();\n}", "function prevSong(){\n i--;\n if(i < 0){\n i = songs.length - 1;\n }\n loadSong(songs[i]);\n playSong();\n}", "function nextSong()\r\n{\r\n songIndex = (songIndex + 1) % songs.length;\r\n loadSong(songs[songIndex]);\r\n playMusic();\r\n}", "playSong(position) {\n let played_song = this.songs[position];\n //return the song information to be played by the player\n //Update to everyone in the room\n\n //if position - this.position > 1, splice from original pos and put\n //into new position right after this.position,\n //go next\n\n if (position - this.position > 1)\n {\n this.songs.splice( position, 1);\n this.songs.splice( this.position + 1, 0 , played_song);\n this.next();\n }\n else if (position - this.position == 1)\n {\n this.next();\n }\n else if (position - this.position == -1)\n {\n this.prev();\n }\n //This means that loungeMaster is playing from music that are way before,\n //Thus add current song to history and add another copy of song in history\n //To song list\n else if (position - this.position <= -2)\n {\n this.songs.splice( this.position + 1, 0, played_song);\n this.next();\n }\n\n return played_song;\n }", "jump(itemIndex = 0){\n this._changeActive_keepPlayState(itemIndex);\n }", "playCurrentSong() {\n\t\t// If there isn't any audio available yet, play first song in queue\n\t\tconsole.log(\"Playing current song\")\n\t\tif (!app.audioObject) {\n\t\t\tif(app.playQueue && app.playQueue.length > 0) {\n\t\t\t\tthis.playSongAtQueueIndex(0);\n\t\t\t} else {\n\t\t\t\t// If we've got no queue, don't play anything\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tapp.audioObject.play();\n\t\t}\n\n\t\t// Tell Vue objects that the current song is being played\n\t\tapp.$emit(\"songPlaying\", true);\n\t}", "prev () {\n if (this._items.length < 2 || this._isMoving) {\n return\n }\n\n var currentIndex = this._items.indexOf(this._current);\n var prevIndex = this._items[currentIndex - 1] !== undefined \n ? currentIndex - 1 : this._items.length;\n this._to(prevIndex);\n }", "function nextSong() {\n checkPlayPause();\n if (playlist_index == (playlist.length - 1)) {\n playlist_index = 0;\n playAudio();\n }\n else {\n playlist_index++;\n playAudio();\n }\n}", "function nextTrack() {\n if(track_index < track_list.length -1) track_index += 1;\n else track_index = 0;\n\n // Load and play the new track\n loadTrack(track_index);\n playTrack();\n}", "function playSong() {\n let note = notes[currentNote];\n synth.play(note, 1, 0, 1);\n currentNote = currentNote + 1;\n if (currentNote === notes.length) {\n currentNote = 0;\n }\n}", "function prependItem() {\n var firstItem = carouselItems[0];\n var newItem = createCarouselObj(\n (firstItem.index + imgs.length - 1) % imgs.length,\n (parseInt(firstItem.item.style.left) - width));\n \n carouselItems.unshift(newItem);\n $('#carousel').prepend(newItem.item);\n}", "playItem(index, combinationPosition, location = 'computer') {\n\n const leds = (location == 'computer') ? startReactor.interface.computerLedPanel : startReactor.interface.playerLedPanel\n const memPanel = startReactor.interface.memoryPanel.children[index] //armazena a posição do objeto\n\n memPanel.classList.add(\"memoryActive\") // adiciona a classe no objeto, p/ acender a luz no container\n startReactor.interface.turnLedOn(combinationPosition, leds) //passa a combinação para ascender\n startReactor.audio.combinations[index].play().then(() => {\n setTimeout(() => {\n memPanel.classList.remove('memoryActive')\n }, 150)\n })\n }", "advanceCurrentItem() {\n this.itemCounter++;\n }", "function Play() {\n var Kick = setInterval(MyBeat, 500);\n var index = 0;\n var Beat = [\"assets/kick.mp3\", \"assets/snare.mp3\", \"assets/hihat.mp3\", \"assets/F.mp3\", \"assets/C.mp3\", \"assets/F.mp3\", \"assets/C.mp3\", \"assets/G.mp3\", \"assets/A.mp3\", \"assets/A.mp3\", \"assets/G.mp3\", \"assets/A.mp3\", \"assets/C.mp3\", \"assets/F.mp3\", \"assets/laugh-2.mp3\"];\n function MyBeat() {\n var sequence = new Audio(Beat[index]);\n sequence.play();\n index += 1;\n if (index >= 15)\n index = 0;\n console.log(Beat[index]);\n document.querySelector(\"#StoppButton\").addEventListener(\"mousedown\", stopBeat);\n function stopBeat() {\n clearInterval(Kick);\n }\n }\n ;\n}", "function start(pack, stack) {\n\tvar startingcard = pack[0]; // Haal startkaart uit de pot en sla deze op\n\tif (startingcard.card !== 0) { // Niet beginnen met een joker\n\t\tpack.splice(0, 1); // Haal de kaart uit de pot\n\t\tstack.push(startingcard); // Voeg de kaart toe aan de aflegstapel\n\t} else {\n\t\tshuffle(pack);\n\t\tstart(pack, stack);\n\t}\n\t\n}", "startMovement() {\n this.gridItems.forEach(item => item.start());\n }", "function previousSong() {\r\n if (index_no > 0) {\r\n index_no -= 1;\r\n loadTrack(index_no);\r\n playSong();\r\n } else {\r\n index_no = All_songs.length;\r\n loadTrack(index_no);\r\n playSong();\r\n }\r\n}", "function prevSnip() {\n if (mixSplits != null && mixSplits != undefined) {\n splitPointer--;\n if ((splitPointer < mixSplits.length) && (splitPointer >= 0)) {\n preview(mixSplits[splitPointer], mixSplits[splitPointer] + snipWin, function () {\n });\n } else {\n splitPointer++;\n }\n }\n}", "function nextMusic() {\n musicIndex++;\n musicIndex > allMusic.length ? (musicIndex = 1) : (musicIndex = musicIndex);\n loadMusic(musicIndex);\n playMusic();\n playingNow();\n}", "function slideLeft() {\n var parent = $(this).closest('.carousel');\n var items = $.makeArray(parent.find('.item:not(.hidden)'));\n if (items.length == 1) {\n //already at the end\n return;\n }\n var item = $(items.shift());\n item.animate({'margin-left': item.width()*-1, opacity: '0%'}, 'slow', 'linear', function() {\n item.addClass('hidden').removeClass('active')\n $(items.shift()).addClass('active');\n setIndicator(parent);\n });\n}", "prevSong() {\n\t\t// Check if queue exists, if not create it\n\t\tif (!app.playQueue) {\n\t\t\tapp.playQueue = new Deque();\n\t\t}\n\n\t\t// Move the index back\n\t\tapp.queueIndex--;\n\t\tif(app.queueIndex < 0) {\n\t\t\tapp.queueIndex = 0;\n\t\t}\n\n\t\t// Update Vue components that queue index changed\n\t\t//app.$emit(\"updatePlayQueueIndex\", app.queueIndex);\n\n\t\t// Play whatever song is at that index\n\t\tthis.playSongAtQueueIndex(app.queueIndex);\n\t}", "incrementIndex() {\n this.currentIndex = this.frames.length === this.currentIndex + 1 ? 0 : this.currentIndex + 1;\n }", "start() {\n this.current = this.nextByte()\n this.position = 1\n }", "prepend(item) {\n }", "playsong_state({ commit }, info) {\n commit(\"startcurrentaudio\", info);\n }", "playRandom()\n\t{\n\t\tif(this.currentPlaylist)\n\t\t\tthis.play(this.currentPlaylist[Math.floor(Math.random() * this.currentPlaylist.length)]);\n\t\telse\n\t\t\tthis.play(Math.floor(Math.random() * this.tracks.length));\n\t}", "_onPlayPauze() {\n if (!this.howl) {\n this._playSong(this.props.songs[0]);\n } else {\n this.state.playing ? this.howl.pause() : this.howl.play()\n this.setState({playing: !this.state.playing})\n }\n }", "_changeActive_keepPlayState(itemIndex){\n if(this._isPlaying){\n this.pause();\n this._changeActive(itemIndex);\n this.play();\n }\n else{\n this._changeActive(itemIndex);\n }\n }", "function prevSong() {\r\n if (shuffle) {\r\n if (shuffleIndex > 0) {\r\n shuffleIndex--;\r\n streamSong(songs[shuffled[shuffleIndex]]);\r\n log (\r\n \"Shuffle Index: \" + shuffleIndex\r\n + \" --song-> \" + shuffled[shuffleIndex]);\r\n \r\n } else if (shuffleIndex <= 0 && repeat) {\r\n shuffleIndex = shuffled.length - 1;\r\n streamSong(songs[shuffled[shuffled.length - 1]]);\r\n log (\r\n \"Shuffle Index: \" + shuffleIndex\r\n + \" --song-> \" + shuffled[shuffleIndex]);\r\n }\r\n } else {\r\n if (playlistIndex > 0) {\r\n streamSong(songs[playlistIndex-1]);\r\n log (\"Playlist Index: \" + (playlistIndex));\r\n } else if (playlistIndex <= 0 && repeat) {\r\n streamSong(songs[songs.length-1]);\r\n log (\"Playlist Index: \" + (playlistIndex));\r\n }\r\n }\r\n }", "play() {\r\n\t\tthis.startedPlayingAt = Date.now();\r\n\t\tthis.shouldStopPlayingAt = this.startedPlayingAt + this.duration;\r\n\t}", "function nextItem() {\n\t\tstopSlideshow();\n\t\tchangeItem(current + 1);\n\t}", "function playNextTrack() {\n\tif (currentIndex == currentTracks.length) {\n\t\t// TODO: change this\n\t\talert(\"No more songs in current tracks\");\n\t}\n\n\tif (curSound != null) {\n\t\tcurSound.destruct();\n\t}\n\n\tvar id = currentTracks[currentIndex].id;\n\tvar title = currentTracks[currentIndex].title;\n\tcurrentIndex++;\n\n\tconsole.log(\"ID: \".concat(id, \" Title: \", title));\n\tSC.stream(\"/tracks/\".concat(id), {onfinish: playNextTrack}, function(sound) {\n\t\tconsole.log(sound);\n\t\tcurSound = sound;\n\t\tsound.play();\n\t});\n}", "next() {\n const { songFile, upNext, previousPlays, songs, repeat, shuffle } = this.state;\n // stop current song with timestampId\n songFile.pause();\n clearInterval(this.timestampID);\n // check if repeating that song\n if (repeat === 'Song') {\n songFile.currentTime = 0;\n this.setState({ timestamp: 0 });\n } else {\n // 1) Splice first song in upNext and push to previousPlays\n previousPlays.push(upNext.shift());\n // 2) If both upNext and songs are empty, call mount to reset state: songs, upnext songfile\n if (upNext.length === 0 && songs.length === 0) {\n this.mount();\n } else {\n // 3) If upNext is empty and set to shuffle, grab a random song to push to upNext\n // 4) Else if upNext is just empty, splice first song in songs and push to upNext\n if (upNext.length === 0 && shuffle === '-alt') {\n const randomIndex = Math.floor(Math.random() * songs.length);\n const randomSong = songs.splice(randomIndex, 1)[0];\n upNext.push(randomSong);\n } else if (upNext.length === 0) {\n upNext.push(songs.shift());\n } \n // Either way, set state: songs, upNext, previousPlays, *new* songFile, timestamp 0\n this.setState({\n upNext,\n previousPlays,\n songs,\n timestamp: 0,\n songFile: new Audio(upNext[0].songFile),\n });\n }\n }\n }", "beginFrame() {\n this.itemsLeft = this.maxItemsPerFrame;\n }", "function prev(){\n // If on first item go to end, otherwise go to previous item\n if ( currentItem - 1 < 0 ){\n currentItem = carouselItems.length - 1;\n } else {\n currentItem--;\n }\n updateCarousel();\n }", "function prevMusic() {\n musicIndex--;\n musicIndex < 1 ? (musicIndex = allMusic.length) : (musicIndex = musicIndex);\n loadMusic(musicIndex);\n playMusic();\n playingNow();\n}", "stepForward() {\n this.player_.volume(this.player_.volume() + 0.1);\n }", "playSlice(time) { \n this.player.start(0, this.loopStartPoint);\n\n this.slice.interval = this.loopLength;\n }", "function startPipeline() {\n // In this way we read one block while we decode and play another.\n if (state.state == STATE.PLAYING) {\n processState();\n }\n processState();\n }", "consume() {\n this.pos++;\n }", "function playNext() {\n var playlist = document.getElementById('playlist_table');\n \n // Get the current playing titleData\n var selected = playlist.querySelector(\"tr.selected\");\n \n if (selected && selected.nextSibling) {\n // Play the next item in the table\n playItem(selected.nextSibling);\n } else if (selected && !selected.nextSibling) {\n // No more items in the table, play the first one\n var playlist = document.getElementById('playlist_table');\n playItem(playlist.childNodes[0]);\n }\n}", "function rewind() {\n if (play) {\n //if you are on the 11th word or more go back 10\n if (count > 10) {\n count -= 10;\n }\n //if you are more than 2 words in and less than 10 words in\n //go back 2 words\n else if (count > 2 && count < 10) {\n count -= 2;\n }\n }\n}", "function startSeek(){\n seek.max = songDuration\n timeLeft = songDuration\n intervalTime = 1000\n setInterval(function(){\n if(!seeking){\n // Updating seek value\n seek.value = audio.currentTime\n }\n // Playing next file if the current song has ended\n if(audio.ended && songIndex < songQueue.length){\n songIndex++\n if(songIndex === songQueue.length && repeat === 1){\n songIndex = 0\n }\n else if(repeat === 2){\n songIndex = songIndex - 1\n }\n if(songIndex < songQueue.length){\n playFile(songQueue[songIndex])\n }\n }\n }, intervalTime)\n}", "function prevItem() {\r\n hideItems();\r\n currentIndex = currentIndex > 0 ? currentIndex - 1 : slidesLength - 1;\r\n updateIndexes();\r\n showItems();\r\n }", "function switchTrack(){\n if(audio.paused){\n player.innerHTML = hdlPause;\n audio.currentTime = 0;\n }else if(index === (playList.length - 1)){\n index = 0\n }else {\n index++\n }\n\n box.innerHTML = `Track ${index + 1} - ${playList[index]}${ext}`;\n audio.src = dir + playList[index] + ext;\n audio.play()\n }", "function prevMusic() {\n if( audio.currentTime > 3 ) audio.currentTime = 0\n else startMusic-- \n\n if( startMusic < 0 ) startMusic = musicList.length - 1\n loadMusic( musicList[startMusic] )\n playMusic()\n}", "function playEnding() {\n var splitItem = getCurrentSplitItem();\n if (splitItem != null) {\n pauseVideo();\n var clipEnd = splitItem.clipEnd;\n setCurrentTime(clipEnd - 2);\n\n clearEvents();\n editor.player.on(\"play\", {\n duration: 2000,\n endTime: clipEnd\n }, onPlay);\n playVideo();\n }\n}", "function firstPlayTick(context)\n {\n for (var index in all_players_list)\n {\n if (all_players_list[index])\n {\n all_players_list[index].points = 0;\n all_players_list[index].incomplete_round = false;\n }\n }\n\n round_in_progress = true;\n app.io.broadcast('round_started', (SECS_IN_COMPLETE_CYCLE - SECS_IN_LOBBY));\n logNow('BROADCAST: round_started -- firstPlayTick() timer callback');\n\n playTick(context);\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 }", "tick () {\n this.lookAhead();\n // here we need to look ahead a small ? amount of time and schedule the next few sounds\n this.time = this.audioContext.currentTime;\n this.position = this.time - this.barStartTime;\n if (this.position > this.secondsPerBar) {\n // start a new bar\n this.position = this.position - this.secondsPerBar;\n this.barStartTime = this.time - this.position;\n }\n //console.log(this.time, this.position, this.secondsPerBar);\n this.to = setTimeout(this.tick.bind(this), 10);\n }", "setupFirstPlay() {\n let seekable;\n let media = this.masterPlaylistLoader_.media();\n\n // check that everything is ready to begin buffering\n // 1) the active media playlist is available\n if (media &&\n // 2) the video is a live stream\n !media.endList &&\n\n // 3) the player is not paused\n !this.tech_.paused() &&\n\n // 4) the player has not started playing\n !this.hasPlayed_) {\n\n this.load();\n\n // trigger the playlist loader to start \"expired time\"-tracking\n this.masterPlaylistLoader_.trigger('firstplay');\n this.hasPlayed_ = true;\n\n // seek to the latest media position for live videos\n seekable = this.seekable();\n if (seekable.length) {\n this.tech_.setCurrentTime(seekable.end(0));\n }\n\n return true;\n }\n return false;\n }", "function playStartLine(e) {\n if (trjs.param.isContinuousPlaying === true) {\n endContinuousPlay();\n return;\n }\n setMedia();\n // console.log(\"pause playStartLine\");\n media.pause();\n var sel = trjs.data.selectedLine;\n sel = trjs.events.findLineToStart(sel);\n if (sel == null) return;\n var ts = trjs.events.lineGetCell(sel, trjs.data.TSCOL);\n if (ts !== '') media.currentTime = ts;\n// not necessary: \ttrjs.events.goToTime('wave');\n setTimer('standard');\n media.play();\n }", "beginFrame()\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }", "function getCurrentSplitItem() {\n if (editor.splitData && editor.splitData.splits) {\n var currentTime = getCurrentTime();\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n var splitItem = editor.splitData.splits[i];\n if ((splitItem.clipBegin <= (currentTime + 0.1)) && (currentTime < (splitItem.clipEnd - 1))) {\n splitItem.id = i;\n return splitItem;\n }\n }\n }\n return currSplitItem;\n}", "play() {\n\t\tlet oCurrentTitle = {},\n\t\t\tiRandomTitleIndex = 0;\n\n\t\tif (this._aPlaylist.length > 0) {\n\t\t\t//Prevent event from being registered twice\n\t\t\tthis._oConnection.removeAllListeners(\"end\");\n\t\t\tthis._oConnection.end();\n\n\t\t\tif (this._bShuffleMode && !this._bOverrideShuffleMode) {\n\t\t\t\tiRandomTitleIndex = Math.floor(Math.random() * this._aPlaylist.length);\n\t\t\t\toCurrentTitle = this.removeTitle(iRandomTitleIndex);\n\t\t\t} else {\n\t\t\t\toCurrentTitle = this._aPlaylist.shift();\n\t\t\t\tthis._bOverrideShuffleMode = false;\n\t\t\t}\n\n\t\t\tthis._sCurrentTitleUrl = oCurrentTitle.url;\n\t\t\tthis._sCurrentTitleName = oCurrentTitle.name;\n\t\t\tthis._oClient.setPresence(oCurrentTitle.name);\n\n\t\t\tthis._oConnection.play(ytDownload(this._sCurrentTitleUrl, {\n\t\t\t\tquality: \"highest\",\n\t\t\t\thighWaterMark: ONE_MEGABYTE\n\t\t\t}));\n\n\t\t\tif (!this._bErrorEventAttached) {\n\t\t\t\tthis._attachErrorEvent();\n\t\t\t}\n\n\t\t\t//Plays the next title when the previous one ended\n\t\t\tthis._oConnection.onEvent(\"end\", this.play.bind(this));\n\t\t} else {\n\t\t\tthis._sCurrentTitleUrl = \"\";\n\t\t\tthis._sCurrentTitleName = \"\";\n\t\t\tthis._oClient.setPresence(\"\");\n\t\t}\n\n\t\tif (this._bAutoplay && this._aPlaylist.length === 0) {\n\t\t\tthis._autoplayAddTitle();\n\t\t}\n\t}", "play(){this.__stopped=!0;this.toggleAnimation()}", "function next(){\n // If on last item go back to start, otherwise go to next item\n if ( currentItem + 1 >= carouselItems.length ){\n currentItem = 0;\n } else {\n currentItem++;\n }\n updateCarousel();\n }", "_moveLeft() {\n if (this._currentPosition < 2 && this._settings.infinity) {\n this._moveLeftInfinity();\n return;\n }\n for (let moved = 0; moved < this._settings.moveCount; moved++) {\n if (this._currentPosition < 1) break;\n\n this._itemsHolder.style.transition = `transform ${ this._settings.movementSmooth }ms`;\n\n const targetItem = this._items[this._currentPosition - 1];\n this._offset += targetItem.offsetWidth + this._settings.slidesSpacing;\n\n this._itemsHolder.style.transform = `translateX(${ this._offset + this._calcTowardsLeft() }px)`;\n\n this._currentPosition -= 1;\n }\n this._adaptViewWrapSizes();\n this._setDisplayedItemsClasses();\n }", "function next_song() {\n if ($('li.queue').length > 1){\n move_to_history()\n loadVideo()\n load_audio()\n }\n}", "function previous_song(){\n\t\tif (playlist_index === 0){\n\t\t\t$('#my_playlist li').last().addClass('active');\n\t\t\t$('#my_playlist li').first().removeClass('active');\n\t\t\tplaylist_index = playlist.length - 1;\n\t\t}else{\n\t\t\t$('#my_playlist li.active').prev().addClass('active');\n\t\t\t$('#my_playlist li.active').last().removeClass('active');\n\t\t\tplaylist_index--;\n\t\t}\n\n\t\t//Update the current song, and play it after switching songs.\n\t\ttrack_info.innerHTML = playlist[playlist_index].artist+' - '+playlist[playlist_index].title;\n\t\taudio.src = dir+playlist[playlist_index].track;\n\t\taudio.play();\n\t}", "function trackNext() {\n var i = queueIdx + 1;\n if (i < queue.length) {\n queueIdxChange(i);\n console.log(\"next track\");\n }\n else {\n console.log(\"no more songs in queue\");\n\n // TODO: Restart if 'repeat queue'\n if (queue.length > 1) {\n // Goto start of queue if more than 1 song\n queueIdxChange(0);\n }\n else {\n // TODO: REPLAY IF THE REPLAY/LOOP OPTION IS SELECTED!!! -------------------\n // For now just stop the only song\n audio.currentTime = 0;\n audioPause();\n }\n }\n}" ]
[ "0.6571789", "0.64713156", "0.6469307", "0.6348793", "0.611338", "0.60931295", "0.6075757", "0.6060013", "0.60393137", "0.60245425", "0.6014614", "0.5991558", "0.59887254", "0.59524554", "0.5933211", "0.5931323", "0.5924069", "0.592249", "0.5922396", "0.59212923", "0.588047", "0.5868859", "0.5864918", "0.5833979", "0.58326507", "0.58312076", "0.58287024", "0.58088756", "0.5799949", "0.5798118", "0.57849133", "0.5776022", "0.5753207", "0.57489395", "0.5747504", "0.5739483", "0.57391864", "0.57250476", "0.57194203", "0.57056105", "0.56969815", "0.56741583", "0.5646552", "0.5644859", "0.56409466", "0.5635038", "0.56342715", "0.563093", "0.56295943", "0.5626474", "0.56249976", "0.56238276", "0.56229424", "0.56165814", "0.5614196", "0.560604", "0.5598413", "0.55980533", "0.55895406", "0.557782", "0.5576279", "0.55482614", "0.5548257", "0.55349165", "0.55285686", "0.5525602", "0.5522401", "0.55147856", "0.5506671", "0.55051005", "0.5499948", "0.5498616", "0.5496681", "0.5496045", "0.54948837", "0.54934484", "0.54927737", "0.5489073", "0.5487774", "0.54682904", "0.54558986", "0.545304", "0.5447097", "0.5443315", "0.5442311", "0.5434911", "0.54333884", "0.5430383", "0.54294133", "0.5418714", "0.5401753", "0.53916836", "0.5387796", "0.5382544", "0.53763294", "0.5373483", "0.5366732", "0.536221", "0.53610086", "0.53605396" ]
0.7102445
0
play last 2 seconds of the current segment
function playEnding() { var splitItem = getCurrentSplitItem(); if (splitItem != null) { pauseVideo(); var clipEnd = splitItem.clipEnd; setCurrentTime(clipEnd - 2); clearEvents(); editor.player.on("play", { duration: 2000, endTime: clipEnd }, onPlay); playVideo(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playOneSegment(videoSrc, inPoint, outPoint) {\n video.src = videoSrc\n video.load\n video.currentTime = inPoint\n video.play()\n video.ontimeupdate = function () {\n stopAtOutPoint()\n }\n counter += 1\n }", "function playBack() {\n setTimeout(function () {\n if (sequenceIndex < currentRound) {\n visualise(programSequence[sequenceIndex]);\n $feedback.addClass('hidden');\n $feedback.html(currentPlayer);\n // console.log(programSequence[sequenceIndex].audio);\n playBack();\n sequenceIndex++;\n } else {\n sequenceIndex = 0;\n $document.keypress(keyListener);\n }\n }, 1000);\n }", "playSlice(time) { \n this.player.start(0, this.loopStartPoint);\n\n this.slice.interval = this.loopLength;\n }", "play() {\n this.timeline.play();\n }", "play() {\n\t\tif (this.getCurrentSong() != null) {\n\n\t\t\t/**\n\t\t\t * factor base del tiempo\n\t\t\t */\n\t\t\tlet seconds = 1.5;\n\n\t\t\t/**\n\t\t\t * funciones asincrona que hace las operaciones\n\t\t\t */\n\t\t\tlet timmer = setInterval(() => {\n\t\t\t\t/**\n\t\t\t\t * segundo actual de la cancion\n\t\t\t\t */\n\t\t\t\tlet currentSecond = this.getCurrentSong().currentSecond;\n\t\t\t\t/**\n\t\t\t\t * Duracion total de la cancion en segundos\n\t\t\t\t */\n\t\t\t\tlet duration = this.getCurrentSong().duration;\n\n\t\t\t\t/**\n\t\t\t\t * Nos indica si la cancion sigue en curso o ya termino\n\t\t\t\t */\n\t\t\t\tif (currentSecond < duration) {\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Objeto a enviar, obitene la hora actual para\n\t\t\t\t\t * calcular una latencia y el segundo actual de la cancion.\n\t\t\t\t\t */\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\tsendTime: (new Date).getTime(),\n\t\t\t\t\t\tsong: this.getCurrentSong()\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.reproductorConfig.play(data);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Actualizamos los segundos actuales de la cancion.\n\t\t\t\t\t */\n\t\t\t\t\tlet song = this.getCurrentSong();\n\t\t\t\t\tsong.currentSecond += seconds;\n\t\t\t\t\tthis.setCurrentSong(song);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t/**\n\t\t\t\t\t * Limpia La funcion.\n\t\t\t\t\t */\n\t\t\t\t\tclearInterval(timmer);\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Selecciona la cancion que sigue.\n\t\t\t\t\t */\n\t\t\t\t\tthis.finishSong();\n\t\t\t\t\tconsole.log('next song please !!');\n\t\t\t\t}\n\t\t\t}, seconds * 1000);\n\t\t}\n\t}", "if (inited && playInited) {\r\n lastCurTime = player.currentTime;\r\n }", "function _play()\n {\n timeout_handle = requestAnimationFrame(function(timestamp) {\n update(timestamp);\n interpolate(timestamp);\n draw();\n \n if (currentIndexPosition == _fileLength()-1)\n {\n _pause();\n }\n _play();\n });\n }", "play() {\n\t\tif (this._isActive && this._isPause) {\n\t\t\tthis.pause(false)\n\t\t} else {\n\t\t\tthis._isPause = false;\n\t\t\tthis._isActive = true;\n\n\t\t\tthis._age = 0;\n\t\t\tthis._zIndex = 0;\n\t\t\tthis.emission.reset();\n\n\t\t\tif (this.life.isLoop && this.life.isPrewarm) {\n\t\t\t\tconst step = 1 / 60;\n\t\t\t\tfor (let i = 0; i < this.life.duration; i += step) {\n\t\t\t\t\tthis.update(step);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function retroceder() {\n\n video.currentTime -= 10;\n console.log(video.currentTime)\n}", "function ucatMediaJumpToTime(mediaId, newTime, playAfter)\r\n{\r\n if (!getCurrentPlayer(mediaId))\r\n {\r\n setCurrentPlayer(mediaId);\r\n }\r\n currentPlayer.mediaTag.currentTime = newTime;\r\n if (playAfter)\r\n ucatMediaPlay(mediaId);\r\n else\r\n playerInterval(true);//run once to update display and stop\r\n}", "play() {\r\n\t\tthis.startedPlayingAt = Date.now();\r\n\t\tthis.shouldStopPlayingAt = this.startedPlayingAt + this.duration;\r\n\t}", "function piloteVideo2() {\r\n\t\tif (LCCMA.paused) {\r\n\t\t\tLCCMA.play();\r\n \r\n\t\t} else {\r\n\t\t\tLCCMA.pause();}\r\n }", "function skipForward10Sec()\r\n\t{\r\n\t\tmyVideo.currentTime = myVideo.currentTime + 10; //the playback time increases by ten second\r\n\t}", "function stopSong(){\n activeSong.currentTime = 0;\n activeSong.pause();\n}", "function whistleButton(){\n var whistleSound= document.getElementById(\"whistle\");\n whistleSound.currentTime=0;\n whistleSound.play();\n console.log(whistleSound.currentTime);\n }", "function SeekTrackDown(num_track)\r\n{\t\r\n try\r\n {\r\n let actual = document.getElementById('soundTrack'+num_track).currentTime;\r\n actual -= 2;\r\n if (actual < 0){\r\n actual = 0;\r\n }\r\n document.getElementById('soundTrack'+num_track).currentTime = actual;\r\n }\r\n catch(err)\r\n {\r\n DebugLog(err.message.toString());\r\n }\r\n}", "function sliderAvancement(time) {\n var seconds = player.duration * (time / 100);\n player.currentTime = seconds;\n if (player.paused) {\n player.play();\n }\n}", "function handleBackward(){\n audio.currentTime -= 3\n }", "function play() {\n\n verovioToolkit.loadData(mei); // this is rendundant with\n verovioToolkit.renderToMidi(); // line 137 & 141\n\n let maxDuration = viewManager.getDuration();\n\n startTime = (new Date().valueOf()) - pauseTimePassed;\n\n function updateTicker() {\n\n let timePassed = (new Date().valueOf()) - startTime;\n\n // If time has passed the duration of the longest audio\n // clip, then rewind and stop\n\n if (timePassed < maxDuration) {\n viewManager.update(timePassed);\n } else {\n reset();\n }\n }\n\n timerId = setInterval(updateTicker, VIZ_REFRESH_INTERVAL);\n }", "function playCurrentSplitItem() {\n var splitItem = getCurrentSplitItem();\n if (splitItem != null) {\n pauseVideo();\n var duration = (splitItem.clipEnd - splitItem.clipBegin) * 1000;\n setCurrentTime(splitItem.clipBegin);\n\n clearEvents();\n editor.player.on(\"play\", {\n duration: duration,\n endTime: splitItem.clipEnd\n }, onPlay);\n playVideo();\n }\n}", "function updateStartTime(){\n if(mode == \"play\"){\n startTime = millis();\n }\n}", "function timer(){\n\t\tsetInterval(function(){\n\t\t\tvar sec_curr = Math.floor(vid.currentTime);\n\t\t\tvar zero_curr = \"\";\n\t\t\tif((sec_curr % 60) < 10){\n\t\t\t\tzero_curr = \"0\";\n\t\t\t} else{\n\t\t\t\tzero_curr = \"\";\n\t\t\t}\n\t\t\tvar current_time = Math.floor(sec_curr / 60) + \":\" + zero_curr + (sec_curr % 60);\n\t\t\t$('#curr_time').text(current_time);\n\t\t\t$('progress').attr('value', sec_curr);\n\t\t}, 1000);\n\t}", "function playSection(x, y) {\n\tvid.currentTime = x;\n\tstopTime = y;\n\tstate = 1;\n\tvid.play(); // autoplay\n}", "function btnComenzar() {\n vid.currentTime = 0;\n vid.play();\n}", "function updateTimer(){\n if (pomo.isPaused) return;\n\n seconds -= 1;\n pomo.timerDisplay.innerHTML = makeSecondsReadable(seconds);\n\n if(seconds<=0) { //if timer is done then 'ding' and set timer to next interval\n console.log(\"play()\")\n pomo.isWork()? document.querySelector(\".tom\").play() : document.querySelector(\".tink\").play();\n setTimer() ;\n }\n }", "function play_time_is_over() {\n let sound = document.getElementById('end_sound');\n sound.play();\n}", "function repeater(start, stop) {\r\n\tlet vid = document.getElementsByTagName('video');\r\n\tvar vid_curr = vid[0].currentTime;\r\n\tconsole.log()\r\n\tif(vid[0].currentTime >= stop)\r\n\t\tvid[0].currentTime = start;\r\n\telse if(vid[0].currentTime < start)\r\n\t\tvid[0].currentTime = start;\r\n}", "function onCurrentTimeInterval() {\n let duration = (Tocadiscos.mostrarTiempoGeneral == 1) ? getSecondsTime(Tocadiscos.valorTiempoGeneral) : player.duration;\n\n if(Tocadiscos.reproductorTipo !== ReproductorTipo.Stream) {\n currentTime = (Tocadiscos.mostrarTiempoGeneral == 1) ? acumulateTime + player.currentTime : player.currentTime;\n }else{\n currentTime++;\n }\n\n if(Tocadiscos.reproductorTipo === ReproductorTipo.Stream){\n if(currentTime >= duration){\n updateIndicators(duration, duration);\n \n setTimeout(() => onClickBtnStop(), 500);\n\n setTimeout(() => { setSource(Tocadiscos.url).then(() => player.play()) }, 1500);\n }\n }\n \n //currentTime++;\n //console.log(currentTime, player.currentTime);\n if(currentTime < duration) {\n //currentTime++;\n updateIndicators(currentTime, duration);\n }\n}", "function updateSample2() {\n playing = false;\n setUpdatingState();\n player.stop();\n setTimeout(() => {\n generateSample(z => {\n z2 = z;\n generateProgressions(setStoppedState);\n });\n }, 0);\n}", "play(){this.__stopped=!0;this.toggleAnimation()}", "function longMoment(){\n console.log(\"moment\");\n\n $('audio#bgm')[0].play();\n\n}", "play()\n {\n\n }", "function blast(){\n $('#cannon')[0].play();\n}", "function goToTime(t) {\n //console.log('goto', t);\n if (t == -2) {\n window.close();\n return;\n } else if (t == -1) {\n t = game.start;\n }\n player.seekTo(t, true);\n player.playVideo();\n nextTimePoint = getNext(t);\n}", "play(){\n\n\n }", "function goToTime(loc) {\n\t//Calculate seconds\n\tvar time = calcTime(loc);\n\t//Jump to time\n\tPopcorn(\"#video\").currentTime(time);\n\tPopcorn(\"#video\").play();\n}", "start(){\n timeline.play();\n }", "play() {\n console.log('play')\n\n this.timer = setInterval(this.next, this.options.autoplaySpeed);\n }", "pause(ms) {\n let p;\n\n p = Math.floor((ms * this.frequency)/1000.0);\n this.play(p);\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 playback(t)\n{\n\tfor ( track = 0; track < new_song.tracks; track ++)\n\t{\n\t\tvar play = new_song.getCurrentBeatTimePlayback(t, track);\n\t\tif ( play == 1)\n\t\t{\n\t\t\tplaySound(track);\n\t\t}\n\t}\n}", "function checkAndUpdate() {\n\t\tconsole.log('playing video'+vm_playingVideoId);\n\t\tvar video = document.getElementById(vm_playingVideoId);\n\t\tconsole.log(currentClip[\"end\"]);\n\t\tif(video.currentTime > currentClip[\"end\"]) {\n\t\t\n\t\t\tif(i < intervals.length-1) {\n\t\t\t\ti = i+1;\n\t\t\t\tcurrentClip = intervals[i];\t\t\t\n\t\t\t\tstartTime = currentClip[\"start\"];\n\t\t\t\tvideo.currentTime = startTime;\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\tvideo.pause();\n\t\t\t}\n\t\t}\n\t}", "function thumbNowPlaying() {\n var offset = $(curTarget).offset();\n if (thumbTimeout) {\n clearInterval(thumbTimeout);\n }\n $(video_thumb).css(offset);\n //console.log(\"Moving video to \" + offset);\n $(video_thumb).show();\n thumbTimeout = setInterval(thumbShotTrigger, (extractTime(segment_list[cur_segment].end) - extractTime(segment_list[cur_segment].begin)) * 1000);\n video_thumb.removeEventListener(\"playing\", thumbNowPlaying);\n }", "function skipBackward30Sec()\r\n\t{\r\n\t\tmyVideo.currentTime = myVideo.currentTime - 30; //the playback time decreases by 30 seconds\r\n\t}", "function timeupdate() {\n var lastBuffered = video.buffered.end(video.buffered.length-1);\n seekbar.min = video.startTime;\n seekbar.max = lastBuffered;\n seekbar.value = video.currentTime;\n $('#timer').html(formatTime(video.currentTime));\n if(review == true)\n {\n\t sk.min = video.startTime;\n\t sk.max = lastBuffered;\n\t sk.value = video.currentTime;\n\t reviewText();\n }\n}", "tick () {\n this.lookAhead();\n // here we need to look ahead a small ? amount of time and schedule the next few sounds\n this.time = this.audioContext.currentTime;\n this.position = this.time - this.barStartTime;\n if (this.position > this.secondsPerBar) {\n // start a new bar\n this.position = this.position - this.secondsPerBar;\n this.barStartTime = this.time - this.position;\n }\n //console.log(this.time, this.position, this.secondsPerBar);\n this.to = setTimeout(this.tick.bind(this), 10);\n }", "function restartSong() {\n\taid.currentTime = 0;\n}", "play() {\n const delay = this.props.delay || 6000;\n const interval = setInterval(() => {\n this.nextItem();\n }, delay);\n this.interval = interval;\n this.setState({ playing: true });\n }", "function updateTime() {\n var video = document.getElementById(\"video\");\n var i = this.getAttribute(\"id\");\n var clickedCaption = captions[i];\n video.currentTime = clickedCaption.startTime;\n }", "function onPlayerReady() {\r\n player.playVideo();\r\n /*let time = player.getCurrentTime();\r\n if(player.stopVideo()){\r\n let time2 = player.getCurrentTime();\r\n \r\n player.playVideo(time2);\r\n }*/\r\n \r\n }", "prev() {\n console.log('radDemo: prev()');\n const currentTime = this.media.currentTime;\n\n let pausePoints = this.playlist[ this.state.currentPlaylistItem ].pausePoints.slice().reverse();\n\n let prevPausePoint = 0;\n\n for(let i=0; i<pausePoints.length; i++) {\n if( currentTime > (pausePoints[i] + 0.15) ) {\n prevPausePoint = pausePoints[i];\n break;\n }\n }\n\n this.media.currentTime = prevPausePoint;\n }", "function onPlaybackUpdate(time, duration) {\n}", "function goToTimeDuration(id_video, time) {\n $(\".img_play_video\").hide();\n var vid = document.getElementById(id_video);\n vid.currentTime = time;\n vid.play();\n}", "function restart()\n{\n\tsetTimeout(function ()\n\t{\n\t\tmuziek.currentTime = 1; muziek.play(); restart();\n\t}, (muziek.duration - 1) * 1000);\n}", "timer2()\n {\n timer2 = setInterval(() => {\n console.log(\"time B \" + seconds2);\n seconds2--;\n if (seconds2 < 0) {\n redBugLoop.destroy();\n clearInterval(timer2);\n this.moveToNextScene();\n\n }\n }, 10000);\n }", "function fastForwardVideo() {\n var fastForward = player.getCurrentTime();\n var add15Seconds = fastForward + 15;\n player.seekTo(add15Seconds);\n }", "function playnext(){\n document.getElementById(\"vtc\").innerHTML = \"Overclock your CPU with BIOS\";\n video.autoplay=\"autoplay\"; //autopaly second video after video1 fingished \n video.src=\"video/p2.mp4\"; //play second video\n }", "if (\n this.state.current_playlist.length > 0 &&\n prevState.next_id !== this.state.next_id &&\n this.state.next_id != null\n ) {\n let next_id = this.state.next_id;\n setTimeout(() => {\n if (next_id !== this.state.next_id) {\n return;\n }\n let next_audio =\n this.state.active_audio === \"audio\" ? \"audio2\" : \"audio\";\n let audio = document.getElementById(next_audio);\n audio.pause();\n audio.src =\n \"http://stella.test/api/song/\" +\n this.state.next_id +\n \"/audio?bitrate=320&remove_metadata=1\";\n audio.load();\n }, 1000);\n }", "function trackplaybackstarted(){\n printNowPlaying();\n}", "function playStop() {\n\n\t\tif (Amplitude.getSongPlayedPercentage()) {\n\t\t\tAmplitude.setSongPlayedPercentage(0);\n\t\t\tAmplitude.pause();\n\t\t}\n\n\t\tif (isRefreshDivs) clearDivs([options.mainArtist, options.mainSong]);\n\n\t\tif (isShuffle) setPlsShuffled();\n\n\t}", "function endPlay() {\n\n}", "function onPlaybackTimeChange(ms) {\n timeline.setCustomTime(new Date(ms));\n }", "function updateCurrentTime() {\n var song = document.querySelector('audio');\n // console.log(\"play 1\");\n $('.time-elapsed').text(fancyTimeFormat(Math.floor(song.currentTime)));\n $('.song-duration').text(fancyTimeFormat(Math.floor(song.duration)));\n // console.log(song.currentTime);\n // console.log(song.duration);\n if(song.duration==song.currentTime)//play the next song if previous song is over\n nextSong();\n}", "function rewind() {\n target = this.classList[1] - 1;\n\n shownMedia[target].currentTime -= 5;\n }", "function onPlay(evt) {\n if (timeout1 == null) {\n currEvt = evt;\n timeout1 = window.setTimeout(onTimeout, evt.data.duration);\n }\n}", "play () {\n if (!this.current) {\n this.start()\n }\n\n if (this.list[this.current.index].videoDuration === 0) {\n return this.next()\n }\n\n this.update()\n }", "function onPlaybackTimeChange (ms) {\n timeline.setCustomTime(new Date(ms));\n }", "function playNextShuffled() {\n\n\t\tif (plsShuffledIndex < (plsShuffled.length - 1)) {\n\t\t\tplsShuffledIndex += 1;\n\t\t\tplay(plsShuffled[plsShuffledIndex]);\n\t\t} else {\n\t\t\tif (isContinuous) {\n\t\t\t\tsetPlsShuffled();\n\t\t\t\tplay(plsShuffled[0]);\n\t\t\t} else {\n\t\t\t\tif (Amplitude.getSongPlayedPercentage() === 100) {\n\t\t\t\t\tcurTrack.classList.remove('selected');\n\t\t\t\t\tfirePlayEnd();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function playPreviousVideo() {\n \tsocket.emit('playPreviousVideo', {myroom: myRoom, controlkey: getControlHash(), currentID: currentPlayingVideoID });\n }", "function onPlaybackTimeChange (ms) {\n // timeline.setCustomTime(new Date(ms));\n countline.setCustomTime(new Date(ms));\n\n let tmp_date = new Date(ms);\n // console.log(tmp_date);\n // console.log(ms);\n // console.log(tmp_date.getTime());\n\n let current_time = vis.moment(new Date(ms));\n let range = countline.getWindow();\n let interval = range.end - range.start;\n countline.setWindow(current_time - 0.4 * interval, current_time + 0.5 * interval);\n\n update_bar_chart(bar_chart, bar_chart_category_data, data, ms);\n }", "function endEarly() {\n var seconds = self.video.time();\n if (seconds >= self.endpoint) {\n console.log(\"end early\");\n self.hide(function () {\n self.video.pause();\n self.video.rewind();\n self.video.dispatch(\"end\");\n });\n }\n }", "function adelantar() {\n\n \n video.currentTime += 10;\n console.log(video.currentTime)\n}", "function timer() {\n\t\t--secs;\n\t\tmins = (secs < 0) ? --mins : mins;\n\t\tif (mins < 0) {\n\t\t\tstop();\n\t\t\tmins += 1;\n\t\t\taudio.play();\n\t\t}\n\t\tsecs = (secs < 0) ? 59 : secs;\n\t\tsecs = (secs < 10) ? '0' + secs : secs;\n\t\t$('#timer').html(mins + ':' + secs);\n\t\tdisplayTime = mins + ':' + secs;\n\t}", "Play() {}", "function timeout() {\r\n buzz.play();\r\n recordAttempt();\r\n reset();\r\n }", "function prevTrack() {\n if(track_index > 0) track_index -= 1;\n else track_index = track_list.length - 1;\n\n // Load and play the new track\n loadTrack(track_index);\n playTrack();\n}", "function play() {\n \n}", "play(){\n this.setState({sentinel : true});\n this.state.video.play();\n this.state.video2.play();\n this.setState({ duration: document.getElementById('v1').duration });\n }", "stopRecord(state){\n for(var j = state.recordSound.length-1; j >= 0 ; j--){\n //if sound still active and the user select to stop the record then \n //Insert end time of the sound\n if(state.recordSound[j].endTime === 0){\n state.recordSound[j].endTime = Date.now()\n }\n //calculate the total time of the sound to be played in the record\n state.recordSound[j].totalTime = (state.recordSound[j].endTime - state.recordSound[j].startTime)/1000\n }\n }", "changeTime() {\n let video = document.getElementById('video');\n let seekBar = document.getElementById('seek-bar');\n \n var time = video.duration * (seekBar.value / 100);\n\n video.currentTime = time;\n this.calculateTime();\n }", "loopInit() {\n this.addEventListener('ended', () => {\n this.currentText = 0;\n this.play();\n })\n }", "playHandler() {\n this.startRefreshing();\n this.setStatus({isPlaying: true});\n }", "function prevMusic() {\n if( audio.currentTime > 3 ) audio.currentTime = 0\n else startMusic-- \n\n if( startMusic < 0 ) startMusic = musicList.length - 1\n loadMusic( musicList[startMusic] )\n playMusic()\n}", "playRandom(){\n this.request(this.routes.randomTrack, this.play);\n }", "function ucatMediaPlayAtTime(mediaId, seekto)\r\n{\r\n if (!getCurrentPlayer(mediaId))\r\n {\r\n setCurrentPlayer(mediaId);\r\n }\r\n clearInterval(mediaInterval);\r\n var duration = currentPlayer.mediaTag.duration;\r\n var percentageToSeekTo = (seekto * 100) / duration;\r\n var currentTime = currentPlayer.mediaTag.currentTime;\r\n //Checks for Rewind if limit plays is active. Prevents repeated listening.\r\n if(seekto < currentTime && currentPlayer.maxPlays > 0){\r\n //update number of plays.\r\n var currentPlayNum = currentPlayer.currentPlay + 1;\r\n updateUcatPlayerCurrentPlay(currentPlayer.id, currentPlayNum);\r\n var mediaPlayEndedEvent = $.Event(\"ucatMediaPlayEnded\");\r\n mediaPlayEndedEvent.containerElementId = currentPlayer.containerElementId;\r\n mediaPlayEndedEvent.src = currentPlayer.src;\r\n mediaPlayEndedEvent.currentPlay = currentPlayer.currentPlay;\r\n $(document).trigger(mediaPlayEndedEvent);\r\n }\r\n\r\n switch (currentPlayer.mediaType)\r\n {\r\n case \"audio\":\r\n if (currentPlayer.options.showseekslider)\r\n {\r\n if(currentPlayer.maxPlays == 0){//Note: Limit plays has no seek bar\r\n $(\"#seekSlider_\" + mediaId).val(percentageToSeekTo);\r\n var seekSlider = document.getElementById(\"seekSlider_\" + mediaId);\r\n ucatMediaSeek(seekSlider);\r\n } else {\r\n currentPlayer.mediaTag.currentTime = seekto;\r\n }\r\n ucatMediaPlay(mediaId);\r\n } else\r\n {\r\n currentPlayer.mediaTag.currentTime = seekto\r\n ucatMediaPlay(mediaId);\r\n }\r\n break;\r\n case \"video\":\r\n if(currentPlayer.maxPlays == 0){//Note: Limit plays has no seek bar\r\n $(\"#seekSlider_\" + mediaId).val(percentageToSeekTo);\r\n var seekSlider = document.getElementById(\"seekSlider_\" + mediaId);\r\n ucatMediaSeek(seekSlider);\r\n currentPlayer.mediaTag.currentTime = seekto\r\n if ($(\"#ucatMediaElement_\" + mediaId + \"_overlay\").css(\"display\") == \"table\")\r\n {\r\n overlayClick(mediaId);\r\n } else\r\n {\r\n ucatMediaPlay(mediaId);\r\n }\r\n } else {\r\n currentPlayer.mediaTag.currentTime = seekto\r\n if ($(\"#ucatMediaElement_\" + mediaId + \"_overlay\").css(\"display\") == \"table\")\r\n {\r\n overlayClick(mediaId);\r\n } else\r\n {\r\n ucatMediaPlay(mediaId);\r\n }\r\n }\r\n\r\n break;\r\n default:\r\n }\r\n}", "function playSample(sample){\n\tsample.play();\n}", "update(dt) {\n if (cc.vv) {\n if (\n this.isPlaying &&\n cc.vv.replayMgr.isReplay() &&\n this.nextPlayTime > 0\n ) {\n this.nextPlayTime -= dt;\n if (this.nextPlayTime < 0) {\n this.nextPlayTime = cc.vv.replayMgr.takeAction();\n }\n }\n }\n }", "function prev_aud() {\n if (trackNumber === 0) {\n resetTrack();\n }\n else if (player.paused) {\n trackNumber --;\n updateTrack(trackNumber);\n }\n else if (player.currentTime < 3) {\n trackNumber --;\n updateTrack(trackNumber);\n already_playing(currentSong);\n }\n else {\n already_playing(currentSong);\n }\n resetProgressBar();\n}", "function playInst(inst, startTime, stopTime){\n\n var inst = inst;\n var startTime = startTime;\n var stopTime = stopTime;\n\n inst.startAtTime(globalNow+startTime);\n inst.stopAtTime(globalNow+stopTime);\n\n}", "function stop(){\n p.currentTime = 0;\n p.pause();\n}", "function roundsSound(){\n\tvar sound = document.getElementById(\"roundsSound\");\n\tsound.currentTime = 0;\n\tsound.play();\n}", "function Update()\n\t{\n\t\tif(NotPlayedYet){\n if (Time.timeSinceLevelLoad > playStartTime) {\n GetComponent.<AudioSource>().PlayOneShot(myClip);\n\t\t\t//AudioSource>().PlayOneShot(myClip);\n\t\t\tNotPlayedYet = false;\n//\t\tplayStartTime = playStartTime + 10 + 60*Random.value; //don't play again for at least 10 seconds + 0-20 more seconds\n\t}\n\t}\n}", "function skipNext() {\n showNoise();\n \n var currentTime = player.getCurrentTime();\n var seekTimecode = higherThan(currentTime,timecodes);\n player.seekTo(seekTimecode,true);\n \n if(debug) {\n console.log(\"skipNext() :: currentTime:\",currentTime,\"nextClip:\",seekTimecode,\"currentIndex\");\n }\n}", "_timeupdate(e){\n\t\tvar percent = this.$video.currentTime / this.$video.duration * 100;\n\t\tvar newState = {\n\t\t\tseekProgress: percent,\n\t\t\tcurrentTime: formatTime(this.$video.currentTime)\n\t\t}\n\t\tif(this.$video.currentTime >= this.$video.duration ) {\n\t\t\tnewState.isPlaying = false;\n\t\t}\n\t\tthis.setState(newState);\n\t}", "function render (){\n if (clockMode === state.SESSION){\n currentTime--;\n $clockLabel.html(parseForDisplay(currentTime));\n if (currentTime === 0){\n clockMode = state.BREAK;\n \n // alarm \n var wav = 'http://soundbible.com/grab.php?id=1531&type=mp3';\n var audio = new Audio(wav);\n\t\t\t audio.play();\n \n currentTime = breakTime;\n }\n }\n else if (clockMode === state.BREAK){\n currentTime--;\n $clockLabel.html(parseForDisplay(currentTime));\n if (currentTime === 0){\n clockMode = state.SESSION;\n \n // alarm \n var wav = 'http://soundbible.com/grab.php?id=1531&type=mp3';\n var audio = new Audio(wav);\n\t\t\t audio.play();\n \n currentTime = sessionTime;\n }\n }\n }", "function autoPlay() {\r\n if (settings.autoPlayDirection == 'forward') {\r\n last2first();\r\n } else if (settings.autoPlayDirection == 'backward') {\r\n first2last();\r\n }\r\n}", "immediateLevelSwitchEnd() {\r\n const media = this.media\r\n if (media && media.buffered.length) {\r\n this.immediateSwitch = false\r\n // if (BufferHelper.isBuffered(media, media.currentTime)) {\r\n // only nudge if currentTime is buffered\r\n // media.currentTime -= 0.0001;\r\n // }\r\n if (!this.previouslyPaused) {\r\n this.playPromise = media.play()\r\n this.playPromise.then(() => {\r\n this._pause = false\r\n this.playing = true\r\n })\r\n }\r\n }\r\n }", "play() {\n\t\tthis.trigger('play', this);\n\t}", "play() {\n\t\tthis.trigger('play', this);\n\t}", "onRewind(){\n var { player } = this.state;\n var norm = this.returnToNorm;\n var intervalFunc = setInterval(function(){\n var currentTime = player.getCurrentTime();\n if(currentTime > 5) {\n player.seekTo(currentTime - 5, true);\n } else {\n player.seekTo(0, true);\n norm();\n }\n }, 250);\n this.setState({\n goForward: intervalFunc\n })\n }" ]
[ "0.6330583", "0.6316276", "0.6207637", "0.61473566", "0.6133786", "0.60890275", "0.6072445", "0.60640234", "0.6042378", "0.60379004", "0.5992548", "0.5988381", "0.59769315", "0.59691375", "0.5966064", "0.5915822", "0.59122777", "0.5911776", "0.5910597", "0.59100187", "0.59038025", "0.58870715", "0.58841026", "0.58817405", "0.5871425", "0.5866594", "0.58600044", "0.58588094", "0.58586246", "0.5852352", "0.58509654", "0.5847579", "0.5842209", "0.5841041", "0.58403903", "0.58327144", "0.58226424", "0.5815574", "0.5812186", "0.58024085", "0.57962096", "0.578689", "0.57683384", "0.5764708", "0.5763446", "0.57597625", "0.5758787", "0.572811", "0.5725472", "0.57117254", "0.5699746", "0.5698741", "0.56888705", "0.568842", "0.56869096", "0.5683709", "0.5679131", "0.5674766", "0.56692374", "0.56671447", "0.5666677", "0.5660762", "0.5657776", "0.5657553", "0.56488717", "0.56455266", "0.5641774", "0.5638692", "0.5638488", "0.5632492", "0.56294495", "0.5625792", "0.56155026", "0.5615269", "0.5613118", "0.5612975", "0.56088006", "0.5605276", "0.5601447", "0.5599762", "0.5596874", "0.55942625", "0.5592074", "0.5591976", "0.55903983", "0.5589826", "0.55818295", "0.55815417", "0.5578659", "0.5567886", "0.55620444", "0.5555873", "0.55540687", "0.5552633", "0.5550129", "0.554984", "0.5544561", "0.5537552", "0.5537552", "0.5531801" ]
0.6438047
0
play current segment with prePostRoll s pre and prePostRoll s postroll, exclude removed segments
function playWithoutDeleted() { playWithoutDeleted_helper(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousSegment() {\n if (editor.splitData && editor.splitData.splits) {\n var playerPaused = getPlayerPaused();\n if (!playerPaused) {\n pauseVideo();\n }\n var currSplitItem = getCurrentSplitItem();\n var new_id = currSplitItem.id - 1;\n new_id = (new_id < 0) ? (editor.splitData.splits.length - 1) : new_id;\n\n var idFound = true;\n if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) {\n idFound = false;\n }\n /*\n\telse if (!editor.splitData.splits[new_id].enabled) {\n idFound = false;\n new_id = (new_id <= 0) ? editor.splitData.splits.length : new_id;\n for (var i = new_id - 1; i >= 0; --i) {\n\n if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n }\n }\n }\n\t*/\n if (!idFound) {\n for (var i = editor.splitData.splits.length - 1; i >= 0; --i) {\n // if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n // }\n }\n }\n\n if (idFound) {\n selectSegmentListElement(new_id, !playerPaused);\n }\n if (!playerPaused) {\n playVideo();\n }\n }\n}", "function playWithoutDeleted_helper(full) {\n full = full || false;\n clearEvents2();\n if (editor.splitData && editor.splitData.splits) {\n var splitItem = getCurrentSplitItem();\n\n if (splitItem != null) {\n pauseVideo();\n\n var clipStartFrom = -1;\n var clipStartTo = -1;\n var segmentStart = splitItem.clipBegin;\n var segmentEnd = splitItem.clipEnd;\n var clipEndFrom = -1;\n var clipEndTo = -1;\n var hasPrevElem = true;\n var hasNextElem = true;\n var duration = getDuration();\n\n // check previous item to be played, get start time\n if ((splitItem.id - 1) >= 0) {\n hasPrevElem = true;\n if ((splitItem.id - 1) >= 0) {\n var prevSplitItem = editor.splitData.splits[splitItem.id - 1];\n while (!prevSplitItem.enabled) {\n if ((prevSplitItem.id - 1) < 0) {\n hasPrevElem = false;\n break;\n } else {\n prevSplitItem = editor.splitData.splits[prevSplitItem.id - 1];\n }\n }\n } else {\n hasPrevElem = false;\n }\n if (hasPrevElem) {\n clipStartTo = prevSplitItem.clipEnd;\n clipStartFrom = clipStartTo - prePostRoll;\n }\n }\n if (hasPrevElem) {\n clipStartFrom = (clipStartFrom < 0) ? 0 : clipStartFrom;\n }\n\n if (full) {\n if ((splitItem.id + 1) < editor.splitData.splits.length) {\n hasNextElem = true;\n var nextSplitItem = editor.splitData.splits[splitItem.id + 1];\n while (!nextSplitItem.enabled) {\n if ((nextSplitItem.id + 1) >= editor.splitData.splits.length) {\n hasNextElem = false;\n break;\n } else {\n nextSplitItem = editor.splitData.splits[nextSplitItem.id + 1];\n }\n }\n if (hasNextElem) {\n clipEndFrom = nextSplitItem.clipBegin;\n clipEndTo = clipEndFrom + prePostRoll;\n }\n }\n if (hasNextElem) {\n clipEndTo = (clipEndTo > duration) ? duration : clipEndTo;\n }\n } else {\n clipEndFrom = -1;\n clipEndTo = -1;\n var splBP2 = splitItem.clipBegin + prePostRoll;\n segmentEnd = (splBP2 <= splitItem.clipEnd) ? splBP2 : splitItem.clipEnd;\n segmentEnd = (segmentEnd > duration) ? duration : segmentEnd;\n }\n\n ocUtils.log(\"Play Times: \" +\n clipStartFrom + \" - \" +\n clipStartTo + \" | \" +\n segmentStart + \" - \" +\n segmentEnd + \" | \" +\n clipEndFrom + \" - \" +\n clipEndTo);\n\n if (hasPrevElem && ((full && hasNextElem) || !full)) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n }, (clipStartTo - clipStartFrom) * 1000);\n\n if (full) {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + (segmentEnd * 1000));\n }\n } else if (!hasPrevElem && hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n\n if (full) {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (segmentEnd * 1000));\n }\n } else if (hasPrevElem && !hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (clipStartTo - clipStartFrom) * 1000);\n } else if (!hasPrevElem && !hasNextElem) {\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n }\n }\n }\n}", "function playSqOfSegments(transcripts) {\n videoSrc = transcripts[counter]['src']\n inPoint = transcripts[counter]['inPoint']\n outPoint = transcripts[counter]['outPoint']\n playOneSegment(videoSrc, inPoint, outPoint)\n }", "function nextSegment() {\n if (editor.splitData && editor.splitData.splits) {\n var playerPaused = getPlayerPaused();\n if (!playerPaused) {\n pauseVideo();\n }\n\n var currSplitItem = getCurrentSplitItem();\n var new_id = currSplitItem.id + 1;\n\n new_id = (new_id >= editor.splitData.splits.length) ? 0 : new_id;\n\n var idFound = true;\n if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) {\n idFound = false;\n }\n /*\n\telse if (!editor.splitData.splits[new_id].enabled) {\n idFound = false;\n new_id = (new_id >= (editor.splitData.splits.length - 1)) ? 0 : new_id;\n\n for (var i = new_id + 1; i < editor.splitData.splits.length; ++i) {\n if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n }\n }\n }\n\t*/\n if (!idFound) {\n for (var i = 0; i < new_id; ++i) {\n // if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n // }\n }\n }\n\n if (idFound) {\n selectSegmentListElement(new_id, !playerPaused);\n }\n if (!playerPaused) {\n playVideo();\n }\n }\n}", "slither() {\n // nextDir will be the NEW direction of the segment being processed in each iteration of the loop below\n let nextDir = this.getHead().direction;\n for ( let s of this.segments ) {\n // Update the segment's position to its next position\n s.gridPosition = s.nextPosition();\n\n const oldDir = s.direction; // Remember its current direction so we can use it as the next nextDir\n s.direction = nextDir; // Update the segment's direction to the nextDir (which was the previous segments direction)\n nextDir = oldDir; // Finally, set up nextDir for the next iteration\n }\n }", "clipEar(listofseg){\n\t\tlet copypoint = listofseg.map(function(e){\n\t\t\treturn e.a\n\t\t})\n\t\tfor (let i=0; i<listofseg.length;i++){\n\t\t\tlet sega = listofseg[i];\n\t\t\tlet segb;\n\t\t\tlet copy = copypoint.map((x=>x));\n\t\t\tif (i=== listofseg.length-1){\n\t\t\t\tsegb = listofseg[0]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsegb = listofseg[i+1]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t}\n\t\t\tlet notfound = true;\n\t\t\tfor (let j=0; j<copy.length;j++){\n\t\t\t\tif (this.checkTriangle(sega, segb, copy[j])){\n\t\t\t\t\tnotfound = false\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (notfound){\n\t\t\t\tthis.segList.push([sega, segb])\n\t\t\t\tif (i=== listofseg.length-1){\n\t\t\t\t\tlistofseg.pop();\n\t\t\t\t\tlistofseg.shift();\n\t\t\t\t\treturn listofseg.splice(0,0,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn listofseg.splice(i,2,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function okButtonClick() {\n if (!continueProcessing && checkClipBegin() && checkClipEnd()) {\n id = $('#splitUUID').val();\n if (id != \"\") {\n var current = editor.splitData.splits[id];\n var tmpBegin = parseFloat(current.clipBegin);\n var tmpEnd = parseFloat(current.clipEnd);\n var duration = getDuration();\n id = parseInt(id);\n if (getTimefieldTimeBegin() > getTimefieldTimeEnd()) {\n displayMsg(\"The inpoint is bigger than the outpoint. Please check and correct it.\",\n \"Check and correct inpoint and outpoint\");\n selectSegmentListElement(id);\n return;\n }\n\n if (checkPrevAndNext(id, true).ok) {\n if (editor.splitData && editor.splitData.splits) {\n current.clipBegin = getTimefieldTimeBegin();\n current.clipEnd = getTimefieldTimeEnd();\n if (id > 0) {\n if (current.clipBegin > editor.splitData.splits[id - 1].clipBegin) {\n editor.splitData.splits[id - 1].clipEnd = current.clipBegin;\n } else {\n displayMsg(\"The inpoint is bigger than the inpoint of the segment before this segment. Please check and correct it.\",\n \"Check and correct inpoint\");\n setTimefieldTimeBegin(editor.splitData.splits[id - 1].clipEnd);\n selectSegmentListElement(id);\n return;\n }\n }\n\n var last = editor.splitData.splits[editor.splitData.splits.length - 1];\n if (last.clipEnd < duration) {\n ocUtils.log(\"Inserting a last split element (auto): (\" + current.clipEnd + \" - \" + duration + \")\");\n var newLastItem = {\n clipBegin: parseFloat(last.clipEnd),\n clipEnd: parseFloat(duration),\n enabled: true\n };\n\n // add the new item to the end\n editor.splitData.splits.push(newLastItem);\n }\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n if (checkPrevAndNext(i, false).inserted) {\n i = 0;\n }\n }\n }\n\n editor.updateSplitList(true, !zoomedIn());\n $('#videoPlayer').focus();\n selectSegmentListElement(id);\n } else {\n current.clipBegin = tmpBegin;\n current.clipEnd = tmpEnd;\n selectSegmentListElement(id);\n }\n }\n } else {\n selectCurrentSplitItem();\n }\n}", "resetSegments() {\n var i;\n for(i = 0; i < this.numSegments; i ++ ){\n this.segmentGenerated[i] = segmentStatus.NOT_GENERATED;\n }\n }", "componentWillReceiveProps(nextProps) {\n const {initialText, segments} = nextProps.currentStory;\n\n //Create pages array that will contain story pages - first page contains initialText and 2 segments\n //Keep only the segments that were accepted in voting\n let pagesArray = [];\n let segmentsCopy = segments.filter(val => val.status === 'accepted');\n pagesArray[0] = [{content: initialText}, segmentsCopy[0], segmentsCopy[1]];\n\n //Remove first two segments that were used in first page, and create pages (3 segments or less per page)\n //Note: optimal number of segments per page has not been decided yet\n segmentsCopy = segmentsCopy.slice(2);\n while (segmentsCopy.length) {\n var newPage = segmentsCopy.splice(0,3);\n pagesArray.push(newPage);\n }\n\n this.setState({\n ...this.state,\n currentStory: nextProps.currentStory,\n pages: pagesArray,\n error: nextProps.error\n });\n }", "function subdivideSegments(eventQueue, subject, clipping, sbbox, cbbox, operation) {\n var sweepLine = new Tree(compareSegments);\n var sortedEvents = [];\n\n var rightbound = min(sbbox[2], cbbox[2]);\n\n var prev, next;\n\n while (eventQueue.length) {\n var event = eventQueue.pop();\n sortedEvents.push(event);\n\n // optimization by bboxes for intersection and difference goes here\n if ((operation === INTERSECTION && event.point[0] > rightbound) ||\n (operation === DIFFERENCE && event.point[0] > sbbox[2])) {\n break;\n }\n\n if (event.left) {\n sweepLine = sweepLine.insert(event);\n //_renderSweepLine(sweepLine, event.point, event);\n\n next = sweepLine.find(event);\n prev = sweepLine.find(event);\n event.iterator = sweepLine.find(event);\n\n if (prev.node !== sweepLine.begin) {\n prev.prev();\n } else {\n prev = sweepLine.begin;\n prev.prev();\n prev.next();\n }\n next.next();\n\n var prevEvent = (prev.key || null), prevprevEvent;\n computeFields(event, prevEvent, operation);\n if (next.node) {\n if (possibleIntersection(event, next.key, eventQueue) === 2) {\n computeFields(event, prevEvent, operation);\n computeFields(event, next.key, operation);\n }\n }\n\n if (prev.node) {\n if (possibleIntersection(prev.key, event, eventQueue) === 2) {\n var prevprev = sweepLine.find(prev.key);\n if (prevprev.node !== sweepLine.begin) {\n prevprev.prev();\n } else {\n prevprev = sweepLine.find(sweepLine.end);\n prevprev.next();\n }\n prevprevEvent = prevprev.key || null;\n computeFields(prevEvent, prevprevEvent, operation);\n computeFields(event, prevEvent, operation);\n }\n }\n } else {\n event = event.otherEvent;\n next = sweepLine.find(event);\n prev = sweepLine.find(event);\n\n // _renderSweepLine(sweepLine, event.otherEvent.point, event);\n\n if (!(prev && next)) continue;\n\n if (prev.node !== sweepLine.begin) {\n prev.prev();\n } else {\n prev = sweepLine.begin;\n prev.prev();\n prev.next();\n }\n next.next();\n sweepLine = sweepLine.remove(event);\n\n // _renderSweepLine(sweepLine, event.otherEvent.point, event);\n\n if (next.node && prev.node) {\n if (typeof prev.node.value !== 'undefined' && typeof next.node.value !== 'undefined') {\n possibleIntersection(prev.key, next.key, eventQueue);\n }\n }\n }\n }\n return sortedEvents;\n}", "async addClip(_, { post_id, user_id }) {\n console.log('addClip');\n console.log(post_id);\n console.log(user_id);\n var alreadyClipped = false;\n db.collection('users')\n .doc(user_id)\n .get()\n .then((doc) => {\n for (const clip in doc.data().clips) {\n //Checks if the user has already clipped the post\n if (doc.data().clips[clip] == post_id) {\n alreadyClipped = true;\n }\n }\n\n // If the user hasnt clipped the post then clip it else unclip it\n if (!alreadyClipped) {\n db.collection('posts')\n .doc(post_id)\n .update({\n clips: firebase.firestore.FieldValue.increment(1),\n });\n db.collection('users')\n .doc(user_id)\n .update({\n clips: firebase.firestore.FieldValue.arrayUnion(post_id),\n });\n } else {\n db.collection('posts')\n .doc(post_id)\n .update({\n clips: firebase.firestore.FieldValue.increment(-1),\n });\n db.collection('users')\n .doc(user_id)\n .update({\n clips: firebase.firestore.FieldValue.arrayRemove(post_id),\n });\n }\n });\n }", "didSwitchToSegmentsLayout() {\n this.controllerState.viewMode = ViewMode.segments;\n this.didSwitchLayout();\n }", "async resumeCleaningSegments() {\n await this.sendCommand(\"resume_segment_clean\", [], {});\n }", "function setPostProcessing(shaders) {\n\t for (var s in allPost) {\n\t allPost[s].turnOff();\n\t }\n\t composer = new EffectComposer(renderer);\n\t var renderPass = new EffectComposer.RenderPass(scene, camera);\n\t composer.addPass(renderPass);\n\t for (var s in currentPost) {\n\t currentPost[s].turnOn();\n\t var pass = currentPost[s].shader;\n\t pass.renderToScreen = true;\n\t composer.addPass(pass);\n\t }\n\t render();\n\t}", "function LateUpdate()\n{\n\tif(!updated)\n\t{\n\t\treturn;\n\t}\n\tupdated = false;\n\t\n\tvar mesh : Mesh = GetComponent(MeshFilter).mesh;\n\tmesh.Clear();\n\tvar segmentCount : int = 0;\n\tfor(var j : int = 0; j < numMarks && j < maxMarks; j++)\n\t\tif(skidmarks[j].lastIndex != -1 && skidmarks[j].lastIndex > numMarks - maxMarks)\n\t\t\tsegmentCount++;\n\t\n\tvar vertices : Vector3[] = new Vector3[segmentCount * 4];\n\tvar normals : Vector3[] = new Vector3[segmentCount * 4];\n\tvar tangents : Vector4[] = new Vector4[segmentCount * 4];\n\tvar colors : Color[] = new Color[segmentCount * 4];\n\tvar uvs : Vector2[] = new Vector2[segmentCount * 4];\n\tvar triangles : int[] = new int[segmentCount * 6];\n\tsegmentCount = 0; \n\t \n\tfor(var i : int = 0; i < numMarks && i < maxMarks; i++)\n\t\tif(skidmarks[i].lastIndex != -1 && skidmarks[i].lastIndex > numMarks - maxMarks)\n\t\t{\n\t\t\tvar curr : markSection = skidmarks[i];\n\t\t\tvar last : markSection = skidmarks[curr.lastIndex % maxMarks];\n\t\t\tvertices[segmentCount * 4 + 0] = last.posl;\n\t\t\tvertices[segmentCount * 4 + 1] = last.posr;\n\t\t\tvertices[segmentCount * 4 + 2] = curr.posl;\n\t\t\tvertices[segmentCount * 4 + 3] = curr.posr;\n\t\t\t\n\t\t\tnormals[segmentCount * 4 + 0] = last.normal;\n\t\t\tnormals[segmentCount * 4 + 1] = last.normal;\n\t\t\tnormals[segmentCount * 4 + 2] = curr.normal;\n\t\t\tnormals[segmentCount * 4 + 3] = curr.normal;\n\n\t\t\ttangents[segmentCount * 4 + 0] = last.tangent;\n\t\t\ttangents[segmentCount * 4 + 1] = last.tangent;\n\t\t\ttangents[segmentCount * 4 + 2] = curr.tangent; \n\t\t\ttangents[segmentCount * 4 + 3] = curr.tangent;\n\t\t\t\n\t\t\tcolors[segmentCount * 4 + 0] = new Color(0, 0, 0, last.intensity * skidmarkIntensity);\n\t\t\tcolors[segmentCount * 4 + 1] = new Color(0, 0, 0, last.intensity * skidmarkIntensity);\n\t\t\tcolors[segmentCount * 4 + 2] = new Color(0, 0, 0, curr.intensity * skidmarkIntensity); \n\t\t\tcolors[segmentCount * 4 + 3 ]= new Color(0, 0, 0, curr.intensity * skidmarkIntensity); \n\n\t\t\tuvs[segmentCount * 4 + 0] = new Vector2(0, 0);\n\t\t\tuvs[segmentCount * 4 + 1] = new Vector2(1, 0);\n\t\t\tuvs[segmentCount * 4 + 2] = new Vector2(0, 1);\n\t\t\tuvs[segmentCount * 4 + 3] = new Vector2(1, 1);\n\t\t\t\n\t\t\ttriangles[segmentCount * 6 + 0] = segmentCount * 4 + 0;\n\t\t\ttriangles[segmentCount * 6 + 2] = segmentCount * 4 + 1;\n\t\t\ttriangles[segmentCount * 6 + 1] = segmentCount * 4 + 2;\n\t\t\t\n\t\t\ttriangles[segmentCount * 6 + 3] = segmentCount * 4 + 2;\n\t\t\ttriangles[segmentCount * 6 + 5] = segmentCount * 4 + 1;\n\t\t\ttriangles[segmentCount * 6 + 4] = segmentCount * 4 + 3;\n\t\t\tsegmentCount++;\t\t\t\n\t\t}\n\t\tmesh.vertices = vertices; \n\t\tmesh.normals = normals;\n\t\tmesh.tangents = tangents;\n\t\tmesh.triangles = triangles;\n\t\tmesh.colors =colors;\n\t\tmesh.uv = uvs; \n}", "function playOneSegment(videoSrc, inPoint, outPoint) {\n video.src = videoSrc\n video.load\n video.currentTime = inPoint\n video.play()\n video.ontimeupdate = function () {\n stopAtOutPoint()\n }\n counter += 1\n }", "function checkPrevAndNext(id, checkTimefields) {\n if (!continueProcessing) {\n checkTimefields = checkTimefields || false;\n var inserted = false;\n if (editor.splitData && editor.splitData.splits) {\n var duration = getDuration();\n var current = editor.splitData.splits[id];\n // new first item\n if (id == 0) {\n var clipBegin = parseFloat(current.clipBegin);\n var clipEnd = parseFloat(current.clipEnd);\n\n if (editor.splitData.splits.length > 1) {\n var next = editor.splitData.splits[1];\n next.clipBegin = clipEnd;\n }\n if ((!checkTimefields || (checkTimefields && (getTimefieldTimeBegin() != 0))) && (clipBegin > minSegmentLength)) {\n ocUtils.log(\"Inserting a first split element (cpan - auto): (\" + 0 + \" - \" + clipBegin + \")\");\n var newSplitItem = {\n clipBegin: 0,\n clipEnd: clipBegin,\n enabled: true\n };\n inserted = true;\n\n // add new item to front\n editor.splitData.splits.splice(0, 0, newSplitItem);\n insertedFirstItem = true;\n } else if (clipBegin > 0) {\n ocUtils.log(\"Extending the first split element to (cpan - auto): (\" + 0 + \" - \" + clipEnd + \")\");\n current.clipBegin = 0;\n }\n }\n // new last item\n else if ((editor.splitData.splits.length > 0) && (id == editor.splitData.splits.length - 1)) {\n if ((!checkTimefields || (checkTimefields && (getTimefieldTimeEnd() != duration))) && (current.clipEnd < (duration - minSegmentLength))) {\n ocUtils.log(\"Inserting a last split element (cpan - auto): (\" + current.clipEnd + \" - \" + duration + \")\");\n var newLastItem = {\n clipBegin: parseFloat(current.clipEnd),\n clipEnd: parseFloat(duration),\n enabled: true\n };\n inserted = true;\n\n // add the new item to the end\n editor.splitData.splits.push(newLastItem);\n var prev = editor.splitData.splits[id - 1];\n prev.clipEnd = parseFloat(current.clipBegin);\n insertedLastItem = true;\n } else {\n ocUtils.log(\"Extending the last split element to (cpan - auto): (\" + current.clipBegin + \" - \" + duration + \")\");\n current.clipEnd = parseFloat(duration);\n }\n }\n // in the middle\n else if ((id > 0) && (id < (editor.splitData.splits.length - 1))) {\n var prev = editor.splitData.splits[id - 1];\n var next = editor.splitData.splits[id + 1];\n\n if (checkTimefields && (getTimefieldTimeBegin() <= prev.clipBegin)) {\n displayMsg(\"The inpoint is lower than the begin of the last segment. Please check.\",\n \"Check inpoint\");\n return {\n ok: false,\n inserted: false\n };\n }\n if (checkTimefields && (getTimefieldTimeEnd() >= next.clipEnd)) {\n displayMsg(\"The outpoint is bigger than the end of the next segment. Please check.\",\n \"Check outpoint\");\n return {\n ok: false,\n inserted: false\n };\n }\n\n prev.clipEnd = parseFloat(current.clipBegin);\n next.clipBegin = parseFloat(current.clipEnd);\n }\n }\n return {\n ok: true,\n inserted: inserted\n };\n }\n}", "function skip() {\n game.cutScene.style.display = 'none';\n game.soundInstance.stop();\n // TODO: stop and unload cut scene animation\n}", "_mayHotReloadSegments() {\n this._allowOverwriteSegment = {};\n var segmentName;\n for (segmentName in this._segments) {\n if (!this._segments.hasOwnProperty(segmentName)) continue;\n this._allowOverwriteSegment[segmentName] = true;\n }\n }", "function export_segmentation_plys(segments, opts) {\n var plyExporter = opts.plyExporter;\n var labelRemap = opts.labelRemap;\n var callback = opts.callback;\n var categoryColorIndex = opts.categoryColorIndex;\n var basename = opts.basename;\n var unlabeledColor = new THREE.Color(STK.Constants.defaultPalette.colors[0]);\n\n // colorSegments takes in three parameters: labelToIndex mapping, getLabelFn, getMaterialFn\n // Slightly weird, but segment attribute are set after coloring\n segments.colorSegments('Category', categoryColorIndex, mapCategoryFn);\n var nyu40Labels = labelRemap? labelRemap.getLabelSet('nyu40') : null;\n var mpr40Labels = labelRemap? labelRemap.getLabelSet('mpr40') : null;\n if (nyu40Labels) {\n segments.colorSegments('NYU40', nyu40Labels.labelToId, nyu40Labels.rawLabelToLabel, nyu40Labels.getMaterial, nyu40Labels.unlabeledId);\n }\n if (mpr40Labels) {\n segments.colorSegments('mpr40', mpr40Labels.labelToId, mpr40Labels.rawLabelToLabel, mpr40Labels.getMaterial, mpr40Labels.unlabeledId);\n }\n var objColorIndex = segments.colorSegments('Object', {'unknown': 0});\n\n async.series([\n function (cb) {\n //segments.setMaterialVertexColors(THREE.VertexColors);\n segments.colorRawSegmentsOriginal();\n segments.export(plyExporter, basename + '.annotated', cb);\n },\n function (cb) {\n //segments.setMaterialVertexColors(THREE.NoColors);\n segments.colorRawSegments(unlabeledColor);\n segments.colorSegments('Category', categoryColorIndex, mapCategoryFn);\n segments.export(plyExporter, basename + '.categories.annotated', cb);\n },\n function (cb) {\n // Map from Category to NYU40 and export\n if (nyu40Labels) {\n segments.colorRawSegments(nyu40Labels.unlabeledColor);\n segments.colorSegments('NYU40', nyu40Labels.labelToId, nyu40Labels.rawLabelToLabel, nyu40Labels.getMaterial, nyu40Labels.unlabeledId);\n segments.export(plyExporter, basename + '.nyu40.annotated', cb);\n } else {\n setTimeout(cb, 0);\n }\n },\n function (cb) {\n // Map from Category to MPR40 and export\n if (mpr40Labels) {\n segments.colorRawSegments(mpr40Labels.unlabeledColor);\n segments.colorSegments('mpr40', mpr40Labels.labelToId, mpr40Labels.rawLabelToLabel, mpr40Labels.getMaterial, mpr40Labels.unlabeledId);\n segments.export(plyExporter, basename + '.mpr40.annotated', cb);\n } else {\n setTimeout(cb, 0);\n }\n },\n function (cb) {\n segments.colorRawSegments(unlabeledColor);\n segments.colorSegments('Object', objColorIndex);\n segments.export(plyExporter, basename + '.instances.annotated', cb);\n }\n ], callback);\n}", "addStackSteps(pre, changeSet, post) {\n this.pre.push(...pre);\n this.changeSet.push(...changeSet);\n this.post.push(...post);\n }", "onReadyForPostroll(player) {\n const Postroll = States.getState('Postroll');\n\n player.ads.debug('Received readyforpostroll event');\n this.transitionTo(Postroll);\n }", "function pageleft(e) {\n setMedia();\n if (media.currentTime > trjs.dmz.winsize())\n media.currentTime = media.currentTime - (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n else\n media.currentTime = 0;\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function selectSegments() {\n var peaks = wavesurfer.backend.peaks;\n var length = peaks.length;\n var duration = wavesurfer.getDuration();\n\n var start = 0;\n var min = 0.001;\n for (var i = start; i < length; i += 1) {\n if (peaks[i] <= min && i > start + (1 / duration) * length) {\n var color = [\n ~~(Math.random() * 255),\n ~~(Math.random() * 255),\n ~~(Math.random() * 255),\n 0.1\n ];\n wavesurfer.addRegion({\n color: 'rgba(' + color + ')',\n start: (start / length) * duration,\n end: (i / length) * duration\n });\n while (peaks[i] <= min) {\n i += 1;\n }\n start = i;\n }\n }\n}", "removeSegmentsIntersections(tunnels, isWalls) {\n const walls = this.walls;\n let startWallsLength = 0;\n let newWallsAmount = walls.length - startWallsLength;\n\n while (newWallsAmount > 0) {\n startWallsLength = walls.length;\n for (let j = 0; j < walls.length; j += 4) {\n for (let i = 0; i < (isWalls ? j : tunnels.length); i += 4) {\n const pieces = this.resolveSegmentSegment(\n tunnels[i], tunnels[i + 1], tunnels[i + 2], tunnels[i + 3],\n walls[j], walls[j + 1], walls[j + 2], walls[j + 3]\n );\n if (pieces.length < 4) { // empty walls will be removed in removeZeroLengthWalls()\n walls[j] = 0;\n walls[j + 1] = 0;\n walls[j + 2] = 0;\n walls[j + 3] = 0;\n } else {\n walls[j] = pieces[0];\n walls[j + 1] = pieces[1];\n walls[j + 2] = pieces[2];\n walls[j + 3] = pieces[3];\n\n if (pieces.length > 4) {\n walls.push(pieces[4]);\n walls.push(pieces[5]);\n walls.push(pieces[6]);\n walls.push(pieces[7]);\n }\n }\n }\n }\n newWallsAmount = walls.length - startWallsLength;\n }\n }", "function barra() {\n var contenedor = document.getElementsByClassName(\"barraSlider\")[0];\n var control = document.getElementsByClassName(\"controlBarraSlider\")[0];\n var activo = false;\n var xInicio = 0;\n var limite = (document.getElementsByClassName(\"lineaBarraSlider\")[0].offsetWidth) - document.getElementsByClassName(\"controlBarraSlider\")[0].offsetWidth;\n var banderaSegmentos = 0;\n var banderaSegmentosFin = 0;\n var contadorSegmentos = 1;\n\n //eventos para interactuar con el drag\n contenedor.addEventListener(\"touchstart\", dragStart, false);\n contenedor.addEventListener(\"touchend\", dragEnd, false);\n contenedor.addEventListener(\"touchmove\", drag, false);\n contenedor.addEventListener(\"mousedown\", dragStart, false);\n contenedor.addEventListener(\"mouseup\", dragEnd, false);\n contenedor.addEventListener(\"mousemove\", drag, false);\n\n //inicia el drag\n function dragStart(e) {\n if (e.type === \"touchstart\") {\n xInicio = e.touches[0].clientX - xOffset;\n } else {\n xInicio = e.clientX - xOffset;\n }\n\n if (e.target === control) {\n activo = true;\n }\n }\n\n //termina el drag\n function dragEnd() {\n xInicio = xActual;\n activo = false;\n }\n\n //en el momento que se esta haciendo el drag\n function drag(e) {\n if (activo) {\n \n e.preventDefault();\n if (e.type === \"touchmove\") {\n if (xActual <= limite && xActual >= 0) {\n xActual = e.touches[0].clientX - xInicio;\n } else {\n if (xActual >= limite) {\n xActual = limite;\n } else if(xActual <= 0) {\n xActual = 0;\n }\n }\n if (xActual > limite) {\n xActual = limite;\n } else if (xActual <= 0) {\n xActual = 0;\n }\n\n } else {\n if (xActual <= limite && xActual >= 0) {\n xActual = e.clientX - xInicio;\n\n } else {\n if (xActual >= limite) {\n xActual = limite;\n } else if (xActual <= 0) {\n xActual = 0;\n }\n }\n\n }\n xOffset = xActual;\n\n actualizarPosicion(xActual, control);\n }\n }\n\n function actualizarPosicion(posicionX, elemento) {\n elemento.style.transform = \"translate3d(\" + posicionX + \"px,\" + 0 + \"px, 0)\";\n calcularMovimientos(posicionX);\n }\n\n //esto se usa en calcularMovimientos();\n var limites = [];\n for (var i = 0; i < cantidadElementos; i++) {\n limites.push(Math.round(segmento * (i + 1))); \n }\n\n var banderaFor = 0;\n function calcularMovimientos(posicionX) {\n\n //segmento, es el espacio asignado dentro de la barra de control para cada slide \n if (posicionX < (segmento * contadorSegmentos) && posicionX >= (segmento * banderaSegmentos)) {\n } else {\n if (posicionX > (segmento * contadorSegmentos)) {\n\n contadorSegmentos = contadorSegmentos + 1;\n banderaSegmentos = banderaSegmentos + 1; \n controles(\"derechaSlider\", 1, \"slide\");\n } else {\n\n contadorSegmentos = contadorSegmentos - 1;\n banderaSegmentos = banderaSegmentos - 1;\n controles(\"izquierdaSlider\", 1, \"slide\");\n\n } \n }\n\n }\n}", "function pageright(e) {\n setMedia();\n media.currentTime = media.currentTime + (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function ArmSegment(shader, name, xPivot, yPivot) {\r\n SceneNode.call(this, shader, name, true); // calling super class constructor\r\n\r\n var xf = this.getXform();\r\n xf.setPosition(xPivot, yPivot);\r\n\r\n // now create the children shapes\r\n var obj = new CircleRenderable(shader); // The purple circle base\r\n this.addToSet(obj);\r\n obj.setColor([0.75, 0.5, 1, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(1, 2);\r\n // xf.setPosition(xPivot, 1 + yPivot);\r\n xf.setPosition(0, 0);\r\n\r\n obj = new SquareRenderable(shader); // The right green\r\n this.addToSet(obj);\r\n obj.setColor([0, 1, 0, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot, 1.75 + yPivot);\r\n xf.setPosition(0.375, 0);\r\n\r\n obj = new SquareRenderable(shader); // The left green\r\n this.addToSet(obj);\r\n obj.setColor([0, 1, 0, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot, 1.75 + yPivot);\r\n xf.setPosition(-0.375, 0);\r\n\r\n obj = new SquareRenderable(shader); // The top green\r\n this.addToSet(obj);\r\n obj.setColor([0, 0.85, 0.15, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot+0.5-0.125, yPivot+0.125);\r\n xf.setPosition(0, 0.375);\r\n\r\n obj = new SquareRenderable(shader); // The bottom green\r\n this.addToSet(obj);\r\n obj.setColor([0, 0.85, 0.15, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot-0.5+0.125, yPivot+0.125);\r\n xf.setPosition(0, -0.375);\r\n\r\n obj = new CircleRenderable(shader); // The middle red circle\r\n this.addToSet(obj);\r\n obj.setColor([1, 0.75, 1, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.5, 0.5); // so that we can see the connecting point\r\n xf.setPosition(0, 0);\r\n\r\n this.mPulseRate = 0.005;\r\n this.mRotateRate = -2;\r\n}", "function splitButtonClick() {\n if (!continueProcessing && editor.splitData && editor.splitData.splits) {\n var currentTime = getCurrentTime();\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n var splitItem = editor.splitData.splits[i];\n\n splitItem.clipBegin = parseFloat(splitItem.clipBegin);\n splitItem.clipEnd = parseFloat(splitItem.clipEnd);\n if ((splitItem.clipBegin < currentTime) && (currentTime < splitItem.clipEnd)) {\n newEnd = 0;\n if (editor.splitData.splits.length == (i + 1)) {\n newEnd = splitItem.clipEnd;\n } else {\n newEnd = editor.splitData.splits[i + 1].clipBegin;\n }\n var newItem = {\n clipBegin: parseFloat(currentTime),\n clipEnd: parseFloat(newEnd),\n enabled: true\n }\n\n splitItem.clipEnd = currentTime;\n editor.splitData.splits.splice(i + 1, 0, newItem);\n // TODO Make splitSegments clickable when zoomed in\n editor.updateSplitList(false, !zoomedIn());\n selectSegmentListElement(i + 1);\n return;\n }\n }\n }\n selectCurrentSplitItem();\n}", "function drawUndo()\n {\n if (hasSlideData( slideIndices, mode ))\n {\n var slideData = getSlideData( slideIndices, mode );\n slideData.events.pop();\n playbackEvents( mode );\n }\n }", "resetMainLoaderReplaceSegments() {\n const buffered = this.tech_.buffered();\n const bufferedEnd = buffered.end(buffered.length - 1);\n\n // Set the replace segments flag to the buffered end, this forces fetchAtBuffer\n // on the main loader to remain, false after the resetLoader call, until we have\n // replaced all content buffered ahead of the currentTime.\n this.mainSegmentLoader_.replaceSegmentsUntil = bufferedEnd;\n this.mainSegmentLoader_.resetLoaderProperties();\n this.mainSegmentLoader_.resetLoader();\n }", "onCodePathSegmentStart(segment) {\n const info = {\n uselessContinues: getUselessContinues([], segment.allPrevSegments),\n returned: false\n };\n\n // Stores the info.\n segmentInfoMap.set(segment, info);\n }", "if (!this.History.inProgress()) {\n this.objects.all()\n .filter(obj => obj.name !== 'groundPlane')\n .forEach(obj => { this.scene.remove(obj) });\n }", "function preDiv(){\n plusDivs(-1);\n}", "process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n this.sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n }", "function segmentTurn(p1, p2, p3, p4) {\n var ax = p1[0],\n ay = p1[1],\n bx = p2[0],\n by = p2[1],\n // shift p3p4 segment to start at p2\n dx = bx - p3[0],\n dy = by - p3[1],\n cx = p4[0] + dx,\n cy = p4[1] + dy,\n orientation = orient2D(ax, ay, bx, by, cx, cy);\n if (!orientation) return 0;\n return orientation < 0 ? 1 : -1;\n }", "function onAudioPositionChanged(position, from, skipping) { //noLetPlay\n\n audioCurrentTime = position;\n\n// if (_letPlay)\n// {\n// return;\n// }\n\n _skipAudioEnded = false;\n// _skipTTSEnded = false;\n\n if (!_smilIterator || !_smilIterator.currentPar)\n {\n return;\n }\n\n var parFrom = _smilIterator.currentPar;\n \n var audio = _smilIterator.currentPar.audio;\n\n //var TOLERANCE = 0.05;\n if(\n //position >= (audio.clipBegin - TOLERANCE) &&\n position > DIRECTION_MARK &&\n position <= audio.clipEnd) {\n\n//console.debug(\"onAudioPositionChanged: \" + position);\n return;\n }\n\n _skipAudioEnded = true;\n\n//console.debug(\"PLAY NEXT: \" + \"(\" + audio.clipBegin + \" -- \" + audio.clipEnd + \") [\" + from + \"] \" + position);\n//console.debug(_smilIterator.currentPar.text.srcFragmentId);\n\n var isPlaying = _audioPlayer.isPlaying();\n if (isPlaying && from === 6)\n {\n console.debug(\"from userNav _audioPlayer.isPlaying() ???\");\n }\n\n var goNext = position > audio.clipEnd;\n\n var doNotNextSmil = !_autoNextSmil && from !== 6 && goNext;\n\n var spineItemIdRef = (_smilIterator && _smilIterator.smil && _smilIterator.smil.spineItemId) ? _smilIterator.smil.spineItemId : ((_lastPaginationData && _lastPaginationData.spineItem && _lastPaginationData.spineItem.idref) ? _lastPaginationData.spineItem.idref : undefined);\n if (doNotNextSmil && spineItemIdRef && _lastPaginationData && _lastPaginationData.paginationInfo && _lastPaginationData.paginationInfo.openPages && _lastPaginationData.paginationInfo.openPages.length > 1)\n {\n //var iPage = _lastPaginationData.paginationInfo.isRightToLeft ? _lastPaginationData.paginationInfo.openPages.length - 1 : 0;\n var iPage = 0;\n \n var openPage = _lastPaginationData.paginationInfo.openPages[iPage];\n if (spineItemIdRef === openPage.idref)\n {\n doNotNextSmil = false;\n }\n }\n \n if (goNext)\n {\n _smilIterator.next();\n }\n else //position <= DIRECTION_MARK\n {\n _smilIterator.previous();\n }\n\n if(!_smilIterator.currentPar)\n {\n //\n // if (!noLetPlay)\n // {\n // _letPlay = true;\n // setTimeout(function()\n // {\n // _letPlay = false;\n // nextSmil(goNext);\n // }, 200);\n // }\n // else\n // {\n // nextSmil(goNext);\n // }\n\n//console.debug(\"NEXT SMIL ON AUDIO POS\");\n \n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n return;\n }\n\n//console.debug(\"ITER: \" + _smilIterator.currentPar.text.srcFragmentId);\n\n if(!_smilIterator.currentPar.audio) {\n self.pause();\n return;\n }\n \n if(_settings.mediaOverlaysSkipSkippables)\n {\n var skip = false;\n var parent = _smilIterator.currentPar;\n while (parent)\n {\n if (parent.isSkippable && parent.isSkippable(_settings.mediaOverlaysSkippables))\n {\n skip = true;\n break;\n }\n parent = parent.parent;\n }\n\n if (skip)\n {\n console.log(\"MO SKIP: \" + parent.epubtype);\n\n self.pause();\n\n var pos = goNext ? _smilIterator.currentPar.audio.clipEnd + 0.1 : DIRECTION_MARK - 1;\n\n onAudioPositionChanged(pos, from, true); //noLetPlay\n return;\n }\n }\n\n // _settings.mediaOverlaysSynchronizationGranularity\n if (!isPlaying && (_smilIterator.currentPar.element || _smilIterator.currentPar.cfi && _smilIterator.currentPar.cfi.cfiTextParent))\n {\n var scopeTo = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (scopeTo && scopeTo !== _smilIterator.currentPar)\n {\n var scopeFrom = _elementHighlighter.adjustParToSeqSyncGranularity(parFrom);\n if (scopeFrom && (scopeFrom === scopeTo || !goNext))\n {\n if (scopeFrom === scopeTo)\n {\n do\n {\n if (goNext) _smilIterator.next();\n else _smilIterator.previous();\n } while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(scopeFrom));\n\n if (!_smilIterator.currentPar)\n {\n //console.debug(\"adjustParToSeqSyncGranularity nextSmil(goNext)\");\n\n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n \n return;\n }\n }\n \n//console.debug(\"ADJUSTED: \" + _smilIterator.currentPar.text.srcFragmentId);\n if (!goNext)\n {\n var landed = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (landed && landed !== _smilIterator.currentPar)\n {\n var backup = _smilIterator.currentPar;\n \n var innerPar = undefined;\n do\n {\n innerPar = _smilIterator.currentPar;\n _smilIterator.previous();\n }\n while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(landed));\n \n if (_smilIterator.currentPar)\n {\n _smilIterator.next();\n \n if (!_smilIterator.currentPar.hasAncestor(landed))\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar.hasAncestor(landed) ???\");\n }\n //assert \n }\n else\n {\n//console.debug(\"adjustParToSeqSyncGranularity reached begin\");\n\n _smilIterator.reset();\n \n if (_smilIterator.currentPar !== innerPar)\n {\n console.error(\"adjustParToSeqSyncGranularity _smilIterator.currentPar !=== innerPar???\");\n }\n }\n\n if (!_smilIterator.currentPar)\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar ?????\");\n _smilIterator.goToPar(backup);\n }\n \n//console.debug(\"ADJUSTED PREV: \" + _smilIterator.currentPar.text.srcFragmentId);\n }\n }\n }\n }\n }\n \n if(_audioPlayer.isPlaying()\n && _smilIterator.currentPar.audio.src\n && _smilIterator.currentPar.audio.src == _audioPlayer.currentSmilSrc()\n && position >= _smilIterator.currentPar.audio.clipBegin\n && position <= _smilIterator.currentPar.audio.clipEnd)\n {\n//console.debug(\"ONLY highlightCurrentElement\");\n highlightCurrentElement();\n return;\n }\n\n //position <= DIRECTION_MARK goes here (goto previous):\n\n// if (!noLetPlay && position > DIRECTION_MARK\n// && _audioPlayer.isPlaying() && _audioPlayer.srcRef() != _smilIterator.currentPar.audio.src)\n// {\n// _letPlay = true;\n// setTimeout(function()\n// {\n// _letPlay = false;\n// playCurrentPar();\n// }, 100);\n//\n// playCurrentPar();\n//\n// return;\n// }\n\n playCurrentPar();\n }", "function onAudioPositionChanged(position, from, skipping) { //noLetPlay\n\n audioCurrentTime = position;\n\n// if (_letPlay)\n// {\n// return;\n// }\n\n _skipAudioEnded = false;\n// _skipTTSEnded = false;\n\n if (!_smilIterator || !_smilIterator.currentPar)\n {\n return;\n }\n\n var parFrom = _smilIterator.currentPar;\n \n var audio = _smilIterator.currentPar.audio;\n\n //var TOLERANCE = 0.05;\n if(\n //position >= (audio.clipBegin - TOLERANCE) &&\n position > DIRECTION_MARK &&\n position <= audio.clipEnd) {\n\n//console.debug(\"onAudioPositionChanged: \" + position);\n return;\n }\n\n _skipAudioEnded = true;\n\n//console.debug(\"PLAY NEXT: \" + \"(\" + audio.clipBegin + \" -- \" + audio.clipEnd + \") [\" + from + \"] \" + position);\n//console.debug(_smilIterator.currentPar.text.srcFragmentId);\n\n var isPlaying = _audioPlayer.isPlaying();\n if (isPlaying && from === 6)\n {\n console.debug(\"from userNav _audioPlayer.isPlaying() ???\");\n }\n\n var goNext = position > audio.clipEnd;\n\n var doNotNextSmil = !_autoNextSmil && from !== 6 && goNext;\n\n var spineItemIdRef = (_smilIterator && _smilIterator.smil && _smilIterator.smil.spineItemId) ? _smilIterator.smil.spineItemId : ((_lastPaginationData && _lastPaginationData.spineItem && _lastPaginationData.spineItem.idref) ? _lastPaginationData.spineItem.idref : undefined);\n if (doNotNextSmil && spineItemIdRef && _lastPaginationData && _lastPaginationData.paginationInfo && _lastPaginationData.paginationInfo.openPages && _lastPaginationData.paginationInfo.openPages.length > 1)\n {\n //var iPage = _lastPaginationData.paginationInfo.isRightToLeft ? _lastPaginationData.paginationInfo.openPages.length - 1 : 0;\n var iPage = 0;\n \n var openPage = _lastPaginationData.paginationInfo.openPages[iPage];\n if (spineItemIdRef === openPage.idref)\n {\n doNotNextSmil = false;\n }\n }\n \n if (goNext)\n {\n _smilIterator.next();\n }\n else //position <= DIRECTION_MARK\n {\n _smilIterator.previous();\n }\n\n if(!_smilIterator.currentPar)\n {\n //\n // if (!noLetPlay)\n // {\n // _letPlay = true;\n // setTimeout(function()\n // {\n // _letPlay = false;\n // nextSmil(goNext);\n // }, 200);\n // }\n // else\n // {\n // nextSmil(goNext);\n // }\n\n//console.debug(\"NEXT SMIL ON AUDIO POS\");\n \n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n return;\n }\n\n//console.debug(\"ITER: \" + _smilIterator.currentPar.text.srcFragmentId);\n\n if(!_smilIterator.currentPar.audio) {\n self.pause();\n return;\n }\n \n if(_settings.mediaOverlaysSkipSkippables)\n {\n var skip = false;\n var parent = _smilIterator.currentPar;\n while (parent)\n {\n if (parent.isSkippable && parent.isSkippable(_settings.mediaOverlaysSkippables))\n {\n skip = true;\n break;\n }\n parent = parent.parent;\n }\n\n if (skip)\n {\n console.log(\"MO SKIP: \" + parent.epubtype);\n\n self.pause();\n\n var pos = goNext ? _smilIterator.currentPar.audio.clipEnd + 0.1 : DIRECTION_MARK - 1;\n\n onAudioPositionChanged(pos, from, true); //noLetPlay\n return;\n }\n }\n\n // _settings.mediaOverlaysSynchronizationGranularity\n if (!isPlaying && (_smilIterator.currentPar.element || _smilIterator.currentPar.cfi && _smilIterator.currentPar.cfi.cfiTextParent))\n {\n var scopeTo = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (scopeTo && scopeTo !== _smilIterator.currentPar)\n {\n var scopeFrom = _elementHighlighter.adjustParToSeqSyncGranularity(parFrom);\n if (scopeFrom && (scopeFrom === scopeTo || !goNext))\n {\n if (scopeFrom === scopeTo)\n {\n do\n {\n if (goNext) _smilIterator.next();\n else _smilIterator.previous();\n } while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(scopeFrom));\n\n if (!_smilIterator.currentPar)\n {\n //console.debug(\"adjustParToSeqSyncGranularity nextSmil(goNext)\");\n\n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n \n return;\n }\n }\n \n//console.debug(\"ADJUSTED: \" + _smilIterator.currentPar.text.srcFragmentId);\n if (!goNext)\n {\n var landed = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (landed && landed !== _smilIterator.currentPar)\n {\n var backup = _smilIterator.currentPar;\n \n var innerPar = undefined;\n do\n {\n innerPar = _smilIterator.currentPar;\n _smilIterator.previous();\n }\n while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(landed));\n \n if (_smilIterator.currentPar)\n {\n _smilIterator.next();\n \n if (!_smilIterator.currentPar.hasAncestor(landed))\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar.hasAncestor(landed) ???\");\n }\n //assert \n }\n else\n {\n//console.debug(\"adjustParToSeqSyncGranularity reached begin\");\n\n _smilIterator.reset();\n \n if (_smilIterator.currentPar !== innerPar)\n {\n console.error(\"adjustParToSeqSyncGranularity _smilIterator.currentPar !=== innerPar???\");\n }\n }\n\n if (!_smilIterator.currentPar)\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar ?????\");\n _smilIterator.goToPar(backup);\n }\n \n//console.debug(\"ADJUSTED PREV: \" + _smilIterator.currentPar.text.srcFragmentId);\n }\n }\n }\n }\n }\n \n if(_audioPlayer.isPlaying()\n && _smilIterator.currentPar.audio.src\n && _smilIterator.currentPar.audio.src == _audioPlayer.currentSmilSrc()\n && position >= _smilIterator.currentPar.audio.clipBegin\n && position <= _smilIterator.currentPar.audio.clipEnd)\n {\n//console.debug(\"ONLY highlightCurrentElement\");\n highlightCurrentElement();\n return;\n }\n\n //position <= DIRECTION_MARK goes here (goto previous):\n\n// if (!noLetPlay && position > DIRECTION_MARK\n// && _audioPlayer.isPlaying() && _audioPlayer.srcRef() != _smilIterator.currentPar.audio.src)\n// {\n// _letPlay = true;\n// setTimeout(function()\n// {\n// _letPlay = false;\n// playCurrentPar();\n// }, 100);\n//\n// playCurrentPar();\n//\n// return;\n// }\n\n playCurrentPar();\n }", "function SnakeSegment() {\n\tthis.draw = function(bIsHead) { // implement the earlier absctract function\n\t\t//this.context.rect(this.x, this.y, 25, 25);\n\t\tif (bIsHead == true){\n\t\t\tthis.context.fillStyle=HEADCOLOUR;\n\t\t} else {\n\t\t\tthis.context.fillStyle=BODYCOLOUR;\n\t\t}\n\t\t\n\t\tthis.context.fillRect((this.x * game.grid.blockSize) + 1 , (this.y * game.grid.blockSize) + 1, game.grid.blockSize - 2, game.grid.blockSize - 2);\n\t}\n\n\tthis.clear = function () {\n\t\tthis.context.clearRect(this.x * game.grid.blockSize, this.y * game.grid.blockSize, game.grid.blockSize, game.grid.blockSize);\n\t}\n}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [], clip = [], i, n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n for ((i = 0, n = clip.length); i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n var start = subject[0], points, point;\n while (1) {\n // Find first unvisited intersection.\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for ((i = 0, n = points.length); i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function intakeSub(points){\r\n\r\n}", "function swipe(evt) {\n 'use strict';\n var sets = document.querySelectorAll('.sets'),\n i,\n rightStyle,\n rightNumbered,\n source = evt.target || evt.srcElement;\n\n if (source.id === \"right\") {\n if (sets[0].style.right === ((sets.length - 1)*100) + \"%\") {\n console.log('no more kit');\n } else {\n // Setting the selected kit in audio app\n audioApp.selectCount += 1;\n audioApp.selectedKit = audioApp.kits[audioApp.selectCount];\n console.log(audioApp.selectedKit);\n \n for (i = 0; i < sets.length; i += 1) {\n rightStyle = sets[i].style.right;\n rightNumbered = Number(rightStyle.substring(0, (rightStyle.length-1)));\n\n sets[i].style.right = rightNumbered + 100 + \"%\";\n }\n }\n }\n if (source.id === \"left\") {\n if (sets[sets.length - 1].style.right === (-(sets.length - 1)*100) + \"%\") {\n console.log('no more kit');\n } else {\n // Setting the selected kit in audio app\n audioApp.selectCount -= 1;\n audioApp.selectedKit = audioApp.kits[audioApp.selectCount];\n console.log(audioApp.selectedKit);\n \n for (i = 0; i < sets.length; i += 1) {\n rightStyle = sets[i].style.right;\n rightNumbered = Number(rightStyle.substring(0, (rightStyle.length-1)));\n\n sets[i].style.right = rightNumbered - 100 + \"%\";\n }\n }\n }\n }", "function tmsavePhase()\n{\n NProgress.start();\n var preNoSegment = 0;\n $.post(domainUrl + 'process/saveTimeLine', {'data': $(\"#timeline_form\").serialize(), }, responceEventStatus, 'html');\n}", "function scrollHandler() { \n\t\tif ( isNextSceneReached(true) ) {\n runNextScene();\n\t\t} else if ( isPrevSceneReached(true) ) {\n runPrevScene();\n\t\t}\n }", "function beforeAfterSlider() {\r\n if ($.exists('.st-before-after')) {\r\n var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;\r\n $('.st-before-after').each(function() {\r\n var $container = $(this),\r\n $before = $container.find('.st-before'),\r\n $after = $container.find('.st-after'),\r\n $handle = $container.find('.st-handle-before-after');\r\n \r\n var maxX = $container.outerWidth(),\r\n offsetX = $container.offset().left,\r\n startX = 0;\r\n \r\n var touchstart, touchmove, touchend;\r\n var mousemove = function(e) {\r\n e.preventDefault();\r\n var curX = e.clientX - offsetX,\r\n diff = startX - curX,\r\n curPos = (curX / maxX) * 100;\r\n if (curPos > 100) {\r\n curPos = 100;\r\n }\r\n if (curPos < 0) {\r\n curPos = 0;\r\n }\r\n $before.css({ right: (100 - curPos) + \"%\" });\r\n $handle.css({ left: curPos + \"%\" });\r\n };\r\n var mouseup = function(e) {\r\n e.preventDefault();\r\n if (supportsTouch) {\r\n $(document).off('touchmove', touchmove);\r\n $(document).off('touchend', touchend);\r\n } else {\r\n $(document).off('mousemove', mousemove);\r\n $(document).off('mouseup', mouseup);\r\n }\r\n };\r\n var mousedown = function(e) {\r\n e.preventDefault();\r\n startX = e.clientX - offsetX;\r\n if (supportsTouch) {\r\n $(document).on('touchmove', touchmove);\r\n $(document).on('touchend', touchend);\r\n } else {\r\n $(document).on('mousemove', mousemove);\r\n $(document).on('mouseup', mouseup);\r\n }\r\n };\r\n \r\n touchstart = function(e) {\r\n console.log(e);\r\n mousedown({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n touchmove = function(e) {\r\n mousemove({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n touchend = function(e) {\r\n mouseup({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n if (supportsTouch) {\r\n $handle.on('touchstart', touchstart);\r\n } else {\r\n $handle.on('mousedown', mousedown);\r\n }\r\n });\r\n }\r\n }", "function inSegment(xP, yP) {\r\n }", "kill() {\n this.segments.forEach(s => s.el.style.opacity = '0.5');\n }", "function preRun(){\n console.log(\"preRun: Begin\")\n\n console.log(\"preRun: End\")\n\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function determineEnrollentsToCopyOrWipe(vm, params) {\n //if the plan being updated is to be removed\n if (params.removeThisPlan) {\n manageEnrollmentsOnRemove.apply(this, [vm, params]);\n } else {\n //cases for re-mapping plan counts using the category enrollments, with or without deduction of DO enrollments\n manageEnrollmentsOnUpdateOrAdd.apply(this, [vm, params]);\n }\n}", "function _default(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n,\n p0 = segment[0],\n p1 = segment[n],\n x;\n\n if ((0, _pointEqual.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n\n stream.lineEnd();\n return;\n } // handle degenerate cases by moving the point\n\n\n p1[0] += 2 * _math.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n\n while (current.v) if ((current = current.n) === start) return;\n\n points = current.z;\n stream.lineStart();\n\n do {\n current.v = current.o.v = true;\n\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n\n current = current.p;\n }\n\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n\n stream.lineEnd();\n }\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function checkTrash(){\n if(currentID.includes('trash')){\n playAudio(correctAudio);\n points++;\n }\n else if(currentID.includes('rec')){\n playAudio(wrongAudio);\n points--;\n wrong++;\n checkWrong();\n }\n $('#points').text(points);\n }", "function jumpToSegment() {\n if (editor.splitData && editor.splitData.splits) {\n id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n\n setCurrentTime(editor.splitData.splits[id].clipBegin);\n }\n}", "function Rbutton01PLAY(){\n //count each time we click the button to play different\n //parts of the animation. much easier than adding and destrying animations!\n \n //done\n if (rightcount==0) {\n animRight.playSegments([140,310],true);\n rightcount+=1;\n //here I would add an extra control so that users cannot\n //click until the animation is finished. but this is fine for\n //the prototype on Tuesday\n \n //done\n } else if (rightcount == 1) {\n animRight.playSegments([310,900],true);\n rightcount+=1;\n \n //done\n } else if (rightcount == 2) {\n animRight.playSegments([900,1360],true);\n rightcount+=1;\n \n //done\n }else if (rightcount == 3) {\n animRight.playSegments([1360,1900],true);\n rightcount+=1;\n \n //done\n }else if (rightcount == 4) {\n animRight.playSegments([1900,2200],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 5) {\n animRight.playSegments([2200,2720],true);\n rightcount+=1;\n \n //done\n }else if (rightcount == 6) {\n animRight.playSegments([2720,3085],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 7) {\n animRight.playSegments([3085,3320],true);\n rightcount+=1;\n \n //done \n }else if (rightcount == 8) {\n animRight.playSegments([3320,3575],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 9) {\n animRight.playSegments([3575,3830],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 10) {\n animRight.playSegments([3830,4060],true); \n rightcount+=1;\n \n \n }else if (rightcount == 11) {\n animRight.playSegments([4060,4290],true); \n rightcount+=1;\n \n }else if (rightcount == 12) {\n animRight.playSegments([4290,4520],true); \n rightcount+=1;\n }\n\n}", "function onSegment(p, q, r) {\n if (\n q[0] <= Math.max(p[0], r[0]) &&\n q[0] >= Math.min(p[0], r[0]) &&\n q[1] <= Math.max(p[1], r[1]) &&\n q[1] >= Math.min(p[1], r[1])\n ) {\n return true;\n }\n\n return false;\n}", "function addSegEndsFromSequences(){\n //Add all the starting segEnds and internal segJoins\n for(var i=0;i<seqArr.length;i++){\n var length=parseInt(seqArr[i]['length']),\n seqId=seqArr[i]['id'];\n segEndArr[segEndArr.length]=[seqId,0,'POS_STRAND']\n segEndArr[segEndArr.length]=[seqId,length-1,'NEG_STRAND']\n segJoinArr[segJoinArr.length]=[[seqId,0,'POS_STRAND'],[seqId,length-1,'NEG_STRAND'],'internal',length]\n }\n segmentize();\n}", "collisionsSystem(scene, self) {\n \n scene.matter.world.on('collisionstart', function (event) {\n var pairs = event.pairs;\n for (var i = 0; i < pairs.length; i++) {\n\n var bodyA = pairs[i].bodyA;\n var bodyB = pairs[i].bodyB;\n\n // Ship - Planet\n if (bodyA.label === 'shipBody' && bodyB.label === 'planetBody' && Game.systemStartTime > 500) {\n self.soundThrusterTop.stop();\n self.soundThrusterBottom.stop();\n self.soundThrusterLeft.stop();\n self.soundThrusterRight.stop();\n\n Game.currentPlanet = bodyB.parent.gameObject.data.list.id;\n Game.lastSystemPosition = {\n x: bodyB.parent.gameObject.x,\n y: bodyB.parent.gameObject.y\n };\n\n // Désactive de témoin du loader de systemScene\n scene.scene.start('PlanetScene');\n\n }\n if (bodyB.label === 'shipBody' && bodyA.label === 'planetBody' && Game.systemStartTime > 500) {\n self.soundThrusterTop.stop();\n self.soundThrusterBottom.stop();\n self.soundThrusterLeft.stop();\n self.soundThrusterRight.stop();\n\n Game.currentPlanet = bodyA.parent.gameObject.data.list.id;\n Game.lastSystemPosition = {\n x: bodyA.parent.gameObject.x,\n y: bodyA.parent.gameObject.y\n };\n\n // Désactive de témoin du loader de systemScene\n scene.scene.start('PlanetScene');\n\n }\n\n // Ship - Star\n if (bodyA.label === 'shipBody' && bodyB.label === 'starBody') {\n console.log('PERDU : Ton vaisseau a cramé sur une étoile...');\n scene.scene.stop('UiScene');\n scene.scene.start('EndGameScene');\n }\n if (bodyB.label === 'shipBody' && bodyA.label === 'starBody') {\n console.log('PERDU : Ton vaisseau a cramé sur une étoile...');\n scene.scene.stop('UiScene');\n scene.scene.start('EndGameScene');\n }\n\n }\n });\n }", "function onSegment (pi, pj, pk) {\n return Math.min(pi[0], pj[0]) <= pk[0] &&\n pk[0] <= Math.max(pi[0], pj[0]) &&\n Math.min(pi[1], pj[1]) <= pk[1] &&\n pk[1] <= Math.max(pi[1], pj[1]);\n}", "function alertPrize(indicatedSegment) {\n console.log(indicatedSegment.text)\n if (indicatedSegment.text == \"Nothing!\") { document.getElementById(\"rays\").style.display = 'none'; incorrectSound.play(); }\n else { document.getElementById(\"rays\").style.display = 'block'; successSound.play(); }\n\n\n wheelRewardBack.style.display = 'block';\n wheelRewardImg.src = indicatedSegment.image;\n document.getElementById(\"wheelRewardTxt2\").innerHTML = indicatedSegment.text;\n grantAwardFromWheel(indicatedSegment.text);\n a.updateMoney();\n a.updateTools();\n localStorage.setItem('starCash', starCash);\n localStorage.setItem('GuiGhostFarms_player', JSON.stringify(player));\n }", "setSurroundingScenes(scene){\n\n // TODO: More checks. Reset to locked\n // let adjacentScene = null;\n\n // // up\n // adjacentScene = this.getSceneAtLocal(scene, 0, -1);\n // if (adjacentScene){\n // if (scene.up && adjacentScene.down){\n // scene.upLocked = false;\n // adjacentScene.downLocked = false;\n // }\n // }\n\n // // right\n // adjacentScene = this.getSceneAtLocal(scene, 1, 0);\n // if (adjacentScene){\n // if (scene.right && adjacentScene.left){\n // scene.rightLocked = false;\n // adjacentScene.leftLocked = false;\n // }\n // }\n\n // // down\n // adjacentScene = this.getSceneAtLocal(scene, 0, 1);\n // if (adjacentScene){\n // if (scene.down && adjacentScene.up){\n // scene.downLocked = false;\n // adjacentScene.upLocked = false;\n // }\n // }\n\n // // left\n // adjacentScene = this.getSceneAtLocal(scene, -1, 0);\n // if (adjacentScene){\n // if (scene.left && adjacentScene.right){\n // scene.leftLocked = false;\n // adjacentScene.rightLocked = false;\n // }\n // }\n }", "function sprawdz(){\n n++;\n i = n-1;\n n=n%tImg.length;\n i=i%tImg.length;\n }", "function manageEnrollmentsOnRemove(vm, params) {\n //zero its enrollments\n zeroEnrollments(params.updatedPlan);\n //if a single other med plan is still selected, give it all the enrollments\n if (params.isMedPlan && params.singleMedStillSelected) { \n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.medPlanRemaining]);\n //recursively pass this plan back through the updatePlans cycle, to get enrollmments to update for the payload\n params.updatePlansFn(vm, params.medPlanRemaining, null, {remainingMedPlanUpdate: true}); \n }\n //if we're removing a delta dental DO plan, remove enrollments from the DO plan, too\n if (params.isDualDenPrimary) { \n const associatedDO = vm.plans.dental.directOption.selected[0];\n if (associatedDO) {\n zeroEnrollments(associatedDO);\n //need to recursively call updatePlans on this DO plan\n this.updatePlans(vm, associatedDO);\n }\n }\n}", "function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n\t var prevX;\n\t var prevY;\n\t var cpx0;\n\t var cpy0;\n\t var cpx1;\n\t var cpy1;\n\t var idx = start;\n\t var k = 0;\n\t\n\t for (; k < segLen; k++) {\n\t var x = points[idx * 2];\n\t var y = points[idx * 2 + 1];\n\t\n\t if (idx >= allLen || idx < 0) {\n\t break;\n\t }\n\t\n\t if (isPointNull(x, y)) {\n\t if (connectNulls) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t break;\n\t }\n\t\n\t if (idx === start) {\n\t ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n\t cpx0 = x;\n\t cpy0 = y;\n\t } else {\n\t var dx = x - prevX;\n\t var dy = y - prevY; // Ignore tiny segment.\n\t\n\t if (dx * dx + dy * dy < 0.5) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t if (smooth > 0) {\n\t var nextIdx = idx + dir;\n\t var nextX = points[nextIdx * 2];\n\t var nextY = points[nextIdx * 2 + 1];\n\t var tmpK = k + 1;\n\t\n\t if (connectNulls) {\n\t // Find next point not null\n\t while (isPointNull(nextX, nextY) && tmpK < segLen) {\n\t tmpK++;\n\t nextIdx += dir;\n\t nextX = points[nextIdx * 2];\n\t nextY = points[nextIdx * 2 + 1];\n\t }\n\t }\n\t\n\t var ratioNextSeg = 0.5;\n\t var vx = 0;\n\t var vy = 0;\n\t var nextCpx0 = void 0;\n\t var nextCpy0 = void 0; // Is last point\n\t\n\t if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n\t cpx1 = x;\n\t cpy1 = y;\n\t } else {\n\t vx = nextX - prevX;\n\t vy = nextY - prevY;\n\t var dx0 = x - prevX;\n\t var dx1 = nextX - x;\n\t var dy0 = y - prevY;\n\t var dy1 = nextY - y;\n\t var lenPrevSeg = void 0;\n\t var lenNextSeg = void 0;\n\t\n\t if (smoothMonotone === 'x') {\n\t lenPrevSeg = Math.abs(dx0);\n\t lenNextSeg = Math.abs(dx1);\n\t cpx1 = x - lenPrevSeg * smooth;\n\t cpy1 = y;\n\t nextCpx0 = x + lenPrevSeg * smooth;\n\t nextCpy0 = y;\n\t } else if (smoothMonotone === 'y') {\n\t lenPrevSeg = Math.abs(dy0);\n\t lenNextSeg = Math.abs(dy1);\n\t cpx1 = x;\n\t cpy1 = y - lenPrevSeg * smooth;\n\t nextCpx0 = x;\n\t nextCpy0 = y + lenPrevSeg * smooth;\n\t } else {\n\t lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n\t lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\t\n\t ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n\t cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n\t cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\t\n\t nextCpx0 = x + vx * smooth * ratioNextSeg;\n\t nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t nextCpx0 = mathMin$5(nextCpx0, mathMax$5(nextX, x));\n\t nextCpy0 = mathMin$5(nextCpy0, mathMax$5(nextY, y));\n\t nextCpx0 = mathMax$5(nextCpx0, mathMin$5(nextX, x));\n\t nextCpy0 = mathMax$5(nextCpy0, mathMin$5(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\t\n\t vx = nextCpx0 - x;\n\t vy = nextCpy0 - y;\n\t cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n\t cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t cpx1 = mathMin$5(cpx1, mathMax$5(prevX, x));\n\t cpy1 = mathMin$5(cpy1, mathMax$5(prevY, y));\n\t cpx1 = mathMax$5(cpx1, mathMin$5(prevX, x));\n\t cpy1 = mathMax$5(cpy1, mathMin$5(prevY, y)); // Adjust next cp0 again.\n\t\n\t vx = x - cpx1;\n\t vy = y - cpy1;\n\t nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n\t nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n\t }\n\t }\n\t\n\t ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n\t cpx0 = nextCpx0;\n\t cpy0 = nextCpy0;\n\t } else {\n\t ctx.lineTo(x, y);\n\t }\n\t }\n\t\n\t prevX = x;\n\t prevY = y;\n\t idx += dir;\n\t }\n\t\n\t return k;\n\t }", "clipSegment(start, end) {\n const quadrantStart = this.pointLocation(start)\n const quadrantEnd = this.pointLocation(end)\n\n if (quadrantStart === 0b0000 && quadrantEnd === 0b0000) {\n // The line is inside the boundaries\n return [start, end]\n }\n\n if (quadrantStart === quadrantEnd) {\n // We are in the same box, and we are out of bounds.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart & quadrantEnd) {\n // These points are all on one side of the box.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart === 0b000) {\n // We are exiting the box. Return the start, the intersection with the boundary, and the closest\n // boundary point to the exited point.\n let line = [start]\n line.push(this.boundPoint(start, end))\n line.push(this.nearestVertex(end))\n return line\n }\n\n if (quadrantEnd === 0b000) {\n // We are re-entering the box.\n return [this.boundPoint(end, start), end]\n }\n\n // We have reached a terrible place, where both points are oob, but it might intersect with the\n // work area. First, define the boundaries as lines.\n const sides = [\n // left\n [Victor(-this.sizeX, -this.sizeY), new Victor(-this.sizeX, this.sizeY)],\n // right\n [new Victor(this.sizeX, -this.sizeY), new Victor(this.sizeX, this.sizeY)],\n // bottom\n [new Victor(-this.sizeX, -this.sizeY), new Victor(this.sizeX, -this.sizeY)],\n // top\n [new Victor(-this.sizeX, this.sizeY), new Victor(this.sizeX, this.sizeY)],\n ]\n\n // Count up the number of boundary lines intersect with our line segment.\n let intersections = []\n for (let s=0; s<sides.length; s++) {\n const intPoint = this.intersection(start,\n end,\n sides[s][0],\n sides[s][1])\n if (intPoint) {\n intersections.push(new Victor(intPoint.x, intPoint.y))\n }\n }\n\n if (intersections.length !== 0) {\n if (intersections.length !== 2) {\n // We should never get here. How would we have something other than 2 or 0 intersections with\n // a box?\n console.log(intersections)\n throw Error(\"Software Geometry Error\")\n }\n\n // The intersections are tested in some normal order, but the line could be going through them\n // in any direction. This check will flip the intersections if they are reversed somehow.\n if (Victor.fromObject(intersections[0]).subtract(start).lengthSq() >\n Victor.fromObject(intersections[1]).subtract(start).lengthSq()) {\n let temp = intersections[0]\n intersections[0] = intersections[1]\n intersections[1] = temp\n }\n\n return [...intersections, this.nearestVertex(end)]\n }\n\n // Damn. We got here because we have a start and end that are failing different boundary checks,\n // and the line segment doesn't intersect the box. We have to crawl around the outside of the\n // box until we reach the other point.\n // Here, I'm going to split this line into two parts, and send each half line segment back\n // through the clipSegment algorithm. Eventually, that should result in only one of the other cases.\n const midpoint = Victor.fromObject(start).add(end).multiply(new Victor(0.5, 0.5))\n\n // recurse, and find smaller segments until we don't end up in this place again.\n return [...this.clipSegment(start, midpoint),\n ...this.clipSegment(midpoint, end)]\n }", "function onSegment( p, q, r ) {\n\n\t\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n\t}", "function playVideo() {\n playVideoSegments(transcripts)\n}", "function onSegment(p, q, r)\n{\n if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) &&\n q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y))\n return true;\n\n return false;\n}", "formatSegments (isProtein) {\n\t\tvar variants = isProtein ? this.attributes.variantDataProtein : this.attributes.variantDataDna;\n\t\tvar sequences = isProtein ? this.attributes.alignedProteinSequences : this.attributes.alignedDnaSequences;\n\t\t// make sure they're sorted by start\n\t\tvariants = _.sortBy(variants, d => {\n\t\t\treturn d.start;\n\t\t});\n\n\t\t// merge segments\n\t\tvar mergedSegments = _.reduce(variants, (memo, d) => {\n\t\t\treturn this._mergeOrAddSegment(memo, d);\n\t\t}, []);\n\n\t\t// add in needed summarized segments\n\t\t// first one\n\t\tif (mergedSegments[0].start > 1) {\n\t\t\tmergedSegments.push({\n\t\t\t\tvisible: false,\n\t\t\t\tstart: 1,\n\t\t\t\tend: mergedSegments[0].start\n\t\t\t});\n\t\t}\n\t\t// loop through and connect visible segments with summarized segments\n\t\tvar _visibleSegments = _.where(mergedSegments, { visible: true });\n\t\t_visibleSegments.forEach( (d, i) => {\n\t\t\t// must not be last or visible\n\t\t\tif (d.visible && i < _visibleSegments.length - 1) {\n\t\t\t\tmergedSegments.push({\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tstart: d.end,\n\t\t\t\t\tend: _visibleSegments[i + 1].start\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t\n\t\tvar _last = _.max(mergedSegments, d => { return d.end; });\n\t\tvar _maxLength = _.max(sequences, d => { return d.sequence.length; }).sequence.length;\n\t\t// add last if last segment is visible and not at the end\n\t\tif (_last.end < _maxLength) {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength,\n\t\t\t\tvisible: false\n\t\t\t});\n\t\t// add last if visible\n\t\t} else {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength + 1,\n\t\t\t\tvisible: true\n\t\t\t});\n\t\t}\n\t\t\n\t\t// change starts and ends to domains\n\t\tmergedSegments = _.map(mergedSegments, d => {\n\t\t\td.domain = [d.start, d.end];\n\t\t\treturn d;\n\t\t});\n\t\t// sort\n\t\tmergedSegments = _.sortBy(mergedSegments, d => {\n\t\t\treturn d.start;\n\t\t});\n\t\treturn mergedSegments;\n\t}", "function prevSnip() {\n if (mixSplits != null && mixSplits != undefined) {\n splitPointer--;\n if ((splitPointer < mixSplits.length) && (splitPointer >= 0)) {\n preview(mixSplits[splitPointer], mixSplits[splitPointer] + snipWin, function () {\n });\n } else {\n splitPointer++;\n }\n }\n}", "function moveScrollStops() {\n trackedArea.find('.spt-trackThis').each(function (index) {\n var section = $(this),\n sectionHeadline = section.children('.spt-sectionTitle:first'),\n sectionTitle = sectionHeadline.text(),\n sectionTopSubtract = trackedArea.offset().top,\n sectionRelativeTop = section.offset().top - trackedArea.offset().top,\n sectionId = index + 1,\n sectionStop = (sectionRelativeTop / getScrollProgressMax()) * 100,\n scrollHorStops = $('.spt-scrollStopContainer'),\n scrollVerStops = $('.spt-vertScrollStopContainer'),\n scrollStopTitles = $('.spt-scrollStopTitles'),\n scrollVerStopTitles = $('.spt-vertScrollStopTitles');\n\n if (sectionStop > 100) {\n sectionStop = 100;\n }\n\n scrollHorStops.children('.spt-stop' + sectionId).css('left', sectionStop + '%');\n scrollVerStops.children('.spt-stop' + sectionId).css('top', sectionStop + '%');\n scrollStopTitles.children('.spt-stop' + sectionId).css('left', sectionStop + '%');\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').addClass('spt-reached');\n if (settings.horStyle == 'beam') {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('left', '-8px');\n } else {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('left', '0');\n }\n scrollVerStopTitles.children('.spt-stop' + sectionId).css('top', sectionStop + '%');\n\n if ($(window).scrollTop() <= trackedArea.find('.spt-trackThis:first').offset().top + trackedArea.find('.spt-trackThis:first').children('.spt-sectionTitle:first').outerHeight() - head) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text('');\n }\n if ($(window).scrollTop() >= section.offset().top + section.children('.spt-sectionTitle:first').outerHeight() - head) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text(sectionTitle);\n var viewportBottom = $(window).scrollTop() + $(window).height();\n if (settings.finalStopTitle != '') {\n if ($(window).width() <= settings.mobileThreshold) {\n if (($(window).scrollTop() + $(window).height()) >= (trackedArea.offset().top + trackedArea.height() + (headlineMargin * 2)) || ($(window).scrollTop() + $(window).height()) >= $(document).outerHeight()) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text(settings.finalStopTitle);\n }\n } else {\n if (($(window).scrollTop() + $(window).height()) >= $(document).outerHeight()) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text(settings.finalStopTitle);\n }\n }\n }\n }\n\n if (settings.horOnlyActiveTitle) {\n scrollStopTitles.children('.spt-stop' + sectionId).css('display', 'none');\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('display', 'block');\n } else {\n scrollStopTitles.children('.spt-stop' + sectionId).css('display', 'block');\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('display', 'none');\n }\n\n if (settings.horTitlesOffset == 'top') {\n scrollStopTitles.children('.spt-stopTitle').css('margin-top', horizontalTop - horizontalTitlesHeight - 5 + 'px').css('margin-left', '8px');\n } else if (settings.horTitlesOffset == 'bottom') {\n scrollStopTitles.children('.spt-stopTitle').css('margin-top', horizontalBottom + 5 + 'px').css('margin-left', '8px');\n scrollStopTitles.children('.spt-finalStopTitle').css('margin-top', horizontalBottom + 5 + 'px');\n } else {\n scrollStopTitles.children('.spt-stopTitle').css('margin-top', horizontalCenter - horizontalTitlesHeight / 2 - 2 + 'px').css('margin-left', '25px');\n scrollStopTitles.children('.spt-finalStopTitle').css('margin-top', horizontalCenter - horizontalTitlesHeight / 2 - 2 + 'px').css('margin-right', '16px');\n }\n if (settings.horStyle == 'fill') {\n scrollStopTitles.children('.spt-onlyActive').css('margin-top', '0');\n }\n\n if (getScrollProgressValue() >= sectionRelativeTop) {\n $('.spt-stop' + sectionId).addClass('spt-reached');\n } else {\n $('.spt-stop' + sectionId).removeClass('spt-reached');\n }\n if (getScrollProgressValue() >= getScrollProgressMax()) {\n $('.spt-finalStopCircle, .spt-finalStopTitle').addClass('spt-reached');\n } else {\n $('.spt-finalStopCircle, .spt-finalStopTitle').removeClass('spt-reached');\n }\n if (settings.trackViewportOnly) {\n if (getScrollProgressValue() - $(window).outerHeight() >= sectionRelativeTop + section.outerHeight()) {\n $('.spt-stop' + sectionId).removeClass('spt-reached');\n }\n }\n });\n }", "function modifySegments() {\n /* ----------------------------- START loop Calls hl7Buttons and sends the segments to generate the fields buttons at front end ---------------------------------------------- */\n for (var i = 0; i < selectedArray.length; i++) {\n hl7Buttons(selectedArray[i]);\n }\n /* ----------------------------- END loop Calls hl7Buttons and sends the segments to generate the fields buttons at front end ---------------------------------------------- */\n /* --------------------------------------- START loop for Checking, Highlighting and disabling the buttons for the mandatory HL7 fields ------------------------------------ */\n for (var i = 0; i < mandatoryFields.length; i++) {\n $(\".\" + mandatoryFields[i]).addClass('disabled'); //Label tag button class to disable the mandatory fields\n $(\"#\" + mandatoryFields[i]).attr('checked', true); //Checkbox tag id to add checked attribute the mandatory fields\n }\n /* --------------------------------------- END loop for Checking, Highlighting and disabling the buttons for the mandatory HL7 fields ------------------------------------ */\n\n /* --------------------------------------- START loop for hiding the fields not supported ------------------------------------ */\n for (var i = 0; i < notUsedFields.length; i++) {\n $(\".\" + notUsedFields[i]).addClass('hiddenFields'); //Adding class to identify the hidden fields and is used in click function for select all button\n $(\".\" + notUsedFields[i]).hide(); //Hiding the fields which we are not using\n }\n /* --------------------------------------- END loop for hiding the fields not supported ------------------------------------ */\n}", "unlike_post(state, payload){\n //nalazimo post koji je neko unlikeovao\n var post = state.posts.find((p) => {\n return p.id === payload.post_id\n })\n //posto smo nasli post sada nalazimo njegov lajk kom id odgovara lajku koji je stigao iz Like.vue tj iz unlike() metoda LikesControllera\n var like = post.likes.find((l) => {\n return l.id === payload.like_id\n })\n //nalazimo index lajka koji hocemo da obrisemo u post.likes\n var index = post.likes.indexOf(like)\n //koristeci splice secamo ga iz post.likes arraya\n post.likes.splice(index, 1)\n }", "reset(){\n this.setSegment();\n if(this.next)this.next.reset();\n }", "removeHoldsIfProceeds(currentAudioTime) {\n\n let listActiveHolds = this.activeHolds.asList() ;\n\n\n // This is used to know whether the last judgment for the hold must be fail or not.\n this.activeHolds.wasLastKnowHoldPressed = this.areHoldsBeingPressed() ;\n\n for ( var i = 0 ; i < listActiveHolds.length ; i++) {\n\n let step = listActiveHolds[i] ;\n\n if (step !== null && currentAudioTime > step.endHoldTimeStamp ) {\n this.activeHolds.setHold(step.kind, step.padId, null) ;\n\n // save the endHoldTimeStamp to compute the remainder judgments.\n this.activeHolds.needFinishJudgment = true ;\n this.activeHolds.judgmentTimeStampEndReference = step.endHoldTimeStamp - this.activeHolds.firstHoldInHoldRun.beginHoldTimeStamp ;\n // console.log('begin: ' + beginTime + ' end: ' + endTime) ;\n // this.activeHolds.actualTotalComboValueOfHold = this.computeTotalComboContribution( beginTime, endTime ) ;\n\n // if the hold is active, we can remove it from the render and give a perfect judgment, I think.\n if (this.keyInput.isPressed(step.kind, step.padId)) {\n\n this.composer.removeObjectFromSteps(step) ;\n this.composer.removeObjectFromSteps(step.holdObject) ;\n this.composer.removeObjectFromSteps(step.endNoteObject) ;\n\n this.composer.animateTapEffect([step]) ;\n\n this.composer.judgmentScale.animateJudgement('p') ;\n\n\n\n // otherwise we have a miss.\n } else {\n this.composer.judgmentScale.miss() ;\n }\n\n\n }\n\n }\n }", "function nearStitching(after0U, before1U, uv) {\n\t\tif(uv.x >= 0.8) {\n\t\t\tbefore1U.push(uv);\n\t\t}\n\t\t\n\t\tif(uv.x <= 0.2) {\n\t\t\tafter0U.push(uv);\n\t\t}\n\t}", "addPre(...steps) {\n this.pre.push(...steps);\n }", "function onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}", "function ir_para( direcao, seletor ){\n\t\tif( ( seletor.find( '.sub-section' ).length > 0 ) ){\n\t\t\t// Se for pai de uma sub-section\n\t\t\t// percorre a subsection ao invez da section pai\n\t\t\tseletor = seletor.find( '.sub-section.ativo' );\n\t\t\tir_para( direcao, seletor );\n\t\t}else {\n\t\t\t// remove as classes de controle de animação\n\t\t\tjQuery( '.forward, .backward ,.reverse' ).removeClass( 'forward' ).removeClass( 'backward' ).removeClass( 'reverse' );\n\t\t\tif( direcao == 'seguinte' ){\n\t\t\t\tif( seletor.hasClass( 'sub-section' ) && ( seletor.next().length == 0 ) ){\n\t\t\t\t\t// se for o último item avança para a proxima section\n\t\t\t\t\tseletor = seletor.parents( 'section' );\n\t\t\t\t}\n\t\t\t\tseletor.addClass( 'forward' ).removeClass( 'ativo' ).next().addClass( 'ativo' );\n\n\t\t\t\tif ($('.resultado').hasClass('ativo')) {\n\n\t\t\t\t\t$('.page-calculadora-btu__container').addClass('is--active');\n\t\t\t\t}\n\n\t\t\t}else if( direcao == 'anterior' ){\n\t\t\t\t// 1- verificamos se existe um palco antes\n\t\t\t\t// caso tenha, voltamos para a section anterior\n\t\t\t\t// 2 - caso não tenha palco, verificamos\n\t\t\t\t// se é o primeiro item da sub-section\n\t\t\t\t// se for, voltamos para a section anterior\n\t\t\t\tif( seletor.prev().not( '.palco' ).length == 0 ||\n\t\t\t\t\t( seletor.hasClass( 'sub-section' ) && ( seletor.prev().length == 0 ) ) ){\n\t\t\t\t\tseletor = seletor.parents( 'section' );\n\t\t\t\t}\n\t\t\t\tseletor.addClass( 'backward' ).removeClass( 'ativo' ).prev().addClass( 'ativo reverse' );\n\n\t\t\t}\n\t\t}\n\t}", "function _ripClipVideos(savePath, vos, callback) {\n\t\tvar videoIndex = 0;\n\n\t\tconsole.log(vos.length);\n\n\t\tfunction __ripVideo(vo) {\n\t\t\tif (!vo) {\n\t\t\t\tcallback();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdelete vo['results'];\n\t\t\tvar name = vo['title'] + '.mp4';\n\t\t\t//only one segment\n\t\t\tvar seg = vo['segments'][0];\n\t\t\tvar p = savePath + '/' + name;\n\t\t\tffmpeg(vo['path'])\n\t\t\t\t.inputOptions('-threads 8')\n\t\t\t\t.seekInput(seg.startTime)\n\t\t\t\t.outputOptions('-map 0')\n\t\t\t\t.outputOptions('-r 25')\n\t\t\t\t.outputOptions('-profile:v Baseline')\n\t\t\t\t.outputOptions('-g 12')\n\t\t\t\t.outputOptions('-c:a aac')\n\t\t\t\t.outputOptions('-b:a 240k')\n\t\t\t\t.outputOptions('-strict -2')\n\t\t\t\t.duration(seg.endTime - seg.startTime)\n\t\t\t\t.format('mp4')\n\t\t\t\t.output(p)\n\t\t\t\t.on('start', function(commandLine) {\n\t\t\t\t\tconsole.log(colors.green('Spawned Ffmpeg with command: %s'), commandLine);\n\t\t\t\t})\n\t\t\t\t.on('error', function(err) {\n\t\t\t\t\tconsole.log('An error occurred: ' + err.message);\n\t\t\t\t\tvo['savePath'] = \"\";\n\t\t\t\t\tvideoIndex += 1;\n\t\t\t\t\t__ripVideo(vos[videoIndex]);\n\t\t\t\t})\n\t\t\t\t.on('end', function() {\n\t\t\t\t\tvo['savePath'] = p;\n\t\t\t\t\tvideoIndex += 1;\n\t\t\t\t\t__ripVideo(vos[videoIndex]);\n\t\t\t\t})\n\t\t\t\t.run();\n\t\t}\n\n\t\t__ripVideo(vos[videoIndex]);\n\t}", "function drawLeftRight(left, n) {\n\t \t\tif(left) {\n\t \t\t\t\tvar a = [(main.segments[0].point.x + main.segments[3].point.x)/2, (main.segments[0].point.y + main.segments[3].point.y)/2]\n\t \t\t\t//console.log(a);\n\t \t\t\tvar b = [(main.segments[4].point.x + main.segments[5].point.x)/2, (main.segments[4].point.y + main.segments[5].point.y)/2];\n\t \t\t\t}\n\t \t\t\telse {\n\t \t\t\t\tvar a = [(main.segments[0].point.x + main.segments[3].point.x)/2, (main.segments[0].point.y + main.segments[3].point.y)/2]\n\t \t\t\t//console.log(a);\n\t \t\t\tvar b = [(main.segments[1].point.x + main.segments[2].point.x)/2, (main.segments[1].point.y + main.segments[2].point.y)/2];\n\t \t\t\t}\n\n\t \t\tvar x = a[0]-b[0];\n\t \t\tvar y = a[1]-b[1];\n\t \t\tvar dist = Math.sqrt(x*x + y*y);\n\t \t\t// depending on the number of figures\n\t \t\tvar step = dist/(n+1);\n\t \t\tfor (var i = 1; i <= n; i++) {\n\t \t\t\tvar new_x = a[0]-((step*i)*(a[0]-b[0]))/dist;\n\t \t\t\tvar new_y = a[1]-((step*i)*(a[1]-b[1]))/dist;\n\t \t\t\tvar new_coord = [new_x, new_y];\n\t \t\t\tvar raster = getFigur(fig);\n\t \t\t\traster.bounds.x = 0;\n\t\t \t\traster.bounds.y = 0;\n\t\t \t\traster.bounds.width = max*0.4;\n\t\t \t\traster.bounds.height = max*0.4;\n\t\t \t\traster.position = new paper.Point(new_x, new_y);\n\n\t\t \t\tgroup.addChild(raster);\n\t \t\t}\n\t \t}", "function process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n}", "addTo(board) { \n this.segments.forEach(s => s.addTo(board)); \n }", "function areaSweep() {//set the completed row to 0's\r\n outer: for (var y = playArea.length -1; y > 0; --y) {\r\n for (var x = 0; x < playArea[y].length; ++x) {\r\n if (playArea[y][x] === 0) {\r\n continue outer;\r\n }\r\n }\r\n\r\n var row = playArea.splice(y, 1)[0].fill(0);//move the rows down\r\n linesCleared++;//does lines for scoring\r\n lines++;//adds line based on completed lines\r\n console.log(lines);\r\n playArea.unshift(row);\r\n ++y;\r\n }\r\n if (linesCleared == 1){\r\n score += (40*level+40);\r\n notTetris.play();\r\n linesCleared=0;\r\n single++;\r\n }\r\n else if (linesCleared == 2){\r\n score += (100*level+100);\r\n notTetris.play();\r\n linesCleared=0;\r\n double++;\r\n }\r\n else if (linesCleared == 3){\r\n score += (300*level+300);\r\n notTetris.play();\r\n linesCleared=0;\r\n triple++;\r\n }\r\n else if (linesCleared == 4){\r\n score += (1200*level+1200);\r\n tetrisSound.play();\r\n linesCleared=0;\r\n tetris++;\r\n }//score based on cleared lines\r\n\r\n if(lines>=10&&level==0){level=1; transitionSound.play();}\r\n else if(lines>=20&&level==1){level=2; transitionSound.play();}\r\n else if(lines>=30&&level==2){level=3; transitionSound.play();}\r\n else if(lines>=40&&level==3){level=4; transitionSound.play();}\r\n else if(lines>=50&&level==4){level=5; transitionSound.play();}\r\n else if(lines>=60&&level==5){level=6; transitionSound.play();}\r\n else if(lines>=70&&level==6){level=7; transitionSound.play();}\r\n else if(lines>=80&&level==7){level=8; transitionSound.play();}\r\n else if(lines>=90&&level==8){level=9; transitionSound.play();}\r\n else if(lines>=100&&level==9){level=10; transitionSound.play();}\r\n else if(lines>=110&&level==10){level=11; transitionSound.play();}\r\n else if(lines>=120&&level==11){level=12; transitionSound.play();}\r\n else if(lines>=130&&level==12){level=13; transitionSound.play();}\r\n else if(lines>=140&&level==13){level=14; transitionSound.play();}\r\n else if(lines>=150&&level==14){level=15; transitionSound.play();}\r\n else if(lines>=160&&level==15){level=16; transitionSound.play();}\r\n else if(lines>=170&&level==16){level=17; transitionSound.play();}\r\n else if(lines>=180&&level==17){level=18; transitionSound.play();}\r\n else if(lines>=190&&level==18){level=19; transitionSound.play();}\r\n else if(lines>=200&&level==19){level=20; transitionSound.play();}\r\n else if(lines>=210&&level==20){level=21; transitionSound.play();}\r\n else if(lines>=220&&level==21){level=22; transitionSound.play();}\r\n else if(lines>=230&&level==22){level=23; transitionSound.play();}\r\n else if(lines>=240&&level==23){level=24; transitionSound.play();}\r\n else if(lines>=250&&level==24){level=25; transitionSound.play();}\r\n else if(lines>=260&&level==25){level=26; transitionSound.play();}\r\n else if(lines>=270&&level==26){level=27; transitionSound.play();}\r\n else if(lines>=280&&level==27){level=28; transitionSound.play();}\r\n else if(lines>=290&&stopTransSound==true){level=29; transitionSound.play();stopTransSound=false;}//level transitions\r\n\r\n if(score>999999)score==999999;\r\n var scoreTag = document.getElementById('score');\r\n scoreTag.innerHTML = 'Score: '+score;\r\n\r\n\r\n var scoreTag = document.getElementById('lines');\r\n scoreTag.innerHTML = 'Lines: '+lines;\r\n}//end of areaSweep", "function onSegment(p, q, r) {\n if (\n q.x <= Math.max(p.x, r.x) &&\n q.x >= Math.min(p.x, r.x) &&\n q.y <= Math.max(p.y, r.y) &&\n q.y >= Math.min(p.y, r.y)\n )\n return true\n\n return false\n}", "function resume(){\n\tfor( let i = 0; i < subplanes.length ; i++ ){\n\t\tsubplanes[i].resume();\n\t}\n\tpaused = false;\n}", "function sliceEffects(effect, crossSlice) {\n var $currentSlide = $slides.eq(currentSlide).css(\"z-index\", 1),\n $nextSlide = $slides.eq(nextSlide),\n blocksNumber,\n blockMetrics;\n if (effect==\"sliceRight\"||effect==\"sliceLeft\") {//horizontal transitions\n blocksNumber = slider.options.horizontalBlocks;\n blockMetrics = Math.ceil(slider._width/blocksNumber);\n } else { //vertical transitions\n blocksNumber = slider.options.verticalBlocks;\n blockMetrics = Math.ceil(slider._height/blocksNumber);\n }\n\n var $toRemove = $();\n\n //creating blocks for slice\n for (var i=0; i<blocksNumber; i++) {\n\n //creating clone of current slide, insert it and set its width to be equal with original one\n var $clone = $nextSlide.clone()\n .appendTo($slidesWrap)\n .wrap(\"<div></div>\"),\n crossMult = (i%2==1 && crossSlice) ? -1 : 1;\n\n //added wrap to a variable\n $parent = $clone.parent();\n\n //clone style\n $clone.css({\n \"left\": (effect == \"sliceRight\") ? -blockMetrics*i + \"px\" : \"auto\",\n \"right\": (effect == \"sliceLeft\") ? -blockMetrics*i + \"px\" : \"auto\",\n \"top\": (effect == \"sliceBottom\") ? -blockMetrics*i + \"px\" : \"auto\",\n \"bottom\": (effect == \"sliceTop\") ? -blockMetrics*i + \"px\" : \"auto\",\n \"width\": (effect == \"sliceRight\"||effect == \"sliceLeft\") ? $currentSlide.width() : \"\",\n \"height\": (effect == \"sliceBottom\"||effect == \"sliceTop\") ? $currentSlide.height() : \"\",\n \"max-width\": \"none\",\n \"max-height\": \"none\"\n });\n\n //wrap styles and animation\n $parent.css({\n \"position\": \"absolute\",\n \"z-index\": 2,\n \"overflow\": \"hidden\",\n \"left\": (effect == \"sliceRight\") ?\n i*blockMetrics + \"px\" :\n (effect == \"sliceLeft\") ?\n \"\" : -slider._width*crossMult,\n \"right\": (effect == \"sliceLeft\") ? i*blockMetrics + \"px\" : \"auto\",\n \"top\": (effect == \"sliceBottom\") ?\n i*blockMetrics + \"px\" :\n (effect == \"sliceTop\") ?\n \"\" : -slider._height*crossMult,\n \"bottom\": (effect == \"sliceTop\") ? i*blockMetrics + \"px\" : \"auto\",\n \"width\": (effect == \"sliceRight\"||effect == \"sliceLeft\") ? Math.ceil(slider._width/blocksNumber) + \"px\" : \"100%\",\n \"height\": (effect == \"sliceBottom\"||effect == \"sliceTop\") ? Math.ceil(slider._height/blocksNumber) + \"px\" : \"100%\"\n }).animate({\"opacity\": 0}, 0); //cross-browser hide parent\n $toRemove = $toRemove.add($parent);\n (function($parent, i, effect){\n var durationCoef = 1/4; // means that last 1/4 of transition time is time when all the blocks are animated already\n setTimeout(function() {\n $parent.animate({\n \"left\": (effect == \"sliceTop\"||effect == \"sliceBottom\") ? 0 : $parent.css(\"left\"),\n \"top\": (effect == \"sliceLeft\"||effect == \"sliceRight\") ? 0 : $parent.css(\"top\"),\n opacity: 1\n }, {\n \"duration\": slider.options.duration*durationCoef,\n \"easing\": \"linear\"\n });\n }, i*(1 - durationCoef)/blocksNumber*slider.options.duration);\n }($parent, i, effect));\n }\n\n //show next slide, hide previous\n $nextSlide.css(\"left\", 0);\n setTimeout(function() {\n $toRemove.remove();\n $currentSlide.css(\"z-index\", \"\");\n hideSlides($currentSlide);\n }, slider.options.duration);\n }", "function pressMove(event){\n if(!started){\n event.target.x = event.stageX;\n event.target.y = event.stageY;\n\n var position = points.indexOf(event.target);\n stage.removeChild(lines[position]);\n\n var temp = points[position+1];\n if((position+1) % vertexAmount == 0){\n var temp2 = points[(position+1)-vertexAmount];\n lines[position] = createLine(event.stageX, event.stageY, temp2.x, temp2.y);\n }\n else{\n lines[position] = createLine(event.stageX, event.stageY, temp.x, temp.y);\n }\n\n if(position % vertexAmount == 0){\n var pos = position-1+vertexAmount;\n stage.removeChild(lines[pos]);\n lines[pos] = createLine(points[pos].x, points[pos].y, event.stageX, event.stageY);\n }\n else{\n stage.removeChild(lines[position-1]);\n lines[position-1] = createLine(points[position-1].x, points[position-1].y, event.stageX, event.stageY);\n }\n updateCurves();\n }\n\n stage.clear();\n stage.update();\n }", "changeSlideOnEnd(){\n if(this.dist.movement > 120 && this.index.next !== undefined){\n this.activeNextSlider();\n }else if(this.dist.movement < -120 && this.index.prev !== undefined){\n this.activePrevSlider();\n }else{\n this.changeSlide(this.index.active)\n }\n }", "function stillHandler() { \n Options.scenes.forEach(function(scene) {\n \tif ( pageYOffset > scene.offset) {\n \t\tscene.action(scene.target);\n \t}\n });\n }", "function reorderBaselinePoints(baseline_path, moving_segment) {\n if (baseline_path.segments.length <= 2) return;\n var to_del = [];\n var moving_segm_idx = baseline_path.segments.indexOf(moving_segment); // Select segments to remove\n\n for (var i = 0; i < baseline_path.segments.length; i++) {\n var segm = baseline_path.segments[i];\n var segm_idx = baseline_path.segments.indexOf(segm);\n if (segm === moving_segment) continue;\n\n if (segm_idx < moving_segm_idx) {\n // Left\n if (segm.point.x > moving_segment.point.x) to_del.push(segm);\n } else {\n // Right\n if (segm.point.x < moving_segment.point.x) to_del.push(segm);\n }\n } // Delete segments\n\n\n for (var _i = 0, _to_del = to_del; _i < _to_del.length; _i++) {\n var _segm = _to_del[_i];\n\n _segm.remove();\n }\n }", "function segment(x, y, a) { //left arm\r\n translate(x, y);\r\n rotate(a);\r\n line(0, 0, segLength, 0);\r\n }", "resume () {\n this.isPaused = false;\n\n for (var i = 0; i < this.queue.length; i++) {\n publish.apply(publish, this.queue[i]);\n }\n\n this.queue = [];\n }", "function Update () \n{\n\tif (Time.frameCount % 30 == 0)\n\t{\n\t System.GC.Collect();\n\t}\n\tif (eventdata==null)\n\t{\n\t\t//if ((Time.time > 5)&&(Time.time < 6)&&(ttt==0)) \n\t\t//{\n\t\t//\tttt=1;\n\t\t//\tLoadEvent(\"91\");\n\t\t//}\n\t\treturn;\n\t}\n\t\n\tif (toc==0)\n\t{\n\t\tTime.timeScale = 0;\n\t\treturn;\n\t}\n\t\n\tredraw_grid();\n\tredraw_marks();\n\t\n\tplaytime = playtime + Time.deltaTime;\n\t\n\t// load race\n\tif ((eventdata!=null)&&(typeof(eventdata[\"race\"])))\n\t{\n\t\tif (raceindex+1<eventdata[\"race\"].length)\n\t\t{\n\t\t\tif (playtime+60 > (parseFloat(eventdata[\"race\"][raceindex+1][\"start_time\"])-parseFloat(eventdata[\"start_time\"])))\n\t\t\t{\n\t\t\t\tLoadRace(raceindex+1);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// update boats\n\tfor (var idx = 0; idx < boatsorder.Count; idx++)\n\t{\n\t\tvar boat : GameObject = boats[boatsorder[idx]];\n\t\tvar boatdatascript:boatdata = boat.GetComponent(boatdata); \n \t\t\n \t\tboatdatascript.RecalculatePosition(playtime);\n \t\t\t\n \t\tvar sailed:float = boatdatascript.routeCompletedDistance + boatdatascript.routeCompletedTotalDistance;\n\t \t\t\n\t \tif (sailed > firstboatsailed)\n\t \t{\n\t \t\tfirstboatindex = idx;\n\t \t\tfirstboatsailed = sailed;\n\t \t}\n\t} \n\t\n\tif (firstboatindex > -1)\n\t{\t\t\t\n\t\tif (firstline!=null)\n\t\t{\n\t\t\tvar firstboat : GameObject = boats[boatsorder[firstboatindex]];\n\t\t\tvar firstboatscript:boatdata = firstboat.GetComponent(boatdata); \n\t\t\t\n\t\t\tvar boatfront:GameObject = firstboat.transform.Find(\"container/front\").gameObject;\n\t\t\t\n\t\t\tif ((firstboatscript.routeIndex >=0)&&(firstboatscript.routeIndex<firstboatscript.route.length))\n\t\t\t{\n\t\t\t\tvar firstboatrouteitem = firstboatscript.GetRouteItem(firstboatscript.routeIndex);\n\t\t\t\t\n\t\t\t\tfirstline.active = true;\n\t\t\t\t//firstline.transform.position.x = boatfront.transform.position.x;\n\t\t\t\t//firstline.transform.position.z = boatfront.transform.position.z;\n\t\t\t\t\n\t\t\t\tfirstline.transform.position.x = firstboatscript.routePointX/2;\n\t\t\t\tfirstline.transform.position.z = firstboatscript.routePointY/2;\n\t\t\t\tfirstline.transform.localScale.z = firstboatscript.routeA/10;\n\t\t\t\n\t\t\t\tfirstline.transform.eulerAngles.y = 180-getdirection_between_points(firstboatrouteitem[\"v1\"].x,firstboatrouteitem[\"v1\"].y,firstboatrouteitem[\"v2\"].x,firstboatrouteitem[\"v2\"].y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfirstline.active = false;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (boats.Count>0)\n \t{\n\t \tvar navigator:GameObject = GameObject.Find(\"navigator\");\t\t\n \t \tnavigator.transform.position = Vector3.SmoothDamp(navigator.transform.position, boats[cameraboatindex].transform.position,velocity, 2.0f);\n\t\t//navigator.transform.position.z = Vector3.MoveTowards(navigator.transform.position.z, boats[cameraboatindex].transform.position.z, Time.deltaTime);\n\t\t\n\t}\n\t\n\t// wind update -- NUll value\n\t/*if (typeof(marker[\"wind\"]))\n\t{\n\t\tif (windindex<marker[\"wind\"].length)\n\t\t{\n\t\t\tvar wind:GameObject = GameObject.Find(\"navigator/wind\");\n\t\t\tif (wind) wind.transform.localRotation.eulerAngles.y = parseFloat(marker[\"wind\"][windindex][\"direction\"]);\n\t\t}\n\t\tif (windindex+1<marker[\"wind\"].length)\n\t\t{\n\t\t\tvar windtime = parseInt(marker[\"wind\"][windindex+1][\"time\"]);\n\t\t\tif (playtime > windtime) windindex = windindex + 1;\n\t\t\t//Debug.Log (windindex+\" \"+eventdata[\"wind\"].length+\" \"+playtime+\" \"+windtime);\n\t\t}\n\t}*/\n}", "function delayedStart(scene, obj){\r\n obj.isReady = true;\r\n //si n != 0 se inicial el descenso despues de 1000 steps\r\n if(n < 0 ||n > 0){\r\n obj.isReady = false;\r\n scene.time.addEvent({\r\n delay: 1000,\r\n callback: () => (initiateDescend(scene, obj))\r\n });\r\n //inicio del descenso\r\n function initiateDescend(scene, obj){\r\n //se inicializan las colisiones con ambos androides usando el plugin de colisiones\r\n const unsubscribe1 = scene.matterCollision.addOnCollideActive({\r\n objectA: scene.game.android1.mainBody,\r\n objectB: obj.sprite,\r\n callback: inflictDamage,\r\n context: scene.game.android1\r\n });\r\n const unsubscribe2 = scene.matterCollision.addOnCollideStart({\r\n objectA: scene.game.android2.mainBody,\r\n objectB: obj.sprite,\r\n callback: inflictDamage,\r\n context: scene.game.android2\r\n });\r\n //si cualquiera de los androides choca con Press se activa esta funcion que les daña\r\n function inflictDamage({ bodyA, bodyB, pair }){this.damaged(new Phaser.Math.Vector2(bodyA.gameObject.x-bodyB.gameObject.x, bodyA.gameObject.y-bodyB.gameObject.y), 90);}\r\n //velocidad del descenso\r\n obj.setStaticVelY(20);\r\n scene.time.addEvent({\r\n delay: 80,\r\n callback: () => (stop(scene, obj))\r\n });\r\n //Despues de 80 steps se para el descenso\r\n function stop(scene, obj){\r\n obj.setStaticVelY(0);\r\n scene.time.addEvent({\r\n delay: 500,\r\n callback: () => (initiateAsccend(scene, obj))\r\n });\r\n //Despues de 500 steps se inicia el ascenso\r\n function initiateAsccend(){\r\n //se quitan las colisionas dañinans con android1 / android2\r\n unsubscribe1();\r\n unsubscribe2();\r\n //velocidad de ascenso\r\n obj.setStaticVelY(-2.5);\r\n scene.time.addEvent({\r\n delay: 700,\r\n callback: () => (stop2(scene, obj))\r\n });\r\n //despues de 700 steps se para la apisonadora\r\n function stop2(){\r\n obj.sprite.setSensor(true)\r\n obj.setStaticVelY(0);\r\n //se reajusta su posicion\r\n obj.sprite.x = obj.initialX;\r\n obj.sprite.y = obj.initialY;\r\n //se vuelve a llamar a su metodo inicial con un delay de 200 steps pero con una n menor (hasta que n==0)\r\n scene.time.addEvent({\r\n delay: 2000,\r\n callback: () => (obj.startCycle(n-1, 0))\r\n });\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "function Snake() {\n this.x = 0;\n this.y = 0;\n this.xspeed = 1;\n this.yspeed = 0;\n this.total = 0;\n this.seg = [];\n this.score = 0;\n this.death = false;\n\n// this checks if the food has been eaten and counts score\n\n this.eat = function(pos) {\n var d = dist(this.x, this.y, pos.x, pos.y);\n if (d < 1) {\n this.total++;\n this.score++;\n return true;\n } else {\n return false;\n }\n }\n\n this.run = function(){\n this.update();\n this.show();\n }\n\n\n//this is the direction function for the snake\n\n this.dir = function(x, y) {\n this.xspeed = x;\n this.yspeed = y;\n }\n\n//this updates the segments of the rect\n\n this.update = function() {\n for (var i = 0; i < this.seg.length - 1; i++) {\n this.seg[i] = this.seg[i + 1];\n }\n if (this.total >= 1) {\n this.seg[this.total - 1] = createVector(this.x, this.y);\n }\n\n// multiplied by scale so will move on a grid\n\n this.x = this.x + this.xspeed * scl;\n this.y = this.y + this.yspeed * scl;\n\n this.x = constrain(this.x, 0, width - scl);\n this.y = constrain(this.y, 0, height - scl);\n }\n\n// adds the other segments\n//and renders the not head segments\n\n this.show = function() {\n fill(0,255,0);\n for (var i = 0; i < this.seg.length; i++) {\n rect(this.seg[i].x, this.seg[i].y, scl, scl);\n }\n\n image(img, this.x, this.y, scl, scl);\n\n\n }\n\n// this checks for death\n\n this.die = function() {\n for (var i = 0; i < this.seg.length; i++) {\n var pos = this.seg[i];\n var d = dist(this.x, this.y, pos.x, pos.y);\n if (d < 1) {\n fill(11, 226, 119);\n textSize(100);\n text(\"Game Over\",150,350);\n this.death = true;\n //causes error in program and freezes interval\n //asjdfkl;asjdf;jas\n\n }\n }\n }\n\n}", "undoStitch(){\n // console.log('undoStitch')\n this.content.css('left',0)\n this.getItems().slice(ITEM_ART_COUNT).remove()\n this.stitchedContent = undefined\n }", "function render() {\n\n var baseSegment = findSegment(position);\n var basePercent = Util.percentRemaining(position, segmentLength);\n var playerSegment = findSegment(position+playerZ);\n var playerPercent = Util.percentRemaining(position+playerZ, segmentLength);\n var playerY = Util.interpolate(playerSegment.p1.world.y, playerSegment.p2.world.y, playerPercent);\n var maxy = height;\n\n var x = 0;\n var dx = - (baseSegment.curve * basePercent);\n\n // Clear the canvas\n ctx.clearRect(0, 0, width, height);\n\n // Order the background layers\n if (currentBackground == 0) {\n // Build the list of positions in the image to extract the appropriate background\n // Depending on the current background, load as current the night or day version\n background_pos_cur = [BACKGROUND.SKY, BACKGROUND.HILLS, BACKGROUND.TREES];\n background_pos_next = [BACKGROUND.SKY2, BACKGROUND.HILLS2, BACKGROUND.TREES2];\n } else {\n background_pos_cur = [BACKGROUND.SKY2, BACKGROUND.HILLS2, BACKGROUND.TREES2];\n background_pos_next = [BACKGROUND.SKY, BACKGROUND.HILLS, BACKGROUND.TREES];\n }\n // Draw the background layers\n if (!changeBackgroundFlag) {\n // No switching, we draw one set of backgrounds\n Render.background(ctx, background, width, height, background_pos_cur[0], skyOffset, resolution * skySpeed * playerY, 1.0);\n Render.background(ctx, background, width, height, background_pos_cur[1], hillOffset, resolution * hillSpeed * playerY, 1.0);\n Render.background(ctx, background, width, height, background_pos_cur[2], treeOffset, resolution * treeSpeed * playerY, 1.0);\n } else {\n // else we are in the process of switching, do a progressive blending\n // continue the blending\n changeBackgroundCurrentAlpha += 0.01; // increase the alpha for one, and decrease for the next background set\n Render.background(ctx, background, width, height, background_pos_cur[0], skyOffset, resolution * skySpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_cur[1], hillOffset, resolution * hillSpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_cur[2], treeOffset, resolution * treeSpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[0], skyOffset, resolution * skySpeed * playerY, changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[1], hillOffset, resolution * hillSpeed * playerY, changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[2], treeOffset, resolution * treeSpeed * playerY, changeBackgroundCurrentAlpha);\n if (changeBackgroundCurrentAlpha >= 1.0) {\n // blending is done, disable the flags and reinit all related vars\n // Note: it is important to still do the drawing (and not put it in an if statement) because else the last drawing won't be done, there will be no background for a split-second and this will produce a flickering effect\n currentBackground = (currentBackground + 1) % 2\n changeBackgroundCurrentAlpha = 0.0;\n changeBackgroundFlag = false;\n }\n }\n\n var n, i, segment, car, sprite, spriteScale, spriteX, spriteY;\n\n for(n = 0 ; n < drawDistance ; n++) {\n\n segment = segments[(baseSegment.index + n) % segments.length];\n segment.looped = segment.index < baseSegment.index;\n segment.fog = Util.exponentialFog(n/drawDistance, fogDensity);\n segment.clip = maxy;\n\n Util.project(segment.p1, (playerX * roadWidth) - x, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n Util.project(segment.p2, (playerX * roadWidth) - x - dx, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n\n x = x + dx;\n dx = dx + segment.curve;\n\n if ((segment.p1.camera.z <= cameraDepth) || // behind us\n (segment.p2.screen.y >= segment.p1.screen.y) || // back face cull\n (segment.p2.screen.y >= maxy)) // clip by (already rendered) hill\n continue;\n\n Render.segment(ctx, width, lanes,\n segment.p1.screen.x,\n segment.p1.screen.y,\n segment.p1.screen.w,\n segment.p2.screen.x,\n segment.p2.screen.y,\n segment.p2.screen.w,\n segment.fog,\n segment.color);\n\n maxy = segment.p1.screen.y;\n }\n\n for(n = (drawDistance-1) ; n > 0 ; n--) {\n segment = segments[(baseSegment.index + n) % segments.length];\n\n for(i = 0 ; i < segment.cars.length ; i++) {\n car = segment.cars[i];\n sprite = car.sprite;\n spriteScale = Util.interpolate(segment.p1.screen.scale, segment.p2.screen.scale, car.percent);\n spriteX = Util.interpolate(segment.p1.screen.x, segment.p2.screen.x, car.percent) + (spriteScale * car.offset * roadWidth * width/2);\n spriteY = Util.interpolate(segment.p1.screen.y, segment.p2.screen.y, car.percent);\n Render.sprite(ctx, width, height, resolution, roadWidth, sprites, car.sprite, spriteScale, spriteX, spriteY, -0.5, -1, segment.clip);\n }\n\n for(i = 0 ; i < segment.sprites.length ; i++) {\n sprite = segment.sprites[i];\n spriteScale = segment.p1.screen.scale;\n spriteX = segment.p1.screen.x + (spriteScale * sprite.offset * roadWidth * width/2);\n spriteY = segment.p1.screen.y;\n Render.sprite(ctx, width, height, resolution, roadWidth, sprites, sprite.source, spriteScale, spriteX, spriteY, (sprite.offset < 0 ? -1 : 0), -1, segment.clip);\n }\n\n if (segment == playerSegment) {\n Render.player(ctx, width, height, resolution, roadWidth, sprites, speed/maxSpeed,\n cameraDepth/playerZ,\n width/2,\n (height/2) - (cameraDepth/playerZ * Util.interpolate(playerSegment.p1.camera.y, playerSegment.p2.camera.y, playerPercent) * height/2),\n speed * (keyLeft ? -1 : keyRight ? 1 : 0),\n playerSegment.p2.world.y - playerSegment.p1.world.y);\n }\n }\n\t\t\t\n // start horizon tilt\n if (enableTilt) {\n rotation=0;\n if (baseSegment.curve==0) {\n rotation=-currentRotation;\n currentRotation=0;\n } else {\n newrot = Math.round(baseSegment.curve*speed/maxSpeed*100)/100;\n rotation=newrot - currentRotation ;\n currentRotation = newrot ;\n }\n if (rotation!=0) {\n //ctx.save(); // doesn't help with moire problem\n ctx.translate(canvas.width/2,canvas.height/2);\n ctx.rotate(-rotation*(Math.PI/90));\n ctx.translate(-canvas.width/2,-canvas.height/2);\n //ctx.restore();\n }\n }\n\n // Draw \"Game Over\" screen\n if (gameOverFlag) {\n ctx.font = \"3em Arial\";\n ctx.fillStyle = \"magenta\";\n ctx.textAlign = \"center\";\n ctx.fillText(\"GAME OVER\", canvas.width/2, canvas.height/2);\n ctx.fillText(\"(refresh to restart)\", canvas.width/2, canvas.height/1.5);\n }\n }", "function manageEnrollmentsOnUpdateOrAdd(vm, params) {\n if (params.isRider) {\n //copy medical riders enrollments from category enrollments\n //the enrollments may be split among plans, but the totals should be the same\n if (params.isDenPlan && params.dualPlanPrimaryAlreadySelected) { \n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.updatedPlan, {subtractDO: params.preselectDirectOption}]);\n } else {\n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.updatedPlan]);\n }\n }\n if (params.isMedPlan) {\n if (params.singleMedStillSelected) {\n //map the category enrollments to the single new medical plan being added\n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.updatedPlan]);\n } else {\n //zero out enrollments for newly added medical plans in a multiple med plan scenario\n zeroEnrollments(params.updatedPlan);\n }\n }\n if (params.isDenPlan) {\n if (params.isDualDenPrimary) {\n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.updatedPlan, {subtractDO: params.preselectDirectOption}]);\n } else {\n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.updatedPlan]);\n }\n }\n}" ]
[ "0.5518453", "0.5355828", "0.53091747", "0.52961946", "0.5143724", "0.49183297", "0.48492965", "0.48300415", "0.4773072", "0.4710266", "0.46952787", "0.46507967", "0.4641206", "0.46408376", "0.4630528", "0.46270755", "0.46068397", "0.45652163", "0.4534271", "0.45284486", "0.4513366", "0.45024636", "0.44986016", "0.44804737", "0.44610405", "0.4450682", "0.44443008", "0.4444273", "0.44307995", "0.4428658", "0.44256598", "0.43873608", "0.43820554", "0.4375801", "0.43599537", "0.43578795", "0.43495575", "0.43495575", "0.43487057", "0.43414113", "0.43372756", "0.43304256", "0.43152642", "0.43147957", "0.43108436", "0.4309923", "0.43081817", "0.43052703", "0.43025544", "0.43002662", "0.42903775", "0.42891178", "0.42891178", "0.42869914", "0.42862603", "0.42762348", "0.4272778", "0.42664677", "0.4266444", "0.42656162", "0.4263964", "0.4253445", "0.42530674", "0.42512786", "0.42503947", "0.42245278", "0.4219404", "0.4217671", "0.4212399", "0.42097038", "0.42085648", "0.42076388", "0.42066613", "0.4199784", "0.41961136", "0.4193166", "0.4190585", "0.41899678", "0.41795492", "0.41743413", "0.4167984", "0.41644412", "0.41560033", "0.4155657", "0.41531873", "0.41526178", "0.41502112", "0.41461384", "0.41452616", "0.41435477", "0.41428798", "0.4142653", "0.41422477", "0.41370004", "0.41308564", "0.41307935", "0.41299418", "0.41292793", "0.41279182", "0.41268387", "0.41252512" ]
0.0
-1
play current segment with prePostRoll s pre and full postroll, exclude removed segments
function playWithoutDeletedFull() { playWithoutDeleted_helper(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playWithoutDeleted_helper(full) {\n full = full || false;\n clearEvents2();\n if (editor.splitData && editor.splitData.splits) {\n var splitItem = getCurrentSplitItem();\n\n if (splitItem != null) {\n pauseVideo();\n\n var clipStartFrom = -1;\n var clipStartTo = -1;\n var segmentStart = splitItem.clipBegin;\n var segmentEnd = splitItem.clipEnd;\n var clipEndFrom = -1;\n var clipEndTo = -1;\n var hasPrevElem = true;\n var hasNextElem = true;\n var duration = getDuration();\n\n // check previous item to be played, get start time\n if ((splitItem.id - 1) >= 0) {\n hasPrevElem = true;\n if ((splitItem.id - 1) >= 0) {\n var prevSplitItem = editor.splitData.splits[splitItem.id - 1];\n while (!prevSplitItem.enabled) {\n if ((prevSplitItem.id - 1) < 0) {\n hasPrevElem = false;\n break;\n } else {\n prevSplitItem = editor.splitData.splits[prevSplitItem.id - 1];\n }\n }\n } else {\n hasPrevElem = false;\n }\n if (hasPrevElem) {\n clipStartTo = prevSplitItem.clipEnd;\n clipStartFrom = clipStartTo - prePostRoll;\n }\n }\n if (hasPrevElem) {\n clipStartFrom = (clipStartFrom < 0) ? 0 : clipStartFrom;\n }\n\n if (full) {\n if ((splitItem.id + 1) < editor.splitData.splits.length) {\n hasNextElem = true;\n var nextSplitItem = editor.splitData.splits[splitItem.id + 1];\n while (!nextSplitItem.enabled) {\n if ((nextSplitItem.id + 1) >= editor.splitData.splits.length) {\n hasNextElem = false;\n break;\n } else {\n nextSplitItem = editor.splitData.splits[nextSplitItem.id + 1];\n }\n }\n if (hasNextElem) {\n clipEndFrom = nextSplitItem.clipBegin;\n clipEndTo = clipEndFrom + prePostRoll;\n }\n }\n if (hasNextElem) {\n clipEndTo = (clipEndTo > duration) ? duration : clipEndTo;\n }\n } else {\n clipEndFrom = -1;\n clipEndTo = -1;\n var splBP2 = splitItem.clipBegin + prePostRoll;\n segmentEnd = (splBP2 <= splitItem.clipEnd) ? splBP2 : splitItem.clipEnd;\n segmentEnd = (segmentEnd > duration) ? duration : segmentEnd;\n }\n\n ocUtils.log(\"Play Times: \" +\n clipStartFrom + \" - \" +\n clipStartTo + \" | \" +\n segmentStart + \" - \" +\n segmentEnd + \" | \" +\n clipEndFrom + \" - \" +\n clipEndTo);\n\n if (hasPrevElem && ((full && hasNextElem) || !full)) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n }, (clipStartTo - clipStartFrom) * 1000);\n\n if (full) {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout4 = window.setTimeout(function() {\n pauseVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout4 != null) {\n window.clearTimeout(timeout4);\n timeout4 = null;\n }\n }, ((clipStartTo - clipStartFrom) * 1000) + (segmentEnd * 1000));\n }\n } else if (!hasPrevElem && hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n\n if (full) {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipEndFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipEndTo - clipEndFrom) * 1000,\n endTime: clipEndTo\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, ((segmentEnd - segmentStart) * 1000));\n } else {\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n clearEvents();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (segmentEnd * 1000));\n }\n } else if (hasPrevElem && !hasNextElem) {\n currSplitItemClickedViaJQ = true;\n setCurrentTime(clipStartFrom);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (clipStartTo - clipStartFrom) * 1000,\n endTime: clipStartTo\n }, onPlay);\n\n playVideo();\n\n timeout3 = window.setTimeout(function() {\n pauseVideo();\n currSplitItemClickedViaJQ = true;\n setCurrentTime(segmentStart);\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n playVideo();\n if (timeout3 != null) {\n window.clearTimeout(timeout3);\n timeout3 = null;\n }\n }, (clipStartTo - clipStartFrom) * 1000);\n } else if (!hasPrevElem && !hasNextElem) {\n clearEvents();\n editor.player.on(\"play\", {\n duration: (segmentEnd - segmentStart) * 1000,\n endTime: segmentEnd\n }, onPlay);\n\n playVideo();\n }\n }\n }\n}", "function previousSegment() {\n if (editor.splitData && editor.splitData.splits) {\n var playerPaused = getPlayerPaused();\n if (!playerPaused) {\n pauseVideo();\n }\n var currSplitItem = getCurrentSplitItem();\n var new_id = currSplitItem.id - 1;\n new_id = (new_id < 0) ? (editor.splitData.splits.length - 1) : new_id;\n\n var idFound = true;\n if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) {\n idFound = false;\n }\n /*\n\telse if (!editor.splitData.splits[new_id].enabled) {\n idFound = false;\n new_id = (new_id <= 0) ? editor.splitData.splits.length : new_id;\n for (var i = new_id - 1; i >= 0; --i) {\n\n if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n }\n }\n }\n\t*/\n if (!idFound) {\n for (var i = editor.splitData.splits.length - 1; i >= 0; --i) {\n // if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n // }\n }\n }\n\n if (idFound) {\n selectSegmentListElement(new_id, !playerPaused);\n }\n if (!playerPaused) {\n playVideo();\n }\n }\n}", "function nextSegment() {\n if (editor.splitData && editor.splitData.splits) {\n var playerPaused = getPlayerPaused();\n if (!playerPaused) {\n pauseVideo();\n }\n\n var currSplitItem = getCurrentSplitItem();\n var new_id = currSplitItem.id + 1;\n\n new_id = (new_id >= editor.splitData.splits.length) ? 0 : new_id;\n\n var idFound = true;\n if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) {\n idFound = false;\n }\n /*\n\telse if (!editor.splitData.splits[new_id].enabled) {\n idFound = false;\n new_id = (new_id >= (editor.splitData.splits.length - 1)) ? 0 : new_id;\n\n for (var i = new_id + 1; i < editor.splitData.splits.length; ++i) {\n if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n }\n }\n }\n\t*/\n if (!idFound) {\n for (var i = 0; i < new_id; ++i) {\n // if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n // }\n }\n }\n\n if (idFound) {\n selectSegmentListElement(new_id, !playerPaused);\n }\n if (!playerPaused) {\n playVideo();\n }\n }\n}", "function playSqOfSegments(transcripts) {\n videoSrc = transcripts[counter]['src']\n inPoint = transcripts[counter]['inPoint']\n outPoint = transcripts[counter]['outPoint']\n playOneSegment(videoSrc, inPoint, outPoint)\n }", "slither() {\n // nextDir will be the NEW direction of the segment being processed in each iteration of the loop below\n let nextDir = this.getHead().direction;\n for ( let s of this.segments ) {\n // Update the segment's position to its next position\n s.gridPosition = s.nextPosition();\n\n const oldDir = s.direction; // Remember its current direction so we can use it as the next nextDir\n s.direction = nextDir; // Update the segment's direction to the nextDir (which was the previous segments direction)\n nextDir = oldDir; // Finally, set up nextDir for the next iteration\n }\n }", "clipEar(listofseg){\n\t\tlet copypoint = listofseg.map(function(e){\n\t\t\treturn e.a\n\t\t})\n\t\tfor (let i=0; i<listofseg.length;i++){\n\t\t\tlet sega = listofseg[i];\n\t\t\tlet segb;\n\t\t\tlet copy = copypoint.map((x=>x));\n\t\t\tif (i=== listofseg.length-1){\n\t\t\t\tsegb = listofseg[0]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsegb = listofseg[i+1]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t}\n\t\t\tlet notfound = true;\n\t\t\tfor (let j=0; j<copy.length;j++){\n\t\t\t\tif (this.checkTriangle(sega, segb, copy[j])){\n\t\t\t\t\tnotfound = false\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (notfound){\n\t\t\t\tthis.segList.push([sega, segb])\n\t\t\t\tif (i=== listofseg.length-1){\n\t\t\t\t\tlistofseg.pop();\n\t\t\t\t\tlistofseg.shift();\n\t\t\t\t\treturn listofseg.splice(0,0,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn listofseg.splice(i,2,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "async resumeCleaningSegments() {\n await this.sendCommand(\"resume_segment_clean\", [], {});\n }", "function okButtonClick() {\n if (!continueProcessing && checkClipBegin() && checkClipEnd()) {\n id = $('#splitUUID').val();\n if (id != \"\") {\n var current = editor.splitData.splits[id];\n var tmpBegin = parseFloat(current.clipBegin);\n var tmpEnd = parseFloat(current.clipEnd);\n var duration = getDuration();\n id = parseInt(id);\n if (getTimefieldTimeBegin() > getTimefieldTimeEnd()) {\n displayMsg(\"The inpoint is bigger than the outpoint. Please check and correct it.\",\n \"Check and correct inpoint and outpoint\");\n selectSegmentListElement(id);\n return;\n }\n\n if (checkPrevAndNext(id, true).ok) {\n if (editor.splitData && editor.splitData.splits) {\n current.clipBegin = getTimefieldTimeBegin();\n current.clipEnd = getTimefieldTimeEnd();\n if (id > 0) {\n if (current.clipBegin > editor.splitData.splits[id - 1].clipBegin) {\n editor.splitData.splits[id - 1].clipEnd = current.clipBegin;\n } else {\n displayMsg(\"The inpoint is bigger than the inpoint of the segment before this segment. Please check and correct it.\",\n \"Check and correct inpoint\");\n setTimefieldTimeBegin(editor.splitData.splits[id - 1].clipEnd);\n selectSegmentListElement(id);\n return;\n }\n }\n\n var last = editor.splitData.splits[editor.splitData.splits.length - 1];\n if (last.clipEnd < duration) {\n ocUtils.log(\"Inserting a last split element (auto): (\" + current.clipEnd + \" - \" + duration + \")\");\n var newLastItem = {\n clipBegin: parseFloat(last.clipEnd),\n clipEnd: parseFloat(duration),\n enabled: true\n };\n\n // add the new item to the end\n editor.splitData.splits.push(newLastItem);\n }\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n if (checkPrevAndNext(i, false).inserted) {\n i = 0;\n }\n }\n }\n\n editor.updateSplitList(true, !zoomedIn());\n $('#videoPlayer').focus();\n selectSegmentListElement(id);\n } else {\n current.clipBegin = tmpBegin;\n current.clipEnd = tmpEnd;\n selectSegmentListElement(id);\n }\n }\n } else {\n selectCurrentSplitItem();\n }\n}", "function subdivideSegments(eventQueue, subject, clipping, sbbox, cbbox, operation) {\n var sweepLine = new Tree(compareSegments);\n var sortedEvents = [];\n\n var rightbound = min(sbbox[2], cbbox[2]);\n\n var prev, next;\n\n while (eventQueue.length) {\n var event = eventQueue.pop();\n sortedEvents.push(event);\n\n // optimization by bboxes for intersection and difference goes here\n if ((operation === INTERSECTION && event.point[0] > rightbound) ||\n (operation === DIFFERENCE && event.point[0] > sbbox[2])) {\n break;\n }\n\n if (event.left) {\n sweepLine = sweepLine.insert(event);\n //_renderSweepLine(sweepLine, event.point, event);\n\n next = sweepLine.find(event);\n prev = sweepLine.find(event);\n event.iterator = sweepLine.find(event);\n\n if (prev.node !== sweepLine.begin) {\n prev.prev();\n } else {\n prev = sweepLine.begin;\n prev.prev();\n prev.next();\n }\n next.next();\n\n var prevEvent = (prev.key || null), prevprevEvent;\n computeFields(event, prevEvent, operation);\n if (next.node) {\n if (possibleIntersection(event, next.key, eventQueue) === 2) {\n computeFields(event, prevEvent, operation);\n computeFields(event, next.key, operation);\n }\n }\n\n if (prev.node) {\n if (possibleIntersection(prev.key, event, eventQueue) === 2) {\n var prevprev = sweepLine.find(prev.key);\n if (prevprev.node !== sweepLine.begin) {\n prevprev.prev();\n } else {\n prevprev = sweepLine.find(sweepLine.end);\n prevprev.next();\n }\n prevprevEvent = prevprev.key || null;\n computeFields(prevEvent, prevprevEvent, operation);\n computeFields(event, prevEvent, operation);\n }\n }\n } else {\n event = event.otherEvent;\n next = sweepLine.find(event);\n prev = sweepLine.find(event);\n\n // _renderSweepLine(sweepLine, event.otherEvent.point, event);\n\n if (!(prev && next)) continue;\n\n if (prev.node !== sweepLine.begin) {\n prev.prev();\n } else {\n prev = sweepLine.begin;\n prev.prev();\n prev.next();\n }\n next.next();\n sweepLine = sweepLine.remove(event);\n\n // _renderSweepLine(sweepLine, event.otherEvent.point, event);\n\n if (next.node && prev.node) {\n if (typeof prev.node.value !== 'undefined' && typeof next.node.value !== 'undefined') {\n possibleIntersection(prev.key, next.key, eventQueue);\n }\n }\n }\n }\n return sortedEvents;\n}", "resetSegments() {\n var i;\n for(i = 0; i < this.numSegments; i ++ ){\n this.segmentGenerated[i] = segmentStatus.NOT_GENERATED;\n }\n }", "componentWillReceiveProps(nextProps) {\n const {initialText, segments} = nextProps.currentStory;\n\n //Create pages array that will contain story pages - first page contains initialText and 2 segments\n //Keep only the segments that were accepted in voting\n let pagesArray = [];\n let segmentsCopy = segments.filter(val => val.status === 'accepted');\n pagesArray[0] = [{content: initialText}, segmentsCopy[0], segmentsCopy[1]];\n\n //Remove first two segments that were used in first page, and create pages (3 segments or less per page)\n //Note: optimal number of segments per page has not been decided yet\n segmentsCopy = segmentsCopy.slice(2);\n while (segmentsCopy.length) {\n var newPage = segmentsCopy.splice(0,3);\n pagesArray.push(newPage);\n }\n\n this.setState({\n ...this.state,\n currentStory: nextProps.currentStory,\n pages: pagesArray,\n error: nextProps.error\n });\n }", "function playOneSegment(videoSrc, inPoint, outPoint) {\n video.src = videoSrc\n video.load\n video.currentTime = inPoint\n video.play()\n video.ontimeupdate = function () {\n stopAtOutPoint()\n }\n counter += 1\n }", "resetMainLoaderReplaceSegments() {\n const buffered = this.tech_.buffered();\n const bufferedEnd = buffered.end(buffered.length - 1);\n\n // Set the replace segments flag to the buffered end, this forces fetchAtBuffer\n // on the main loader to remain, false after the resetLoader call, until we have\n // replaced all content buffered ahead of the currentTime.\n this.mainSegmentLoader_.replaceSegmentsUntil = bufferedEnd;\n this.mainSegmentLoader_.resetLoaderProperties();\n this.mainSegmentLoader_.resetLoader();\n }", "function checkPrevAndNext(id, checkTimefields) {\n if (!continueProcessing) {\n checkTimefields = checkTimefields || false;\n var inserted = false;\n if (editor.splitData && editor.splitData.splits) {\n var duration = getDuration();\n var current = editor.splitData.splits[id];\n // new first item\n if (id == 0) {\n var clipBegin = parseFloat(current.clipBegin);\n var clipEnd = parseFloat(current.clipEnd);\n\n if (editor.splitData.splits.length > 1) {\n var next = editor.splitData.splits[1];\n next.clipBegin = clipEnd;\n }\n if ((!checkTimefields || (checkTimefields && (getTimefieldTimeBegin() != 0))) && (clipBegin > minSegmentLength)) {\n ocUtils.log(\"Inserting a first split element (cpan - auto): (\" + 0 + \" - \" + clipBegin + \")\");\n var newSplitItem = {\n clipBegin: 0,\n clipEnd: clipBegin,\n enabled: true\n };\n inserted = true;\n\n // add new item to front\n editor.splitData.splits.splice(0, 0, newSplitItem);\n insertedFirstItem = true;\n } else if (clipBegin > 0) {\n ocUtils.log(\"Extending the first split element to (cpan - auto): (\" + 0 + \" - \" + clipEnd + \")\");\n current.clipBegin = 0;\n }\n }\n // new last item\n else if ((editor.splitData.splits.length > 0) && (id == editor.splitData.splits.length - 1)) {\n if ((!checkTimefields || (checkTimefields && (getTimefieldTimeEnd() != duration))) && (current.clipEnd < (duration - minSegmentLength))) {\n ocUtils.log(\"Inserting a last split element (cpan - auto): (\" + current.clipEnd + \" - \" + duration + \")\");\n var newLastItem = {\n clipBegin: parseFloat(current.clipEnd),\n clipEnd: parseFloat(duration),\n enabled: true\n };\n inserted = true;\n\n // add the new item to the end\n editor.splitData.splits.push(newLastItem);\n var prev = editor.splitData.splits[id - 1];\n prev.clipEnd = parseFloat(current.clipBegin);\n insertedLastItem = true;\n } else {\n ocUtils.log(\"Extending the last split element to (cpan - auto): (\" + current.clipBegin + \" - \" + duration + \")\");\n current.clipEnd = parseFloat(duration);\n }\n }\n // in the middle\n else if ((id > 0) && (id < (editor.splitData.splits.length - 1))) {\n var prev = editor.splitData.splits[id - 1];\n var next = editor.splitData.splits[id + 1];\n\n if (checkTimefields && (getTimefieldTimeBegin() <= prev.clipBegin)) {\n displayMsg(\"The inpoint is lower than the begin of the last segment. Please check.\",\n \"Check inpoint\");\n return {\n ok: false,\n inserted: false\n };\n }\n if (checkTimefields && (getTimefieldTimeEnd() >= next.clipEnd)) {\n displayMsg(\"The outpoint is bigger than the end of the next segment. Please check.\",\n \"Check outpoint\");\n return {\n ok: false,\n inserted: false\n };\n }\n\n prev.clipEnd = parseFloat(current.clipBegin);\n next.clipBegin = parseFloat(current.clipEnd);\n }\n }\n return {\n ok: true,\n inserted: inserted\n };\n }\n}", "didSwitchToSegmentsLayout() {\n this.controllerState.viewMode = ViewMode.segments;\n this.didSwitchLayout();\n }", "_mayHotReloadSegments() {\n this._allowOverwriteSegment = {};\n var segmentName;\n for (segmentName in this._segments) {\n if (!this._segments.hasOwnProperty(segmentName)) continue;\n this._allowOverwriteSegment[segmentName] = true;\n }\n }", "function pageleft(e) {\n setMedia();\n if (media.currentTime > trjs.dmz.winsize())\n media.currentTime = media.currentTime - (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n else\n media.currentTime = 0;\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "onCodePathSegmentStart(segment) {\n const info = {\n uselessContinues: getUselessContinues([], segment.allPrevSegments),\n returned: false\n };\n\n // Stores the info.\n segmentInfoMap.set(segment, info);\n }", "function LateUpdate()\n{\n\tif(!updated)\n\t{\n\t\treturn;\n\t}\n\tupdated = false;\n\t\n\tvar mesh : Mesh = GetComponent(MeshFilter).mesh;\n\tmesh.Clear();\n\tvar segmentCount : int = 0;\n\tfor(var j : int = 0; j < numMarks && j < maxMarks; j++)\n\t\tif(skidmarks[j].lastIndex != -1 && skidmarks[j].lastIndex > numMarks - maxMarks)\n\t\t\tsegmentCount++;\n\t\n\tvar vertices : Vector3[] = new Vector3[segmentCount * 4];\n\tvar normals : Vector3[] = new Vector3[segmentCount * 4];\n\tvar tangents : Vector4[] = new Vector4[segmentCount * 4];\n\tvar colors : Color[] = new Color[segmentCount * 4];\n\tvar uvs : Vector2[] = new Vector2[segmentCount * 4];\n\tvar triangles : int[] = new int[segmentCount * 6];\n\tsegmentCount = 0; \n\t \n\tfor(var i : int = 0; i < numMarks && i < maxMarks; i++)\n\t\tif(skidmarks[i].lastIndex != -1 && skidmarks[i].lastIndex > numMarks - maxMarks)\n\t\t{\n\t\t\tvar curr : markSection = skidmarks[i];\n\t\t\tvar last : markSection = skidmarks[curr.lastIndex % maxMarks];\n\t\t\tvertices[segmentCount * 4 + 0] = last.posl;\n\t\t\tvertices[segmentCount * 4 + 1] = last.posr;\n\t\t\tvertices[segmentCount * 4 + 2] = curr.posl;\n\t\t\tvertices[segmentCount * 4 + 3] = curr.posr;\n\t\t\t\n\t\t\tnormals[segmentCount * 4 + 0] = last.normal;\n\t\t\tnormals[segmentCount * 4 + 1] = last.normal;\n\t\t\tnormals[segmentCount * 4 + 2] = curr.normal;\n\t\t\tnormals[segmentCount * 4 + 3] = curr.normal;\n\n\t\t\ttangents[segmentCount * 4 + 0] = last.tangent;\n\t\t\ttangents[segmentCount * 4 + 1] = last.tangent;\n\t\t\ttangents[segmentCount * 4 + 2] = curr.tangent; \n\t\t\ttangents[segmentCount * 4 + 3] = curr.tangent;\n\t\t\t\n\t\t\tcolors[segmentCount * 4 + 0] = new Color(0, 0, 0, last.intensity * skidmarkIntensity);\n\t\t\tcolors[segmentCount * 4 + 1] = new Color(0, 0, 0, last.intensity * skidmarkIntensity);\n\t\t\tcolors[segmentCount * 4 + 2] = new Color(0, 0, 0, curr.intensity * skidmarkIntensity); \n\t\t\tcolors[segmentCount * 4 + 3 ]= new Color(0, 0, 0, curr.intensity * skidmarkIntensity); \n\n\t\t\tuvs[segmentCount * 4 + 0] = new Vector2(0, 0);\n\t\t\tuvs[segmentCount * 4 + 1] = new Vector2(1, 0);\n\t\t\tuvs[segmentCount * 4 + 2] = new Vector2(0, 1);\n\t\t\tuvs[segmentCount * 4 + 3] = new Vector2(1, 1);\n\t\t\t\n\t\t\ttriangles[segmentCount * 6 + 0] = segmentCount * 4 + 0;\n\t\t\ttriangles[segmentCount * 6 + 2] = segmentCount * 4 + 1;\n\t\t\ttriangles[segmentCount * 6 + 1] = segmentCount * 4 + 2;\n\t\t\t\n\t\t\ttriangles[segmentCount * 6 + 3] = segmentCount * 4 + 2;\n\t\t\ttriangles[segmentCount * 6 + 5] = segmentCount * 4 + 1;\n\t\t\ttriangles[segmentCount * 6 + 4] = segmentCount * 4 + 3;\n\t\t\tsegmentCount++;\t\t\t\n\t\t}\n\t\tmesh.vertices = vertices; \n\t\tmesh.normals = normals;\n\t\tmesh.tangents = tangents;\n\t\tmesh.triangles = triangles;\n\t\tmesh.colors =colors;\n\t\tmesh.uv = uvs; \n}", "function SnakeSegment() {\n\tthis.draw = function(bIsHead) { // implement the earlier absctract function\n\t\t//this.context.rect(this.x, this.y, 25, 25);\n\t\tif (bIsHead == true){\n\t\t\tthis.context.fillStyle=HEADCOLOUR;\n\t\t} else {\n\t\t\tthis.context.fillStyle=BODYCOLOUR;\n\t\t}\n\t\t\n\t\tthis.context.fillRect((this.x * game.grid.blockSize) + 1 , (this.y * game.grid.blockSize) + 1, game.grid.blockSize - 2, game.grid.blockSize - 2);\n\t}\n\n\tthis.clear = function () {\n\t\tthis.context.clearRect(this.x * game.grid.blockSize, this.y * game.grid.blockSize, game.grid.blockSize, game.grid.blockSize);\n\t}\n}", "removeSegmentsIntersections(tunnels, isWalls) {\n const walls = this.walls;\n let startWallsLength = 0;\n let newWallsAmount = walls.length - startWallsLength;\n\n while (newWallsAmount > 0) {\n startWallsLength = walls.length;\n for (let j = 0; j < walls.length; j += 4) {\n for (let i = 0; i < (isWalls ? j : tunnels.length); i += 4) {\n const pieces = this.resolveSegmentSegment(\n tunnels[i], tunnels[i + 1], tunnels[i + 2], tunnels[i + 3],\n walls[j], walls[j + 1], walls[j + 2], walls[j + 3]\n );\n if (pieces.length < 4) { // empty walls will be removed in removeZeroLengthWalls()\n walls[j] = 0;\n walls[j + 1] = 0;\n walls[j + 2] = 0;\n walls[j + 3] = 0;\n } else {\n walls[j] = pieces[0];\n walls[j + 1] = pieces[1];\n walls[j + 2] = pieces[2];\n walls[j + 3] = pieces[3];\n\n if (pieces.length > 4) {\n walls.push(pieces[4]);\n walls.push(pieces[5]);\n walls.push(pieces[6]);\n walls.push(pieces[7]);\n }\n }\n }\n }\n newWallsAmount = walls.length - startWallsLength;\n }\n }", "function skip() {\n game.cutScene.style.display = 'none';\n game.soundInstance.stop();\n // TODO: stop and unload cut scene animation\n}", "function pageright(e) {\n setMedia();\n media.currentTime = media.currentTime + (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function selectSegments() {\n var peaks = wavesurfer.backend.peaks;\n var length = peaks.length;\n var duration = wavesurfer.getDuration();\n\n var start = 0;\n var min = 0.001;\n for (var i = start; i < length; i += 1) {\n if (peaks[i] <= min && i > start + (1 / duration) * length) {\n var color = [\n ~~(Math.random() * 255),\n ~~(Math.random() * 255),\n ~~(Math.random() * 255),\n 0.1\n ];\n wavesurfer.addRegion({\n color: 'rgba(' + color + ')',\n start: (start / length) * duration,\n end: (i / length) * duration\n });\n while (peaks[i] <= min) {\n i += 1;\n }\n start = i;\n }\n }\n}", "async addClip(_, { post_id, user_id }) {\n console.log('addClip');\n console.log(post_id);\n console.log(user_id);\n var alreadyClipped = false;\n db.collection('users')\n .doc(user_id)\n .get()\n .then((doc) => {\n for (const clip in doc.data().clips) {\n //Checks if the user has already clipped the post\n if (doc.data().clips[clip] == post_id) {\n alreadyClipped = true;\n }\n }\n\n // If the user hasnt clipped the post then clip it else unclip it\n if (!alreadyClipped) {\n db.collection('posts')\n .doc(post_id)\n .update({\n clips: firebase.firestore.FieldValue.increment(1),\n });\n db.collection('users')\n .doc(user_id)\n .update({\n clips: firebase.firestore.FieldValue.arrayUnion(post_id),\n });\n } else {\n db.collection('posts')\n .doc(post_id)\n .update({\n clips: firebase.firestore.FieldValue.increment(-1),\n });\n db.collection('users')\n .doc(user_id)\n .update({\n clips: firebase.firestore.FieldValue.arrayRemove(post_id),\n });\n }\n });\n }", "function splitButtonClick() {\n if (!continueProcessing && editor.splitData && editor.splitData.splits) {\n var currentTime = getCurrentTime();\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n var splitItem = editor.splitData.splits[i];\n\n splitItem.clipBegin = parseFloat(splitItem.clipBegin);\n splitItem.clipEnd = parseFloat(splitItem.clipEnd);\n if ((splitItem.clipBegin < currentTime) && (currentTime < splitItem.clipEnd)) {\n newEnd = 0;\n if (editor.splitData.splits.length == (i + 1)) {\n newEnd = splitItem.clipEnd;\n } else {\n newEnd = editor.splitData.splits[i + 1].clipBegin;\n }\n var newItem = {\n clipBegin: parseFloat(currentTime),\n clipEnd: parseFloat(newEnd),\n enabled: true\n }\n\n splitItem.clipEnd = currentTime;\n editor.splitData.splits.splice(i + 1, 0, newItem);\n // TODO Make splitSegments clickable when zoomed in\n editor.updateSplitList(false, !zoomedIn());\n selectSegmentListElement(i + 1);\n return;\n }\n }\n }\n selectCurrentSplitItem();\n}", "function preRun(){\n console.log(\"preRun: Begin\")\n\n console.log(\"preRun: End\")\n\n}", "process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n this.sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n }", "function jumpToSegment() {\n if (editor.splitData && editor.splitData.splits) {\n id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n\n setCurrentTime(editor.splitData.splits[id].clipBegin);\n }\n}", "if (!this.History.inProgress()) {\n this.objects.all()\n .filter(obj => obj.name !== 'groundPlane')\n .forEach(obj => { this.scene.remove(obj) });\n }", "function export_segmentation_plys(segments, opts) {\n var plyExporter = opts.plyExporter;\n var labelRemap = opts.labelRemap;\n var callback = opts.callback;\n var categoryColorIndex = opts.categoryColorIndex;\n var basename = opts.basename;\n var unlabeledColor = new THREE.Color(STK.Constants.defaultPalette.colors[0]);\n\n // colorSegments takes in three parameters: labelToIndex mapping, getLabelFn, getMaterialFn\n // Slightly weird, but segment attribute are set after coloring\n segments.colorSegments('Category', categoryColorIndex, mapCategoryFn);\n var nyu40Labels = labelRemap? labelRemap.getLabelSet('nyu40') : null;\n var mpr40Labels = labelRemap? labelRemap.getLabelSet('mpr40') : null;\n if (nyu40Labels) {\n segments.colorSegments('NYU40', nyu40Labels.labelToId, nyu40Labels.rawLabelToLabel, nyu40Labels.getMaterial, nyu40Labels.unlabeledId);\n }\n if (mpr40Labels) {\n segments.colorSegments('mpr40', mpr40Labels.labelToId, mpr40Labels.rawLabelToLabel, mpr40Labels.getMaterial, mpr40Labels.unlabeledId);\n }\n var objColorIndex = segments.colorSegments('Object', {'unknown': 0});\n\n async.series([\n function (cb) {\n //segments.setMaterialVertexColors(THREE.VertexColors);\n segments.colorRawSegmentsOriginal();\n segments.export(plyExporter, basename + '.annotated', cb);\n },\n function (cb) {\n //segments.setMaterialVertexColors(THREE.NoColors);\n segments.colorRawSegments(unlabeledColor);\n segments.colorSegments('Category', categoryColorIndex, mapCategoryFn);\n segments.export(plyExporter, basename + '.categories.annotated', cb);\n },\n function (cb) {\n // Map from Category to NYU40 and export\n if (nyu40Labels) {\n segments.colorRawSegments(nyu40Labels.unlabeledColor);\n segments.colorSegments('NYU40', nyu40Labels.labelToId, nyu40Labels.rawLabelToLabel, nyu40Labels.getMaterial, nyu40Labels.unlabeledId);\n segments.export(plyExporter, basename + '.nyu40.annotated', cb);\n } else {\n setTimeout(cb, 0);\n }\n },\n function (cb) {\n // Map from Category to MPR40 and export\n if (mpr40Labels) {\n segments.colorRawSegments(mpr40Labels.unlabeledColor);\n segments.colorSegments('mpr40', mpr40Labels.labelToId, mpr40Labels.rawLabelToLabel, mpr40Labels.getMaterial, mpr40Labels.unlabeledId);\n segments.export(plyExporter, basename + '.mpr40.annotated', cb);\n } else {\n setTimeout(cb, 0);\n }\n },\n function (cb) {\n segments.colorRawSegments(unlabeledColor);\n segments.colorSegments('Object', objColorIndex);\n segments.export(plyExporter, basename + '.instances.annotated', cb);\n }\n ], callback);\n}", "function preDiv(){\n plusDivs(-1);\n}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [], clip = [], i, n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n for ((i = 0, n = clip.length); i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n var start = subject[0], points, point;\n while (1) {\n // Find first unvisited intersection.\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for ((i = 0, n = points.length); i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function barra() {\n var contenedor = document.getElementsByClassName(\"barraSlider\")[0];\n var control = document.getElementsByClassName(\"controlBarraSlider\")[0];\n var activo = false;\n var xInicio = 0;\n var limite = (document.getElementsByClassName(\"lineaBarraSlider\")[0].offsetWidth) - document.getElementsByClassName(\"controlBarraSlider\")[0].offsetWidth;\n var banderaSegmentos = 0;\n var banderaSegmentosFin = 0;\n var contadorSegmentos = 1;\n\n //eventos para interactuar con el drag\n contenedor.addEventListener(\"touchstart\", dragStart, false);\n contenedor.addEventListener(\"touchend\", dragEnd, false);\n contenedor.addEventListener(\"touchmove\", drag, false);\n contenedor.addEventListener(\"mousedown\", dragStart, false);\n contenedor.addEventListener(\"mouseup\", dragEnd, false);\n contenedor.addEventListener(\"mousemove\", drag, false);\n\n //inicia el drag\n function dragStart(e) {\n if (e.type === \"touchstart\") {\n xInicio = e.touches[0].clientX - xOffset;\n } else {\n xInicio = e.clientX - xOffset;\n }\n\n if (e.target === control) {\n activo = true;\n }\n }\n\n //termina el drag\n function dragEnd() {\n xInicio = xActual;\n activo = false;\n }\n\n //en el momento que se esta haciendo el drag\n function drag(e) {\n if (activo) {\n \n e.preventDefault();\n if (e.type === \"touchmove\") {\n if (xActual <= limite && xActual >= 0) {\n xActual = e.touches[0].clientX - xInicio;\n } else {\n if (xActual >= limite) {\n xActual = limite;\n } else if(xActual <= 0) {\n xActual = 0;\n }\n }\n if (xActual > limite) {\n xActual = limite;\n } else if (xActual <= 0) {\n xActual = 0;\n }\n\n } else {\n if (xActual <= limite && xActual >= 0) {\n xActual = e.clientX - xInicio;\n\n } else {\n if (xActual >= limite) {\n xActual = limite;\n } else if (xActual <= 0) {\n xActual = 0;\n }\n }\n\n }\n xOffset = xActual;\n\n actualizarPosicion(xActual, control);\n }\n }\n\n function actualizarPosicion(posicionX, elemento) {\n elemento.style.transform = \"translate3d(\" + posicionX + \"px,\" + 0 + \"px, 0)\";\n calcularMovimientos(posicionX);\n }\n\n //esto se usa en calcularMovimientos();\n var limites = [];\n for (var i = 0; i < cantidadElementos; i++) {\n limites.push(Math.round(segmento * (i + 1))); \n }\n\n var banderaFor = 0;\n function calcularMovimientos(posicionX) {\n\n //segmento, es el espacio asignado dentro de la barra de control para cada slide \n if (posicionX < (segmento * contadorSegmentos) && posicionX >= (segmento * banderaSegmentos)) {\n } else {\n if (posicionX > (segmento * contadorSegmentos)) {\n\n contadorSegmentos = contadorSegmentos + 1;\n banderaSegmentos = banderaSegmentos + 1; \n controles(\"derechaSlider\", 1, \"slide\");\n } else {\n\n contadorSegmentos = contadorSegmentos - 1;\n banderaSegmentos = banderaSegmentos - 1;\n controles(\"izquierdaSlider\", 1, \"slide\");\n\n } \n }\n\n }\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function tmsavePhase()\n{\n NProgress.start();\n var preNoSegment = 0;\n $.post(domainUrl + 'process/saveTimeLine', {'data': $(\"#timeline_form\").serialize(), }, responceEventStatus, 'html');\n}", "function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n\t var prevX;\n\t var prevY;\n\t var cpx0;\n\t var cpy0;\n\t var cpx1;\n\t var cpy1;\n\t var idx = start;\n\t var k = 0;\n\t\n\t for (; k < segLen; k++) {\n\t var x = points[idx * 2];\n\t var y = points[idx * 2 + 1];\n\t\n\t if (idx >= allLen || idx < 0) {\n\t break;\n\t }\n\t\n\t if (isPointNull(x, y)) {\n\t if (connectNulls) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t break;\n\t }\n\t\n\t if (idx === start) {\n\t ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n\t cpx0 = x;\n\t cpy0 = y;\n\t } else {\n\t var dx = x - prevX;\n\t var dy = y - prevY; // Ignore tiny segment.\n\t\n\t if (dx * dx + dy * dy < 0.5) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t if (smooth > 0) {\n\t var nextIdx = idx + dir;\n\t var nextX = points[nextIdx * 2];\n\t var nextY = points[nextIdx * 2 + 1];\n\t var tmpK = k + 1;\n\t\n\t if (connectNulls) {\n\t // Find next point not null\n\t while (isPointNull(nextX, nextY) && tmpK < segLen) {\n\t tmpK++;\n\t nextIdx += dir;\n\t nextX = points[nextIdx * 2];\n\t nextY = points[nextIdx * 2 + 1];\n\t }\n\t }\n\t\n\t var ratioNextSeg = 0.5;\n\t var vx = 0;\n\t var vy = 0;\n\t var nextCpx0 = void 0;\n\t var nextCpy0 = void 0; // Is last point\n\t\n\t if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n\t cpx1 = x;\n\t cpy1 = y;\n\t } else {\n\t vx = nextX - prevX;\n\t vy = nextY - prevY;\n\t var dx0 = x - prevX;\n\t var dx1 = nextX - x;\n\t var dy0 = y - prevY;\n\t var dy1 = nextY - y;\n\t var lenPrevSeg = void 0;\n\t var lenNextSeg = void 0;\n\t\n\t if (smoothMonotone === 'x') {\n\t lenPrevSeg = Math.abs(dx0);\n\t lenNextSeg = Math.abs(dx1);\n\t cpx1 = x - lenPrevSeg * smooth;\n\t cpy1 = y;\n\t nextCpx0 = x + lenPrevSeg * smooth;\n\t nextCpy0 = y;\n\t } else if (smoothMonotone === 'y') {\n\t lenPrevSeg = Math.abs(dy0);\n\t lenNextSeg = Math.abs(dy1);\n\t cpx1 = x;\n\t cpy1 = y - lenPrevSeg * smooth;\n\t nextCpx0 = x;\n\t nextCpy0 = y + lenPrevSeg * smooth;\n\t } else {\n\t lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n\t lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\t\n\t ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n\t cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n\t cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\t\n\t nextCpx0 = x + vx * smooth * ratioNextSeg;\n\t nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t nextCpx0 = mathMin$5(nextCpx0, mathMax$5(nextX, x));\n\t nextCpy0 = mathMin$5(nextCpy0, mathMax$5(nextY, y));\n\t nextCpx0 = mathMax$5(nextCpx0, mathMin$5(nextX, x));\n\t nextCpy0 = mathMax$5(nextCpy0, mathMin$5(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\t\n\t vx = nextCpx0 - x;\n\t vy = nextCpy0 - y;\n\t cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n\t cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t cpx1 = mathMin$5(cpx1, mathMax$5(prevX, x));\n\t cpy1 = mathMin$5(cpy1, mathMax$5(prevY, y));\n\t cpx1 = mathMax$5(cpx1, mathMin$5(prevX, x));\n\t cpy1 = mathMax$5(cpy1, mathMin$5(prevY, y)); // Adjust next cp0 again.\n\t\n\t vx = x - cpx1;\n\t vy = y - cpy1;\n\t nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n\t nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n\t }\n\t }\n\t\n\t ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n\t cpx0 = nextCpx0;\n\t cpy0 = nextCpy0;\n\t } else {\n\t ctx.lineTo(x, y);\n\t }\n\t }\n\t\n\t prevX = x;\n\t prevY = y;\n\t idx += dir;\n\t }\n\t\n\t return k;\n\t }", "function _default(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n,\n p0 = segment[0],\n p1 = segment[n],\n x;\n\n if ((0, _pointEqual.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n\n stream.lineEnd();\n return;\n } // handle degenerate cases by moving the point\n\n\n p1[0] += 2 * _math.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n\n while (current.v) if ((current = current.n) === start) return;\n\n points = current.z;\n stream.lineStart();\n\n do {\n current.v = current.o.v = true;\n\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n\n current = current.p;\n }\n\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n\n stream.lineEnd();\n }\n}", "function inSegment(xP, yP) {\r\n }", "function onAudioPositionChanged(position, from, skipping) { //noLetPlay\n\n audioCurrentTime = position;\n\n// if (_letPlay)\n// {\n// return;\n// }\n\n _skipAudioEnded = false;\n// _skipTTSEnded = false;\n\n if (!_smilIterator || !_smilIterator.currentPar)\n {\n return;\n }\n\n var parFrom = _smilIterator.currentPar;\n \n var audio = _smilIterator.currentPar.audio;\n\n //var TOLERANCE = 0.05;\n if(\n //position >= (audio.clipBegin - TOLERANCE) &&\n position > DIRECTION_MARK &&\n position <= audio.clipEnd) {\n\n//console.debug(\"onAudioPositionChanged: \" + position);\n return;\n }\n\n _skipAudioEnded = true;\n\n//console.debug(\"PLAY NEXT: \" + \"(\" + audio.clipBegin + \" -- \" + audio.clipEnd + \") [\" + from + \"] \" + position);\n//console.debug(_smilIterator.currentPar.text.srcFragmentId);\n\n var isPlaying = _audioPlayer.isPlaying();\n if (isPlaying && from === 6)\n {\n console.debug(\"from userNav _audioPlayer.isPlaying() ???\");\n }\n\n var goNext = position > audio.clipEnd;\n\n var doNotNextSmil = !_autoNextSmil && from !== 6 && goNext;\n\n var spineItemIdRef = (_smilIterator && _smilIterator.smil && _smilIterator.smil.spineItemId) ? _smilIterator.smil.spineItemId : ((_lastPaginationData && _lastPaginationData.spineItem && _lastPaginationData.spineItem.idref) ? _lastPaginationData.spineItem.idref : undefined);\n if (doNotNextSmil && spineItemIdRef && _lastPaginationData && _lastPaginationData.paginationInfo && _lastPaginationData.paginationInfo.openPages && _lastPaginationData.paginationInfo.openPages.length > 1)\n {\n //var iPage = _lastPaginationData.paginationInfo.isRightToLeft ? _lastPaginationData.paginationInfo.openPages.length - 1 : 0;\n var iPage = 0;\n \n var openPage = _lastPaginationData.paginationInfo.openPages[iPage];\n if (spineItemIdRef === openPage.idref)\n {\n doNotNextSmil = false;\n }\n }\n \n if (goNext)\n {\n _smilIterator.next();\n }\n else //position <= DIRECTION_MARK\n {\n _smilIterator.previous();\n }\n\n if(!_smilIterator.currentPar)\n {\n //\n // if (!noLetPlay)\n // {\n // _letPlay = true;\n // setTimeout(function()\n // {\n // _letPlay = false;\n // nextSmil(goNext);\n // }, 200);\n // }\n // else\n // {\n // nextSmil(goNext);\n // }\n\n//console.debug(\"NEXT SMIL ON AUDIO POS\");\n \n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n return;\n }\n\n//console.debug(\"ITER: \" + _smilIterator.currentPar.text.srcFragmentId);\n\n if(!_smilIterator.currentPar.audio) {\n self.pause();\n return;\n }\n \n if(_settings.mediaOverlaysSkipSkippables)\n {\n var skip = false;\n var parent = _smilIterator.currentPar;\n while (parent)\n {\n if (parent.isSkippable && parent.isSkippable(_settings.mediaOverlaysSkippables))\n {\n skip = true;\n break;\n }\n parent = parent.parent;\n }\n\n if (skip)\n {\n console.log(\"MO SKIP: \" + parent.epubtype);\n\n self.pause();\n\n var pos = goNext ? _smilIterator.currentPar.audio.clipEnd + 0.1 : DIRECTION_MARK - 1;\n\n onAudioPositionChanged(pos, from, true); //noLetPlay\n return;\n }\n }\n\n // _settings.mediaOverlaysSynchronizationGranularity\n if (!isPlaying && (_smilIterator.currentPar.element || _smilIterator.currentPar.cfi && _smilIterator.currentPar.cfi.cfiTextParent))\n {\n var scopeTo = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (scopeTo && scopeTo !== _smilIterator.currentPar)\n {\n var scopeFrom = _elementHighlighter.adjustParToSeqSyncGranularity(parFrom);\n if (scopeFrom && (scopeFrom === scopeTo || !goNext))\n {\n if (scopeFrom === scopeTo)\n {\n do\n {\n if (goNext) _smilIterator.next();\n else _smilIterator.previous();\n } while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(scopeFrom));\n\n if (!_smilIterator.currentPar)\n {\n //console.debug(\"adjustParToSeqSyncGranularity nextSmil(goNext)\");\n\n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n \n return;\n }\n }\n \n//console.debug(\"ADJUSTED: \" + _smilIterator.currentPar.text.srcFragmentId);\n if (!goNext)\n {\n var landed = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (landed && landed !== _smilIterator.currentPar)\n {\n var backup = _smilIterator.currentPar;\n \n var innerPar = undefined;\n do\n {\n innerPar = _smilIterator.currentPar;\n _smilIterator.previous();\n }\n while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(landed));\n \n if (_smilIterator.currentPar)\n {\n _smilIterator.next();\n \n if (!_smilIterator.currentPar.hasAncestor(landed))\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar.hasAncestor(landed) ???\");\n }\n //assert \n }\n else\n {\n//console.debug(\"adjustParToSeqSyncGranularity reached begin\");\n\n _smilIterator.reset();\n \n if (_smilIterator.currentPar !== innerPar)\n {\n console.error(\"adjustParToSeqSyncGranularity _smilIterator.currentPar !=== innerPar???\");\n }\n }\n\n if (!_smilIterator.currentPar)\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar ?????\");\n _smilIterator.goToPar(backup);\n }\n \n//console.debug(\"ADJUSTED PREV: \" + _smilIterator.currentPar.text.srcFragmentId);\n }\n }\n }\n }\n }\n \n if(_audioPlayer.isPlaying()\n && _smilIterator.currentPar.audio.src\n && _smilIterator.currentPar.audio.src == _audioPlayer.currentSmilSrc()\n && position >= _smilIterator.currentPar.audio.clipBegin\n && position <= _smilIterator.currentPar.audio.clipEnd)\n {\n//console.debug(\"ONLY highlightCurrentElement\");\n highlightCurrentElement();\n return;\n }\n\n //position <= DIRECTION_MARK goes here (goto previous):\n\n// if (!noLetPlay && position > DIRECTION_MARK\n// && _audioPlayer.isPlaying() && _audioPlayer.srcRef() != _smilIterator.currentPar.audio.src)\n// {\n// _letPlay = true;\n// setTimeout(function()\n// {\n// _letPlay = false;\n// playCurrentPar();\n// }, 100);\n//\n// playCurrentPar();\n//\n// return;\n// }\n\n playCurrentPar();\n }", "function onAudioPositionChanged(position, from, skipping) { //noLetPlay\n\n audioCurrentTime = position;\n\n// if (_letPlay)\n// {\n// return;\n// }\n\n _skipAudioEnded = false;\n// _skipTTSEnded = false;\n\n if (!_smilIterator || !_smilIterator.currentPar)\n {\n return;\n }\n\n var parFrom = _smilIterator.currentPar;\n \n var audio = _smilIterator.currentPar.audio;\n\n //var TOLERANCE = 0.05;\n if(\n //position >= (audio.clipBegin - TOLERANCE) &&\n position > DIRECTION_MARK &&\n position <= audio.clipEnd) {\n\n//console.debug(\"onAudioPositionChanged: \" + position);\n return;\n }\n\n _skipAudioEnded = true;\n\n//console.debug(\"PLAY NEXT: \" + \"(\" + audio.clipBegin + \" -- \" + audio.clipEnd + \") [\" + from + \"] \" + position);\n//console.debug(_smilIterator.currentPar.text.srcFragmentId);\n\n var isPlaying = _audioPlayer.isPlaying();\n if (isPlaying && from === 6)\n {\n console.debug(\"from userNav _audioPlayer.isPlaying() ???\");\n }\n\n var goNext = position > audio.clipEnd;\n\n var doNotNextSmil = !_autoNextSmil && from !== 6 && goNext;\n\n var spineItemIdRef = (_smilIterator && _smilIterator.smil && _smilIterator.smil.spineItemId) ? _smilIterator.smil.spineItemId : ((_lastPaginationData && _lastPaginationData.spineItem && _lastPaginationData.spineItem.idref) ? _lastPaginationData.spineItem.idref : undefined);\n if (doNotNextSmil && spineItemIdRef && _lastPaginationData && _lastPaginationData.paginationInfo && _lastPaginationData.paginationInfo.openPages && _lastPaginationData.paginationInfo.openPages.length > 1)\n {\n //var iPage = _lastPaginationData.paginationInfo.isRightToLeft ? _lastPaginationData.paginationInfo.openPages.length - 1 : 0;\n var iPage = 0;\n \n var openPage = _lastPaginationData.paginationInfo.openPages[iPage];\n if (spineItemIdRef === openPage.idref)\n {\n doNotNextSmil = false;\n }\n }\n \n if (goNext)\n {\n _smilIterator.next();\n }\n else //position <= DIRECTION_MARK\n {\n _smilIterator.previous();\n }\n\n if(!_smilIterator.currentPar)\n {\n //\n // if (!noLetPlay)\n // {\n // _letPlay = true;\n // setTimeout(function()\n // {\n // _letPlay = false;\n // nextSmil(goNext);\n // }, 200);\n // }\n // else\n // {\n // nextSmil(goNext);\n // }\n\n//console.debug(\"NEXT SMIL ON AUDIO POS\");\n \n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n return;\n }\n\n//console.debug(\"ITER: \" + _smilIterator.currentPar.text.srcFragmentId);\n\n if(!_smilIterator.currentPar.audio) {\n self.pause();\n return;\n }\n \n if(_settings.mediaOverlaysSkipSkippables)\n {\n var skip = false;\n var parent = _smilIterator.currentPar;\n while (parent)\n {\n if (parent.isSkippable && parent.isSkippable(_settings.mediaOverlaysSkippables))\n {\n skip = true;\n break;\n }\n parent = parent.parent;\n }\n\n if (skip)\n {\n console.log(\"MO SKIP: \" + parent.epubtype);\n\n self.pause();\n\n var pos = goNext ? _smilIterator.currentPar.audio.clipEnd + 0.1 : DIRECTION_MARK - 1;\n\n onAudioPositionChanged(pos, from, true); //noLetPlay\n return;\n }\n }\n\n // _settings.mediaOverlaysSynchronizationGranularity\n if (!isPlaying && (_smilIterator.currentPar.element || _smilIterator.currentPar.cfi && _smilIterator.currentPar.cfi.cfiTextParent))\n {\n var scopeTo = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (scopeTo && scopeTo !== _smilIterator.currentPar)\n {\n var scopeFrom = _elementHighlighter.adjustParToSeqSyncGranularity(parFrom);\n if (scopeFrom && (scopeFrom === scopeTo || !goNext))\n {\n if (scopeFrom === scopeTo)\n {\n do\n {\n if (goNext) _smilIterator.next();\n else _smilIterator.previous();\n } while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(scopeFrom));\n\n if (!_smilIterator.currentPar)\n {\n //console.debug(\"adjustParToSeqSyncGranularity nextSmil(goNext)\");\n\n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n \n return;\n }\n }\n \n//console.debug(\"ADJUSTED: \" + _smilIterator.currentPar.text.srcFragmentId);\n if (!goNext)\n {\n var landed = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (landed && landed !== _smilIterator.currentPar)\n {\n var backup = _smilIterator.currentPar;\n \n var innerPar = undefined;\n do\n {\n innerPar = _smilIterator.currentPar;\n _smilIterator.previous();\n }\n while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(landed));\n \n if (_smilIterator.currentPar)\n {\n _smilIterator.next();\n \n if (!_smilIterator.currentPar.hasAncestor(landed))\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar.hasAncestor(landed) ???\");\n }\n //assert \n }\n else\n {\n//console.debug(\"adjustParToSeqSyncGranularity reached begin\");\n\n _smilIterator.reset();\n \n if (_smilIterator.currentPar !== innerPar)\n {\n console.error(\"adjustParToSeqSyncGranularity _smilIterator.currentPar !=== innerPar???\");\n }\n }\n\n if (!_smilIterator.currentPar)\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar ?????\");\n _smilIterator.goToPar(backup);\n }\n \n//console.debug(\"ADJUSTED PREV: \" + _smilIterator.currentPar.text.srcFragmentId);\n }\n }\n }\n }\n }\n \n if(_audioPlayer.isPlaying()\n && _smilIterator.currentPar.audio.src\n && _smilIterator.currentPar.audio.src == _audioPlayer.currentSmilSrc()\n && position >= _smilIterator.currentPar.audio.clipBegin\n && position <= _smilIterator.currentPar.audio.clipEnd)\n {\n//console.debug(\"ONLY highlightCurrentElement\");\n highlightCurrentElement();\n return;\n }\n\n //position <= DIRECTION_MARK goes here (goto previous):\n\n// if (!noLetPlay && position > DIRECTION_MARK\n// && _audioPlayer.isPlaying() && _audioPlayer.srcRef() != _smilIterator.currentPar.audio.src)\n// {\n// _letPlay = true;\n// setTimeout(function()\n// {\n// _letPlay = false;\n// playCurrentPar();\n// }, 100);\n//\n// playCurrentPar();\n//\n// return;\n// }\n\n playCurrentPar();\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function drawUndo()\n {\n if (hasSlideData( slideIndices, mode ))\n {\n var slideData = getSlideData( slideIndices, mode );\n slideData.events.pop();\n playbackEvents( mode );\n }\n }", "function ArmSegment(shader, name, xPivot, yPivot) {\r\n SceneNode.call(this, shader, name, true); // calling super class constructor\r\n\r\n var xf = this.getXform();\r\n xf.setPosition(xPivot, yPivot);\r\n\r\n // now create the children shapes\r\n var obj = new CircleRenderable(shader); // The purple circle base\r\n this.addToSet(obj);\r\n obj.setColor([0.75, 0.5, 1, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(1, 2);\r\n // xf.setPosition(xPivot, 1 + yPivot);\r\n xf.setPosition(0, 0);\r\n\r\n obj = new SquareRenderable(shader); // The right green\r\n this.addToSet(obj);\r\n obj.setColor([0, 1, 0, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot, 1.75 + yPivot);\r\n xf.setPosition(0.375, 0);\r\n\r\n obj = new SquareRenderable(shader); // The left green\r\n this.addToSet(obj);\r\n obj.setColor([0, 1, 0, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot, 1.75 + yPivot);\r\n xf.setPosition(-0.375, 0);\r\n\r\n obj = new SquareRenderable(shader); // The top green\r\n this.addToSet(obj);\r\n obj.setColor([0, 0.85, 0.15, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot+0.5-0.125, yPivot+0.125);\r\n xf.setPosition(0, 0.375);\r\n\r\n obj = new SquareRenderable(shader); // The bottom green\r\n this.addToSet(obj);\r\n obj.setColor([0, 0.85, 0.15, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot-0.5+0.125, yPivot+0.125);\r\n xf.setPosition(0, -0.375);\r\n\r\n obj = new CircleRenderable(shader); // The middle red circle\r\n this.addToSet(obj);\r\n obj.setColor([1, 0.75, 1, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.5, 0.5); // so that we can see the connecting point\r\n xf.setPosition(0, 0);\r\n\r\n this.mPulseRate = 0.005;\r\n this.mRotateRate = -2;\r\n}", "onReadyForPostroll(player) {\n const Postroll = States.getState('Postroll');\n\n player.ads.debug('Received readyforpostroll event');\n this.transitionTo(Postroll);\n }", "function onSegment(p, q, r) {\n if (\n q[0] <= Math.max(p[0], r[0]) &&\n q[0] >= Math.min(p[0], r[0]) &&\n q[1] <= Math.max(p[1], r[1]) &&\n q[1] >= Math.min(p[1], r[1])\n ) {\n return true;\n }\n\n return false;\n}", "function setPostProcessing(shaders) {\n\t for (var s in allPost) {\n\t allPost[s].turnOff();\n\t }\n\t composer = new EffectComposer(renderer);\n\t var renderPass = new EffectComposer.RenderPass(scene, camera);\n\t composer.addPass(renderPass);\n\t for (var s in currentPost) {\n\t currentPost[s].turnOn();\n\t var pass = currentPost[s].shader;\n\t pass.renderToScreen = true;\n\t composer.addPass(pass);\n\t }\n\t render();\n\t}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function segmentTurn(p1, p2, p3, p4) {\n var ax = p1[0],\n ay = p1[1],\n bx = p2[0],\n by = p2[1],\n // shift p3p4 segment to start at p2\n dx = bx - p3[0],\n dy = by - p3[1],\n cx = p4[0] + dx,\n cy = p4[1] + dy,\n orientation = orient2D(ax, ay, bx, by, cx, cy);\n if (!orientation) return 0;\n return orientation < 0 ? 1 : -1;\n }", "clipSegment(start, end) {\n const quadrantStart = this.pointLocation(start)\n const quadrantEnd = this.pointLocation(end)\n\n if (quadrantStart === 0b0000 && quadrantEnd === 0b0000) {\n // The line is inside the boundaries\n return [start, end]\n }\n\n if (quadrantStart === quadrantEnd) {\n // We are in the same box, and we are out of bounds.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart & quadrantEnd) {\n // These points are all on one side of the box.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart === 0b000) {\n // We are exiting the box. Return the start, the intersection with the boundary, and the closest\n // boundary point to the exited point.\n let line = [start]\n line.push(this.boundPoint(start, end))\n line.push(this.nearestVertex(end))\n return line\n }\n\n if (quadrantEnd === 0b000) {\n // We are re-entering the box.\n return [this.boundPoint(end, start), end]\n }\n\n // We have reached a terrible place, where both points are oob, but it might intersect with the\n // work area. First, define the boundaries as lines.\n const sides = [\n // left\n [Victor(-this.sizeX, -this.sizeY), new Victor(-this.sizeX, this.sizeY)],\n // right\n [new Victor(this.sizeX, -this.sizeY), new Victor(this.sizeX, this.sizeY)],\n // bottom\n [new Victor(-this.sizeX, -this.sizeY), new Victor(this.sizeX, -this.sizeY)],\n // top\n [new Victor(-this.sizeX, this.sizeY), new Victor(this.sizeX, this.sizeY)],\n ]\n\n // Count up the number of boundary lines intersect with our line segment.\n let intersections = []\n for (let s=0; s<sides.length; s++) {\n const intPoint = this.intersection(start,\n end,\n sides[s][0],\n sides[s][1])\n if (intPoint) {\n intersections.push(new Victor(intPoint.x, intPoint.y))\n }\n }\n\n if (intersections.length !== 0) {\n if (intersections.length !== 2) {\n // We should never get here. How would we have something other than 2 or 0 intersections with\n // a box?\n console.log(intersections)\n throw Error(\"Software Geometry Error\")\n }\n\n // The intersections are tested in some normal order, but the line could be going through them\n // in any direction. This check will flip the intersections if they are reversed somehow.\n if (Victor.fromObject(intersections[0]).subtract(start).lengthSq() >\n Victor.fromObject(intersections[1]).subtract(start).lengthSq()) {\n let temp = intersections[0]\n intersections[0] = intersections[1]\n intersections[1] = temp\n }\n\n return [...intersections, this.nearestVertex(end)]\n }\n\n // Damn. We got here because we have a start and end that are failing different boundary checks,\n // and the line segment doesn't intersect the box. We have to crawl around the outside of the\n // box until we reach the other point.\n // Here, I'm going to split this line into two parts, and send each half line segment back\n // through the clipSegment algorithm. Eventually, that should result in only one of the other cases.\n const midpoint = Victor.fromObject(start).add(end).multiply(new Victor(0.5, 0.5))\n\n // recurse, and find smaller segments until we don't end up in this place again.\n return [...this.clipSegment(start, midpoint),\n ...this.clipSegment(midpoint, end)]\n }", "computeControlSegments() {\n if (this.controlSteps.length) {\n this.controlSegments = [];\n let segment = { start : 0, end : 0, human : this.controlSteps[0] }\n for (let i = 0; i < this.controlSteps.length; ++i) {\n const humanStep = this.controlSteps[i];\n if (humanStep != segment.human) {\n this.controlSegments.push(segment);\n segment = { start : i, end : i, human : humanStep };\n } else {\n segment.end = i;\n }\n }\n this.controlSegments.push(segment);\n }\n }", "function checkTrash(){\n if(currentID.includes('trash')){\n playAudio(correctAudio);\n points++;\n }\n else if(currentID.includes('rec')){\n playAudio(wrongAudio);\n points--;\n wrong++;\n checkWrong();\n }\n $('#points').text(points);\n }", "formatSegments (isProtein) {\n\t\tvar variants = isProtein ? this.attributes.variantDataProtein : this.attributes.variantDataDna;\n\t\tvar sequences = isProtein ? this.attributes.alignedProteinSequences : this.attributes.alignedDnaSequences;\n\t\t// make sure they're sorted by start\n\t\tvariants = _.sortBy(variants, d => {\n\t\t\treturn d.start;\n\t\t});\n\n\t\t// merge segments\n\t\tvar mergedSegments = _.reduce(variants, (memo, d) => {\n\t\t\treturn this._mergeOrAddSegment(memo, d);\n\t\t}, []);\n\n\t\t// add in needed summarized segments\n\t\t// first one\n\t\tif (mergedSegments[0].start > 1) {\n\t\t\tmergedSegments.push({\n\t\t\t\tvisible: false,\n\t\t\t\tstart: 1,\n\t\t\t\tend: mergedSegments[0].start\n\t\t\t});\n\t\t}\n\t\t// loop through and connect visible segments with summarized segments\n\t\tvar _visibleSegments = _.where(mergedSegments, { visible: true });\n\t\t_visibleSegments.forEach( (d, i) => {\n\t\t\t// must not be last or visible\n\t\t\tif (d.visible && i < _visibleSegments.length - 1) {\n\t\t\t\tmergedSegments.push({\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tstart: d.end,\n\t\t\t\t\tend: _visibleSegments[i + 1].start\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t\n\t\tvar _last = _.max(mergedSegments, d => { return d.end; });\n\t\tvar _maxLength = _.max(sequences, d => { return d.sequence.length; }).sequence.length;\n\t\t// add last if last segment is visible and not at the end\n\t\tif (_last.end < _maxLength) {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength,\n\t\t\t\tvisible: false\n\t\t\t});\n\t\t// add last if visible\n\t\t} else {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength + 1,\n\t\t\t\tvisible: true\n\t\t\t});\n\t\t}\n\t\t\n\t\t// change starts and ends to domains\n\t\tmergedSegments = _.map(mergedSegments, d => {\n\t\t\td.domain = [d.start, d.end];\n\t\t\treturn d;\n\t\t});\n\t\t// sort\n\t\tmergedSegments = _.sortBy(mergedSegments, d => {\n\t\t\treturn d.start;\n\t\t});\n\t\treturn mergedSegments;\n\t}", "function intakeSub(points){\r\n\r\n}", "reset(){\n this.setSegment();\n if(this.next)this.next.reset();\n }", "function onSegment (pi, pj, pk) {\n return Math.min(pi[0], pj[0]) <= pk[0] &&\n pk[0] <= Math.max(pi[0], pj[0]) &&\n Math.min(pi[1], pj[1]) <= pk[1] &&\n pk[1] <= Math.max(pi[1], pj[1]);\n}", "function setGamerSeg () {\n permutive.segment(6912, function(result) {\n if (result) {\n console.log(`2) Response returned in permutve.segment -if is gamer segment: ${result}`)\n getGamerAd();\n } else {\n console.log(`segment doesnt return gamer - served default ad`)\n }\n});\n}", "function scrollHandler() { \n\t\tif ( isNextSceneReached(true) ) {\n runNextScene();\n\t\t} else if ( isPrevSceneReached(true) ) {\n runPrevScene();\n\t\t}\n }", "function determineEnrollentsToCopyOrWipe(vm, params) {\n //if the plan being updated is to be removed\n if (params.removeThisPlan) {\n manageEnrollmentsOnRemove.apply(this, [vm, params]);\n } else {\n //cases for re-mapping plan counts using the category enrollments, with or without deduction of DO enrollments\n manageEnrollmentsOnUpdateOrAdd.apply(this, [vm, params]);\n }\n}", "function alertPrize(indicatedSegment) {\n console.log(indicatedSegment.text)\n if (indicatedSegment.text == \"Nothing!\") { document.getElementById(\"rays\").style.display = 'none'; incorrectSound.play(); }\n else { document.getElementById(\"rays\").style.display = 'block'; successSound.play(); }\n\n\n wheelRewardBack.style.display = 'block';\n wheelRewardImg.src = indicatedSegment.image;\n document.getElementById(\"wheelRewardTxt2\").innerHTML = indicatedSegment.text;\n grantAwardFromWheel(indicatedSegment.text);\n a.updateMoney();\n a.updateTools();\n localStorage.setItem('starCash', starCash);\n localStorage.setItem('GuiGhostFarms_player', JSON.stringify(player));\n }", "function addSegEndsFromSequences(){\n //Add all the starting segEnds and internal segJoins\n for(var i=0;i<seqArr.length;i++){\n var length=parseInt(seqArr[i]['length']),\n seqId=seqArr[i]['id'];\n segEndArr[segEndArr.length]=[seqId,0,'POS_STRAND']\n segEndArr[segEndArr.length]=[seqId,length-1,'NEG_STRAND']\n segJoinArr[segJoinArr.length]=[[seqId,0,'POS_STRAND'],[seqId,length-1,'NEG_STRAND'],'internal',length]\n }\n segmentize();\n}", "function onSegment(p, q, r)\n{\n if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) &&\n q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y))\n return true;\n\n return false;\n}", "function onSegment( p, q, r ) {\n\n\t\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n\t}", "removeHoldsIfProceeds(currentAudioTime) {\n\n let listActiveHolds = this.activeHolds.asList() ;\n\n\n // This is used to know whether the last judgment for the hold must be fail or not.\n this.activeHolds.wasLastKnowHoldPressed = this.areHoldsBeingPressed() ;\n\n for ( var i = 0 ; i < listActiveHolds.length ; i++) {\n\n let step = listActiveHolds[i] ;\n\n if (step !== null && currentAudioTime > step.endHoldTimeStamp ) {\n this.activeHolds.setHold(step.kind, step.padId, null) ;\n\n // save the endHoldTimeStamp to compute the remainder judgments.\n this.activeHolds.needFinishJudgment = true ;\n this.activeHolds.judgmentTimeStampEndReference = step.endHoldTimeStamp - this.activeHolds.firstHoldInHoldRun.beginHoldTimeStamp ;\n // console.log('begin: ' + beginTime + ' end: ' + endTime) ;\n // this.activeHolds.actualTotalComboValueOfHold = this.computeTotalComboContribution( beginTime, endTime ) ;\n\n // if the hold is active, we can remove it from the render and give a perfect judgment, I think.\n if (this.keyInput.isPressed(step.kind, step.padId)) {\n\n this.composer.removeObjectFromSteps(step) ;\n this.composer.removeObjectFromSteps(step.holdObject) ;\n this.composer.removeObjectFromSteps(step.endNoteObject) ;\n\n this.composer.animateTapEffect([step]) ;\n\n this.composer.judgmentScale.animateJudgement('p') ;\n\n\n\n // otherwise we have a miss.\n } else {\n this.composer.judgmentScale.miss() ;\n }\n\n\n }\n\n }\n }", "function stillHandler() { \n Options.scenes.forEach(function(scene) {\n \tif ( pageYOffset > scene.offset) {\n \t\tscene.action(scene.target);\n \t}\n });\n }", "function playVideo() {\n playVideoSegments(transcripts)\n}", "function process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n}", "function swipe(evt) {\n 'use strict';\n var sets = document.querySelectorAll('.sets'),\n i,\n rightStyle,\n rightNumbered,\n source = evt.target || evt.srcElement;\n\n if (source.id === \"right\") {\n if (sets[0].style.right === ((sets.length - 1)*100) + \"%\") {\n console.log('no more kit');\n } else {\n // Setting the selected kit in audio app\n audioApp.selectCount += 1;\n audioApp.selectedKit = audioApp.kits[audioApp.selectCount];\n console.log(audioApp.selectedKit);\n \n for (i = 0; i < sets.length; i += 1) {\n rightStyle = sets[i].style.right;\n rightNumbered = Number(rightStyle.substring(0, (rightStyle.length-1)));\n\n sets[i].style.right = rightNumbered + 100 + \"%\";\n }\n }\n }\n if (source.id === \"left\") {\n if (sets[sets.length - 1].style.right === (-(sets.length - 1)*100) + \"%\") {\n console.log('no more kit');\n } else {\n // Setting the selected kit in audio app\n audioApp.selectCount -= 1;\n audioApp.selectedKit = audioApp.kits[audioApp.selectCount];\n console.log(audioApp.selectedKit);\n \n for (i = 0; i < sets.length; i += 1) {\n rightStyle = sets[i].style.right;\n rightNumbered = Number(rightStyle.substring(0, (rightStyle.length-1)));\n\n sets[i].style.right = rightNumbered - 100 + \"%\";\n }\n }\n }\n }", "function onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}", "function render() {\n\n var baseSegment = findSegment(position);\n var basePercent = Util.percentRemaining(position, segmentLength);\n var playerSegment = findSegment(position+playerZ);\n var playerPercent = Util.percentRemaining(position+playerZ, segmentLength);\n var playerY = Util.interpolate(playerSegment.p1.world.y, playerSegment.p2.world.y, playerPercent);\n var maxy = height;\n\n var x = 0;\n var dx = - (baseSegment.curve * basePercent);\n\n // Clear the canvas\n ctx.clearRect(0, 0, width, height);\n\n // Order the background layers\n if (currentBackground == 0) {\n // Build the list of positions in the image to extract the appropriate background\n // Depending on the current background, load as current the night or day version\n background_pos_cur = [BACKGROUND.SKY, BACKGROUND.HILLS, BACKGROUND.TREES];\n background_pos_next = [BACKGROUND.SKY2, BACKGROUND.HILLS2, BACKGROUND.TREES2];\n } else {\n background_pos_cur = [BACKGROUND.SKY2, BACKGROUND.HILLS2, BACKGROUND.TREES2];\n background_pos_next = [BACKGROUND.SKY, BACKGROUND.HILLS, BACKGROUND.TREES];\n }\n // Draw the background layers\n if (!changeBackgroundFlag) {\n // No switching, we draw one set of backgrounds\n Render.background(ctx, background, width, height, background_pos_cur[0], skyOffset, resolution * skySpeed * playerY, 1.0);\n Render.background(ctx, background, width, height, background_pos_cur[1], hillOffset, resolution * hillSpeed * playerY, 1.0);\n Render.background(ctx, background, width, height, background_pos_cur[2], treeOffset, resolution * treeSpeed * playerY, 1.0);\n } else {\n // else we are in the process of switching, do a progressive blending\n // continue the blending\n changeBackgroundCurrentAlpha += 0.01; // increase the alpha for one, and decrease for the next background set\n Render.background(ctx, background, width, height, background_pos_cur[0], skyOffset, resolution * skySpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_cur[1], hillOffset, resolution * hillSpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_cur[2], treeOffset, resolution * treeSpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[0], skyOffset, resolution * skySpeed * playerY, changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[1], hillOffset, resolution * hillSpeed * playerY, changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[2], treeOffset, resolution * treeSpeed * playerY, changeBackgroundCurrentAlpha);\n if (changeBackgroundCurrentAlpha >= 1.0) {\n // blending is done, disable the flags and reinit all related vars\n // Note: it is important to still do the drawing (and not put it in an if statement) because else the last drawing won't be done, there will be no background for a split-second and this will produce a flickering effect\n currentBackground = (currentBackground + 1) % 2\n changeBackgroundCurrentAlpha = 0.0;\n changeBackgroundFlag = false;\n }\n }\n\n var n, i, segment, car, sprite, spriteScale, spriteX, spriteY;\n\n for(n = 0 ; n < drawDistance ; n++) {\n\n segment = segments[(baseSegment.index + n) % segments.length];\n segment.looped = segment.index < baseSegment.index;\n segment.fog = Util.exponentialFog(n/drawDistance, fogDensity);\n segment.clip = maxy;\n\n Util.project(segment.p1, (playerX * roadWidth) - x, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n Util.project(segment.p2, (playerX * roadWidth) - x - dx, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n\n x = x + dx;\n dx = dx + segment.curve;\n\n if ((segment.p1.camera.z <= cameraDepth) || // behind us\n (segment.p2.screen.y >= segment.p1.screen.y) || // back face cull\n (segment.p2.screen.y >= maxy)) // clip by (already rendered) hill\n continue;\n\n Render.segment(ctx, width, lanes,\n segment.p1.screen.x,\n segment.p1.screen.y,\n segment.p1.screen.w,\n segment.p2.screen.x,\n segment.p2.screen.y,\n segment.p2.screen.w,\n segment.fog,\n segment.color);\n\n maxy = segment.p1.screen.y;\n }\n\n for(n = (drawDistance-1) ; n > 0 ; n--) {\n segment = segments[(baseSegment.index + n) % segments.length];\n\n for(i = 0 ; i < segment.cars.length ; i++) {\n car = segment.cars[i];\n sprite = car.sprite;\n spriteScale = Util.interpolate(segment.p1.screen.scale, segment.p2.screen.scale, car.percent);\n spriteX = Util.interpolate(segment.p1.screen.x, segment.p2.screen.x, car.percent) + (spriteScale * car.offset * roadWidth * width/2);\n spriteY = Util.interpolate(segment.p1.screen.y, segment.p2.screen.y, car.percent);\n Render.sprite(ctx, width, height, resolution, roadWidth, sprites, car.sprite, spriteScale, spriteX, spriteY, -0.5, -1, segment.clip);\n }\n\n for(i = 0 ; i < segment.sprites.length ; i++) {\n sprite = segment.sprites[i];\n spriteScale = segment.p1.screen.scale;\n spriteX = segment.p1.screen.x + (spriteScale * sprite.offset * roadWidth * width/2);\n spriteY = segment.p1.screen.y;\n Render.sprite(ctx, width, height, resolution, roadWidth, sprites, sprite.source, spriteScale, spriteX, spriteY, (sprite.offset < 0 ? -1 : 0), -1, segment.clip);\n }\n\n if (segment == playerSegment) {\n Render.player(ctx, width, height, resolution, roadWidth, sprites, speed/maxSpeed,\n cameraDepth/playerZ,\n width/2,\n (height/2) - (cameraDepth/playerZ * Util.interpolate(playerSegment.p1.camera.y, playerSegment.p2.camera.y, playerPercent) * height/2),\n speed * (keyLeft ? -1 : keyRight ? 1 : 0),\n playerSegment.p2.world.y - playerSegment.p1.world.y);\n }\n }\n\t\t\t\n // start horizon tilt\n if (enableTilt) {\n rotation=0;\n if (baseSegment.curve==0) {\n rotation=-currentRotation;\n currentRotation=0;\n } else {\n newrot = Math.round(baseSegment.curve*speed/maxSpeed*100)/100;\n rotation=newrot - currentRotation ;\n currentRotation = newrot ;\n }\n if (rotation!=0) {\n //ctx.save(); // doesn't help with moire problem\n ctx.translate(canvas.width/2,canvas.height/2);\n ctx.rotate(-rotation*(Math.PI/90));\n ctx.translate(-canvas.width/2,-canvas.height/2);\n //ctx.restore();\n }\n }\n\n // Draw \"Game Over\" screen\n if (gameOverFlag) {\n ctx.font = \"3em Arial\";\n ctx.fillStyle = \"magenta\";\n ctx.textAlign = \"center\";\n ctx.fillText(\"GAME OVER\", canvas.width/2, canvas.height/2);\n ctx.fillText(\"(refresh to restart)\", canvas.width/2, canvas.height/1.5);\n }\n }", "function modifySegments() {\n /* ----------------------------- START loop Calls hl7Buttons and sends the segments to generate the fields buttons at front end ---------------------------------------------- */\n for (var i = 0; i < selectedArray.length; i++) {\n hl7Buttons(selectedArray[i]);\n }\n /* ----------------------------- END loop Calls hl7Buttons and sends the segments to generate the fields buttons at front end ---------------------------------------------- */\n /* --------------------------------------- START loop for Checking, Highlighting and disabling the buttons for the mandatory HL7 fields ------------------------------------ */\n for (var i = 0; i < mandatoryFields.length; i++) {\n $(\".\" + mandatoryFields[i]).addClass('disabled'); //Label tag button class to disable the mandatory fields\n $(\"#\" + mandatoryFields[i]).attr('checked', true); //Checkbox tag id to add checked attribute the mandatory fields\n }\n /* --------------------------------------- END loop for Checking, Highlighting and disabling the buttons for the mandatory HL7 fields ------------------------------------ */\n\n /* --------------------------------------- START loop for hiding the fields not supported ------------------------------------ */\n for (var i = 0; i < notUsedFields.length; i++) {\n $(\".\" + notUsedFields[i]).addClass('hiddenFields'); //Adding class to identify the hidden fields and is used in click function for select all button\n $(\".\" + notUsedFields[i]).hide(); //Hiding the fields which we are not using\n }\n /* --------------------------------------- END loop for hiding the fields not supported ------------------------------------ */\n}", "function loadSegments() {\n var regions = JSON.parse(localStorage.regions);\n regions.forEach(function (region) {\n wavesurfer.addRegion(region);\n });\n}", "function loadExistingSegmentValues() {\n\n // header update\n UpdateCurrentLesion();\n\n if ( meCompletedLesions[meCurrentLesion] ) {\n for (var i = 0; i < meIndicateSegmentNumber.length; i++) {\n if( meSegmentsInvolved[i][meCurrentLesion] == 1 ) {\n\tgetById('right', 'dd' + i + 'd' + meCurrentLesion).checked = true;\n\tgetFrame('right').lightUpRow('row_' + i + meCurrentLesion);\n }\n }\n }\n else {\n resetExistingFormGlobalVars();\n resetAnswersForLesion(meCurrentLesion);\n }\n}", "function Update () \n{\n\tif (Time.frameCount % 30 == 0)\n\t{\n\t System.GC.Collect();\n\t}\n\tif (eventdata==null)\n\t{\n\t\t//if ((Time.time > 5)&&(Time.time < 6)&&(ttt==0)) \n\t\t//{\n\t\t//\tttt=1;\n\t\t//\tLoadEvent(\"91\");\n\t\t//}\n\t\treturn;\n\t}\n\t\n\tif (toc==0)\n\t{\n\t\tTime.timeScale = 0;\n\t\treturn;\n\t}\n\t\n\tredraw_grid();\n\tredraw_marks();\n\t\n\tplaytime = playtime + Time.deltaTime;\n\t\n\t// load race\n\tif ((eventdata!=null)&&(typeof(eventdata[\"race\"])))\n\t{\n\t\tif (raceindex+1<eventdata[\"race\"].length)\n\t\t{\n\t\t\tif (playtime+60 > (parseFloat(eventdata[\"race\"][raceindex+1][\"start_time\"])-parseFloat(eventdata[\"start_time\"])))\n\t\t\t{\n\t\t\t\tLoadRace(raceindex+1);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// update boats\n\tfor (var idx = 0; idx < boatsorder.Count; idx++)\n\t{\n\t\tvar boat : GameObject = boats[boatsorder[idx]];\n\t\tvar boatdatascript:boatdata = boat.GetComponent(boatdata); \n \t\t\n \t\tboatdatascript.RecalculatePosition(playtime);\n \t\t\t\n \t\tvar sailed:float = boatdatascript.routeCompletedDistance + boatdatascript.routeCompletedTotalDistance;\n\t \t\t\n\t \tif (sailed > firstboatsailed)\n\t \t{\n\t \t\tfirstboatindex = idx;\n\t \t\tfirstboatsailed = sailed;\n\t \t}\n\t} \n\t\n\tif (firstboatindex > -1)\n\t{\t\t\t\n\t\tif (firstline!=null)\n\t\t{\n\t\t\tvar firstboat : GameObject = boats[boatsorder[firstboatindex]];\n\t\t\tvar firstboatscript:boatdata = firstboat.GetComponent(boatdata); \n\t\t\t\n\t\t\tvar boatfront:GameObject = firstboat.transform.Find(\"container/front\").gameObject;\n\t\t\t\n\t\t\tif ((firstboatscript.routeIndex >=0)&&(firstboatscript.routeIndex<firstboatscript.route.length))\n\t\t\t{\n\t\t\t\tvar firstboatrouteitem = firstboatscript.GetRouteItem(firstboatscript.routeIndex);\n\t\t\t\t\n\t\t\t\tfirstline.active = true;\n\t\t\t\t//firstline.transform.position.x = boatfront.transform.position.x;\n\t\t\t\t//firstline.transform.position.z = boatfront.transform.position.z;\n\t\t\t\t\n\t\t\t\tfirstline.transform.position.x = firstboatscript.routePointX/2;\n\t\t\t\tfirstline.transform.position.z = firstboatscript.routePointY/2;\n\t\t\t\tfirstline.transform.localScale.z = firstboatscript.routeA/10;\n\t\t\t\n\t\t\t\tfirstline.transform.eulerAngles.y = 180-getdirection_between_points(firstboatrouteitem[\"v1\"].x,firstboatrouteitem[\"v1\"].y,firstboatrouteitem[\"v2\"].x,firstboatrouteitem[\"v2\"].y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfirstline.active = false;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (boats.Count>0)\n \t{\n\t \tvar navigator:GameObject = GameObject.Find(\"navigator\");\t\t\n \t \tnavigator.transform.position = Vector3.SmoothDamp(navigator.transform.position, boats[cameraboatindex].transform.position,velocity, 2.0f);\n\t\t//navigator.transform.position.z = Vector3.MoveTowards(navigator.transform.position.z, boats[cameraboatindex].transform.position.z, Time.deltaTime);\n\t\t\n\t}\n\t\n\t// wind update -- NUll value\n\t/*if (typeof(marker[\"wind\"]))\n\t{\n\t\tif (windindex<marker[\"wind\"].length)\n\t\t{\n\t\t\tvar wind:GameObject = GameObject.Find(\"navigator/wind\");\n\t\t\tif (wind) wind.transform.localRotation.eulerAngles.y = parseFloat(marker[\"wind\"][windindex][\"direction\"]);\n\t\t}\n\t\tif (windindex+1<marker[\"wind\"].length)\n\t\t{\n\t\t\tvar windtime = parseInt(marker[\"wind\"][windindex+1][\"time\"]);\n\t\t\tif (playtime > windtime) windindex = windindex + 1;\n\t\t\t//Debug.Log (windindex+\" \"+eventdata[\"wind\"].length+\" \"+playtime+\" \"+windtime);\n\t\t}\n\t}*/\n}", "function Snake() {\n this.x = 0;\n this.y = 0;\n this.xspeed = 1;\n this.yspeed = 0;\n this.total = 0;\n this.seg = [];\n this.score = 0;\n this.death = false;\n\n// this checks if the food has been eaten and counts score\n\n this.eat = function(pos) {\n var d = dist(this.x, this.y, pos.x, pos.y);\n if (d < 1) {\n this.total++;\n this.score++;\n return true;\n } else {\n return false;\n }\n }\n\n this.run = function(){\n this.update();\n this.show();\n }\n\n\n//this is the direction function for the snake\n\n this.dir = function(x, y) {\n this.xspeed = x;\n this.yspeed = y;\n }\n\n//this updates the segments of the rect\n\n this.update = function() {\n for (var i = 0; i < this.seg.length - 1; i++) {\n this.seg[i] = this.seg[i + 1];\n }\n if (this.total >= 1) {\n this.seg[this.total - 1] = createVector(this.x, this.y);\n }\n\n// multiplied by scale so will move on a grid\n\n this.x = this.x + this.xspeed * scl;\n this.y = this.y + this.yspeed * scl;\n\n this.x = constrain(this.x, 0, width - scl);\n this.y = constrain(this.y, 0, height - scl);\n }\n\n// adds the other segments\n//and renders the not head segments\n\n this.show = function() {\n fill(0,255,0);\n for (var i = 0; i < this.seg.length; i++) {\n rect(this.seg[i].x, this.seg[i].y, scl, scl);\n }\n\n image(img, this.x, this.y, scl, scl);\n\n\n }\n\n// this checks for death\n\n this.die = function() {\n for (var i = 0; i < this.seg.length; i++) {\n var pos = this.seg[i];\n var d = dist(this.x, this.y, pos.x, pos.y);\n if (d < 1) {\n fill(11, 226, 119);\n textSize(100);\n text(\"Game Over\",150,350);\n this.death = true;\n //causes error in program and freezes interval\n //asjdfkl;asjdf;jas\n\n }\n }\n }\n\n}", "function alignDiscontinuities(lastFrag,details,lastLevel){if(shouldAlignOnDiscontinuities(lastFrag,lastLevel,details)){var referenceFrag=findDiscontinuousReferenceFrag(lastLevel.details,details);if(referenceFrag){logger_1.logger.log('Adjusting PTS using last level due to CC increase within current level');adjustPts(referenceFrag.start,details);}}}", "function areaSweep() {//set the completed row to 0's\r\n outer: for (var y = playArea.length -1; y > 0; --y) {\r\n for (var x = 0; x < playArea[y].length; ++x) {\r\n if (playArea[y][x] === 0) {\r\n continue outer;\r\n }\r\n }\r\n\r\n var row = playArea.splice(y, 1)[0].fill(0);//move the rows down\r\n linesCleared++;//does lines for scoring\r\n lines++;//adds line based on completed lines\r\n console.log(lines);\r\n playArea.unshift(row);\r\n ++y;\r\n }\r\n if (linesCleared == 1){\r\n score += (40*level+40);\r\n notTetris.play();\r\n linesCleared=0;\r\n single++;\r\n }\r\n else if (linesCleared == 2){\r\n score += (100*level+100);\r\n notTetris.play();\r\n linesCleared=0;\r\n double++;\r\n }\r\n else if (linesCleared == 3){\r\n score += (300*level+300);\r\n notTetris.play();\r\n linesCleared=0;\r\n triple++;\r\n }\r\n else if (linesCleared == 4){\r\n score += (1200*level+1200);\r\n tetrisSound.play();\r\n linesCleared=0;\r\n tetris++;\r\n }//score based on cleared lines\r\n\r\n if(lines>=10&&level==0){level=1; transitionSound.play();}\r\n else if(lines>=20&&level==1){level=2; transitionSound.play();}\r\n else if(lines>=30&&level==2){level=3; transitionSound.play();}\r\n else if(lines>=40&&level==3){level=4; transitionSound.play();}\r\n else if(lines>=50&&level==4){level=5; transitionSound.play();}\r\n else if(lines>=60&&level==5){level=6; transitionSound.play();}\r\n else if(lines>=70&&level==6){level=7; transitionSound.play();}\r\n else if(lines>=80&&level==7){level=8; transitionSound.play();}\r\n else if(lines>=90&&level==8){level=9; transitionSound.play();}\r\n else if(lines>=100&&level==9){level=10; transitionSound.play();}\r\n else if(lines>=110&&level==10){level=11; transitionSound.play();}\r\n else if(lines>=120&&level==11){level=12; transitionSound.play();}\r\n else if(lines>=130&&level==12){level=13; transitionSound.play();}\r\n else if(lines>=140&&level==13){level=14; transitionSound.play();}\r\n else if(lines>=150&&level==14){level=15; transitionSound.play();}\r\n else if(lines>=160&&level==15){level=16; transitionSound.play();}\r\n else if(lines>=170&&level==16){level=17; transitionSound.play();}\r\n else if(lines>=180&&level==17){level=18; transitionSound.play();}\r\n else if(lines>=190&&level==18){level=19; transitionSound.play();}\r\n else if(lines>=200&&level==19){level=20; transitionSound.play();}\r\n else if(lines>=210&&level==20){level=21; transitionSound.play();}\r\n else if(lines>=220&&level==21){level=22; transitionSound.play();}\r\n else if(lines>=230&&level==22){level=23; transitionSound.play();}\r\n else if(lines>=240&&level==23){level=24; transitionSound.play();}\r\n else if(lines>=250&&level==24){level=25; transitionSound.play();}\r\n else if(lines>=260&&level==25){level=26; transitionSound.play();}\r\n else if(lines>=270&&level==26){level=27; transitionSound.play();}\r\n else if(lines>=280&&level==27){level=28; transitionSound.play();}\r\n else if(lines>=290&&stopTransSound==true){level=29; transitionSound.play();stopTransSound=false;}//level transitions\r\n\r\n if(score>999999)score==999999;\r\n var scoreTag = document.getElementById('score');\r\n scoreTag.innerHTML = 'Score: '+score;\r\n\r\n\r\n var scoreTag = document.getElementById('lines');\r\n scoreTag.innerHTML = 'Lines: '+lines;\r\n}//end of areaSweep", "function segment(x, y, a) { //left arm\r\n translate(x, y);\r\n rotate(a);\r\n line(0, 0, segLength, 0);\r\n }", "function beforeAfterSlider() {\r\n if ($.exists('.st-before-after')) {\r\n var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;\r\n $('.st-before-after').each(function() {\r\n var $container = $(this),\r\n $before = $container.find('.st-before'),\r\n $after = $container.find('.st-after'),\r\n $handle = $container.find('.st-handle-before-after');\r\n \r\n var maxX = $container.outerWidth(),\r\n offsetX = $container.offset().left,\r\n startX = 0;\r\n \r\n var touchstart, touchmove, touchend;\r\n var mousemove = function(e) {\r\n e.preventDefault();\r\n var curX = e.clientX - offsetX,\r\n diff = startX - curX,\r\n curPos = (curX / maxX) * 100;\r\n if (curPos > 100) {\r\n curPos = 100;\r\n }\r\n if (curPos < 0) {\r\n curPos = 0;\r\n }\r\n $before.css({ right: (100 - curPos) + \"%\" });\r\n $handle.css({ left: curPos + \"%\" });\r\n };\r\n var mouseup = function(e) {\r\n e.preventDefault();\r\n if (supportsTouch) {\r\n $(document).off('touchmove', touchmove);\r\n $(document).off('touchend', touchend);\r\n } else {\r\n $(document).off('mousemove', mousemove);\r\n $(document).off('mouseup', mouseup);\r\n }\r\n };\r\n var mousedown = function(e) {\r\n e.preventDefault();\r\n startX = e.clientX - offsetX;\r\n if (supportsTouch) {\r\n $(document).on('touchmove', touchmove);\r\n $(document).on('touchend', touchend);\r\n } else {\r\n $(document).on('mousemove', mousemove);\r\n $(document).on('mouseup', mouseup);\r\n }\r\n };\r\n \r\n touchstart = function(e) {\r\n console.log(e);\r\n mousedown({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n touchmove = function(e) {\r\n mousemove({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n touchend = function(e) {\r\n mouseup({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n if (supportsTouch) {\r\n $handle.on('touchstart', touchstart);\r\n } else {\r\n $handle.on('mousedown', mousedown);\r\n }\r\n });\r\n }\r\n }", "function _ripClipVideos(savePath, vos, callback) {\n\t\tvar videoIndex = 0;\n\n\t\tconsole.log(vos.length);\n\n\t\tfunction __ripVideo(vo) {\n\t\t\tif (!vo) {\n\t\t\t\tcallback();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdelete vo['results'];\n\t\t\tvar name = vo['title'] + '.mp4';\n\t\t\t//only one segment\n\t\t\tvar seg = vo['segments'][0];\n\t\t\tvar p = savePath + '/' + name;\n\t\t\tffmpeg(vo['path'])\n\t\t\t\t.inputOptions('-threads 8')\n\t\t\t\t.seekInput(seg.startTime)\n\t\t\t\t.outputOptions('-map 0')\n\t\t\t\t.outputOptions('-r 25')\n\t\t\t\t.outputOptions('-profile:v Baseline')\n\t\t\t\t.outputOptions('-g 12')\n\t\t\t\t.outputOptions('-c:a aac')\n\t\t\t\t.outputOptions('-b:a 240k')\n\t\t\t\t.outputOptions('-strict -2')\n\t\t\t\t.duration(seg.endTime - seg.startTime)\n\t\t\t\t.format('mp4')\n\t\t\t\t.output(p)\n\t\t\t\t.on('start', function(commandLine) {\n\t\t\t\t\tconsole.log(colors.green('Spawned Ffmpeg with command: %s'), commandLine);\n\t\t\t\t})\n\t\t\t\t.on('error', function(err) {\n\t\t\t\t\tconsole.log('An error occurred: ' + err.message);\n\t\t\t\t\tvo['savePath'] = \"\";\n\t\t\t\t\tvideoIndex += 1;\n\t\t\t\t\t__ripVideo(vos[videoIndex]);\n\t\t\t\t})\n\t\t\t\t.on('end', function() {\n\t\t\t\t\tvo['savePath'] = p;\n\t\t\t\t\tvideoIndex += 1;\n\t\t\t\t\t__ripVideo(vos[videoIndex]);\n\t\t\t\t})\n\t\t\t\t.run();\n\t\t}\n\n\t\t__ripVideo(vos[videoIndex]);\n\t}", "function only_one_trap_below( inTrNext ) {\n\n\t\t\tif ( trCurrent.vLow == trLast.vLow ) {\n\t\t\t\t// final part of segment\n\n\t\t\t\tif ( meetsLowAdjSeg ) {\n\t\t\t\t\t// downward cusp: bottom forms a triangle\n\n\t\t\t\t\t// ATTENTION: the decision whether trNewLeft and trNewRight are to the\n\t\t\t\t\t//\tleft or right of the already inserted segment the new one meets here\n\t\t\t\t\t//\thas already been taken when selecting trLast to the left or right\n\t\t\t\t\t//\tof that already inserted segment !!\n\n\t\t\t\t\tif ( trCurrent.dL ) {\n\t\t\t\t\t\t//\t*** Case: 1B_DC_LEFT; next: ----\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg from the left!\" );\n\t\t\t\t\t\t//\t\t+\t\t/\n\t\t\t\t\t\t//\t\t + NR /\n\t\t\t\t\t\t//\t NL +\t /\n\t\t\t\t\t\t//\t\t + /\n\t\t\t\t\t\t// -------*-------\n\t\t\t\t\t\t//\t C.dL = next\n\n\t\t\t\t\t\t// setAbove\n\t\t\t\t\t\tinTrNext.uL = trNewLeft;\t// uR: unchanged, NEVER null\n\t\t\t\t\t\t// setBelow part 1\n\t\t\t\t\t\ttrNewLeft.dL = inTrNext;\n\t\t\t\t\t\ttrNewRight.dR = null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//\t*** Case: 1B_DC_RIGHT; next: ----\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg to the right!\" );\n\t\t\t\t\t\t//\t\t\\\t\t+\n\t\t\t\t\t\t//\t\t \\ NL +\n\t\t\t\t\t\t//\t\t \\\t + NR\n\t\t\t\t\t\t//\t\t \\ +\n\t\t\t\t\t\t// -------*-------\n\t\t\t\t\t\t//\t C.dR = next\n\n\t\t\t\t\t\t// setAbove\n\t\t\t\t\t\tinTrNext.uR = trNewRight;\t// uL: unchanged, NEVER null\n\t\t\t\t\t\t// setBelow part 1\n\t\t\t\t\t\ttrNewLeft.dL = null;\n\t\t\t\t\t\ttrNewRight.dR = inTrNext;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//\t*** Case: 1B_1UN_END; next: ----\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg ends here, low adjacent seg still missing\" );\n\t\t\t\t\t//\t\t\t +\n\t\t\t\t\t//\t\tNL\t + NR\n\t\t\t\t\t//\t\t\t+\n\t\t\t\t\t// ------*-------\n\t\t\t\t\t//\t\t next\n\n\t\t\t\t\t// setAbove\n\t\t\t\t\tinTrNext.uL = trNewLeft;\t\t\t\t\t\t\t\t\t// trNewLeft must\n\t\t\t\t\tinTrNext.uR = trNewRight;\t\t// must\n\t\t\t\t\t// setBelow part 1\n\t\t\t\t\ttrNewLeft.dL = trNewRight.dR = inTrNext;\t\t\t\t\t// Error\n//\t\t\t\t\ttrNewRight.dR = inTrNext;\n\t\t\t\t}\n\t\t\t\t// setBelow part 2\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = null;\n\t\t\t} else {\n\t\t\t\t// NOT final part of segment\n\n\t\t\t\tif ( inTrNext.uL && inTrNext.uR ) {\n\t\t\t\t\t// inTrNext has two upper neighbors\n\t\t\t\t\t// => a segment ends on the upper Y-line of inTrNext\n\t\t\t\t\t// => inTrNext has temporarily 3 upper neighbors\n\t\t\t\t\t// => marks whether the new segment cuts through\n\t\t\t\t\t//\t\tuL or uR of inTrNext and saves the other in .usave\n\t\t\t\t\tif ( inTrNext.uL == trCurrent ) {\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_LEFT; next: CC_3UN_LEFT\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): u0a, u0b, uR(usave)\" );\n\t\t\t\t\t\t//\t\t +\t\t /\n\t\t\t\t\t\t//\t NL +\t NR\t /\n\t\t\t\t\t\t//\t\t +\t/\n\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 next\n//\t\t\t\t\t\tif ( inTrNext.uR != trNewRight ) {\t\t// for robustness\tTODO: prevent\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uR;\n\t\t\t\t\t\t\tinTrNext.uleft = true;\n\t\t\t\t\t\t\t// trNewLeft: L/R undefined, will be extended down and changed anyway\n\t\t\t\t\t\t// } else {\n\t\t\t\t\t\t\t// ERROR: should not happen\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop right\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\n//\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_RIGHT; next: CC_3UN_RIGHT\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): uL(usave), u1a, u1b\" );\n\t\t\t\t\t\t//\t \\\t\t +\n\t\t\t\t\t\t//\t \\\t NL + NR\n\t\t\t\t\t\t//\t \\\t +\n\t\t\t\t\t\t// ---*---+- - - -\n\t\t\t\t\t\t//\t\t +\n\t\t\t\t\t\t//\t\t next\n//\t\t\t\t\t\tif ( inTrNext.uL != trNewLeft ) {\t\t// for robustness\tTODO: prevent\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uL;\n\t\t\t\t\t\t\tinTrNext.uleft = false;\n\t\t\t\t\t\t\t// trNewRight: L/R undefined, will be extended down and changed anyway\n\t\t\t\t\t\t// } else {\n\t\t\t\t\t\t\t// ERROR: should not happen\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop left\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\n//\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t//} else {\n\t\t\t\t\t//\t*** Case: 1B_1UN_CONT; next: CC_2UN\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg continues down\" );\n\t\t\t\t\t//\t\t\t +\n\t\t\t\t\t//\t\tNL\t + NR\n\t\t\t\t\t//\t\t\t+\n\t\t\t\t\t// ------+-------\n\t\t\t\t\t//\t \t +\n\t\t\t\t\t//\t\tnext\n\n\t\t\t\t\t// L/R for one side undefined, which one is not fixed\n\t\t\t\t\t//\tbut that one will be extended down and changed anyway\n\t\t\t\t\t// for the other side, vLow must lie at the opposite end\n\t\t\t\t\t//\tthus both are set accordingly\n\t\t\t\t}\n\t\t\t\t// setAbove\n\t\t\t\tinTrNext.uL = trNewLeft;\n\t\t\t\tinTrNext.uR = trNewRight;\n\t\t\t\t// setBelow\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = inTrNext;\n\t\t\t\ttrNewLeft.dL = trNewRight.dR = null;\n\t\t\t}\n\t\t}", "function nearStitching(after0U, before1U, uv) {\n\t\tif(uv.x >= 0.8) {\n\t\t\tbefore1U.push(uv);\n\t\t}\n\t\t\n\t\tif(uv.x <= 0.2) {\n\t\t\tafter0U.push(uv);\n\t\t}\n\t}", "function resume(){\n\tfor( let i = 0; i < subplanes.length ; i++ ){\n\t\tsubplanes[i].resume();\n\t}\n\tpaused = false;\n}", "kill() {\n this.segments.forEach(s => s.el.style.opacity = '0.5');\n }", "function onSegment(p, q, r) {\n if (\n q.x <= Math.max(p.x, r.x) &&\n q.x >= Math.min(p.x, r.x) &&\n q.y <= Math.max(p.y, r.y) &&\n q.y >= Math.min(p.y, r.y)\n )\n return true\n\n return false\n}", "function only_one_trap_below( inTrNext ) {\r\n\r\n\t\t\tif ( trCurrent.vLow == trLast.vLow ) {\r\n\t\t\t\t// final part of segment\r\n\r\n\t\t\t\tif ( meetsLowAdjSeg ) {\r\n\t\t\t\t\t// downward cusp: bottom forms a triangle\r\n\r\n\t\t\t\t\t// ATTENTION: the decision whether trNewLeft and trNewRight are to the\r\n\t\t\t\t\t//\tleft or right of the already inserted segment the new one meets here\r\n\t\t\t\t\t//\thas already been taken when selecting trLast to the left or right\r\n\t\t\t\t\t//\tof that already inserted segment !!\r\n\r\n\t\t\t\t\tif ( trCurrent.dL ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_LEFT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg from the left!\" );\r\n\t\t\t\t\t\t//\t\t+\t\t/\r\n\t\t\t\t\t\t//\t\t + NR /\r\n\t\t\t\t\t\t//\t NL +\t /\r\n\t\t\t\t\t\t//\t\t + /\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dL = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uL = trNewLeft;\t// uR: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = inTrNext;\r\n\t\t\t\t\t\ttrNewRight.dR = null;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_RIGHT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg to the right!\" );\r\n\t\t\t\t\t\t//\t\t\\\t\t+\r\n\t\t\t\t\t\t//\t\t \\ NL +\r\n\t\t\t\t\t\t//\t\t \\\t + NR\r\n\t\t\t\t\t\t//\t\t \\ +\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dR = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uR = trNewRight;\t// uL: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = null;\r\n\t\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_END; next: ----\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg ends here, low adjacent seg still missing\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------*-------\r\n\t\t\t\t\t//\t\t next\r\n\r\n\t\t\t\t\t// setAbove\r\n\t\t\t\t\tinTrNext.uL = trNewLeft;\t\t\t\t\t\t\t\t\t// trNewLeft must\r\n\t\t\t\t\tinTrNext.uR = trNewRight;\t\t// must\r\n\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\ttrNewLeft.dL = trNewRight.dR = inTrNext;\t\t\t\t\t// Error\r\n//\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t}\r\n\t\t\t\t// setBelow part 2\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = null;\r\n\t\t\t} else {\r\n\t\t\t\t// NOT final part of segment\r\n\r\n\t\t\t\tif ( inTrNext.uL && inTrNext.uR ) {\r\n\t\t\t\t\t// inTrNext has two upper neighbors\r\n\t\t\t\t\t// => a segment ends on the upper Y-line of inTrNext\r\n\t\t\t\t\t// => inTrNext has temporarily 3 upper neighbors\r\n\t\t\t\t\t// => marks whether the new segment cuts through\r\n\t\t\t\t\t//\t\tuL or uR of inTrNext and saves the other in .usave\r\n\t\t\t\t\tif ( inTrNext.uL == trCurrent ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_LEFT; next: CC_3UN_LEFT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): u0a, u0b, uR(usave)\" );\r\n\t\t\t\t\t\t//\t\t +\t\t /\r\n\t\t\t\t\t\t//\t NL +\t NR\t /\r\n\t\t\t\t\t\t//\t\t +\t/\r\n\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 next\r\n//\t\t\t\t\t\tif ( inTrNext.uR != trNewRight ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uR;\r\n\t\t\t\t\t\t\tinTrNext.uleft = true;\r\n\t\t\t\t\t\t\t// trNewLeft: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop right\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_RIGHT; next: CC_3UN_RIGHT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): uL(usave), u1a, u1b\" );\r\n\t\t\t\t\t\t//\t \\\t\t +\r\n\t\t\t\t\t\t//\t \\\t NL + NR\r\n\t\t\t\t\t\t//\t \\\t +\r\n\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\t next\r\n//\t\t\t\t\t\tif ( inTrNext.uL != trNewLeft ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uL;\r\n\t\t\t\t\t\t\tinTrNext.uleft = false;\r\n\t\t\t\t\t\t\t// trNewRight: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop left\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t//} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_CONT; next: CC_2UN\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg continues down\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------+-------\r\n\t\t\t\t\t//\t \t +\r\n\t\t\t\t\t//\t\tnext\r\n\r\n\t\t\t\t\t// L/R for one side undefined, which one is not fixed\r\n\t\t\t\t\t//\tbut that one will be extended down and changed anyway\r\n\t\t\t\t\t// for the other side, vLow must lie at the opposite end\r\n\t\t\t\t\t//\tthus both are set accordingly\r\n\t\t\t\t}\r\n\t\t\t\t// setAbove\r\n\t\t\t\tinTrNext.uL = trNewLeft;\r\n\t\t\t\tinTrNext.uR = trNewRight;\r\n\t\t\t\t// setBelow\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = inTrNext;\r\n\t\t\t\ttrNewLeft.dL = trNewRight.dR = null;\r\n\t\t\t}\r\n\t\t}", "function only_one_trap_below( inTrNext ) {\r\n\r\n\t\t\tif ( trCurrent.vLow == trLast.vLow ) {\r\n\t\t\t\t// final part of segment\r\n\r\n\t\t\t\tif ( meetsLowAdjSeg ) {\r\n\t\t\t\t\t// downward cusp: bottom forms a triangle\r\n\r\n\t\t\t\t\t// ATTENTION: the decision whether trNewLeft and trNewRight are to the\r\n\t\t\t\t\t//\tleft or right of the already inserted segment the new one meets here\r\n\t\t\t\t\t//\thas already been taken when selecting trLast to the left or right\r\n\t\t\t\t\t//\tof that already inserted segment !!\r\n\r\n\t\t\t\t\tif ( trCurrent.dL ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_LEFT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg from the left!\" );\r\n\t\t\t\t\t\t//\t\t+\t\t/\r\n\t\t\t\t\t\t//\t\t + NR /\r\n\t\t\t\t\t\t//\t NL +\t /\r\n\t\t\t\t\t\t//\t\t + /\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dL = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uL = trNewLeft;\t// uR: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = inTrNext;\r\n\t\t\t\t\t\ttrNewRight.dR = null;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_RIGHT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg to the right!\" );\r\n\t\t\t\t\t\t//\t\t\\\t\t+\r\n\t\t\t\t\t\t//\t\t \\ NL +\r\n\t\t\t\t\t\t//\t\t \\\t + NR\r\n\t\t\t\t\t\t//\t\t \\ +\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dR = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uR = trNewRight;\t// uL: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = null;\r\n\t\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_END; next: ----\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg ends here, low adjacent seg still missing\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------*-------\r\n\t\t\t\t\t//\t\t next\r\n\r\n\t\t\t\t\t// setAbove\r\n\t\t\t\t\tinTrNext.uL = trNewLeft;\t\t\t\t\t\t\t\t\t// trNewLeft must\r\n\t\t\t\t\tinTrNext.uR = trNewRight;\t\t// must\r\n\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\ttrNewLeft.dL = trNewRight.dR = inTrNext;\t\t\t\t\t// Error\r\n//\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t}\r\n\t\t\t\t// setBelow part 2\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = null;\r\n\t\t\t} else {\r\n\t\t\t\t// NOT final part of segment\r\n\r\n\t\t\t\tif ( inTrNext.uL && inTrNext.uR ) {\r\n\t\t\t\t\t// inTrNext has two upper neighbors\r\n\t\t\t\t\t// => a segment ends on the upper Y-line of inTrNext\r\n\t\t\t\t\t// => inTrNext has temporarily 3 upper neighbors\r\n\t\t\t\t\t// => marks whether the new segment cuts through\r\n\t\t\t\t\t//\t\tuL or uR of inTrNext and saves the other in .usave\r\n\t\t\t\t\tif ( inTrNext.uL == trCurrent ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_LEFT; next: CC_3UN_LEFT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): u0a, u0b, uR(usave)\" );\r\n\t\t\t\t\t\t//\t\t +\t\t /\r\n\t\t\t\t\t\t//\t NL +\t NR\t /\r\n\t\t\t\t\t\t//\t\t +\t/\r\n\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 next\r\n//\t\t\t\t\t\tif ( inTrNext.uR != trNewRight ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uR;\r\n\t\t\t\t\t\t\tinTrNext.uleft = true;\r\n\t\t\t\t\t\t\t// trNewLeft: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop right\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_RIGHT; next: CC_3UN_RIGHT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): uL(usave), u1a, u1b\" );\r\n\t\t\t\t\t\t//\t \\\t\t +\r\n\t\t\t\t\t\t//\t \\\t NL + NR\r\n\t\t\t\t\t\t//\t \\\t +\r\n\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\t next\r\n//\t\t\t\t\t\tif ( inTrNext.uL != trNewLeft ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uL;\r\n\t\t\t\t\t\t\tinTrNext.uleft = false;\r\n\t\t\t\t\t\t\t// trNewRight: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop left\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t//} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_CONT; next: CC_2UN\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg continues down\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------+-------\r\n\t\t\t\t\t//\t \t +\r\n\t\t\t\t\t//\t\tnext\r\n\r\n\t\t\t\t\t// L/R for one side undefined, which one is not fixed\r\n\t\t\t\t\t//\tbut that one will be extended down and changed anyway\r\n\t\t\t\t\t// for the other side, vLow must lie at the opposite end\r\n\t\t\t\t\t//\tthus both are set accordingly\r\n\t\t\t\t}\r\n\t\t\t\t// setAbove\r\n\t\t\t\tinTrNext.uL = trNewLeft;\r\n\t\t\t\tinTrNext.uR = trNewRight;\r\n\t\t\t\t// setBelow\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = inTrNext;\r\n\t\t\t\ttrNewLeft.dL = trNewRight.dR = null;\r\n\t\t\t}\r\n\t\t}", "trim(start, end) {\n const trackStart = this.getStartTime();\n const trackEnd = this.endTime;\n const offset = this.cueIn - trackStart;\n\n if ((trackStart <= start && trackEnd >= start) ||\n (trackStart <= end && trackEnd >= end)) {\n const cueIn = (start < trackStart) ? trackStart : start;\n const cueOut = (end > trackEnd) ? trackEnd : end;\n\n this.setCues(cueIn + offset, cueOut + offset);\n if (start > trackStart) {\n this.setStartTime(start);\n }\n }\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if (pointEqual(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link$1(subject);\n link$1(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function sprawdz(){\n n++;\n i = n-1;\n n=n%tImg.length;\n i=i%tImg.length;\n }", "function updateScreen(){\t//funcio (bucle) que s'executa per actualitzar l'estat de la pantalla del joc\n\tcuttingSegments();\t//mira si hi ha segments que es creuin\n\tdrawAll();\t\t\t//dibuixa al canvas\n\tupdateState();\t\t//reescriu el nivell i el % completat\n}", "function prevSnip() {\n if (mixSplits != null && mixSplits != undefined) {\n splitPointer--;\n if ((splitPointer < mixSplits.length) && (splitPointer >= 0)) {\n preview(mixSplits[splitPointer], mixSplits[splitPointer] + snipWin, function () {\n });\n } else {\n splitPointer++;\n }\n }\n}", "sendSegmentAckIfApplicable() {\n // We check for chunks Received +1 as at the sender side it is one greate\n // TODO: Improve this logic. It is ugly\n if ((this.chunksReceived + 1) % this.transferRate === 0) {\n this.segmentNumberReceived += 1;\n\n this.peerComm.send(this.peer_id, {\n type: \"file_segment_ack\",\n data: {\n transfer_id: this.id,\n segment_number: this.segmentNumberReceived\n }\n });\n\n console.log(`Segment ACK sent: ${this.segmentNumberReceived}`);\n }\n }", "function manageEnrollmentsOnRemove(vm, params) {\n //zero its enrollments\n zeroEnrollments(params.updatedPlan);\n //if a single other med plan is still selected, give it all the enrollments\n if (params.isMedPlan && params.singleMedStillSelected) { \n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.medPlanRemaining]);\n //recursively pass this plan back through the updatePlans cycle, to get enrollmments to update for the payload\n params.updatePlansFn(vm, params.medPlanRemaining, null, {remainingMedPlanUpdate: true}); \n }\n //if we're removing a delta dental DO plan, remove enrollments from the DO plan, too\n if (params.isDualDenPrimary) { \n const associatedDO = vm.plans.dental.directOption.selected[0];\n if (associatedDO) {\n zeroEnrollments(associatedDO);\n //need to recursively call updatePlans on this DO plan\n this.updatePlans(vm, associatedDO);\n }\n }\n}", "function render() {\n\n var baseSegment = findSegment(position);\n var basePercent = Util_percentRemaining(position, segmentLength);\n var playerSegment = findSegment(position+playerZ);\n var playerPercent = Util_percentRemaining(position+playerZ, segmentLength);\n var playerY = Util_interpolate(playerSegment.p1.w.y, playerSegment.p2.w.y, playerPercent);\n var maxy = height;\n\n var x = 0;\n var dx = - (baseSegment.curve * basePercent);\n\n ctx.clearRect(0, 0, width, height);\n\n Render_background(ctx, background, width, height, BACKGROUND.SKY, skyOffset, resolution * skySpeed * playerY);\n Render_background(ctx, background, width, height, BACKGROUND.HILLS, hillOffset, resolution * hillSpeed * playerY);\n Render_background(ctx, background, width, height, BACKGROUND.TREES, treeOffset, resolution * treeSpeed * playerY);\n\n var n, i, segment, car, sprite, spriteScale, spriteX, spriteY;\n\n for(n = 0 ; n < drawDistance ; n++) {\n\n segment = segments[(baseSegment.n + n) % segments.length];\n segment.looped = segment.n < baseSegment.n;\n segment.f = Util_exponentialFog(n/drawDistance, fogDensity);\n segment.clip = maxy;\n\n Util_project(segment.p1, (playerX * roadWidth) - x, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n Util_project(segment.p2, (playerX * roadWidth) - x - dx, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n\n x = x + dx;\n dx = dx + segment.curve;\n\n if ((segment.p1.c.z <= cameraDepth) || // behind us\n (segment.p2.s.y >= segment.p1.s.y) || // back face cull\n (segment.p2.s.y >= maxy)) // clip by (already rendered) hill\n continue;\n\n Render_segment(ctx, width, lanes,\n segment.p1.s.x,\n segment.p1.s.y,\n segment.p1.s.w,\n segment.p2.s.x,\n segment.p2.s.y,\n segment.p2.s.w,\n segment.f,\n segment.c);\n\n maxy = segment.p1.s.y;\n }\n\n for(n = (drawDistance-1) ; n > 0 ; n--) {\n segment = segments[(baseSegment.n + n) % segments.length];\n\n for(i = 0 ; i < segment.cars.length ; i++) {\n car = segment.cars[i];\n sprite = car.sprite;\n spriteScale = Util_interpolate(segment.p1.s.s, segment.p2.s.s, car.percent);\n spriteX = Util_interpolate(segment.p1.s.x, segment.p2.s.x, car.percent) + (spriteScale * car.o * roadWidth * width/2);\n spriteY = Util_interpolate(segment.p1.s.y, segment.p2.s.y, car.percent);\n Render_sprite(ctx, width, height, resolution, roadWidth, sprites, car.sprite, spriteScale, spriteX, spriteY, -0.5, -1, segment.clip);\n }\n\n for(i = 0 ; i < segment.s.length ; i++) {\n sprite = segment.s[i];\n spriteScale = segment.p1.s.s;\n spriteX = segment.p1.s.x + (spriteScale * sprite.o * roadWidth * width/2);\n spriteY = segment.p1.s.y;\n Render_sprite(ctx, width, height, resolution, roadWidth, sprites, sprite.source, spriteScale, spriteX, spriteY, (sprite.o < 0 ? -1 : 0), -1, segment.clip);\n }\n\n if (segment == playerSegment) {\n Render_player(ctx, width, height, resolution, roadWidth, sprites, speed/maxSpeed,\n cameraDepth/playerZ,\n width/2,\n (height/2) - (cameraDepth/playerZ * Util_interpolate(playerSegment.p1.c.y, playerSegment.p2.c.y, playerPercent) * height/2),\n speed * (keyLeft ? -1 : keyRight ? 1 : 0),\n playerSegment.p2.w.y - playerSegment.p1.w.y);\n }\n }\n\n\tctx.font = '12px monospace';\n\tctx.fillStyle = '#000';\n\tctx.fillText((' ' + 5 * round(speed/500) + ' mph').slice(-7), 10, 15);\n\tctx.fillText(formatTime(currentTime), width / 2 - 30, 15);\n\tctx.fillText('Lap ' + lapCount + ' of ' + totalLaps, width - 80, 15);\n\n }" ]
[ "0.5766313", "0.5746724", "0.5595022", "0.5417537", "0.52656126", "0.5077525", "0.5059967", "0.50532365", "0.50049883", "0.5002344", "0.4894684", "0.48554", "0.4810387", "0.47657138", "0.47534618", "0.47334775", "0.4716487", "0.47163123", "0.471399", "0.46825728", "0.46762305", "0.46661034", "0.46425444", "0.46383134", "0.46356678", "0.46013767", "0.4571785", "0.45653", "0.45520514", "0.45283875", "0.4521835", "0.45114887", "0.45030868", "0.44994125", "0.4499034", "0.449448", "0.447411", "0.44738275", "0.44633007", "0.44541973", "0.44541973", "0.44451353", "0.44356877", "0.44354716", "0.44331735", "0.44322175", "0.44319996", "0.44247955", "0.44247955", "0.44162792", "0.44093746", "0.4407388", "0.44020122", "0.4393984", "0.4384377", "0.43807766", "0.437995", "0.43770382", "0.43736613", "0.43725833", "0.43681055", "0.43647438", "0.4357643", "0.4353598", "0.4351415", "0.43509385", "0.43474108", "0.43472192", "0.43309763", "0.4324879", "0.43204877", "0.43185976", "0.43086267", "0.43059093", "0.43053374", "0.43039697", "0.4300514", "0.43001643", "0.42933327", "0.4292393", "0.42923456", "0.42884898", "0.42872334", "0.42835522", "0.42804185", "0.4279431", "0.42774144", "0.42774144", "0.42750078", "0.426383", "0.42578602", "0.42578602", "0.42578602", "0.42578602", "0.4255244", "0.42535368", "0.4252344", "0.42476994", "0.4243497", "0.42400724", "0.42399678" ]
0.0
-1
play current segment with prePostRoll s pre and prePostRoll s/full postroll, exclude removed segments
function playWithoutDeleted_helper(full) { full = full || false; clearEvents2(); if (editor.splitData && editor.splitData.splits) { var splitItem = getCurrentSplitItem(); if (splitItem != null) { pauseVideo(); var clipStartFrom = -1; var clipStartTo = -1; var segmentStart = splitItem.clipBegin; var segmentEnd = splitItem.clipEnd; var clipEndFrom = -1; var clipEndTo = -1; var hasPrevElem = true; var hasNextElem = true; var duration = getDuration(); // check previous item to be played, get start time if ((splitItem.id - 1) >= 0) { hasPrevElem = true; if ((splitItem.id - 1) >= 0) { var prevSplitItem = editor.splitData.splits[splitItem.id - 1]; while (!prevSplitItem.enabled) { if ((prevSplitItem.id - 1) < 0) { hasPrevElem = false; break; } else { prevSplitItem = editor.splitData.splits[prevSplitItem.id - 1]; } } } else { hasPrevElem = false; } if (hasPrevElem) { clipStartTo = prevSplitItem.clipEnd; clipStartFrom = clipStartTo - prePostRoll; } } if (hasPrevElem) { clipStartFrom = (clipStartFrom < 0) ? 0 : clipStartFrom; } if (full) { if ((splitItem.id + 1) < editor.splitData.splits.length) { hasNextElem = true; var nextSplitItem = editor.splitData.splits[splitItem.id + 1]; while (!nextSplitItem.enabled) { if ((nextSplitItem.id + 1) >= editor.splitData.splits.length) { hasNextElem = false; break; } else { nextSplitItem = editor.splitData.splits[nextSplitItem.id + 1]; } } if (hasNextElem) { clipEndFrom = nextSplitItem.clipBegin; clipEndTo = clipEndFrom + prePostRoll; } } if (hasNextElem) { clipEndTo = (clipEndTo > duration) ? duration : clipEndTo; } } else { clipEndFrom = -1; clipEndTo = -1; var splBP2 = splitItem.clipBegin + prePostRoll; segmentEnd = (splBP2 <= splitItem.clipEnd) ? splBP2 : splitItem.clipEnd; segmentEnd = (segmentEnd > duration) ? duration : segmentEnd; } ocUtils.log("Play Times: " + clipStartFrom + " - " + clipStartTo + " | " + segmentStart + " - " + segmentEnd + " | " + clipEndFrom + " - " + clipEndTo); if (hasPrevElem && ((full && hasNextElem) || !full)) { currSplitItemClickedViaJQ = true; setCurrentTime(clipStartFrom); clearEvents(); editor.player.on("play", { duration: (clipStartTo - clipStartFrom) * 1000, endTime: clipStartTo }, onPlay); playVideo(); timeout3 = window.setTimeout(function() { pauseVideo(); currSplitItemClickedViaJQ = true; setCurrentTime(segmentStart); clearEvents(); editor.player.on("play", { duration: (segmentEnd - segmentStart) * 1000, endTime: segmentEnd }, onPlay); playVideo(); }, (clipStartTo - clipStartFrom) * 1000); if (full) { timeout4 = window.setTimeout(function() { pauseVideo(); if (timeout3 != null) { window.clearTimeout(timeout3); timeout3 = null; } currSplitItemClickedViaJQ = true; setCurrentTime(clipEndFrom); clearEvents(); editor.player.on("play", { duration: (clipEndTo - clipEndFrom) * 1000, endTime: clipEndTo }, onPlay); playVideo(); if (timeout4 != null) { window.clearTimeout(timeout4); timeout4 = null; } }, ((clipStartTo - clipStartFrom) * 1000) + ((segmentEnd - segmentStart) * 1000)); } else { timeout4 = window.setTimeout(function() { pauseVideo(); if (timeout3 != null) { window.clearTimeout(timeout3); timeout3 = null; } currSplitItemClickedViaJQ = true; clearEvents(); if (timeout4 != null) { window.clearTimeout(timeout4); timeout4 = null; } }, ((clipStartTo - clipStartFrom) * 1000) + (segmentEnd * 1000)); } } else if (!hasPrevElem && hasNextElem) { currSplitItemClickedViaJQ = true; setCurrentTime(segmentStart); clearEvents(); editor.player.on("play", { duration: (segmentEnd - segmentStart) * 1000, endTime: segmentEnd }, onPlay); playVideo(); if (full) { timeout3 = window.setTimeout(function() { pauseVideo(); currSplitItemClickedViaJQ = true; setCurrentTime(clipEndFrom); clearEvents(); editor.player.on("play", { duration: (clipEndTo - clipEndFrom) * 1000, endTime: clipEndTo }, onPlay); playVideo(); if (timeout3 != null) { window.clearTimeout(timeout3); timeout3 = null; } }, ((segmentEnd - segmentStart) * 1000)); } else { timeout3 = window.setTimeout(function() { pauseVideo(); currSplitItemClickedViaJQ = true; clearEvents(); if (timeout3 != null) { window.clearTimeout(timeout3); timeout3 = null; } }, (segmentEnd * 1000)); } } else if (hasPrevElem && !hasNextElem) { currSplitItemClickedViaJQ = true; setCurrentTime(clipStartFrom); clearEvents(); editor.player.on("play", { duration: (clipStartTo - clipStartFrom) * 1000, endTime: clipStartTo }, onPlay); playVideo(); timeout3 = window.setTimeout(function() { pauseVideo(); currSplitItemClickedViaJQ = true; setCurrentTime(segmentStart); clearEvents(); editor.player.on("play", { duration: (segmentEnd - segmentStart) * 1000, endTime: segmentEnd }, onPlay); playVideo(); if (timeout3 != null) { window.clearTimeout(timeout3); timeout3 = null; } }, (clipStartTo - clipStartFrom) * 1000); } else if (!hasPrevElem && !hasNextElem) { clearEvents(); editor.player.on("play", { duration: (segmentEnd - segmentStart) * 1000, endTime: segmentEnd }, onPlay); playVideo(); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousSegment() {\n if (editor.splitData && editor.splitData.splits) {\n var playerPaused = getPlayerPaused();\n if (!playerPaused) {\n pauseVideo();\n }\n var currSplitItem = getCurrentSplitItem();\n var new_id = currSplitItem.id - 1;\n new_id = (new_id < 0) ? (editor.splitData.splits.length - 1) : new_id;\n\n var idFound = true;\n if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) {\n idFound = false;\n }\n /*\n\telse if (!editor.splitData.splits[new_id].enabled) {\n idFound = false;\n new_id = (new_id <= 0) ? editor.splitData.splits.length : new_id;\n for (var i = new_id - 1; i >= 0; --i) {\n\n if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n }\n }\n }\n\t*/\n if (!idFound) {\n for (var i = editor.splitData.splits.length - 1; i >= 0; --i) {\n // if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n // }\n }\n }\n\n if (idFound) {\n selectSegmentListElement(new_id, !playerPaused);\n }\n if (!playerPaused) {\n playVideo();\n }\n }\n}", "function nextSegment() {\n if (editor.splitData && editor.splitData.splits) {\n var playerPaused = getPlayerPaused();\n if (!playerPaused) {\n pauseVideo();\n }\n\n var currSplitItem = getCurrentSplitItem();\n var new_id = currSplitItem.id + 1;\n\n new_id = (new_id >= editor.splitData.splits.length) ? 0 : new_id;\n\n var idFound = true;\n if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) {\n idFound = false;\n }\n /*\n\telse if (!editor.splitData.splits[new_id].enabled) {\n idFound = false;\n new_id = (new_id >= (editor.splitData.splits.length - 1)) ? 0 : new_id;\n\n for (var i = new_id + 1; i < editor.splitData.splits.length; ++i) {\n if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n }\n }\n }\n\t*/\n if (!idFound) {\n for (var i = 0; i < new_id; ++i) {\n // if (editor.splitData.splits[i].enabled) {\n new_id = i;\n idFound = true;\n break;\n // }\n }\n }\n\n if (idFound) {\n selectSegmentListElement(new_id, !playerPaused);\n }\n if (!playerPaused) {\n playVideo();\n }\n }\n}", "function playSqOfSegments(transcripts) {\n videoSrc = transcripts[counter]['src']\n inPoint = transcripts[counter]['inPoint']\n outPoint = transcripts[counter]['outPoint']\n playOneSegment(videoSrc, inPoint, outPoint)\n }", "slither() {\n // nextDir will be the NEW direction of the segment being processed in each iteration of the loop below\n let nextDir = this.getHead().direction;\n for ( let s of this.segments ) {\n // Update the segment's position to its next position\n s.gridPosition = s.nextPosition();\n\n const oldDir = s.direction; // Remember its current direction so we can use it as the next nextDir\n s.direction = nextDir; // Update the segment's direction to the nextDir (which was the previous segments direction)\n nextDir = oldDir; // Finally, set up nextDir for the next iteration\n }\n }", "resetSegments() {\n var i;\n for(i = 0; i < this.numSegments; i ++ ){\n this.segmentGenerated[i] = segmentStatus.NOT_GENERATED;\n }\n }", "clipEar(listofseg){\n\t\tlet copypoint = listofseg.map(function(e){\n\t\t\treturn e.a\n\t\t})\n\t\tfor (let i=0; i<listofseg.length;i++){\n\t\t\tlet sega = listofseg[i];\n\t\t\tlet segb;\n\t\t\tlet copy = copypoint.map((x=>x));\n\t\t\tif (i=== listofseg.length-1){\n\t\t\t\tsegb = listofseg[0]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t\tcopy.splice(0,1)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsegb = listofseg[i+1]\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t\tcopy.splice(i,1)\n\t\t\t}\n\t\t\tlet notfound = true;\n\t\t\tfor (let j=0; j<copy.length;j++){\n\t\t\t\tif (this.checkTriangle(sega, segb, copy[j])){\n\t\t\t\t\tnotfound = false\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (notfound){\n\t\t\t\tthis.segList.push([sega, segb])\n\t\t\t\tif (i=== listofseg.length-1){\n\t\t\t\t\tlistofseg.pop();\n\t\t\t\t\tlistofseg.shift();\n\t\t\t\t\treturn listofseg.splice(0,0,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\treturn listofseg.splice(i,2,{a:sega.a,b:segb.b})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function okButtonClick() {\n if (!continueProcessing && checkClipBegin() && checkClipEnd()) {\n id = $('#splitUUID').val();\n if (id != \"\") {\n var current = editor.splitData.splits[id];\n var tmpBegin = parseFloat(current.clipBegin);\n var tmpEnd = parseFloat(current.clipEnd);\n var duration = getDuration();\n id = parseInt(id);\n if (getTimefieldTimeBegin() > getTimefieldTimeEnd()) {\n displayMsg(\"The inpoint is bigger than the outpoint. Please check and correct it.\",\n \"Check and correct inpoint and outpoint\");\n selectSegmentListElement(id);\n return;\n }\n\n if (checkPrevAndNext(id, true).ok) {\n if (editor.splitData && editor.splitData.splits) {\n current.clipBegin = getTimefieldTimeBegin();\n current.clipEnd = getTimefieldTimeEnd();\n if (id > 0) {\n if (current.clipBegin > editor.splitData.splits[id - 1].clipBegin) {\n editor.splitData.splits[id - 1].clipEnd = current.clipBegin;\n } else {\n displayMsg(\"The inpoint is bigger than the inpoint of the segment before this segment. Please check and correct it.\",\n \"Check and correct inpoint\");\n setTimefieldTimeBegin(editor.splitData.splits[id - 1].clipEnd);\n selectSegmentListElement(id);\n return;\n }\n }\n\n var last = editor.splitData.splits[editor.splitData.splits.length - 1];\n if (last.clipEnd < duration) {\n ocUtils.log(\"Inserting a last split element (auto): (\" + current.clipEnd + \" - \" + duration + \")\");\n var newLastItem = {\n clipBegin: parseFloat(last.clipEnd),\n clipEnd: parseFloat(duration),\n enabled: true\n };\n\n // add the new item to the end\n editor.splitData.splits.push(newLastItem);\n }\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n if (checkPrevAndNext(i, false).inserted) {\n i = 0;\n }\n }\n }\n\n editor.updateSplitList(true, !zoomedIn());\n $('#videoPlayer').focus();\n selectSegmentListElement(id);\n } else {\n current.clipBegin = tmpBegin;\n current.clipEnd = tmpEnd;\n selectSegmentListElement(id);\n }\n }\n } else {\n selectCurrentSplitItem();\n }\n}", "async resumeCleaningSegments() {\n await this.sendCommand(\"resume_segment_clean\", [], {});\n }", "componentWillReceiveProps(nextProps) {\n const {initialText, segments} = nextProps.currentStory;\n\n //Create pages array that will contain story pages - first page contains initialText and 2 segments\n //Keep only the segments that were accepted in voting\n let pagesArray = [];\n let segmentsCopy = segments.filter(val => val.status === 'accepted');\n pagesArray[0] = [{content: initialText}, segmentsCopy[0], segmentsCopy[1]];\n\n //Remove first two segments that were used in first page, and create pages (3 segments or less per page)\n //Note: optimal number of segments per page has not been decided yet\n segmentsCopy = segmentsCopy.slice(2);\n while (segmentsCopy.length) {\n var newPage = segmentsCopy.splice(0,3);\n pagesArray.push(newPage);\n }\n\n this.setState({\n ...this.state,\n currentStory: nextProps.currentStory,\n pages: pagesArray,\n error: nextProps.error\n });\n }", "function subdivideSegments(eventQueue, subject, clipping, sbbox, cbbox, operation) {\n var sweepLine = new Tree(compareSegments);\n var sortedEvents = [];\n\n var rightbound = min(sbbox[2], cbbox[2]);\n\n var prev, next;\n\n while (eventQueue.length) {\n var event = eventQueue.pop();\n sortedEvents.push(event);\n\n // optimization by bboxes for intersection and difference goes here\n if ((operation === INTERSECTION && event.point[0] > rightbound) ||\n (operation === DIFFERENCE && event.point[0] > sbbox[2])) {\n break;\n }\n\n if (event.left) {\n sweepLine = sweepLine.insert(event);\n //_renderSweepLine(sweepLine, event.point, event);\n\n next = sweepLine.find(event);\n prev = sweepLine.find(event);\n event.iterator = sweepLine.find(event);\n\n if (prev.node !== sweepLine.begin) {\n prev.prev();\n } else {\n prev = sweepLine.begin;\n prev.prev();\n prev.next();\n }\n next.next();\n\n var prevEvent = (prev.key || null), prevprevEvent;\n computeFields(event, prevEvent, operation);\n if (next.node) {\n if (possibleIntersection(event, next.key, eventQueue) === 2) {\n computeFields(event, prevEvent, operation);\n computeFields(event, next.key, operation);\n }\n }\n\n if (prev.node) {\n if (possibleIntersection(prev.key, event, eventQueue) === 2) {\n var prevprev = sweepLine.find(prev.key);\n if (prevprev.node !== sweepLine.begin) {\n prevprev.prev();\n } else {\n prevprev = sweepLine.find(sweepLine.end);\n prevprev.next();\n }\n prevprevEvent = prevprev.key || null;\n computeFields(prevEvent, prevprevEvent, operation);\n computeFields(event, prevEvent, operation);\n }\n }\n } else {\n event = event.otherEvent;\n next = sweepLine.find(event);\n prev = sweepLine.find(event);\n\n // _renderSweepLine(sweepLine, event.otherEvent.point, event);\n\n if (!(prev && next)) continue;\n\n if (prev.node !== sweepLine.begin) {\n prev.prev();\n } else {\n prev = sweepLine.begin;\n prev.prev();\n prev.next();\n }\n next.next();\n sweepLine = sweepLine.remove(event);\n\n // _renderSweepLine(sweepLine, event.otherEvent.point, event);\n\n if (next.node && prev.node) {\n if (typeof prev.node.value !== 'undefined' && typeof next.node.value !== 'undefined') {\n possibleIntersection(prev.key, next.key, eventQueue);\n }\n }\n }\n }\n return sortedEvents;\n}", "function playOneSegment(videoSrc, inPoint, outPoint) {\n video.src = videoSrc\n video.load\n video.currentTime = inPoint\n video.play()\n video.ontimeupdate = function () {\n stopAtOutPoint()\n }\n counter += 1\n }", "didSwitchToSegmentsLayout() {\n this.controllerState.viewMode = ViewMode.segments;\n this.didSwitchLayout();\n }", "async addClip(_, { post_id, user_id }) {\n console.log('addClip');\n console.log(post_id);\n console.log(user_id);\n var alreadyClipped = false;\n db.collection('users')\n .doc(user_id)\n .get()\n .then((doc) => {\n for (const clip in doc.data().clips) {\n //Checks if the user has already clipped the post\n if (doc.data().clips[clip] == post_id) {\n alreadyClipped = true;\n }\n }\n\n // If the user hasnt clipped the post then clip it else unclip it\n if (!alreadyClipped) {\n db.collection('posts')\n .doc(post_id)\n .update({\n clips: firebase.firestore.FieldValue.increment(1),\n });\n db.collection('users')\n .doc(user_id)\n .update({\n clips: firebase.firestore.FieldValue.arrayUnion(post_id),\n });\n } else {\n db.collection('posts')\n .doc(post_id)\n .update({\n clips: firebase.firestore.FieldValue.increment(-1),\n });\n db.collection('users')\n .doc(user_id)\n .update({\n clips: firebase.firestore.FieldValue.arrayRemove(post_id),\n });\n }\n });\n }", "_mayHotReloadSegments() {\n this._allowOverwriteSegment = {};\n var segmentName;\n for (segmentName in this._segments) {\n if (!this._segments.hasOwnProperty(segmentName)) continue;\n this._allowOverwriteSegment[segmentName] = true;\n }\n }", "function LateUpdate()\n{\n\tif(!updated)\n\t{\n\t\treturn;\n\t}\n\tupdated = false;\n\t\n\tvar mesh : Mesh = GetComponent(MeshFilter).mesh;\n\tmesh.Clear();\n\tvar segmentCount : int = 0;\n\tfor(var j : int = 0; j < numMarks && j < maxMarks; j++)\n\t\tif(skidmarks[j].lastIndex != -1 && skidmarks[j].lastIndex > numMarks - maxMarks)\n\t\t\tsegmentCount++;\n\t\n\tvar vertices : Vector3[] = new Vector3[segmentCount * 4];\n\tvar normals : Vector3[] = new Vector3[segmentCount * 4];\n\tvar tangents : Vector4[] = new Vector4[segmentCount * 4];\n\tvar colors : Color[] = new Color[segmentCount * 4];\n\tvar uvs : Vector2[] = new Vector2[segmentCount * 4];\n\tvar triangles : int[] = new int[segmentCount * 6];\n\tsegmentCount = 0; \n\t \n\tfor(var i : int = 0; i < numMarks && i < maxMarks; i++)\n\t\tif(skidmarks[i].lastIndex != -1 && skidmarks[i].lastIndex > numMarks - maxMarks)\n\t\t{\n\t\t\tvar curr : markSection = skidmarks[i];\n\t\t\tvar last : markSection = skidmarks[curr.lastIndex % maxMarks];\n\t\t\tvertices[segmentCount * 4 + 0] = last.posl;\n\t\t\tvertices[segmentCount * 4 + 1] = last.posr;\n\t\t\tvertices[segmentCount * 4 + 2] = curr.posl;\n\t\t\tvertices[segmentCount * 4 + 3] = curr.posr;\n\t\t\t\n\t\t\tnormals[segmentCount * 4 + 0] = last.normal;\n\t\t\tnormals[segmentCount * 4 + 1] = last.normal;\n\t\t\tnormals[segmentCount * 4 + 2] = curr.normal;\n\t\t\tnormals[segmentCount * 4 + 3] = curr.normal;\n\n\t\t\ttangents[segmentCount * 4 + 0] = last.tangent;\n\t\t\ttangents[segmentCount * 4 + 1] = last.tangent;\n\t\t\ttangents[segmentCount * 4 + 2] = curr.tangent; \n\t\t\ttangents[segmentCount * 4 + 3] = curr.tangent;\n\t\t\t\n\t\t\tcolors[segmentCount * 4 + 0] = new Color(0, 0, 0, last.intensity * skidmarkIntensity);\n\t\t\tcolors[segmentCount * 4 + 1] = new Color(0, 0, 0, last.intensity * skidmarkIntensity);\n\t\t\tcolors[segmentCount * 4 + 2] = new Color(0, 0, 0, curr.intensity * skidmarkIntensity); \n\t\t\tcolors[segmentCount * 4 + 3 ]= new Color(0, 0, 0, curr.intensity * skidmarkIntensity); \n\n\t\t\tuvs[segmentCount * 4 + 0] = new Vector2(0, 0);\n\t\t\tuvs[segmentCount * 4 + 1] = new Vector2(1, 0);\n\t\t\tuvs[segmentCount * 4 + 2] = new Vector2(0, 1);\n\t\t\tuvs[segmentCount * 4 + 3] = new Vector2(1, 1);\n\t\t\t\n\t\t\ttriangles[segmentCount * 6 + 0] = segmentCount * 4 + 0;\n\t\t\ttriangles[segmentCount * 6 + 2] = segmentCount * 4 + 1;\n\t\t\ttriangles[segmentCount * 6 + 1] = segmentCount * 4 + 2;\n\t\t\t\n\t\t\ttriangles[segmentCount * 6 + 3] = segmentCount * 4 + 2;\n\t\t\ttriangles[segmentCount * 6 + 5] = segmentCount * 4 + 1;\n\t\t\ttriangles[segmentCount * 6 + 4] = segmentCount * 4 + 3;\n\t\t\tsegmentCount++;\t\t\t\n\t\t}\n\t\tmesh.vertices = vertices; \n\t\tmesh.normals = normals;\n\t\tmesh.tangents = tangents;\n\t\tmesh.triangles = triangles;\n\t\tmesh.colors =colors;\n\t\tmesh.uv = uvs; \n}", "function checkPrevAndNext(id, checkTimefields) {\n if (!continueProcessing) {\n checkTimefields = checkTimefields || false;\n var inserted = false;\n if (editor.splitData && editor.splitData.splits) {\n var duration = getDuration();\n var current = editor.splitData.splits[id];\n // new first item\n if (id == 0) {\n var clipBegin = parseFloat(current.clipBegin);\n var clipEnd = parseFloat(current.clipEnd);\n\n if (editor.splitData.splits.length > 1) {\n var next = editor.splitData.splits[1];\n next.clipBegin = clipEnd;\n }\n if ((!checkTimefields || (checkTimefields && (getTimefieldTimeBegin() != 0))) && (clipBegin > minSegmentLength)) {\n ocUtils.log(\"Inserting a first split element (cpan - auto): (\" + 0 + \" - \" + clipBegin + \")\");\n var newSplitItem = {\n clipBegin: 0,\n clipEnd: clipBegin,\n enabled: true\n };\n inserted = true;\n\n // add new item to front\n editor.splitData.splits.splice(0, 0, newSplitItem);\n insertedFirstItem = true;\n } else if (clipBegin > 0) {\n ocUtils.log(\"Extending the first split element to (cpan - auto): (\" + 0 + \" - \" + clipEnd + \")\");\n current.clipBegin = 0;\n }\n }\n // new last item\n else if ((editor.splitData.splits.length > 0) && (id == editor.splitData.splits.length - 1)) {\n if ((!checkTimefields || (checkTimefields && (getTimefieldTimeEnd() != duration))) && (current.clipEnd < (duration - minSegmentLength))) {\n ocUtils.log(\"Inserting a last split element (cpan - auto): (\" + current.clipEnd + \" - \" + duration + \")\");\n var newLastItem = {\n clipBegin: parseFloat(current.clipEnd),\n clipEnd: parseFloat(duration),\n enabled: true\n };\n inserted = true;\n\n // add the new item to the end\n editor.splitData.splits.push(newLastItem);\n var prev = editor.splitData.splits[id - 1];\n prev.clipEnd = parseFloat(current.clipBegin);\n insertedLastItem = true;\n } else {\n ocUtils.log(\"Extending the last split element to (cpan - auto): (\" + current.clipBegin + \" - \" + duration + \")\");\n current.clipEnd = parseFloat(duration);\n }\n }\n // in the middle\n else if ((id > 0) && (id < (editor.splitData.splits.length - 1))) {\n var prev = editor.splitData.splits[id - 1];\n var next = editor.splitData.splits[id + 1];\n\n if (checkTimefields && (getTimefieldTimeBegin() <= prev.clipBegin)) {\n displayMsg(\"The inpoint is lower than the begin of the last segment. Please check.\",\n \"Check inpoint\");\n return {\n ok: false,\n inserted: false\n };\n }\n if (checkTimefields && (getTimefieldTimeEnd() >= next.clipEnd)) {\n displayMsg(\"The outpoint is bigger than the end of the next segment. Please check.\",\n \"Check outpoint\");\n return {\n ok: false,\n inserted: false\n };\n }\n\n prev.clipEnd = parseFloat(current.clipBegin);\n next.clipBegin = parseFloat(current.clipEnd);\n }\n }\n return {\n ok: true,\n inserted: inserted\n };\n }\n}", "removeSegmentsIntersections(tunnels, isWalls) {\n const walls = this.walls;\n let startWallsLength = 0;\n let newWallsAmount = walls.length - startWallsLength;\n\n while (newWallsAmount > 0) {\n startWallsLength = walls.length;\n for (let j = 0; j < walls.length; j += 4) {\n for (let i = 0; i < (isWalls ? j : tunnels.length); i += 4) {\n const pieces = this.resolveSegmentSegment(\n tunnels[i], tunnels[i + 1], tunnels[i + 2], tunnels[i + 3],\n walls[j], walls[j + 1], walls[j + 2], walls[j + 3]\n );\n if (pieces.length < 4) { // empty walls will be removed in removeZeroLengthWalls()\n walls[j] = 0;\n walls[j + 1] = 0;\n walls[j + 2] = 0;\n walls[j + 3] = 0;\n } else {\n walls[j] = pieces[0];\n walls[j + 1] = pieces[1];\n walls[j + 2] = pieces[2];\n walls[j + 3] = pieces[3];\n\n if (pieces.length > 4) {\n walls.push(pieces[4]);\n walls.push(pieces[5]);\n walls.push(pieces[6]);\n walls.push(pieces[7]);\n }\n }\n }\n }\n newWallsAmount = walls.length - startWallsLength;\n }\n }", "function pageleft(e) {\n setMedia();\n if (media.currentTime > trjs.dmz.winsize())\n media.currentTime = media.currentTime - (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n else\n media.currentTime = 0;\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function export_segmentation_plys(segments, opts) {\n var plyExporter = opts.plyExporter;\n var labelRemap = opts.labelRemap;\n var callback = opts.callback;\n var categoryColorIndex = opts.categoryColorIndex;\n var basename = opts.basename;\n var unlabeledColor = new THREE.Color(STK.Constants.defaultPalette.colors[0]);\n\n // colorSegments takes in three parameters: labelToIndex mapping, getLabelFn, getMaterialFn\n // Slightly weird, but segment attribute are set after coloring\n segments.colorSegments('Category', categoryColorIndex, mapCategoryFn);\n var nyu40Labels = labelRemap? labelRemap.getLabelSet('nyu40') : null;\n var mpr40Labels = labelRemap? labelRemap.getLabelSet('mpr40') : null;\n if (nyu40Labels) {\n segments.colorSegments('NYU40', nyu40Labels.labelToId, nyu40Labels.rawLabelToLabel, nyu40Labels.getMaterial, nyu40Labels.unlabeledId);\n }\n if (mpr40Labels) {\n segments.colorSegments('mpr40', mpr40Labels.labelToId, mpr40Labels.rawLabelToLabel, mpr40Labels.getMaterial, mpr40Labels.unlabeledId);\n }\n var objColorIndex = segments.colorSegments('Object', {'unknown': 0});\n\n async.series([\n function (cb) {\n //segments.setMaterialVertexColors(THREE.VertexColors);\n segments.colorRawSegmentsOriginal();\n segments.export(plyExporter, basename + '.annotated', cb);\n },\n function (cb) {\n //segments.setMaterialVertexColors(THREE.NoColors);\n segments.colorRawSegments(unlabeledColor);\n segments.colorSegments('Category', categoryColorIndex, mapCategoryFn);\n segments.export(plyExporter, basename + '.categories.annotated', cb);\n },\n function (cb) {\n // Map from Category to NYU40 and export\n if (nyu40Labels) {\n segments.colorRawSegments(nyu40Labels.unlabeledColor);\n segments.colorSegments('NYU40', nyu40Labels.labelToId, nyu40Labels.rawLabelToLabel, nyu40Labels.getMaterial, nyu40Labels.unlabeledId);\n segments.export(plyExporter, basename + '.nyu40.annotated', cb);\n } else {\n setTimeout(cb, 0);\n }\n },\n function (cb) {\n // Map from Category to MPR40 and export\n if (mpr40Labels) {\n segments.colorRawSegments(mpr40Labels.unlabeledColor);\n segments.colorSegments('mpr40', mpr40Labels.labelToId, mpr40Labels.rawLabelToLabel, mpr40Labels.getMaterial, mpr40Labels.unlabeledId);\n segments.export(plyExporter, basename + '.mpr40.annotated', cb);\n } else {\n setTimeout(cb, 0);\n }\n },\n function (cb) {\n segments.colorRawSegments(unlabeledColor);\n segments.colorSegments('Object', objColorIndex);\n segments.export(plyExporter, basename + '.instances.annotated', cb);\n }\n ], callback);\n}", "resetMainLoaderReplaceSegments() {\n const buffered = this.tech_.buffered();\n const bufferedEnd = buffered.end(buffered.length - 1);\n\n // Set the replace segments flag to the buffered end, this forces fetchAtBuffer\n // on the main loader to remain, false after the resetLoader call, until we have\n // replaced all content buffered ahead of the currentTime.\n this.mainSegmentLoader_.replaceSegmentsUntil = bufferedEnd;\n this.mainSegmentLoader_.resetLoaderProperties();\n this.mainSegmentLoader_.resetLoader();\n }", "onCodePathSegmentStart(segment) {\n const info = {\n uselessContinues: getUselessContinues([], segment.allPrevSegments),\n returned: false\n };\n\n // Stores the info.\n segmentInfoMap.set(segment, info);\n }", "function selectSegments() {\n var peaks = wavesurfer.backend.peaks;\n var length = peaks.length;\n var duration = wavesurfer.getDuration();\n\n var start = 0;\n var min = 0.001;\n for (var i = start; i < length; i += 1) {\n if (peaks[i] <= min && i > start + (1 / duration) * length) {\n var color = [\n ~~(Math.random() * 255),\n ~~(Math.random() * 255),\n ~~(Math.random() * 255),\n 0.1\n ];\n wavesurfer.addRegion({\n color: 'rgba(' + color + ')',\n start: (start / length) * duration,\n end: (i / length) * duration\n });\n while (peaks[i] <= min) {\n i += 1;\n }\n start = i;\n }\n }\n}", "function SnakeSegment() {\n\tthis.draw = function(bIsHead) { // implement the earlier absctract function\n\t\t//this.context.rect(this.x, this.y, 25, 25);\n\t\tif (bIsHead == true){\n\t\t\tthis.context.fillStyle=HEADCOLOUR;\n\t\t} else {\n\t\t\tthis.context.fillStyle=BODYCOLOUR;\n\t\t}\n\t\t\n\t\tthis.context.fillRect((this.x * game.grid.blockSize) + 1 , (this.y * game.grid.blockSize) + 1, game.grid.blockSize - 2, game.grid.blockSize - 2);\n\t}\n\n\tthis.clear = function () {\n\t\tthis.context.clearRect(this.x * game.grid.blockSize, this.y * game.grid.blockSize, game.grid.blockSize, game.grid.blockSize);\n\t}\n}", "function pageright(e) {\n setMedia();\n media.currentTime = media.currentTime + (trjs.dmz.winsize() * trjs.dmz.pagePercentage);\n if (trjs.param.synchro.block() === true) {\n trjs.events.goToTime('partition', media.currentTime); // the wave is not already set\n }\n }", "function skip() {\n game.cutScene.style.display = 'none';\n game.soundInstance.stop();\n // TODO: stop and unload cut scene animation\n}", "onReadyForPostroll(player) {\n const Postroll = States.getState('Postroll');\n\n player.ads.debug('Received readyforpostroll event');\n this.transitionTo(Postroll);\n }", "function setPostProcessing(shaders) {\n\t for (var s in allPost) {\n\t allPost[s].turnOff();\n\t }\n\t composer = new EffectComposer(renderer);\n\t var renderPass = new EffectComposer.RenderPass(scene, camera);\n\t composer.addPass(renderPass);\n\t for (var s in currentPost) {\n\t currentPost[s].turnOn();\n\t var pass = currentPost[s].shader;\n\t pass.renderToScreen = true;\n\t composer.addPass(pass);\n\t }\n\t render();\n\t}", "function splitButtonClick() {\n if (!continueProcessing && editor.splitData && editor.splitData.splits) {\n var currentTime = getCurrentTime();\n for (var i = 0; i < editor.splitData.splits.length; ++i) {\n var splitItem = editor.splitData.splits[i];\n\n splitItem.clipBegin = parseFloat(splitItem.clipBegin);\n splitItem.clipEnd = parseFloat(splitItem.clipEnd);\n if ((splitItem.clipBegin < currentTime) && (currentTime < splitItem.clipEnd)) {\n newEnd = 0;\n if (editor.splitData.splits.length == (i + 1)) {\n newEnd = splitItem.clipEnd;\n } else {\n newEnd = editor.splitData.splits[i + 1].clipBegin;\n }\n var newItem = {\n clipBegin: parseFloat(currentTime),\n clipEnd: parseFloat(newEnd),\n enabled: true\n }\n\n splitItem.clipEnd = currentTime;\n editor.splitData.splits.splice(i + 1, 0, newItem);\n // TODO Make splitSegments clickable when zoomed in\n editor.updateSplitList(false, !zoomedIn());\n selectSegmentListElement(i + 1);\n return;\n }\n }\n }\n selectCurrentSplitItem();\n}", "function ArmSegment(shader, name, xPivot, yPivot) {\r\n SceneNode.call(this, shader, name, true); // calling super class constructor\r\n\r\n var xf = this.getXform();\r\n xf.setPosition(xPivot, yPivot);\r\n\r\n // now create the children shapes\r\n var obj = new CircleRenderable(shader); // The purple circle base\r\n this.addToSet(obj);\r\n obj.setColor([0.75, 0.5, 1, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(1, 2);\r\n // xf.setPosition(xPivot, 1 + yPivot);\r\n xf.setPosition(0, 0);\r\n\r\n obj = new SquareRenderable(shader); // The right green\r\n this.addToSet(obj);\r\n obj.setColor([0, 1, 0, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot, 1.75 + yPivot);\r\n xf.setPosition(0.375, 0);\r\n\r\n obj = new SquareRenderable(shader); // The left green\r\n this.addToSet(obj);\r\n obj.setColor([0, 1, 0, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot, 1.75 + yPivot);\r\n xf.setPosition(-0.375, 0);\r\n\r\n obj = new SquareRenderable(shader); // The top green\r\n this.addToSet(obj);\r\n obj.setColor([0, 0.85, 0.15, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot+0.5-0.125, yPivot+0.125);\r\n xf.setPosition(0, 0.375);\r\n\r\n obj = new SquareRenderable(shader); // The bottom green\r\n this.addToSet(obj);\r\n obj.setColor([0, 0.85, 0.15, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.25, 0.25); // so that we can see the connecting point\r\n // xf.setPosition(xPivot-0.5+0.125, yPivot+0.125);\r\n xf.setPosition(0, -0.375);\r\n\r\n obj = new CircleRenderable(shader); // The middle red circle\r\n this.addToSet(obj);\r\n obj.setColor([1, 0.75, 1, 1]);\r\n xf = obj.getXform();\r\n xf.setSize(0.5, 0.5); // so that we can see the connecting point\r\n xf.setPosition(0, 0);\r\n\r\n this.mPulseRate = 0.005;\r\n this.mRotateRate = -2;\r\n}", "function jumpToSegment() {\n if (editor.splitData && editor.splitData.splits) {\n id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n\n setCurrentTime(editor.splitData.splits[id].clipBegin);\n }\n}", "function drawSegment(ctx, points, start, segLen, allLen, dir, smooth, smoothMonotone, connectNulls) {\n\t var prevX;\n\t var prevY;\n\t var cpx0;\n\t var cpy0;\n\t var cpx1;\n\t var cpy1;\n\t var idx = start;\n\t var k = 0;\n\t\n\t for (; k < segLen; k++) {\n\t var x = points[idx * 2];\n\t var y = points[idx * 2 + 1];\n\t\n\t if (idx >= allLen || idx < 0) {\n\t break;\n\t }\n\t\n\t if (isPointNull(x, y)) {\n\t if (connectNulls) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t break;\n\t }\n\t\n\t if (idx === start) {\n\t ctx[dir > 0 ? 'moveTo' : 'lineTo'](x, y);\n\t cpx0 = x;\n\t cpy0 = y;\n\t } else {\n\t var dx = x - prevX;\n\t var dy = y - prevY; // Ignore tiny segment.\n\t\n\t if (dx * dx + dy * dy < 0.5) {\n\t idx += dir;\n\t continue;\n\t }\n\t\n\t if (smooth > 0) {\n\t var nextIdx = idx + dir;\n\t var nextX = points[nextIdx * 2];\n\t var nextY = points[nextIdx * 2 + 1];\n\t var tmpK = k + 1;\n\t\n\t if (connectNulls) {\n\t // Find next point not null\n\t while (isPointNull(nextX, nextY) && tmpK < segLen) {\n\t tmpK++;\n\t nextIdx += dir;\n\t nextX = points[nextIdx * 2];\n\t nextY = points[nextIdx * 2 + 1];\n\t }\n\t }\n\t\n\t var ratioNextSeg = 0.5;\n\t var vx = 0;\n\t var vy = 0;\n\t var nextCpx0 = void 0;\n\t var nextCpy0 = void 0; // Is last point\n\t\n\t if (tmpK >= segLen || isPointNull(nextX, nextY)) {\n\t cpx1 = x;\n\t cpy1 = y;\n\t } else {\n\t vx = nextX - prevX;\n\t vy = nextY - prevY;\n\t var dx0 = x - prevX;\n\t var dx1 = nextX - x;\n\t var dy0 = y - prevY;\n\t var dy1 = nextY - y;\n\t var lenPrevSeg = void 0;\n\t var lenNextSeg = void 0;\n\t\n\t if (smoothMonotone === 'x') {\n\t lenPrevSeg = Math.abs(dx0);\n\t lenNextSeg = Math.abs(dx1);\n\t cpx1 = x - lenPrevSeg * smooth;\n\t cpy1 = y;\n\t nextCpx0 = x + lenPrevSeg * smooth;\n\t nextCpy0 = y;\n\t } else if (smoothMonotone === 'y') {\n\t lenPrevSeg = Math.abs(dy0);\n\t lenNextSeg = Math.abs(dy1);\n\t cpx1 = x;\n\t cpy1 = y - lenPrevSeg * smooth;\n\t nextCpx0 = x;\n\t nextCpy0 = y + lenPrevSeg * smooth;\n\t } else {\n\t lenPrevSeg = Math.sqrt(dx0 * dx0 + dy0 * dy0);\n\t lenNextSeg = Math.sqrt(dx1 * dx1 + dy1 * dy1); // Use ratio of seg length\n\t\n\t ratioNextSeg = lenNextSeg / (lenNextSeg + lenPrevSeg);\n\t cpx1 = x - vx * smooth * (1 - ratioNextSeg);\n\t cpy1 = y - vy * smooth * (1 - ratioNextSeg); // cp0 of next segment\n\t\n\t nextCpx0 = x + vx * smooth * ratioNextSeg;\n\t nextCpy0 = y + vy * smooth * ratioNextSeg; // Smooth constraint between point and next point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t nextCpx0 = mathMin$5(nextCpx0, mathMax$5(nextX, x));\n\t nextCpy0 = mathMin$5(nextCpy0, mathMax$5(nextY, y));\n\t nextCpx0 = mathMax$5(nextCpx0, mathMin$5(nextX, x));\n\t nextCpy0 = mathMax$5(nextCpy0, mathMin$5(nextY, y)); // Reclaculate cp1 based on the adjusted cp0 of next seg.\n\t\n\t vx = nextCpx0 - x;\n\t vy = nextCpy0 - y;\n\t cpx1 = x - vx * lenPrevSeg / lenNextSeg;\n\t cpy1 = y - vy * lenPrevSeg / lenNextSeg; // Smooth constraint between point and prev point.\n\t // Avoid exceeding extreme after smoothing.\n\t\n\t cpx1 = mathMin$5(cpx1, mathMax$5(prevX, x));\n\t cpy1 = mathMin$5(cpy1, mathMax$5(prevY, y));\n\t cpx1 = mathMax$5(cpx1, mathMin$5(prevX, x));\n\t cpy1 = mathMax$5(cpy1, mathMin$5(prevY, y)); // Adjust next cp0 again.\n\t\n\t vx = x - cpx1;\n\t vy = y - cpy1;\n\t nextCpx0 = x + vx * lenNextSeg / lenPrevSeg;\n\t nextCpy0 = y + vy * lenNextSeg / lenPrevSeg;\n\t }\n\t }\n\t\n\t ctx.bezierCurveTo(cpx0, cpy0, cpx1, cpy1, x, y);\n\t cpx0 = nextCpx0;\n\t cpy0 = nextCpy0;\n\t } else {\n\t ctx.lineTo(x, y);\n\t }\n\t }\n\t\n\t prevX = x;\n\t prevY = y;\n\t idx += dir;\n\t }\n\t\n\t return k;\n\t }", "process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n this.sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n }", "function alertPrize(indicatedSegment) {\n console.log(indicatedSegment.text)\n if (indicatedSegment.text == \"Nothing!\") { document.getElementById(\"rays\").style.display = 'none'; incorrectSound.play(); }\n else { document.getElementById(\"rays\").style.display = 'block'; successSound.play(); }\n\n\n wheelRewardBack.style.display = 'block';\n wheelRewardImg.src = indicatedSegment.image;\n document.getElementById(\"wheelRewardTxt2\").innerHTML = indicatedSegment.text;\n grantAwardFromWheel(indicatedSegment.text);\n a.updateMoney();\n a.updateTools();\n localStorage.setItem('starCash', starCash);\n localStorage.setItem('GuiGhostFarms_player', JSON.stringify(player));\n }", "if (!this.History.inProgress()) {\n this.objects.all()\n .filter(obj => obj.name !== 'groundPlane')\n .forEach(obj => { this.scene.remove(obj) });\n }", "function barra() {\n var contenedor = document.getElementsByClassName(\"barraSlider\")[0];\n var control = document.getElementsByClassName(\"controlBarraSlider\")[0];\n var activo = false;\n var xInicio = 0;\n var limite = (document.getElementsByClassName(\"lineaBarraSlider\")[0].offsetWidth) - document.getElementsByClassName(\"controlBarraSlider\")[0].offsetWidth;\n var banderaSegmentos = 0;\n var banderaSegmentosFin = 0;\n var contadorSegmentos = 1;\n\n //eventos para interactuar con el drag\n contenedor.addEventListener(\"touchstart\", dragStart, false);\n contenedor.addEventListener(\"touchend\", dragEnd, false);\n contenedor.addEventListener(\"touchmove\", drag, false);\n contenedor.addEventListener(\"mousedown\", dragStart, false);\n contenedor.addEventListener(\"mouseup\", dragEnd, false);\n contenedor.addEventListener(\"mousemove\", drag, false);\n\n //inicia el drag\n function dragStart(e) {\n if (e.type === \"touchstart\") {\n xInicio = e.touches[0].clientX - xOffset;\n } else {\n xInicio = e.clientX - xOffset;\n }\n\n if (e.target === control) {\n activo = true;\n }\n }\n\n //termina el drag\n function dragEnd() {\n xInicio = xActual;\n activo = false;\n }\n\n //en el momento que se esta haciendo el drag\n function drag(e) {\n if (activo) {\n \n e.preventDefault();\n if (e.type === \"touchmove\") {\n if (xActual <= limite && xActual >= 0) {\n xActual = e.touches[0].clientX - xInicio;\n } else {\n if (xActual >= limite) {\n xActual = limite;\n } else if(xActual <= 0) {\n xActual = 0;\n }\n }\n if (xActual > limite) {\n xActual = limite;\n } else if (xActual <= 0) {\n xActual = 0;\n }\n\n } else {\n if (xActual <= limite && xActual >= 0) {\n xActual = e.clientX - xInicio;\n\n } else {\n if (xActual >= limite) {\n xActual = limite;\n } else if (xActual <= 0) {\n xActual = 0;\n }\n }\n\n }\n xOffset = xActual;\n\n actualizarPosicion(xActual, control);\n }\n }\n\n function actualizarPosicion(posicionX, elemento) {\n elemento.style.transform = \"translate3d(\" + posicionX + \"px,\" + 0 + \"px, 0)\";\n calcularMovimientos(posicionX);\n }\n\n //esto se usa en calcularMovimientos();\n var limites = [];\n for (var i = 0; i < cantidadElementos; i++) {\n limites.push(Math.round(segmento * (i + 1))); \n }\n\n var banderaFor = 0;\n function calcularMovimientos(posicionX) {\n\n //segmento, es el espacio asignado dentro de la barra de control para cada slide \n if (posicionX < (segmento * contadorSegmentos) && posicionX >= (segmento * banderaSegmentos)) {\n } else {\n if (posicionX > (segmento * contadorSegmentos)) {\n\n contadorSegmentos = contadorSegmentos + 1;\n banderaSegmentos = banderaSegmentos + 1; \n controles(\"derechaSlider\", 1, \"slide\");\n } else {\n\n contadorSegmentos = contadorSegmentos - 1;\n banderaSegmentos = banderaSegmentos - 1;\n controles(\"izquierdaSlider\", 1, \"slide\");\n\n } \n }\n\n }\n}", "function checkTrash(){\n if(currentID.includes('trash')){\n playAudio(correctAudio);\n points++;\n }\n else if(currentID.includes('rec')){\n playAudio(wrongAudio);\n points--;\n wrong++;\n checkWrong();\n }\n $('#points').text(points);\n }", "function scrollHandler() { \n\t\tif ( isNextSceneReached(true) ) {\n runNextScene();\n\t\t} else if ( isPrevSceneReached(true) ) {\n runPrevScene();\n\t\t}\n }", "function onAudioPositionChanged(position, from, skipping) { //noLetPlay\n\n audioCurrentTime = position;\n\n// if (_letPlay)\n// {\n// return;\n// }\n\n _skipAudioEnded = false;\n// _skipTTSEnded = false;\n\n if (!_smilIterator || !_smilIterator.currentPar)\n {\n return;\n }\n\n var parFrom = _smilIterator.currentPar;\n \n var audio = _smilIterator.currentPar.audio;\n\n //var TOLERANCE = 0.05;\n if(\n //position >= (audio.clipBegin - TOLERANCE) &&\n position > DIRECTION_MARK &&\n position <= audio.clipEnd) {\n\n//console.debug(\"onAudioPositionChanged: \" + position);\n return;\n }\n\n _skipAudioEnded = true;\n\n//console.debug(\"PLAY NEXT: \" + \"(\" + audio.clipBegin + \" -- \" + audio.clipEnd + \") [\" + from + \"] \" + position);\n//console.debug(_smilIterator.currentPar.text.srcFragmentId);\n\n var isPlaying = _audioPlayer.isPlaying();\n if (isPlaying && from === 6)\n {\n console.debug(\"from userNav _audioPlayer.isPlaying() ???\");\n }\n\n var goNext = position > audio.clipEnd;\n\n var doNotNextSmil = !_autoNextSmil && from !== 6 && goNext;\n\n var spineItemIdRef = (_smilIterator && _smilIterator.smil && _smilIterator.smil.spineItemId) ? _smilIterator.smil.spineItemId : ((_lastPaginationData && _lastPaginationData.spineItem && _lastPaginationData.spineItem.idref) ? _lastPaginationData.spineItem.idref : undefined);\n if (doNotNextSmil && spineItemIdRef && _lastPaginationData && _lastPaginationData.paginationInfo && _lastPaginationData.paginationInfo.openPages && _lastPaginationData.paginationInfo.openPages.length > 1)\n {\n //var iPage = _lastPaginationData.paginationInfo.isRightToLeft ? _lastPaginationData.paginationInfo.openPages.length - 1 : 0;\n var iPage = 0;\n \n var openPage = _lastPaginationData.paginationInfo.openPages[iPage];\n if (spineItemIdRef === openPage.idref)\n {\n doNotNextSmil = false;\n }\n }\n \n if (goNext)\n {\n _smilIterator.next();\n }\n else //position <= DIRECTION_MARK\n {\n _smilIterator.previous();\n }\n\n if(!_smilIterator.currentPar)\n {\n //\n // if (!noLetPlay)\n // {\n // _letPlay = true;\n // setTimeout(function()\n // {\n // _letPlay = false;\n // nextSmil(goNext);\n // }, 200);\n // }\n // else\n // {\n // nextSmil(goNext);\n // }\n\n//console.debug(\"NEXT SMIL ON AUDIO POS\");\n \n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n return;\n }\n\n//console.debug(\"ITER: \" + _smilIterator.currentPar.text.srcFragmentId);\n\n if(!_smilIterator.currentPar.audio) {\n self.pause();\n return;\n }\n \n if(_settings.mediaOverlaysSkipSkippables)\n {\n var skip = false;\n var parent = _smilIterator.currentPar;\n while (parent)\n {\n if (parent.isSkippable && parent.isSkippable(_settings.mediaOverlaysSkippables))\n {\n skip = true;\n break;\n }\n parent = parent.parent;\n }\n\n if (skip)\n {\n console.log(\"MO SKIP: \" + parent.epubtype);\n\n self.pause();\n\n var pos = goNext ? _smilIterator.currentPar.audio.clipEnd + 0.1 : DIRECTION_MARK - 1;\n\n onAudioPositionChanged(pos, from, true); //noLetPlay\n return;\n }\n }\n\n // _settings.mediaOverlaysSynchronizationGranularity\n if (!isPlaying && (_smilIterator.currentPar.element || _smilIterator.currentPar.cfi && _smilIterator.currentPar.cfi.cfiTextParent))\n {\n var scopeTo = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (scopeTo && scopeTo !== _smilIterator.currentPar)\n {\n var scopeFrom = _elementHighlighter.adjustParToSeqSyncGranularity(parFrom);\n if (scopeFrom && (scopeFrom === scopeTo || !goNext))\n {\n if (scopeFrom === scopeTo)\n {\n do\n {\n if (goNext) _smilIterator.next();\n else _smilIterator.previous();\n } while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(scopeFrom));\n\n if (!_smilIterator.currentPar)\n {\n //console.debug(\"adjustParToSeqSyncGranularity nextSmil(goNext)\");\n\n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n \n return;\n }\n }\n \n//console.debug(\"ADJUSTED: \" + _smilIterator.currentPar.text.srcFragmentId);\n if (!goNext)\n {\n var landed = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (landed && landed !== _smilIterator.currentPar)\n {\n var backup = _smilIterator.currentPar;\n \n var innerPar = undefined;\n do\n {\n innerPar = _smilIterator.currentPar;\n _smilIterator.previous();\n }\n while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(landed));\n \n if (_smilIterator.currentPar)\n {\n _smilIterator.next();\n \n if (!_smilIterator.currentPar.hasAncestor(landed))\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar.hasAncestor(landed) ???\");\n }\n //assert \n }\n else\n {\n//console.debug(\"adjustParToSeqSyncGranularity reached begin\");\n\n _smilIterator.reset();\n \n if (_smilIterator.currentPar !== innerPar)\n {\n console.error(\"adjustParToSeqSyncGranularity _smilIterator.currentPar !=== innerPar???\");\n }\n }\n\n if (!_smilIterator.currentPar)\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar ?????\");\n _smilIterator.goToPar(backup);\n }\n \n//console.debug(\"ADJUSTED PREV: \" + _smilIterator.currentPar.text.srcFragmentId);\n }\n }\n }\n }\n }\n \n if(_audioPlayer.isPlaying()\n && _smilIterator.currentPar.audio.src\n && _smilIterator.currentPar.audio.src == _audioPlayer.currentSmilSrc()\n && position >= _smilIterator.currentPar.audio.clipBegin\n && position <= _smilIterator.currentPar.audio.clipEnd)\n {\n//console.debug(\"ONLY highlightCurrentElement\");\n highlightCurrentElement();\n return;\n }\n\n //position <= DIRECTION_MARK goes here (goto previous):\n\n// if (!noLetPlay && position > DIRECTION_MARK\n// && _audioPlayer.isPlaying() && _audioPlayer.srcRef() != _smilIterator.currentPar.audio.src)\n// {\n// _letPlay = true;\n// setTimeout(function()\n// {\n// _letPlay = false;\n// playCurrentPar();\n// }, 100);\n//\n// playCurrentPar();\n//\n// return;\n// }\n\n playCurrentPar();\n }", "function onAudioPositionChanged(position, from, skipping) { //noLetPlay\n\n audioCurrentTime = position;\n\n// if (_letPlay)\n// {\n// return;\n// }\n\n _skipAudioEnded = false;\n// _skipTTSEnded = false;\n\n if (!_smilIterator || !_smilIterator.currentPar)\n {\n return;\n }\n\n var parFrom = _smilIterator.currentPar;\n \n var audio = _smilIterator.currentPar.audio;\n\n //var TOLERANCE = 0.05;\n if(\n //position >= (audio.clipBegin - TOLERANCE) &&\n position > DIRECTION_MARK &&\n position <= audio.clipEnd) {\n\n//console.debug(\"onAudioPositionChanged: \" + position);\n return;\n }\n\n _skipAudioEnded = true;\n\n//console.debug(\"PLAY NEXT: \" + \"(\" + audio.clipBegin + \" -- \" + audio.clipEnd + \") [\" + from + \"] \" + position);\n//console.debug(_smilIterator.currentPar.text.srcFragmentId);\n\n var isPlaying = _audioPlayer.isPlaying();\n if (isPlaying && from === 6)\n {\n console.debug(\"from userNav _audioPlayer.isPlaying() ???\");\n }\n\n var goNext = position > audio.clipEnd;\n\n var doNotNextSmil = !_autoNextSmil && from !== 6 && goNext;\n\n var spineItemIdRef = (_smilIterator && _smilIterator.smil && _smilIterator.smil.spineItemId) ? _smilIterator.smil.spineItemId : ((_lastPaginationData && _lastPaginationData.spineItem && _lastPaginationData.spineItem.idref) ? _lastPaginationData.spineItem.idref : undefined);\n if (doNotNextSmil && spineItemIdRef && _lastPaginationData && _lastPaginationData.paginationInfo && _lastPaginationData.paginationInfo.openPages && _lastPaginationData.paginationInfo.openPages.length > 1)\n {\n //var iPage = _lastPaginationData.paginationInfo.isRightToLeft ? _lastPaginationData.paginationInfo.openPages.length - 1 : 0;\n var iPage = 0;\n \n var openPage = _lastPaginationData.paginationInfo.openPages[iPage];\n if (spineItemIdRef === openPage.idref)\n {\n doNotNextSmil = false;\n }\n }\n \n if (goNext)\n {\n _smilIterator.next();\n }\n else //position <= DIRECTION_MARK\n {\n _smilIterator.previous();\n }\n\n if(!_smilIterator.currentPar)\n {\n //\n // if (!noLetPlay)\n // {\n // _letPlay = true;\n // setTimeout(function()\n // {\n // _letPlay = false;\n // nextSmil(goNext);\n // }, 200);\n // }\n // else\n // {\n // nextSmil(goNext);\n // }\n\n//console.debug(\"NEXT SMIL ON AUDIO POS\");\n \n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n return;\n }\n\n//console.debug(\"ITER: \" + _smilIterator.currentPar.text.srcFragmentId);\n\n if(!_smilIterator.currentPar.audio) {\n self.pause();\n return;\n }\n \n if(_settings.mediaOverlaysSkipSkippables)\n {\n var skip = false;\n var parent = _smilIterator.currentPar;\n while (parent)\n {\n if (parent.isSkippable && parent.isSkippable(_settings.mediaOverlaysSkippables))\n {\n skip = true;\n break;\n }\n parent = parent.parent;\n }\n\n if (skip)\n {\n console.log(\"MO SKIP: \" + parent.epubtype);\n\n self.pause();\n\n var pos = goNext ? _smilIterator.currentPar.audio.clipEnd + 0.1 : DIRECTION_MARK - 1;\n\n onAudioPositionChanged(pos, from, true); //noLetPlay\n return;\n }\n }\n\n // _settings.mediaOverlaysSynchronizationGranularity\n if (!isPlaying && (_smilIterator.currentPar.element || _smilIterator.currentPar.cfi && _smilIterator.currentPar.cfi.cfiTextParent))\n {\n var scopeTo = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (scopeTo && scopeTo !== _smilIterator.currentPar)\n {\n var scopeFrom = _elementHighlighter.adjustParToSeqSyncGranularity(parFrom);\n if (scopeFrom && (scopeFrom === scopeTo || !goNext))\n {\n if (scopeFrom === scopeTo)\n {\n do\n {\n if (goNext) _smilIterator.next();\n else _smilIterator.previous();\n } while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(scopeFrom));\n\n if (!_smilIterator.currentPar)\n {\n //console.debug(\"adjustParToSeqSyncGranularity nextSmil(goNext)\");\n\n if (doNotNextSmil)\n {\n _wasPausedBecauseNoAutoNextSmil = true;\n self.reset();\n //self.pause();\n }\n else\n {\n nextSmil(goNext);\n }\n \n return;\n }\n }\n \n//console.debug(\"ADJUSTED: \" + _smilIterator.currentPar.text.srcFragmentId);\n if (!goNext)\n {\n var landed = _elementHighlighter.adjustParToSeqSyncGranularity(_smilIterator.currentPar);\n if (landed && landed !== _smilIterator.currentPar)\n {\n var backup = _smilIterator.currentPar;\n \n var innerPar = undefined;\n do\n {\n innerPar = _smilIterator.currentPar;\n _smilIterator.previous();\n }\n while (_smilIterator.currentPar && _smilIterator.currentPar.hasAncestor(landed));\n \n if (_smilIterator.currentPar)\n {\n _smilIterator.next();\n \n if (!_smilIterator.currentPar.hasAncestor(landed))\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar.hasAncestor(landed) ???\");\n }\n //assert \n }\n else\n {\n//console.debug(\"adjustParToSeqSyncGranularity reached begin\");\n\n _smilIterator.reset();\n \n if (_smilIterator.currentPar !== innerPar)\n {\n console.error(\"adjustParToSeqSyncGranularity _smilIterator.currentPar !=== innerPar???\");\n }\n }\n\n if (!_smilIterator.currentPar)\n {\n console.error(\"adjustParToSeqSyncGranularity !_smilIterator.currentPar ?????\");\n _smilIterator.goToPar(backup);\n }\n \n//console.debug(\"ADJUSTED PREV: \" + _smilIterator.currentPar.text.srcFragmentId);\n }\n }\n }\n }\n }\n \n if(_audioPlayer.isPlaying()\n && _smilIterator.currentPar.audio.src\n && _smilIterator.currentPar.audio.src == _audioPlayer.currentSmilSrc()\n && position >= _smilIterator.currentPar.audio.clipBegin\n && position <= _smilIterator.currentPar.audio.clipEnd)\n {\n//console.debug(\"ONLY highlightCurrentElement\");\n highlightCurrentElement();\n return;\n }\n\n //position <= DIRECTION_MARK goes here (goto previous):\n\n// if (!noLetPlay && position > DIRECTION_MARK\n// && _audioPlayer.isPlaying() && _audioPlayer.srcRef() != _smilIterator.currentPar.audio.src)\n// {\n// _letPlay = true;\n// setTimeout(function()\n// {\n// _letPlay = false;\n// playCurrentPar();\n// }, 100);\n//\n// playCurrentPar();\n//\n// return;\n// }\n\n playCurrentPar();\n }", "function onSegment(p, q, r) {\n if (\n q[0] <= Math.max(p[0], r[0]) &&\n q[0] >= Math.min(p[0], r[0]) &&\n q[1] <= Math.max(p[1], r[1]) &&\n q[1] >= Math.min(p[1], r[1])\n ) {\n return true;\n }\n\n return false;\n}", "function inSegment(xP, yP) {\r\n }", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [], clip = [], i, n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n for ((i = 0, n = clip.length); i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n var start = subject[0], points, point;\n while (1) {\n // Find first unvisited intersection.\n var current = start, isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for ((i = 0, n = points.length); i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function _default(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n segments.forEach(function (segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n,\n p0 = segment[0],\n p1 = segment[n],\n x;\n\n if ((0, _pointEqual.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n\n stream.lineEnd();\n return;\n } // handle degenerate cases by moving the point\n\n\n p1[0] += 2 * _math.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n if (!subject.length) return;\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n\n while (current.v) if ((current = current.n) === start) return;\n\n points = current.z;\n stream.lineStart();\n\n do {\n current.v = current.o.v = true;\n\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n\n current = current.p;\n }\n\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n\n stream.lineEnd();\n }\n}", "function segmentTurn(p1, p2, p3, p4) {\n var ax = p1[0],\n ay = p1[1],\n bx = p2[0],\n by = p2[1],\n // shift p3p4 segment to start at p2\n dx = bx - p3[0],\n dy = by - p3[1],\n cx = p4[0] + dx,\n cy = p4[1] + dy,\n orientation = orient2D(ax, ay, bx, by, cx, cy);\n if (!orientation) return 0;\n return orientation < 0 ? 1 : -1;\n }", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n // If the first and last points of a segment are coincident, then treat as a\n // closed ring. TODO if all rings are closed, then the winding order of the\n // exterior ring should be checked.\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function tmsavePhase()\n{\n NProgress.start();\n var preNoSegment = 0;\n $.post(domainUrl + 'process/saveTimeLine', {'data': $(\"#timeline_form\").serialize(), }, responceEventStatus, 'html');\n}", "function preDiv(){\n plusDivs(-1);\n}", "function drawUndo()\n {\n if (hasSlideData( slideIndices, mode ))\n {\n var slideData = getSlideData( slideIndices, mode );\n slideData.events.pop();\n playbackEvents( mode );\n }\n }", "function swipe(evt) {\n 'use strict';\n var sets = document.querySelectorAll('.sets'),\n i,\n rightStyle,\n rightNumbered,\n source = evt.target || evt.srcElement;\n\n if (source.id === \"right\") {\n if (sets[0].style.right === ((sets.length - 1)*100) + \"%\") {\n console.log('no more kit');\n } else {\n // Setting the selected kit in audio app\n audioApp.selectCount += 1;\n audioApp.selectedKit = audioApp.kits[audioApp.selectCount];\n console.log(audioApp.selectedKit);\n \n for (i = 0; i < sets.length; i += 1) {\n rightStyle = sets[i].style.right;\n rightNumbered = Number(rightStyle.substring(0, (rightStyle.length-1)));\n\n sets[i].style.right = rightNumbered + 100 + \"%\";\n }\n }\n }\n if (source.id === \"left\") {\n if (sets[sets.length - 1].style.right === (-(sets.length - 1)*100) + \"%\") {\n console.log('no more kit');\n } else {\n // Setting the selected kit in audio app\n audioApp.selectCount -= 1;\n audioApp.selectedKit = audioApp.kits[audioApp.selectCount];\n console.log(audioApp.selectedKit);\n \n for (i = 0; i < sets.length; i += 1) {\n rightStyle = sets[i].style.right;\n rightNumbered = Number(rightStyle.substring(0, (rightStyle.length-1)));\n\n sets[i].style.right = rightNumbered - 100 + \"%\";\n }\n }\n }\n }", "function addSegEndsFromSequences(){\n //Add all the starting segEnds and internal segJoins\n for(var i=0;i<seqArr.length;i++){\n var length=parseInt(seqArr[i]['length']),\n seqId=seqArr[i]['id'];\n segEndArr[segEndArr.length]=[seqId,0,'POS_STRAND']\n segEndArr[segEndArr.length]=[seqId,length-1,'NEG_STRAND']\n segJoinArr[segJoinArr.length]=[[seqId,0,'POS_STRAND'],[seqId,length-1,'NEG_STRAND'],'internal',length]\n }\n segmentize();\n}", "formatSegments (isProtein) {\n\t\tvar variants = isProtein ? this.attributes.variantDataProtein : this.attributes.variantDataDna;\n\t\tvar sequences = isProtein ? this.attributes.alignedProteinSequences : this.attributes.alignedDnaSequences;\n\t\t// make sure they're sorted by start\n\t\tvariants = _.sortBy(variants, d => {\n\t\t\treturn d.start;\n\t\t});\n\n\t\t// merge segments\n\t\tvar mergedSegments = _.reduce(variants, (memo, d) => {\n\t\t\treturn this._mergeOrAddSegment(memo, d);\n\t\t}, []);\n\n\t\t// add in needed summarized segments\n\t\t// first one\n\t\tif (mergedSegments[0].start > 1) {\n\t\t\tmergedSegments.push({\n\t\t\t\tvisible: false,\n\t\t\t\tstart: 1,\n\t\t\t\tend: mergedSegments[0].start\n\t\t\t});\n\t\t}\n\t\t// loop through and connect visible segments with summarized segments\n\t\tvar _visibleSegments = _.where(mergedSegments, { visible: true });\n\t\t_visibleSegments.forEach( (d, i) => {\n\t\t\t// must not be last or visible\n\t\t\tif (d.visible && i < _visibleSegments.length - 1) {\n\t\t\t\tmergedSegments.push({\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tstart: d.end,\n\t\t\t\t\tend: _visibleSegments[i + 1].start\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t\n\t\tvar _last = _.max(mergedSegments, d => { return d.end; });\n\t\tvar _maxLength = _.max(sequences, d => { return d.sequence.length; }).sequence.length;\n\t\t// add last if last segment is visible and not at the end\n\t\tif (_last.end < _maxLength) {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength,\n\t\t\t\tvisible: false\n\t\t\t});\n\t\t// add last if visible\n\t\t} else {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength + 1,\n\t\t\t\tvisible: true\n\t\t\t});\n\t\t}\n\t\t\n\t\t// change starts and ends to domains\n\t\tmergedSegments = _.map(mergedSegments, d => {\n\t\t\td.domain = [d.start, d.end];\n\t\t\treturn d;\n\t\t});\n\t\t// sort\n\t\tmergedSegments = _.sortBy(mergedSegments, d => {\n\t\t\treturn d.start;\n\t\t});\n\t\treturn mergedSegments;\n\t}", "function onSegment (pi, pj, pk) {\n return Math.min(pi[0], pj[0]) <= pk[0] &&\n pk[0] <= Math.max(pi[0], pj[0]) &&\n Math.min(pi[1], pj[1]) <= pk[1] &&\n pk[1] <= Math.max(pi[1], pj[1]);\n}", "function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if (pointEqual(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n }", "function onSegment( p, q, r ) {\n\n\t\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n\t}", "removeHoldsIfProceeds(currentAudioTime) {\n\n let listActiveHolds = this.activeHolds.asList() ;\n\n\n // This is used to know whether the last judgment for the hold must be fail or not.\n this.activeHolds.wasLastKnowHoldPressed = this.areHoldsBeingPressed() ;\n\n for ( var i = 0 ; i < listActiveHolds.length ; i++) {\n\n let step = listActiveHolds[i] ;\n\n if (step !== null && currentAudioTime > step.endHoldTimeStamp ) {\n this.activeHolds.setHold(step.kind, step.padId, null) ;\n\n // save the endHoldTimeStamp to compute the remainder judgments.\n this.activeHolds.needFinishJudgment = true ;\n this.activeHolds.judgmentTimeStampEndReference = step.endHoldTimeStamp - this.activeHolds.firstHoldInHoldRun.beginHoldTimeStamp ;\n // console.log('begin: ' + beginTime + ' end: ' + endTime) ;\n // this.activeHolds.actualTotalComboValueOfHold = this.computeTotalComboContribution( beginTime, endTime ) ;\n\n // if the hold is active, we can remove it from the render and give a perfect judgment, I think.\n if (this.keyInput.isPressed(step.kind, step.padId)) {\n\n this.composer.removeObjectFromSteps(step) ;\n this.composer.removeObjectFromSteps(step.holdObject) ;\n this.composer.removeObjectFromSteps(step.endNoteObject) ;\n\n this.composer.animateTapEffect([step]) ;\n\n this.composer.judgmentScale.animateJudgement('p') ;\n\n\n\n // otherwise we have a miss.\n } else {\n this.composer.judgmentScale.miss() ;\n }\n\n\n }\n\n }\n }", "function determineEnrollentsToCopyOrWipe(vm, params) {\n //if the plan being updated is to be removed\n if (params.removeThisPlan) {\n manageEnrollmentsOnRemove.apply(this, [vm, params]);\n } else {\n //cases for re-mapping plan counts using the category enrollments, with or without deduction of DO enrollments\n manageEnrollmentsOnUpdateOrAdd.apply(this, [vm, params]);\n }\n}", "function modifySegments() {\n /* ----------------------------- START loop Calls hl7Buttons and sends the segments to generate the fields buttons at front end ---------------------------------------------- */\n for (var i = 0; i < selectedArray.length; i++) {\n hl7Buttons(selectedArray[i]);\n }\n /* ----------------------------- END loop Calls hl7Buttons and sends the segments to generate the fields buttons at front end ---------------------------------------------- */\n /* --------------------------------------- START loop for Checking, Highlighting and disabling the buttons for the mandatory HL7 fields ------------------------------------ */\n for (var i = 0; i < mandatoryFields.length; i++) {\n $(\".\" + mandatoryFields[i]).addClass('disabled'); //Label tag button class to disable the mandatory fields\n $(\"#\" + mandatoryFields[i]).attr('checked', true); //Checkbox tag id to add checked attribute the mandatory fields\n }\n /* --------------------------------------- END loop for Checking, Highlighting and disabling the buttons for the mandatory HL7 fields ------------------------------------ */\n\n /* --------------------------------------- START loop for hiding the fields not supported ------------------------------------ */\n for (var i = 0; i < notUsedFields.length; i++) {\n $(\".\" + notUsedFields[i]).addClass('hiddenFields'); //Adding class to identify the hidden fields and is used in click function for select all button\n $(\".\" + notUsedFields[i]).hide(); //Hiding the fields which we are not using\n }\n /* --------------------------------------- END loop for hiding the fields not supported ------------------------------------ */\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function __WEBPACK_DEFAULT_EXPORT__(segments, compareIntersection, startInside, interpolate, stream) {\n var subject = [],\n clip = [],\n i,\n n;\n\n segments.forEach(function(segment) {\n if ((n = segment.length - 1) <= 0) return;\n var n, p0 = segment[0], p1 = segment[n], x;\n\n if ((0,_pointEqual_js__WEBPACK_IMPORTED_MODULE_0__.default)(p0, p1)) {\n if (!p0[2] && !p1[2]) {\n stream.lineStart();\n for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);\n stream.lineEnd();\n return;\n }\n // handle degenerate cases by moving the point\n p1[0] += 2 * _math_js__WEBPACK_IMPORTED_MODULE_1__.epsilon;\n }\n\n subject.push(x = new Intersection(p0, segment, null, true));\n clip.push(x.o = new Intersection(p0, null, x, false));\n subject.push(x = new Intersection(p1, segment, null, false));\n clip.push(x.o = new Intersection(p1, null, x, true));\n });\n\n if (!subject.length) return;\n\n clip.sort(compareIntersection);\n link(subject);\n link(clip);\n\n for (i = 0, n = clip.length; i < n; ++i) {\n clip[i].e = startInside = !startInside;\n }\n\n var start = subject[0],\n points,\n point;\n\n while (1) {\n // Find first unvisited intersection.\n var current = start,\n isSubject = true;\n while (current.v) if ((current = current.n) === start) return;\n points = current.z;\n stream.lineStart();\n do {\n current.v = current.o.v = true;\n if (current.e) {\n if (isSubject) {\n for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.n.x, 1, stream);\n }\n current = current.n;\n } else {\n if (isSubject) {\n points = current.p.z;\n for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]);\n } else {\n interpolate(current.x, current.p.x, -1, stream);\n }\n current = current.p;\n }\n current = current.o;\n points = current.z;\n isSubject = !isSubject;\n } while (!current.v);\n stream.lineEnd();\n }\n}", "function Rbutton01PLAY(){\n //count each time we click the button to play different\n //parts of the animation. much easier than adding and destrying animations!\n \n //done\n if (rightcount==0) {\n animRight.playSegments([140,310],true);\n rightcount+=1;\n //here I would add an extra control so that users cannot\n //click until the animation is finished. but this is fine for\n //the prototype on Tuesday\n \n //done\n } else if (rightcount == 1) {\n animRight.playSegments([310,900],true);\n rightcount+=1;\n \n //done\n } else if (rightcount == 2) {\n animRight.playSegments([900,1360],true);\n rightcount+=1;\n \n //done\n }else if (rightcount == 3) {\n animRight.playSegments([1360,1900],true);\n rightcount+=1;\n \n //done\n }else if (rightcount == 4) {\n animRight.playSegments([1900,2200],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 5) {\n animRight.playSegments([2200,2720],true);\n rightcount+=1;\n \n //done\n }else if (rightcount == 6) {\n animRight.playSegments([2720,3085],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 7) {\n animRight.playSegments([3085,3320],true);\n rightcount+=1;\n \n //done \n }else if (rightcount == 8) {\n animRight.playSegments([3320,3575],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 9) {\n animRight.playSegments([3575,3830],true); \n rightcount+=1;\n \n //done\n }else if (rightcount == 10) {\n animRight.playSegments([3830,4060],true); \n rightcount+=1;\n \n \n }else if (rightcount == 11) {\n animRight.playSegments([4060,4290],true); \n rightcount+=1;\n \n }else if (rightcount == 12) {\n animRight.playSegments([4290,4520],true); \n rightcount+=1;\n }\n\n}", "function intakeSub(points){\r\n\r\n}", "function onSegment(p, q, r)\n{\n if (q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) &&\n q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y))\n return true;\n\n return false;\n}", "computeControlSegments() {\n if (this.controlSteps.length) {\n this.controlSegments = [];\n let segment = { start : 0, end : 0, human : this.controlSteps[0] }\n for (let i = 0; i < this.controlSteps.length; ++i) {\n const humanStep = this.controlSteps[i];\n if (humanStep != segment.human) {\n this.controlSegments.push(segment);\n segment = { start : i, end : i, human : humanStep };\n } else {\n segment.end = i;\n }\n }\n this.controlSegments.push(segment);\n }\n }", "reset(){\n this.setSegment();\n if(this.next)this.next.reset();\n }", "function preRun(){\n console.log(\"preRun: Begin\")\n\n console.log(\"preRun: End\")\n\n}", "clipSegment(start, end) {\n const quadrantStart = this.pointLocation(start)\n const quadrantEnd = this.pointLocation(end)\n\n if (quadrantStart === 0b0000 && quadrantEnd === 0b0000) {\n // The line is inside the boundaries\n return [start, end]\n }\n\n if (quadrantStart === quadrantEnd) {\n // We are in the same box, and we are out of bounds.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart & quadrantEnd) {\n // These points are all on one side of the box.\n return [this.nearestVertex(start), this.nearestVertex(end)]\n }\n\n if (quadrantStart === 0b000) {\n // We are exiting the box. Return the start, the intersection with the boundary, and the closest\n // boundary point to the exited point.\n let line = [start]\n line.push(this.boundPoint(start, end))\n line.push(this.nearestVertex(end))\n return line\n }\n\n if (quadrantEnd === 0b000) {\n // We are re-entering the box.\n return [this.boundPoint(end, start), end]\n }\n\n // We have reached a terrible place, where both points are oob, but it might intersect with the\n // work area. First, define the boundaries as lines.\n const sides = [\n // left\n [Victor(-this.sizeX, -this.sizeY), new Victor(-this.sizeX, this.sizeY)],\n // right\n [new Victor(this.sizeX, -this.sizeY), new Victor(this.sizeX, this.sizeY)],\n // bottom\n [new Victor(-this.sizeX, -this.sizeY), new Victor(this.sizeX, -this.sizeY)],\n // top\n [new Victor(-this.sizeX, this.sizeY), new Victor(this.sizeX, this.sizeY)],\n ]\n\n // Count up the number of boundary lines intersect with our line segment.\n let intersections = []\n for (let s=0; s<sides.length; s++) {\n const intPoint = this.intersection(start,\n end,\n sides[s][0],\n sides[s][1])\n if (intPoint) {\n intersections.push(new Victor(intPoint.x, intPoint.y))\n }\n }\n\n if (intersections.length !== 0) {\n if (intersections.length !== 2) {\n // We should never get here. How would we have something other than 2 or 0 intersections with\n // a box?\n console.log(intersections)\n throw Error(\"Software Geometry Error\")\n }\n\n // The intersections are tested in some normal order, but the line could be going through them\n // in any direction. This check will flip the intersections if they are reversed somehow.\n if (Victor.fromObject(intersections[0]).subtract(start).lengthSq() >\n Victor.fromObject(intersections[1]).subtract(start).lengthSq()) {\n let temp = intersections[0]\n intersections[0] = intersections[1]\n intersections[1] = temp\n }\n\n return [...intersections, this.nearestVertex(end)]\n }\n\n // Damn. We got here because we have a start and end that are failing different boundary checks,\n // and the line segment doesn't intersect the box. We have to crawl around the outside of the\n // box until we reach the other point.\n // Here, I'm going to split this line into two parts, and send each half line segment back\n // through the clipSegment algorithm. Eventually, that should result in only one of the other cases.\n const midpoint = Victor.fromObject(start).add(end).multiply(new Victor(0.5, 0.5))\n\n // recurse, and find smaller segments until we don't end up in this place again.\n return [...this.clipSegment(start, midpoint),\n ...this.clipSegment(midpoint, end)]\n }", "kill() {\n this.segments.forEach(s => s.el.style.opacity = '0.5');\n }", "function setGamerSeg () {\n permutive.segment(6912, function(result) {\n if (result) {\n console.log(`2) Response returned in permutve.segment -if is gamer segment: ${result}`)\n getGamerAd();\n } else {\n console.log(`segment doesnt return gamer - served default ad`)\n }\n});\n}", "function _ripClipVideos(savePath, vos, callback) {\n\t\tvar videoIndex = 0;\n\n\t\tconsole.log(vos.length);\n\n\t\tfunction __ripVideo(vo) {\n\t\t\tif (!vo) {\n\t\t\t\tcallback();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tdelete vo['results'];\n\t\t\tvar name = vo['title'] + '.mp4';\n\t\t\t//only one segment\n\t\t\tvar seg = vo['segments'][0];\n\t\t\tvar p = savePath + '/' + name;\n\t\t\tffmpeg(vo['path'])\n\t\t\t\t.inputOptions('-threads 8')\n\t\t\t\t.seekInput(seg.startTime)\n\t\t\t\t.outputOptions('-map 0')\n\t\t\t\t.outputOptions('-r 25')\n\t\t\t\t.outputOptions('-profile:v Baseline')\n\t\t\t\t.outputOptions('-g 12')\n\t\t\t\t.outputOptions('-c:a aac')\n\t\t\t\t.outputOptions('-b:a 240k')\n\t\t\t\t.outputOptions('-strict -2')\n\t\t\t\t.duration(seg.endTime - seg.startTime)\n\t\t\t\t.format('mp4')\n\t\t\t\t.output(p)\n\t\t\t\t.on('start', function(commandLine) {\n\t\t\t\t\tconsole.log(colors.green('Spawned Ffmpeg with command: %s'), commandLine);\n\t\t\t\t})\n\t\t\t\t.on('error', function(err) {\n\t\t\t\t\tconsole.log('An error occurred: ' + err.message);\n\t\t\t\t\tvo['savePath'] = \"\";\n\t\t\t\t\tvideoIndex += 1;\n\t\t\t\t\t__ripVideo(vos[videoIndex]);\n\t\t\t\t})\n\t\t\t\t.on('end', function() {\n\t\t\t\t\tvo['savePath'] = p;\n\t\t\t\t\tvideoIndex += 1;\n\t\t\t\t\t__ripVideo(vos[videoIndex]);\n\t\t\t\t})\n\t\t\t\t.run();\n\t\t}\n\n\t\t__ripVideo(vos[videoIndex]);\n\t}", "addStackSteps(pre, changeSet, post) {\n this.pre.push(...pre);\n this.changeSet.push(...changeSet);\n this.post.push(...post);\n }", "function areaSweep() {//set the completed row to 0's\r\n outer: for (var y = playArea.length -1; y > 0; --y) {\r\n for (var x = 0; x < playArea[y].length; ++x) {\r\n if (playArea[y][x] === 0) {\r\n continue outer;\r\n }\r\n }\r\n\r\n var row = playArea.splice(y, 1)[0].fill(0);//move the rows down\r\n linesCleared++;//does lines for scoring\r\n lines++;//adds line based on completed lines\r\n console.log(lines);\r\n playArea.unshift(row);\r\n ++y;\r\n }\r\n if (linesCleared == 1){\r\n score += (40*level+40);\r\n notTetris.play();\r\n linesCleared=0;\r\n single++;\r\n }\r\n else if (linesCleared == 2){\r\n score += (100*level+100);\r\n notTetris.play();\r\n linesCleared=0;\r\n double++;\r\n }\r\n else if (linesCleared == 3){\r\n score += (300*level+300);\r\n notTetris.play();\r\n linesCleared=0;\r\n triple++;\r\n }\r\n else if (linesCleared == 4){\r\n score += (1200*level+1200);\r\n tetrisSound.play();\r\n linesCleared=0;\r\n tetris++;\r\n }//score based on cleared lines\r\n\r\n if(lines>=10&&level==0){level=1; transitionSound.play();}\r\n else if(lines>=20&&level==1){level=2; transitionSound.play();}\r\n else if(lines>=30&&level==2){level=3; transitionSound.play();}\r\n else if(lines>=40&&level==3){level=4; transitionSound.play();}\r\n else if(lines>=50&&level==4){level=5; transitionSound.play();}\r\n else if(lines>=60&&level==5){level=6; transitionSound.play();}\r\n else if(lines>=70&&level==6){level=7; transitionSound.play();}\r\n else if(lines>=80&&level==7){level=8; transitionSound.play();}\r\n else if(lines>=90&&level==8){level=9; transitionSound.play();}\r\n else if(lines>=100&&level==9){level=10; transitionSound.play();}\r\n else if(lines>=110&&level==10){level=11; transitionSound.play();}\r\n else if(lines>=120&&level==11){level=12; transitionSound.play();}\r\n else if(lines>=130&&level==12){level=13; transitionSound.play();}\r\n else if(lines>=140&&level==13){level=14; transitionSound.play();}\r\n else if(lines>=150&&level==14){level=15; transitionSound.play();}\r\n else if(lines>=160&&level==15){level=16; transitionSound.play();}\r\n else if(lines>=170&&level==16){level=17; transitionSound.play();}\r\n else if(lines>=180&&level==17){level=18; transitionSound.play();}\r\n else if(lines>=190&&level==18){level=19; transitionSound.play();}\r\n else if(lines>=200&&level==19){level=20; transitionSound.play();}\r\n else if(lines>=210&&level==20){level=21; transitionSound.play();}\r\n else if(lines>=220&&level==21){level=22; transitionSound.play();}\r\n else if(lines>=230&&level==22){level=23; transitionSound.play();}\r\n else if(lines>=240&&level==23){level=24; transitionSound.play();}\r\n else if(lines>=250&&level==24){level=25; transitionSound.play();}\r\n else if(lines>=260&&level==25){level=26; transitionSound.play();}\r\n else if(lines>=270&&level==26){level=27; transitionSound.play();}\r\n else if(lines>=280&&level==27){level=28; transitionSound.play();}\r\n else if(lines>=290&&stopTransSound==true){level=29; transitionSound.play();stopTransSound=false;}//level transitions\r\n\r\n if(score>999999)score==999999;\r\n var scoreTag = document.getElementById('score');\r\n scoreTag.innerHTML = 'Score: '+score;\r\n\r\n\r\n var scoreTag = document.getElementById('lines');\r\n scoreTag.innerHTML = 'Lines: '+lines;\r\n}//end of areaSweep", "function stillHandler() { \n Options.scenes.forEach(function(scene) {\n \tif ( pageYOffset > scene.offset) {\n \t\tscene.action(scene.target);\n \t}\n });\n }", "function moveScrollStops() {\n trackedArea.find('.spt-trackThis').each(function (index) {\n var section = $(this),\n sectionHeadline = section.children('.spt-sectionTitle:first'),\n sectionTitle = sectionHeadline.text(),\n sectionTopSubtract = trackedArea.offset().top,\n sectionRelativeTop = section.offset().top - trackedArea.offset().top,\n sectionId = index + 1,\n sectionStop = (sectionRelativeTop / getScrollProgressMax()) * 100,\n scrollHorStops = $('.spt-scrollStopContainer'),\n scrollVerStops = $('.spt-vertScrollStopContainer'),\n scrollStopTitles = $('.spt-scrollStopTitles'),\n scrollVerStopTitles = $('.spt-vertScrollStopTitles');\n\n if (sectionStop > 100) {\n sectionStop = 100;\n }\n\n scrollHorStops.children('.spt-stop' + sectionId).css('left', sectionStop + '%');\n scrollVerStops.children('.spt-stop' + sectionId).css('top', sectionStop + '%');\n scrollStopTitles.children('.spt-stop' + sectionId).css('left', sectionStop + '%');\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').addClass('spt-reached');\n if (settings.horStyle == 'beam') {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('left', '-8px');\n } else {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('left', '0');\n }\n scrollVerStopTitles.children('.spt-stop' + sectionId).css('top', sectionStop + '%');\n\n if ($(window).scrollTop() <= trackedArea.find('.spt-trackThis:first').offset().top + trackedArea.find('.spt-trackThis:first').children('.spt-sectionTitle:first').outerHeight() - head) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text('');\n }\n if ($(window).scrollTop() >= section.offset().top + section.children('.spt-sectionTitle:first').outerHeight() - head) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text(sectionTitle);\n var viewportBottom = $(window).scrollTop() + $(window).height();\n if (settings.finalStopTitle != '') {\n if ($(window).width() <= settings.mobileThreshold) {\n if (($(window).scrollTop() + $(window).height()) >= (trackedArea.offset().top + trackedArea.height() + (headlineMargin * 2)) || ($(window).scrollTop() + $(window).height()) >= $(document).outerHeight()) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text(settings.finalStopTitle);\n }\n } else {\n if (($(window).scrollTop() + $(window).height()) >= $(document).outerHeight()) {\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').text(settings.finalStopTitle);\n }\n }\n }\n }\n\n if (settings.horOnlyActiveTitle) {\n scrollStopTitles.children('.spt-stop' + sectionId).css('display', 'none');\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('display', 'block');\n } else {\n scrollStopTitles.children('.spt-stop' + sectionId).css('display', 'block');\n scrollStopTitles.children('.spt-stopTitle.spt-onlyActive').css('display', 'none');\n }\n\n if (settings.horTitlesOffset == 'top') {\n scrollStopTitles.children('.spt-stopTitle').css('margin-top', horizontalTop - horizontalTitlesHeight - 5 + 'px').css('margin-left', '8px');\n } else if (settings.horTitlesOffset == 'bottom') {\n scrollStopTitles.children('.spt-stopTitle').css('margin-top', horizontalBottom + 5 + 'px').css('margin-left', '8px');\n scrollStopTitles.children('.spt-finalStopTitle').css('margin-top', horizontalBottom + 5 + 'px');\n } else {\n scrollStopTitles.children('.spt-stopTitle').css('margin-top', horizontalCenter - horizontalTitlesHeight / 2 - 2 + 'px').css('margin-left', '25px');\n scrollStopTitles.children('.spt-finalStopTitle').css('margin-top', horizontalCenter - horizontalTitlesHeight / 2 - 2 + 'px').css('margin-right', '16px');\n }\n if (settings.horStyle == 'fill') {\n scrollStopTitles.children('.spt-onlyActive').css('margin-top', '0');\n }\n\n if (getScrollProgressValue() >= sectionRelativeTop) {\n $('.spt-stop' + sectionId).addClass('spt-reached');\n } else {\n $('.spt-stop' + sectionId).removeClass('spt-reached');\n }\n if (getScrollProgressValue() >= getScrollProgressMax()) {\n $('.spt-finalStopCircle, .spt-finalStopTitle').addClass('spt-reached');\n } else {\n $('.spt-finalStopCircle, .spt-finalStopTitle').removeClass('spt-reached');\n }\n if (settings.trackViewportOnly) {\n if (getScrollProgressValue() - $(window).outerHeight() >= sectionRelativeTop + section.outerHeight()) {\n $('.spt-stop' + sectionId).removeClass('spt-reached');\n }\n }\n });\n }", "function onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}", "function Snake() {\n this.x = 0;\n this.y = 0;\n this.xspeed = 1;\n this.yspeed = 0;\n this.total = 0;\n this.seg = [];\n this.score = 0;\n this.death = false;\n\n// this checks if the food has been eaten and counts score\n\n this.eat = function(pos) {\n var d = dist(this.x, this.y, pos.x, pos.y);\n if (d < 1) {\n this.total++;\n this.score++;\n return true;\n } else {\n return false;\n }\n }\n\n this.run = function(){\n this.update();\n this.show();\n }\n\n\n//this is the direction function for the snake\n\n this.dir = function(x, y) {\n this.xspeed = x;\n this.yspeed = y;\n }\n\n//this updates the segments of the rect\n\n this.update = function() {\n for (var i = 0; i < this.seg.length - 1; i++) {\n this.seg[i] = this.seg[i + 1];\n }\n if (this.total >= 1) {\n this.seg[this.total - 1] = createVector(this.x, this.y);\n }\n\n// multiplied by scale so will move on a grid\n\n this.x = this.x + this.xspeed * scl;\n this.y = this.y + this.yspeed * scl;\n\n this.x = constrain(this.x, 0, width - scl);\n this.y = constrain(this.y, 0, height - scl);\n }\n\n// adds the other segments\n//and renders the not head segments\n\n this.show = function() {\n fill(0,255,0);\n for (var i = 0; i < this.seg.length; i++) {\n rect(this.seg[i].x, this.seg[i].y, scl, scl);\n }\n\n image(img, this.x, this.y, scl, scl);\n\n\n }\n\n// this checks for death\n\n this.die = function() {\n for (var i = 0; i < this.seg.length; i++) {\n var pos = this.seg[i];\n var d = dist(this.x, this.y, pos.x, pos.y);\n if (d < 1) {\n fill(11, 226, 119);\n textSize(100);\n text(\"Game Over\",150,350);\n this.death = true;\n //causes error in program and freezes interval\n //asjdfkl;asjdf;jas\n\n }\n }\n }\n\n}", "function manageEnrollmentsOnRemove(vm, params) {\n //zero its enrollments\n zeroEnrollments(params.updatedPlan);\n //if a single other med plan is still selected, give it all the enrollments\n if (params.isMedPlan && params.singleMedStillSelected) { \n mapCategoryEnrollmentsToPlan.apply(this, [vm, params.medPlanRemaining]);\n //recursively pass this plan back through the updatePlans cycle, to get enrollmments to update for the payload\n params.updatePlansFn(vm, params.medPlanRemaining, null, {remainingMedPlanUpdate: true}); \n }\n //if we're removing a delta dental DO plan, remove enrollments from the DO plan, too\n if (params.isDualDenPrimary) { \n const associatedDO = vm.plans.dental.directOption.selected[0];\n if (associatedDO) {\n zeroEnrollments(associatedDO);\n //need to recursively call updatePlans on this DO plan\n this.updatePlans(vm, associatedDO);\n }\n }\n}", "function playVideo() {\n playVideoSegments(transcripts)\n}", "function onSegment(p, q, r) {\n if (\n q.x <= Math.max(p.x, r.x) &&\n q.x >= Math.min(p.x, r.x) &&\n q.y <= Math.max(p.y, r.y) &&\n q.y >= Math.min(p.y, r.y)\n )\n return true\n\n return false\n}", "function only_one_trap_below( inTrNext ) {\n\n\t\t\tif ( trCurrent.vLow == trLast.vLow ) {\n\t\t\t\t// final part of segment\n\n\t\t\t\tif ( meetsLowAdjSeg ) {\n\t\t\t\t\t// downward cusp: bottom forms a triangle\n\n\t\t\t\t\t// ATTENTION: the decision whether trNewLeft and trNewRight are to the\n\t\t\t\t\t//\tleft or right of the already inserted segment the new one meets here\n\t\t\t\t\t//\thas already been taken when selecting trLast to the left or right\n\t\t\t\t\t//\tof that already inserted segment !!\n\n\t\t\t\t\tif ( trCurrent.dL ) {\n\t\t\t\t\t\t//\t*** Case: 1B_DC_LEFT; next: ----\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg from the left!\" );\n\t\t\t\t\t\t//\t\t+\t\t/\n\t\t\t\t\t\t//\t\t + NR /\n\t\t\t\t\t\t//\t NL +\t /\n\t\t\t\t\t\t//\t\t + /\n\t\t\t\t\t\t// -------*-------\n\t\t\t\t\t\t//\t C.dL = next\n\n\t\t\t\t\t\t// setAbove\n\t\t\t\t\t\tinTrNext.uL = trNewLeft;\t// uR: unchanged, NEVER null\n\t\t\t\t\t\t// setBelow part 1\n\t\t\t\t\t\ttrNewLeft.dL = inTrNext;\n\t\t\t\t\t\ttrNewRight.dR = null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//\t*** Case: 1B_DC_RIGHT; next: ----\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg to the right!\" );\n\t\t\t\t\t\t//\t\t\\\t\t+\n\t\t\t\t\t\t//\t\t \\ NL +\n\t\t\t\t\t\t//\t\t \\\t + NR\n\t\t\t\t\t\t//\t\t \\ +\n\t\t\t\t\t\t// -------*-------\n\t\t\t\t\t\t//\t C.dR = next\n\n\t\t\t\t\t\t// setAbove\n\t\t\t\t\t\tinTrNext.uR = trNewRight;\t// uL: unchanged, NEVER null\n\t\t\t\t\t\t// setBelow part 1\n\t\t\t\t\t\ttrNewLeft.dL = null;\n\t\t\t\t\t\ttrNewRight.dR = inTrNext;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//\t*** Case: 1B_1UN_END; next: ----\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg ends here, low adjacent seg still missing\" );\n\t\t\t\t\t//\t\t\t +\n\t\t\t\t\t//\t\tNL\t + NR\n\t\t\t\t\t//\t\t\t+\n\t\t\t\t\t// ------*-------\n\t\t\t\t\t//\t\t next\n\n\t\t\t\t\t// setAbove\n\t\t\t\t\tinTrNext.uL = trNewLeft;\t\t\t\t\t\t\t\t\t// trNewLeft must\n\t\t\t\t\tinTrNext.uR = trNewRight;\t\t// must\n\t\t\t\t\t// setBelow part 1\n\t\t\t\t\ttrNewLeft.dL = trNewRight.dR = inTrNext;\t\t\t\t\t// Error\n//\t\t\t\t\ttrNewRight.dR = inTrNext;\n\t\t\t\t}\n\t\t\t\t// setBelow part 2\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = null;\n\t\t\t} else {\n\t\t\t\t// NOT final part of segment\n\n\t\t\t\tif ( inTrNext.uL && inTrNext.uR ) {\n\t\t\t\t\t// inTrNext has two upper neighbors\n\t\t\t\t\t// => a segment ends on the upper Y-line of inTrNext\n\t\t\t\t\t// => inTrNext has temporarily 3 upper neighbors\n\t\t\t\t\t// => marks whether the new segment cuts through\n\t\t\t\t\t//\t\tuL or uR of inTrNext and saves the other in .usave\n\t\t\t\t\tif ( inTrNext.uL == trCurrent ) {\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_LEFT; next: CC_3UN_LEFT\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): u0a, u0b, uR(usave)\" );\n\t\t\t\t\t\t//\t\t +\t\t /\n\t\t\t\t\t\t//\t NL +\t NR\t /\n\t\t\t\t\t\t//\t\t +\t/\n\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 next\n//\t\t\t\t\t\tif ( inTrNext.uR != trNewRight ) {\t\t// for robustness\tTODO: prevent\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uR;\n\t\t\t\t\t\t\tinTrNext.uleft = true;\n\t\t\t\t\t\t\t// trNewLeft: L/R undefined, will be extended down and changed anyway\n\t\t\t\t\t\t// } else {\n\t\t\t\t\t\t\t// ERROR: should not happen\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop right\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\n//\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_RIGHT; next: CC_3UN_RIGHT\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): uL(usave), u1a, u1b\" );\n\t\t\t\t\t\t//\t \\\t\t +\n\t\t\t\t\t\t//\t \\\t NL + NR\n\t\t\t\t\t\t//\t \\\t +\n\t\t\t\t\t\t// ---*---+- - - -\n\t\t\t\t\t\t//\t\t +\n\t\t\t\t\t\t//\t\t next\n//\t\t\t\t\t\tif ( inTrNext.uL != trNewLeft ) {\t\t// for robustness\tTODO: prevent\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uL;\n\t\t\t\t\t\t\tinTrNext.uleft = false;\n\t\t\t\t\t\t\t// trNewRight: L/R undefined, will be extended down and changed anyway\n\t\t\t\t\t\t// } else {\n\t\t\t\t\t\t\t// ERROR: should not happen\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop left\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\n//\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t//} else {\n\t\t\t\t\t//\t*** Case: 1B_1UN_CONT; next: CC_2UN\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg continues down\" );\n\t\t\t\t\t//\t\t\t +\n\t\t\t\t\t//\t\tNL\t + NR\n\t\t\t\t\t//\t\t\t+\n\t\t\t\t\t// ------+-------\n\t\t\t\t\t//\t \t +\n\t\t\t\t\t//\t\tnext\n\n\t\t\t\t\t// L/R for one side undefined, which one is not fixed\n\t\t\t\t\t//\tbut that one will be extended down and changed anyway\n\t\t\t\t\t// for the other side, vLow must lie at the opposite end\n\t\t\t\t\t//\tthus both are set accordingly\n\t\t\t\t}\n\t\t\t\t// setAbove\n\t\t\t\tinTrNext.uL = trNewLeft;\n\t\t\t\tinTrNext.uR = trNewRight;\n\t\t\t\t// setBelow\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = inTrNext;\n\t\t\t\ttrNewLeft.dL = trNewRight.dR = null;\n\t\t\t}\n\t\t}", "function only_one_trap_below( inTrNext ) {\r\n\r\n\t\t\tif ( trCurrent.vLow == trLast.vLow ) {\r\n\t\t\t\t// final part of segment\r\n\r\n\t\t\t\tif ( meetsLowAdjSeg ) {\r\n\t\t\t\t\t// downward cusp: bottom forms a triangle\r\n\r\n\t\t\t\t\t// ATTENTION: the decision whether trNewLeft and trNewRight are to the\r\n\t\t\t\t\t//\tleft or right of the already inserted segment the new one meets here\r\n\t\t\t\t\t//\thas already been taken when selecting trLast to the left or right\r\n\t\t\t\t\t//\tof that already inserted segment !!\r\n\r\n\t\t\t\t\tif ( trCurrent.dL ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_LEFT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg from the left!\" );\r\n\t\t\t\t\t\t//\t\t+\t\t/\r\n\t\t\t\t\t\t//\t\t + NR /\r\n\t\t\t\t\t\t//\t NL +\t /\r\n\t\t\t\t\t\t//\t\t + /\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dL = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uL = trNewLeft;\t// uR: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = inTrNext;\r\n\t\t\t\t\t\ttrNewRight.dR = null;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_RIGHT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg to the right!\" );\r\n\t\t\t\t\t\t//\t\t\\\t\t+\r\n\t\t\t\t\t\t//\t\t \\ NL +\r\n\t\t\t\t\t\t//\t\t \\\t + NR\r\n\t\t\t\t\t\t//\t\t \\ +\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dR = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uR = trNewRight;\t// uL: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = null;\r\n\t\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_END; next: ----\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg ends here, low adjacent seg still missing\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------*-------\r\n\t\t\t\t\t//\t\t next\r\n\r\n\t\t\t\t\t// setAbove\r\n\t\t\t\t\tinTrNext.uL = trNewLeft;\t\t\t\t\t\t\t\t\t// trNewLeft must\r\n\t\t\t\t\tinTrNext.uR = trNewRight;\t\t// must\r\n\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\ttrNewLeft.dL = trNewRight.dR = inTrNext;\t\t\t\t\t// Error\r\n//\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t}\r\n\t\t\t\t// setBelow part 2\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = null;\r\n\t\t\t} else {\r\n\t\t\t\t// NOT final part of segment\r\n\r\n\t\t\t\tif ( inTrNext.uL && inTrNext.uR ) {\r\n\t\t\t\t\t// inTrNext has two upper neighbors\r\n\t\t\t\t\t// => a segment ends on the upper Y-line of inTrNext\r\n\t\t\t\t\t// => inTrNext has temporarily 3 upper neighbors\r\n\t\t\t\t\t// => marks whether the new segment cuts through\r\n\t\t\t\t\t//\t\tuL or uR of inTrNext and saves the other in .usave\r\n\t\t\t\t\tif ( inTrNext.uL == trCurrent ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_LEFT; next: CC_3UN_LEFT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): u0a, u0b, uR(usave)\" );\r\n\t\t\t\t\t\t//\t\t +\t\t /\r\n\t\t\t\t\t\t//\t NL +\t NR\t /\r\n\t\t\t\t\t\t//\t\t +\t/\r\n\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 next\r\n//\t\t\t\t\t\tif ( inTrNext.uR != trNewRight ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uR;\r\n\t\t\t\t\t\t\tinTrNext.uleft = true;\r\n\t\t\t\t\t\t\t// trNewLeft: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop right\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_RIGHT; next: CC_3UN_RIGHT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): uL(usave), u1a, u1b\" );\r\n\t\t\t\t\t\t//\t \\\t\t +\r\n\t\t\t\t\t\t//\t \\\t NL + NR\r\n\t\t\t\t\t\t//\t \\\t +\r\n\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\t next\r\n//\t\t\t\t\t\tif ( inTrNext.uL != trNewLeft ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uL;\r\n\t\t\t\t\t\t\tinTrNext.uleft = false;\r\n\t\t\t\t\t\t\t// trNewRight: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop left\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t//} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_CONT; next: CC_2UN\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg continues down\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------+-------\r\n\t\t\t\t\t//\t \t +\r\n\t\t\t\t\t//\t\tnext\r\n\r\n\t\t\t\t\t// L/R for one side undefined, which one is not fixed\r\n\t\t\t\t\t//\tbut that one will be extended down and changed anyway\r\n\t\t\t\t\t// for the other side, vLow must lie at the opposite end\r\n\t\t\t\t\t//\tthus both are set accordingly\r\n\t\t\t\t}\r\n\t\t\t\t// setAbove\r\n\t\t\t\tinTrNext.uL = trNewLeft;\r\n\t\t\t\tinTrNext.uR = trNewRight;\r\n\t\t\t\t// setBelow\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = inTrNext;\r\n\t\t\t\ttrNewLeft.dL = trNewRight.dR = null;\r\n\t\t\t}\r\n\t\t}", "function only_one_trap_below( inTrNext ) {\r\n\r\n\t\t\tif ( trCurrent.vLow == trLast.vLow ) {\r\n\t\t\t\t// final part of segment\r\n\r\n\t\t\t\tif ( meetsLowAdjSeg ) {\r\n\t\t\t\t\t// downward cusp: bottom forms a triangle\r\n\r\n\t\t\t\t\t// ATTENTION: the decision whether trNewLeft and trNewRight are to the\r\n\t\t\t\t\t//\tleft or right of the already inserted segment the new one meets here\r\n\t\t\t\t\t//\thas already been taken when selecting trLast to the left or right\r\n\t\t\t\t\t//\tof that already inserted segment !!\r\n\r\n\t\t\t\t\tif ( trCurrent.dL ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_LEFT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg from the left!\" );\r\n\t\t\t\t\t\t//\t\t+\t\t/\r\n\t\t\t\t\t\t//\t\t + NR /\r\n\t\t\t\t\t\t//\t NL +\t /\r\n\t\t\t\t\t\t//\t\t + /\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dL = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uL = trNewLeft;\t// uR: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = inTrNext;\r\n\t\t\t\t\t\ttrNewRight.dR = null;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_DC_RIGHT; next: ----\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: downward cusp, new seg to the right!\" );\r\n\t\t\t\t\t\t//\t\t\\\t\t+\r\n\t\t\t\t\t\t//\t\t \\ NL +\r\n\t\t\t\t\t\t//\t\t \\\t + NR\r\n\t\t\t\t\t\t//\t\t \\ +\r\n\t\t\t\t\t\t// -------*-------\r\n\t\t\t\t\t\t//\t C.dR = next\r\n\r\n\t\t\t\t\t\t// setAbove\r\n\t\t\t\t\t\tinTrNext.uR = trNewRight;\t// uL: unchanged, NEVER null\r\n\t\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\t\ttrNewLeft.dL = null;\r\n\t\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_END; next: ----\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg ends here, low adjacent seg still missing\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------*-------\r\n\t\t\t\t\t//\t\t next\r\n\r\n\t\t\t\t\t// setAbove\r\n\t\t\t\t\tinTrNext.uL = trNewLeft;\t\t\t\t\t\t\t\t\t// trNewLeft must\r\n\t\t\t\t\tinTrNext.uR = trNewRight;\t\t// must\r\n\t\t\t\t\t// setBelow part 1\r\n\t\t\t\t\ttrNewLeft.dL = trNewRight.dR = inTrNext;\t\t\t\t\t// Error\r\n//\t\t\t\t\ttrNewRight.dR = inTrNext;\r\n\t\t\t\t}\r\n\t\t\t\t// setBelow part 2\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = null;\r\n\t\t\t} else {\r\n\t\t\t\t// NOT final part of segment\r\n\r\n\t\t\t\tif ( inTrNext.uL && inTrNext.uR ) {\r\n\t\t\t\t\t// inTrNext has two upper neighbors\r\n\t\t\t\t\t// => a segment ends on the upper Y-line of inTrNext\r\n\t\t\t\t\t// => inTrNext has temporarily 3 upper neighbors\r\n\t\t\t\t\t// => marks whether the new segment cuts through\r\n\t\t\t\t\t//\t\tuL or uR of inTrNext and saves the other in .usave\r\n\t\t\t\t\tif ( inTrNext.uL == trCurrent ) {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_LEFT; next: CC_3UN_LEFT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): u0a, u0b, uR(usave)\" );\r\n\t\t\t\t\t\t//\t\t +\t\t /\r\n\t\t\t\t\t\t//\t NL +\t NR\t /\r\n\t\t\t\t\t\t//\t\t +\t/\r\n\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 next\r\n//\t\t\t\t\t\tif ( inTrNext.uR != trNewRight ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uR;\r\n\t\t\t\t\t\t\tinTrNext.uleft = true;\r\n\t\t\t\t\t\t\t// trNewLeft: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop right\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t//\t*** Case: 1B_3UN_RIGHT; next: CC_3UN_RIGHT\r\n\t\t\t\t\t\t// console.log( \"only_one_trap_below: inTrNext has 3 upper neighbors (part I): uL(usave), u1a, u1b\" );\r\n\t\t\t\t\t\t//\t \\\t\t +\r\n\t\t\t\t\t\t//\t \\\t NL + NR\r\n\t\t\t\t\t\t//\t \\\t +\r\n\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\t next\r\n//\t\t\t\t\t\tif ( inTrNext.uL != trNewLeft ) {\t\t// for robustness\tTODO: prevent\r\n\t\t\t\t\t\t\tinTrNext.usave = inTrNext.uL;\r\n\t\t\t\t\t\t\tinTrNext.uleft = false;\r\n\t\t\t\t\t\t\t// trNewRight: L/R undefined, will be extended down and changed anyway\r\n\t\t\t\t\t\t// } else {\r\n\t\t\t\t\t\t\t// ERROR: should not happen\r\n\t\t\t\t\t\t\t// console.log( \"ERR add_segment: Trapezoid Loop left\", inTrNext, trCurrent, trNewLeft, trNewRight, inSegment, this );\r\n//\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t//} else {\r\n\t\t\t\t\t//\t*** Case: 1B_1UN_CONT; next: CC_2UN\r\n\t\t\t\t\t// console.log( \"only_one_trap_below: simple case, new seg continues down\" );\r\n\t\t\t\t\t//\t\t\t +\r\n\t\t\t\t\t//\t\tNL\t + NR\r\n\t\t\t\t\t//\t\t\t+\r\n\t\t\t\t\t// ------+-------\r\n\t\t\t\t\t//\t \t +\r\n\t\t\t\t\t//\t\tnext\r\n\r\n\t\t\t\t\t// L/R for one side undefined, which one is not fixed\r\n\t\t\t\t\t//\tbut that one will be extended down and changed anyway\r\n\t\t\t\t\t// for the other side, vLow must lie at the opposite end\r\n\t\t\t\t\t//\tthus both are set accordingly\r\n\t\t\t\t}\r\n\t\t\t\t// setAbove\r\n\t\t\t\tinTrNext.uL = trNewLeft;\r\n\t\t\t\tinTrNext.uR = trNewRight;\r\n\t\t\t\t// setBelow\r\n\t\t\t\ttrNewLeft.dR = trNewRight.dL = inTrNext;\r\n\t\t\t\ttrNewLeft.dL = trNewRight.dR = null;\r\n\t\t\t}\r\n\t\t}", "function loadExistingSegmentValues() {\n\n // header update\n UpdateCurrentLesion();\n\n if ( meCompletedLesions[meCurrentLesion] ) {\n for (var i = 0; i < meIndicateSegmentNumber.length; i++) {\n if( meSegmentsInvolved[i][meCurrentLesion] == 1 ) {\n\tgetById('right', 'dd' + i + 'd' + meCurrentLesion).checked = true;\n\tgetFrame('right').lightUpRow('row_' + i + meCurrentLesion);\n }\n }\n }\n else {\n resetExistingFormGlobalVars();\n resetAnswersForLesion(meCurrentLesion);\n }\n}", "function beforeAfterSlider() {\r\n if ($.exists('.st-before-after')) {\r\n var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;\r\n $('.st-before-after').each(function() {\r\n var $container = $(this),\r\n $before = $container.find('.st-before'),\r\n $after = $container.find('.st-after'),\r\n $handle = $container.find('.st-handle-before-after');\r\n \r\n var maxX = $container.outerWidth(),\r\n offsetX = $container.offset().left,\r\n startX = 0;\r\n \r\n var touchstart, touchmove, touchend;\r\n var mousemove = function(e) {\r\n e.preventDefault();\r\n var curX = e.clientX - offsetX,\r\n diff = startX - curX,\r\n curPos = (curX / maxX) * 100;\r\n if (curPos > 100) {\r\n curPos = 100;\r\n }\r\n if (curPos < 0) {\r\n curPos = 0;\r\n }\r\n $before.css({ right: (100 - curPos) + \"%\" });\r\n $handle.css({ left: curPos + \"%\" });\r\n };\r\n var mouseup = function(e) {\r\n e.preventDefault();\r\n if (supportsTouch) {\r\n $(document).off('touchmove', touchmove);\r\n $(document).off('touchend', touchend);\r\n } else {\r\n $(document).off('mousemove', mousemove);\r\n $(document).off('mouseup', mouseup);\r\n }\r\n };\r\n var mousedown = function(e) {\r\n e.preventDefault();\r\n startX = e.clientX - offsetX;\r\n if (supportsTouch) {\r\n $(document).on('touchmove', touchmove);\r\n $(document).on('touchend', touchend);\r\n } else {\r\n $(document).on('mousemove', mousemove);\r\n $(document).on('mouseup', mouseup);\r\n }\r\n };\r\n \r\n touchstart = function(e) {\r\n console.log(e);\r\n mousedown({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n touchmove = function(e) {\r\n mousemove({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n touchend = function(e) {\r\n mouseup({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });\r\n };\r\n if (supportsTouch) {\r\n $handle.on('touchstart', touchstart);\r\n } else {\r\n $handle.on('mousedown', mousedown);\r\n }\r\n });\r\n }\r\n }", "function Update () \n{\n\tif (Time.frameCount % 30 == 0)\n\t{\n\t System.GC.Collect();\n\t}\n\tif (eventdata==null)\n\t{\n\t\t//if ((Time.time > 5)&&(Time.time < 6)&&(ttt==0)) \n\t\t//{\n\t\t//\tttt=1;\n\t\t//\tLoadEvent(\"91\");\n\t\t//}\n\t\treturn;\n\t}\n\t\n\tif (toc==0)\n\t{\n\t\tTime.timeScale = 0;\n\t\treturn;\n\t}\n\t\n\tredraw_grid();\n\tredraw_marks();\n\t\n\tplaytime = playtime + Time.deltaTime;\n\t\n\t// load race\n\tif ((eventdata!=null)&&(typeof(eventdata[\"race\"])))\n\t{\n\t\tif (raceindex+1<eventdata[\"race\"].length)\n\t\t{\n\t\t\tif (playtime+60 > (parseFloat(eventdata[\"race\"][raceindex+1][\"start_time\"])-parseFloat(eventdata[\"start_time\"])))\n\t\t\t{\n\t\t\t\tLoadRace(raceindex+1);\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// update boats\n\tfor (var idx = 0; idx < boatsorder.Count; idx++)\n\t{\n\t\tvar boat : GameObject = boats[boatsorder[idx]];\n\t\tvar boatdatascript:boatdata = boat.GetComponent(boatdata); \n \t\t\n \t\tboatdatascript.RecalculatePosition(playtime);\n \t\t\t\n \t\tvar sailed:float = boatdatascript.routeCompletedDistance + boatdatascript.routeCompletedTotalDistance;\n\t \t\t\n\t \tif (sailed > firstboatsailed)\n\t \t{\n\t \t\tfirstboatindex = idx;\n\t \t\tfirstboatsailed = sailed;\n\t \t}\n\t} \n\t\n\tif (firstboatindex > -1)\n\t{\t\t\t\n\t\tif (firstline!=null)\n\t\t{\n\t\t\tvar firstboat : GameObject = boats[boatsorder[firstboatindex]];\n\t\t\tvar firstboatscript:boatdata = firstboat.GetComponent(boatdata); \n\t\t\t\n\t\t\tvar boatfront:GameObject = firstboat.transform.Find(\"container/front\").gameObject;\n\t\t\t\n\t\t\tif ((firstboatscript.routeIndex >=0)&&(firstboatscript.routeIndex<firstboatscript.route.length))\n\t\t\t{\n\t\t\t\tvar firstboatrouteitem = firstboatscript.GetRouteItem(firstboatscript.routeIndex);\n\t\t\t\t\n\t\t\t\tfirstline.active = true;\n\t\t\t\t//firstline.transform.position.x = boatfront.transform.position.x;\n\t\t\t\t//firstline.transform.position.z = boatfront.transform.position.z;\n\t\t\t\t\n\t\t\t\tfirstline.transform.position.x = firstboatscript.routePointX/2;\n\t\t\t\tfirstline.transform.position.z = firstboatscript.routePointY/2;\n\t\t\t\tfirstline.transform.localScale.z = firstboatscript.routeA/10;\n\t\t\t\n\t\t\t\tfirstline.transform.eulerAngles.y = 180-getdirection_between_points(firstboatrouteitem[\"v1\"].x,firstboatrouteitem[\"v1\"].y,firstboatrouteitem[\"v2\"].x,firstboatrouteitem[\"v2\"].y);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfirstline.active = false;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (boats.Count>0)\n \t{\n\t \tvar navigator:GameObject = GameObject.Find(\"navigator\");\t\t\n \t \tnavigator.transform.position = Vector3.SmoothDamp(navigator.transform.position, boats[cameraboatindex].transform.position,velocity, 2.0f);\n\t\t//navigator.transform.position.z = Vector3.MoveTowards(navigator.transform.position.z, boats[cameraboatindex].transform.position.z, Time.deltaTime);\n\t\t\n\t}\n\t\n\t// wind update -- NUll value\n\t/*if (typeof(marker[\"wind\"]))\n\t{\n\t\tif (windindex<marker[\"wind\"].length)\n\t\t{\n\t\t\tvar wind:GameObject = GameObject.Find(\"navigator/wind\");\n\t\t\tif (wind) wind.transform.localRotation.eulerAngles.y = parseFloat(marker[\"wind\"][windindex][\"direction\"]);\n\t\t}\n\t\tif (windindex+1<marker[\"wind\"].length)\n\t\t{\n\t\t\tvar windtime = parseInt(marker[\"wind\"][windindex+1][\"time\"]);\n\t\t\tif (playtime > windtime) windindex = windindex + 1;\n\t\t\t//Debug.Log (windindex+\" \"+eventdata[\"wind\"].length+\" \"+playtime+\" \"+windtime);\n\t\t}\n\t}*/\n}", "function prevSnip() {\n if (mixSplits != null && mixSplits != undefined) {\n splitPointer--;\n if ((splitPointer < mixSplits.length) && (splitPointer >= 0)) {\n preview(mixSplits[splitPointer], mixSplits[splitPointer] + snipWin, function () {\n });\n } else {\n splitPointer++;\n }\n }\n}", "function segment(x, y, a) { //left arm\r\n translate(x, y);\r\n rotate(a);\r\n line(0, 0, segLength, 0);\r\n }", "function computeSlotSegPressures(seg){var forwardSegs=seg.forwardSegs;var forwardPressure=0;var i;var forwardSeg;if(seg.forwardPressure===undefined){// not already computed\nfor(i=0;i<forwardSegs.length;i++){forwardSeg=forwardSegs[i];// figure out the child's maximum forward path\ncomputeSlotSegPressures(forwardSeg);// either use the existing maximum, or use the child's forward pressure\n// plus one (for the forwardSeg itself)\nforwardPressure=Math.max(forwardPressure,1+forwardSeg.forwardPressure);}seg.forwardPressure=forwardPressure;}}// Find all the segments in `otherSegs` that vertically collide with `seg`.", "function alignDiscontinuities(lastFrag,details,lastLevel){if(shouldAlignOnDiscontinuities(lastFrag,lastLevel,details)){var referenceFrag=findDiscontinuousReferenceFrag(lastLevel.details,details);if(referenceFrag){logger_1.logger.log('Adjusting PTS using last level due to CC increase within current level');adjustPts(referenceFrag.start,details);}}}", "function process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}", "function sprawdz(){\n n++;\n i = n-1;\n n=n%tImg.length;\n i=i%tImg.length;\n }", "function render() {\n\n var baseSegment = findSegment(position);\n var basePercent = Util.percentRemaining(position, segmentLength);\n var playerSegment = findSegment(position+playerZ);\n var playerPercent = Util.percentRemaining(position+playerZ, segmentLength);\n var playerY = Util.interpolate(playerSegment.p1.world.y, playerSegment.p2.world.y, playerPercent);\n var maxy = height;\n\n var x = 0;\n var dx = - (baseSegment.curve * basePercent);\n\n // Clear the canvas\n ctx.clearRect(0, 0, width, height);\n\n // Order the background layers\n if (currentBackground == 0) {\n // Build the list of positions in the image to extract the appropriate background\n // Depending on the current background, load as current the night or day version\n background_pos_cur = [BACKGROUND.SKY, BACKGROUND.HILLS, BACKGROUND.TREES];\n background_pos_next = [BACKGROUND.SKY2, BACKGROUND.HILLS2, BACKGROUND.TREES2];\n } else {\n background_pos_cur = [BACKGROUND.SKY2, BACKGROUND.HILLS2, BACKGROUND.TREES2];\n background_pos_next = [BACKGROUND.SKY, BACKGROUND.HILLS, BACKGROUND.TREES];\n }\n // Draw the background layers\n if (!changeBackgroundFlag) {\n // No switching, we draw one set of backgrounds\n Render.background(ctx, background, width, height, background_pos_cur[0], skyOffset, resolution * skySpeed * playerY, 1.0);\n Render.background(ctx, background, width, height, background_pos_cur[1], hillOffset, resolution * hillSpeed * playerY, 1.0);\n Render.background(ctx, background, width, height, background_pos_cur[2], treeOffset, resolution * treeSpeed * playerY, 1.0);\n } else {\n // else we are in the process of switching, do a progressive blending\n // continue the blending\n changeBackgroundCurrentAlpha += 0.01; // increase the alpha for one, and decrease for the next background set\n Render.background(ctx, background, width, height, background_pos_cur[0], skyOffset, resolution * skySpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_cur[1], hillOffset, resolution * hillSpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_cur[2], treeOffset, resolution * treeSpeed * playerY, 1.0-changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[0], skyOffset, resolution * skySpeed * playerY, changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[1], hillOffset, resolution * hillSpeed * playerY, changeBackgroundCurrentAlpha);\n Render.background(ctx, background, width, height, background_pos_next[2], treeOffset, resolution * treeSpeed * playerY, changeBackgroundCurrentAlpha);\n if (changeBackgroundCurrentAlpha >= 1.0) {\n // blending is done, disable the flags and reinit all related vars\n // Note: it is important to still do the drawing (and not put it in an if statement) because else the last drawing won't be done, there will be no background for a split-second and this will produce a flickering effect\n currentBackground = (currentBackground + 1) % 2\n changeBackgroundCurrentAlpha = 0.0;\n changeBackgroundFlag = false;\n }\n }\n\n var n, i, segment, car, sprite, spriteScale, spriteX, spriteY;\n\n for(n = 0 ; n < drawDistance ; n++) {\n\n segment = segments[(baseSegment.index + n) % segments.length];\n segment.looped = segment.index < baseSegment.index;\n segment.fog = Util.exponentialFog(n/drawDistance, fogDensity);\n segment.clip = maxy;\n\n Util.project(segment.p1, (playerX * roadWidth) - x, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n Util.project(segment.p2, (playerX * roadWidth) - x - dx, playerY + cameraHeight, position - (segment.looped ? trackLength : 0), cameraDepth, width, height, roadWidth);\n\n x = x + dx;\n dx = dx + segment.curve;\n\n if ((segment.p1.camera.z <= cameraDepth) || // behind us\n (segment.p2.screen.y >= segment.p1.screen.y) || // back face cull\n (segment.p2.screen.y >= maxy)) // clip by (already rendered) hill\n continue;\n\n Render.segment(ctx, width, lanes,\n segment.p1.screen.x,\n segment.p1.screen.y,\n segment.p1.screen.w,\n segment.p2.screen.x,\n segment.p2.screen.y,\n segment.p2.screen.w,\n segment.fog,\n segment.color);\n\n maxy = segment.p1.screen.y;\n }\n\n for(n = (drawDistance-1) ; n > 0 ; n--) {\n segment = segments[(baseSegment.index + n) % segments.length];\n\n for(i = 0 ; i < segment.cars.length ; i++) {\n car = segment.cars[i];\n sprite = car.sprite;\n spriteScale = Util.interpolate(segment.p1.screen.scale, segment.p2.screen.scale, car.percent);\n spriteX = Util.interpolate(segment.p1.screen.x, segment.p2.screen.x, car.percent) + (spriteScale * car.offset * roadWidth * width/2);\n spriteY = Util.interpolate(segment.p1.screen.y, segment.p2.screen.y, car.percent);\n Render.sprite(ctx, width, height, resolution, roadWidth, sprites, car.sprite, spriteScale, spriteX, spriteY, -0.5, -1, segment.clip);\n }\n\n for(i = 0 ; i < segment.sprites.length ; i++) {\n sprite = segment.sprites[i];\n spriteScale = segment.p1.screen.scale;\n spriteX = segment.p1.screen.x + (spriteScale * sprite.offset * roadWidth * width/2);\n spriteY = segment.p1.screen.y;\n Render.sprite(ctx, width, height, resolution, roadWidth, sprites, sprite.source, spriteScale, spriteX, spriteY, (sprite.offset < 0 ? -1 : 0), -1, segment.clip);\n }\n\n if (segment == playerSegment) {\n Render.player(ctx, width, height, resolution, roadWidth, sprites, speed/maxSpeed,\n cameraDepth/playerZ,\n width/2,\n (height/2) - (cameraDepth/playerZ * Util.interpolate(playerSegment.p1.camera.y, playerSegment.p2.camera.y, playerPercent) * height/2),\n speed * (keyLeft ? -1 : keyRight ? 1 : 0),\n playerSegment.p2.world.y - playerSegment.p1.world.y);\n }\n }\n\t\t\t\n // start horizon tilt\n if (enableTilt) {\n rotation=0;\n if (baseSegment.curve==0) {\n rotation=-currentRotation;\n currentRotation=0;\n } else {\n newrot = Math.round(baseSegment.curve*speed/maxSpeed*100)/100;\n rotation=newrot - currentRotation ;\n currentRotation = newrot ;\n }\n if (rotation!=0) {\n //ctx.save(); // doesn't help with moire problem\n ctx.translate(canvas.width/2,canvas.height/2);\n ctx.rotate(-rotation*(Math.PI/90));\n ctx.translate(-canvas.width/2,-canvas.height/2);\n //ctx.restore();\n }\n }\n\n // Draw \"Game Over\" screen\n if (gameOverFlag) {\n ctx.font = \"3em Arial\";\n ctx.fillStyle = \"magenta\";\n ctx.textAlign = \"center\";\n ctx.fillText(\"GAME OVER\", canvas.width/2, canvas.height/2);\n ctx.fillText(\"(refresh to restart)\", canvas.width/2, canvas.height/1.5);\n }\n }", "collisionsSystem(scene, self) {\n \n scene.matter.world.on('collisionstart', function (event) {\n var pairs = event.pairs;\n for (var i = 0; i < pairs.length; i++) {\n\n var bodyA = pairs[i].bodyA;\n var bodyB = pairs[i].bodyB;\n\n // Ship - Planet\n if (bodyA.label === 'shipBody' && bodyB.label === 'planetBody' && Game.systemStartTime > 500) {\n self.soundThrusterTop.stop();\n self.soundThrusterBottom.stop();\n self.soundThrusterLeft.stop();\n self.soundThrusterRight.stop();\n\n Game.currentPlanet = bodyB.parent.gameObject.data.list.id;\n Game.lastSystemPosition = {\n x: bodyB.parent.gameObject.x,\n y: bodyB.parent.gameObject.y\n };\n\n // Désactive de témoin du loader de systemScene\n scene.scene.start('PlanetScene');\n\n }\n if (bodyB.label === 'shipBody' && bodyA.label === 'planetBody' && Game.systemStartTime > 500) {\n self.soundThrusterTop.stop();\n self.soundThrusterBottom.stop();\n self.soundThrusterLeft.stop();\n self.soundThrusterRight.stop();\n\n Game.currentPlanet = bodyA.parent.gameObject.data.list.id;\n Game.lastSystemPosition = {\n x: bodyA.parent.gameObject.x,\n y: bodyA.parent.gameObject.y\n };\n\n // Désactive de témoin du loader de systemScene\n scene.scene.start('PlanetScene');\n\n }\n\n // Ship - Star\n if (bodyA.label === 'shipBody' && bodyB.label === 'starBody') {\n console.log('PERDU : Ton vaisseau a cramé sur une étoile...');\n scene.scene.stop('UiScene');\n scene.scene.start('EndGameScene');\n }\n if (bodyB.label === 'shipBody' && bodyA.label === 'starBody') {\n console.log('PERDU : Ton vaisseau a cramé sur une étoile...');\n scene.scene.stop('UiScene');\n scene.scene.start('EndGameScene');\n }\n\n }\n });\n }", "sendSegmentAckIfApplicable() {\n // We check for chunks Received +1 as at the sender side it is one greate\n // TODO: Improve this logic. It is ugly\n if ((this.chunksReceived + 1) % this.transferRate === 0) {\n this.segmentNumberReceived += 1;\n\n this.peerComm.send(this.peer_id, {\n type: \"file_segment_ack\",\n data: {\n transfer_id: this.id,\n segment_number: this.segmentNumberReceived\n }\n });\n\n console.log(`Segment ACK sent: ${this.segmentNumberReceived}`);\n }\n }", "setSurroundingScenes(scene){\n\n // TODO: More checks. Reset to locked\n // let adjacentScene = null;\n\n // // up\n // adjacentScene = this.getSceneAtLocal(scene, 0, -1);\n // if (adjacentScene){\n // if (scene.up && adjacentScene.down){\n // scene.upLocked = false;\n // adjacentScene.downLocked = false;\n // }\n // }\n\n // // right\n // adjacentScene = this.getSceneAtLocal(scene, 1, 0);\n // if (adjacentScene){\n // if (scene.right && adjacentScene.left){\n // scene.rightLocked = false;\n // adjacentScene.leftLocked = false;\n // }\n // }\n\n // // down\n // adjacentScene = this.getSceneAtLocal(scene, 0, 1);\n // if (adjacentScene){\n // if (scene.down && adjacentScene.up){\n // scene.downLocked = false;\n // adjacentScene.upLocked = false;\n // }\n // }\n\n // // left\n // adjacentScene = this.getSceneAtLocal(scene, -1, 0);\n // if (adjacentScene){\n // if (scene.left && adjacentScene.right){\n // scene.leftLocked = false;\n // adjacentScene.rightLocked = false;\n // }\n // }\n }", "function loadSegments() {\n var regions = JSON.parse(localStorage.regions);\n regions.forEach(function (region) {\n wavesurfer.addRegion(region);\n });\n}", "function addSegment(segment) {\n\t\t\t\n\t\t// create canvas element used to visualize the frames of \n\t\t// the given segment + its timecodes\n\t\tvar item = document.createElement('canvas');\n\t\titem.width = 1000;\n\t\titem.height = 200;\n\t\t\n\t\t// input field for description of a segment\n\t\tvar input = document.createElement('input');\n\t\tinput.type = 'text';\n\t\tinput.placeholder = 'description';\n\t\tinput.className = 'description';\n\t\tinput.value = segment.description;\n\t\tinput.id = '' + segment.id;\n\t\tinput.width = 500;\n\t\t\n\t\t// draw segment frames of the video\n\t\tvar context = item.getContext(\"2d\");\n\t\tcontext.drawImage(segment.startFrame.image, 10, 10, 150, 150);\n\t\tcontext.drawImage(segment.endFrame.image, 170, 10, 150, 150);\n\t\t\n\t\t// draw timecode as text\n\t\tcontext.font = \"20px Arial\";\n\t\tcontext.fillStyle = 'Black';\n\t\tcontext.fillText(segment.startFrame.asText() + ' - ' + segment.endFrame.asText(), 10, 190);\n\t\t\n\t\tvar div = document.createElement('div');\n\t\tdiv.className = 'element';\n\t\tdiv.setAttribute('data-start', segment.startFrame.second);\n\t\tdiv.setAttribute('data-end', segment.endFrame.second);\n\t\tdiv.id = 'div' + segment.id;\n\t\t\n\t\t// logic for button showing the up arrow\n\t\tvar up_arrow = document.createElement('button');\n\t\tup_arrow.type = 'button';\n\t\tup_arrow.innerHTML = '&uarr;'\n\t\tup_arrow.setAttribute('data-id', segment.id);\n\t\tvar index = segments.indexOf(segment);\n\t\tup_arrow.disabled = index == 0;\n\t\tup_arrow.addEventListener('click', \n\t\tfunction() {\n\t\t\tvar segment_id = this.getAttribute('data-id');\n\t\t\tvar se = getSegmentById(segment_id);\n\t\t\tvar index_se = segments.indexOf(se);\n\t\t\tif (index_se <= 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tswapSegments(index_se, index_se - 1);\n\t\t\trepaintSegments();\n\t\t},\n\t\tfalse);\n\t\t\n\t\t// logic for button showing the down arrow\n\t\tvar down_arrow = document.createElement('button');\n\t\tdown_arrow.type = 'button';\n\t\tdown_arrow.innerHTML = '&darr;'\n\t\tdown_arrow.setAttribute('data-id', segment.id);\n\t\tdown_arrow.disabled = index == segments.length - 1;\n\t\tdown_arrow.addEventListener('click', \n\t\tfunction() {\n\t\t\tvar segment_id = this.getAttribute('data-id');\n\t\t\tvar se = getSegmentById(segment_id);\n\t\t\tvar index_se = segments.indexOf(se);\n\t\t\tif (index_se >= segments.length - 1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tswapSegments(index_se, index_se + 1);\n\t\t\trepaintSegments();\n\t\t},\n\t\tfalse);\n\t\t\n\t\t// logic for remove button -> removes a segment\n\t\tvar remove = document.createElement('button');\n\t\tremove.type = 'button';\n\t\tremove.innerHTML = '-';\n\t\tremove.setAttribute('data-id', segment.id);\n\t\tremove.style.color = 'red',\n\t\tremove.addEventListener('click', \n\t\tfunction() {\n\t\t\tvar segment_id = this.getAttribute('data-id');\n\t\t\tvar se = getSegmentById(segment_id);\n\t\t\tvar index_se = segments.indexOf(se);\n\t\t\t// Find and remove item from an array\n\t\t\tif(index_se >= 0 && index_se < segments.length) {\n\t\t\t\tsegments.splice(index_se, 1);\n\t\t\t\tavailable_ids.push(se.id);\n\t\t\t\tremoveSegment(se);\n\t\t\t\trepaintSegments();\n\t\t\t}\n\t\t},\n\t\tfalse);\n\t\t\n\t\tdiv.appendChild(item);\n\t\tdiv.appendChild(input);\n\t\tdiv.appendChild(up_arrow);\n\t\tdiv.appendChild(down_arrow);\n\t\tdiv.appendChild(remove);\n\t\t\n\t\t// add the new segment div to the list of div objects\n\t\tcontainer.appendChild(div);\n\t}" ]
[ "0.5564305", "0.5399973", "0.5356345", "0.514701", "0.49325645", "0.49311793", "0.49182078", "0.4847869", "0.48345715", "0.47871506", "0.4709126", "0.47009376", "0.4678099", "0.46700835", "0.46627903", "0.46214515", "0.4574515", "0.45615485", "0.4560828", "0.4557831", "0.4541452", "0.4535215", "0.45156065", "0.4505024", "0.44886872", "0.44718608", "0.4461714", "0.4449534", "0.44476894", "0.44211513", "0.4410989", "0.4409956", "0.44006437", "0.4395455", "0.43906942", "0.439053", "0.43681526", "0.4364687", "0.4364687", "0.43600285", "0.43584204", "0.4355918", "0.43536726", "0.43515", "0.43447036", "0.43384415", "0.43371326", "0.43338928", "0.4330673", "0.43173978", "0.4317168", "0.4313032", "0.43020755", "0.42919743", "0.4283753", "0.42823663", "0.42808017", "0.42788213", "0.42788213", "0.42782646", "0.42764357", "0.42741686", "0.4267437", "0.42665726", "0.42635465", "0.42630693", "0.42625126", "0.42612356", "0.42527533", "0.42526338", "0.42511436", "0.42496943", "0.42496517", "0.42408013", "0.423824", "0.4231729", "0.4227271", "0.42083752", "0.42076322", "0.42010438", "0.42010438", "0.4190434", "0.4189323", "0.41850862", "0.418485", "0.4180674", "0.4177963", "0.41775024", "0.417706", "0.41734955", "0.41734955", "0.41734955", "0.41734955", "0.41724688", "0.4161725", "0.41545972", "0.4150817", "0.41502753", "0.41402856", "0.4137266" ]
0.5598638
0
jumps jump to beginning of current split item
function jumpToSegment() { if (editor.splitData && editor.splitData.splits) { id = $(this).prop('id'); id = id.replace('splitItem-', ''); id = id.replace('splitItemDiv-', ''); id = id.replace('splitSegmentItem-', ''); setCurrentTime(editor.splitData.splits[id].clipBegin); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "jump(itemIndex = 0){\n this._changeActive_keepPlayState(itemIndex);\n }", "jump(item) { this._.unshift(item); return this; }", "jumpTo(position = 0) {\n this.at = position;\n }", "jumpToBeginning() {\n this.simulateKeyPress_(SAConstants.KeyCode.HOME, {ctrl: true});\n }", "function jumpToFirst() {\n\t\t\tif (options.sliderType === 'vertical') {\n\t\t\t\t$sliderWindow.animate({\n\t\t\t\t\tmarginTop: '0px'\n\t\t\t\t}, 0);\n\t\t\t} else if (options.sliderType === 'horizontal') {\n\t\t\t\t$sliderWindow.animate({right: '0px'}, 0);\n\t\t\t}\n\t\t}", "jump() {\n\t\t// \n\t}", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0\n });\n }", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0\n });\n }", "function goToStep(step){//because steps starts with zero\nthis._currentStep=step-2;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "function keyCommandMoveSelectionToStartOfBlock(editorState){var selection=editorState.getSelection();var startKey=selection.getStartKey();return EditorState.set(editorState,{selection:selection.merge({anchorKey:startKey,anchorOffset:0,focusKey:startKey,focusOffset:0,isBackward:false}),forceSelection:true});}", "function jumpToFirst() {\n\t\t\tif (options.SliderTypeVert) {\n\t\t\t\t$SliderWindow.animate({\n\t\t\t\t\tmarginTop: '0px'\n\t\t\t\t}, 0);\n\t\t\t// horizontal slider\n\t\t\t} else if (!options.SliderTypeFade) {\n\t\t\t\t$SliderWindow.animate({\n\t\t\t\t\tright: '0px'\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t}", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0,\n }\n )\n }", "goToFirstSlide() {\n\n this.goTo(0, -1);\n\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 _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 }", "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 }", "gotoSibling(n_item) {\n const view = this.app.workspace.activeLeaf.view;\n if (view instanceof obsidian.MarkdownView) {\n const cm = view.sourceMode.cmEditor;\n let line_limit;\n if (n_item > 0) {\n line_limit = cm.lastLine();\n }\n else {\n line_limit = cm.firstLine();\n }\n let cursorHead = cm.getCursor();\n let var_token_base = cm.getTokenTypeAt(cursorHead);\n let line_base = cursorHead.line;\n let var_token;\n while (var_token != var_token_base\n && this.gotoCheckLimit(cursorHead.line, n_item, line_limit)) {\n cursorHead.line += n_item;\n var_token = cm.getTokenTypeAt(cursorHead);\n }\n if (var_token == var_token_base) {\n cm.setCursor(cursorHead);\n this.flashLine();\n }\n else {\n cursorHead.line = line_base;\n this.errorLine();\n }\n }\n }", "jumpPush(){\n\t\tthis.async_jump_pos.push(0);\n\t}", "jump() {\n let editor = vscode.window.activeTextEditor;\n if (!editor) {\n return;\n }\n let doc = editor.document;\n let pos = editor.selection.active;\n let { word, range } = this.findWordRange(doc, pos);\n //If on a keyword, got to complementing keyword. Else go to next keyword\n if (this.isKeyword(word, doc, range)) {\n let parseDir = this.keywords.open.includes(word) ? 1 : -1;\n let complement = this.parseUntilComplement(1, parseDir, doc, parseDir === 1 ? range.end : range.start);\n if (complement !== undefined) {\n editor.selection = new vscode.Selection(complement.start, complement.end);\n }\n else {\n let { range: nextRange } = this.findNextKeyword(1, doc, pos.line, range.end.character);\n if (!nextRange.isEmpty) {\n editor.selection = new vscode.Selection(nextRange.start, nextRange.end);\n }\n }\n }\n }", "function goToPrevStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId-=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "function firstItem() {\n\t\tstopSlideshow();\n\t\tchangeItem(0);\n\t}", "setNextItemActive() {\n this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(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 }", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "_setEvent_jump(){\n let jumps = this._carousel.find(this._controlSelectors.jump);\n $(jumps).click((e)=>{\n let indexStr = $(e.target).attr(this._itemIndexAttr);\n let indexInt = parseInt(indexStr);\n this.jump(indexInt);\n });\n }", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) ===0,\n clickedButton: step,\n });\n }", "jumpTo(step) {\n // rerender the game to reflect these steps\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0,\n });\n }", "function scrollToBeginningfn(segmentID)\n{\n\tif(gDataArray != [])\n\t\tsegmentID.selectedIndex = [0,0];//indicates 1st row in 1st section of segmented ui.\n}", "function pageSkipper(){\n\tvar pageIndicator = document.getElementById(\"jumpval\").value - 2;\n\tif (pageIndicator >= 0){\n\t\twindow.scrollTo({\n\t\t\ttop: array[pageIndicator] + 1,\n\t\t\tbehavior: \"smooth\"\n\t\t});\n\t}\n\telse {\n\t\twindow.scrollTo({\n\t\t\ttop: 0,\n\t\t\tbehavior: \"smooth\"\n\t\t});\n\t}\n}", "next () {\n\t\tconsole.log(this.currentItem)\n\t\tthis.gotoItem(this.currentItem + this.slidesToScroll) // Appel de la methode gotoItem et parametres : index de l'item + nombres de slide a defiler\n\t}", "moveSourceCursorToTheNextPosition () {\n\n }", "navigateLineStart() {\n this.selection.moveCursorLineStart();\n this.clearSelection();\n }", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n\t var selection = editorState.getSelection();\n\t var startKey = selection.getStartKey();\n\t return EditorState.set(editorState, {\n\t selection: selection.merge({\n\t anchorKey: startKey,\n\t anchorOffset: 0,\n\t focusKey: startKey,\n\t focusOffset: 0,\n\t isBackward: false\n\t }),\n\t forceSelection: true\n\t });\n\t}", "function keyCommandMoveSelectionToStartOfBlock(\n editorState: EditorState,\n): EditorState {\n const selection = editorState.getSelection();\n const startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false,\n }),\n forceSelection: true,\n });\n}", "onMoveUp() {\n if (this.state.selectedIndex > 0) {\n this.selectIndex(--this.state.selectedIndex);\n\n // User is at the start of the list. Should we cycle back to the end again?\n } else if (this.props.cycleAtEndsOfList) {\n this.selectIndex(this.state.items.length-1);\n }\n }", "gotoFirstHit() {\n this.gotoHit(0);\n }", "gotoFirstHit() {\n this.gotoHit(0);\n }", "gotoFirstHit() {\n this.gotoHit(0);\n }", "gotoFirstHit() {\n this.gotoHit(0);\n }", "scrollDown() {\n if (this.currentOffset < this.items.length - 1) {\n this.currentOffset++\n this.goToThePage()\n }\n }", "_moveToStart() {\n // moveCount can disturb the method logic.\n const initialMoveCount = this._settings.moveCount;\n this._settings.moveCount = 1;\n\n for (let pos = 1; pos < this._settings.startPosition; pos++) {\n this._rightMoveHandler();\n }\n this._settings.moveCount = initialMoveCount;\n }", "jumpPop(){\n\t\tthis.async_jump_pos.pop();\n\t}", "function updateCurrentNextToGoCandidate(item) {\n item.nextToGo = true;\n}", "next() {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);\n }", "moveNext() {\n const nextStep = this.steps[this.currentStep + 1];\n if (!nextStep) {\n this.reset();\n return;\n }\n\n this.overlay.highlight(nextStep);\n this.currentStep += 1;\n }", "moveToNextLine() {\n this.moveDown();\n }", "function goToStepNumber(step){this._currentStepNumber=step;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "function mycarousel_itemFirstInCallback(carousel, item, idx, state) {\r\n //alert(idx);\r\n //display('Item #' + idx + ' is now the first item');\r\n featureFirstIndex = idx;\r\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 }", "setNextItemActive() {\n this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1);\n }", "setNextItemActive() {\n this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1);\n }", "setNextItemActive() {\n this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1);\n }", "previousItem() {\n\t\tif (this.cursor > 0) {\n\t\t\tthis.cursor--;\n\t\t}\n\n\t\tthis.menuData[this.cursor].focus();\n\t}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function keyCommandMoveSelectionToStartOfBlock(editorState) {\n var selection = editorState.getSelection();\n var startKey = selection.getStartKey();\n return EditorState.set(editorState, {\n selection: selection.merge({\n anchorKey: startKey,\n anchorOffset: 0,\n focusKey: startKey,\n focusOffset: 0,\n isBackward: false\n }),\n forceSelection: true\n });\n}", "function goToNextStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId+=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "jumpTo(step) {\n\t\t// Calculating winner at this point in game\n\t\tlet winnerSquares = this.calculateWinnerSquares(this.state.history[step].squares, true);\n\t\tlet winner = winnerSquares ? this.state.history[step].squares[winnerSquares[0]] : null;\n\t\tlet showTrophy = winner ? true : false;\n\t\tthis.setState({\n\t\t\tstepNumber: step,\n\t\t\tnextPlayer: this.getNextPlayer(step),\n\t\t\twinner: winner,\n\t\t\twinnerSquares: winnerSquares,\n\t\t\tshowTrophy: showTrophy\n\t\t});\n\t}", "function gotoNext() {\n\tif(typeof nextInventory !== 'undefined') {\n\t\tpreviousInventory = currentInventory;\n\t\tcurrentInventory = nextInventory;\n\t\tnextInventory = undefined;\n\t}\n}", "gotoPrevHit() {\n const me = this;\n if (!me.found || !me.found.length) return;\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell ? grid.store.indexOf(fromCell.id) : 0,\n found = me.found;\n\n for (let i = found.length - 1; i--; i >= 0) {\n const hit = found[i];\n\n if (hit.index < currentIndex) {\n me.gotoHit(i);\n break;\n }\n }\n }", "function onKeyDown() {\n ctrl.selectedIndex = (ctrl.selectedIndex + 1) % ctrl.items.length;\n updateView();\n }", "jump() {\n if (this._state !== this.PLAY_STATE) {\n return;\n }\n if (this._jump > 1) {\n this._y -= Math.floor(this._jump * 0.08);\n if (this._y < 0) {\n this._y = 0;\n }\n this._jump = Math.floor(this._jump * 0.92);\n } else {\n this._jump = 0;\n }\n offset = this._jump;\n }", "gotoPrevHit() {\n const me = this;\n\n if (!me.found || !me.found.length) return;\n\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell ? grid.store.indexOf(fromCell.id) : 0,\n found = me.found;\n\n for (let i = found.length - 1; i--; i >= 0) {\n let hit = found[i];\n if (hit.index < currentIndex) {\n me.gotoHit(i);\n break;\n }\n }\n }", "goForward() {\n const actualPosition = this.mower.position.clone();\n const nextPosition = this.getNextPositionForward(actualPosition);\n if(this.isNextPositionAllowed(nextPosition)) {\n this.updatePosition(nextPosition);\n }\n }", "prev () {\n if (this._items.length < 2 || this._isMoving) {\n return\n }\n\n var currentIndex = this._items.indexOf(this._current);\n var prevIndex = this._items[currentIndex - 1] !== undefined \n ? currentIndex - 1 : this._items.length;\n this._to(prevIndex);\n }", "function myMoveLeft() { //ad ogni click sulla freccia di sinistra\n scrollPosition = scrollPosition - scrollChange; //sottraggo alla posizione iniziale il valore di cambiamento settato \n carousel.scrollTo(scrollPosition, 0); //vado ad assegnare la posizione finale al contenitore sull'asse x\n}", "nextItem() {\n\t\tif (this.cursor < this.menuData.length - 1) {\n\t\t\tthis.cursor++;\n\t\t}\n\n\t\tthis.menuData[this.cursor].focus();\n\t}", "function JumpToChapter(c,frame) {\n\tLoadSection(c * 100 + chapterStartSectionOffset);\n\t// PW: Note that chapterStartSectionOffset is defined above and may be overridden by config.js\n}", "next(){\r\n (this.position == this.testimonial.length - 1) ? this.position = 0 : this.position++\r\n }", "function nextItem() {\n\t\tstopSlideshow();\n\t\tchangeItem(current + 1);\n\t}", "next(){\n let next = this.currentId + 1;\n if(next >= this.list.length){\n next = this.list.length;\n }\n this.goto(next);\n }", "moveForward() {\n let indexInInline = 0;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n let inline = inlineObj.element;\n indexInInline = inlineObj.index;\n if (!isNullOrUndefined(inline)) {\n if (!this.owner.selection.isEmpty && indexInInline === inline.length && inline instanceof FieldElementBox\n && inline.fieldType === 1) {\n let hierarchicalIndex = this.owner.selection.start.getHierarchicalIndexInternal();\n // tslint:disable-next-line:max-line-length\n let fieldBeginOffset = inline.fieldBegin.line.getOffset(inline.fieldBegin, 0);\n // tslint:disable-next-line:max-line-length\n let fieldBeginIndex = this.getHierarchicalIndex(inline.fieldBegin.line, fieldBeginOffset.toString());\n if (!TextPosition.isForwardSelection(hierarchicalIndex, fieldBeginIndex)) {\n //If field begin is before selection start, move selection start to field begin.\n // tslint:disable-next-line:max-line-length\n this.owner.selection.start.setPositionParagraph(inline.fieldBegin.line, fieldBeginOffset);\n return;\n }\n }\n inline = this.selection.getNextRenderedElementBox(inline, indexInInline);\n }\n if (inline instanceof FieldElementBox && !isNullOrUndefined(inline.fieldEnd)) {\n let selectionStartParagraph = this.owner.selection.start.paragraph;\n let selectionStartIndex = 0;\n // tslint:disable-next-line:max-line-length\n let selectionStartInlineObj = selectionStartParagraph.getInline(this.owner.selection.start.offset, selectionStartIndex);\n let selectionStartInline = selectionStartInlineObj.element;\n selectionStartIndex = selectionStartInlineObj.index;\n let nextRenderInline = this.selection.getNextRenderedElementBox(selectionStartInline, selectionStartIndex);\n if (nextRenderInline === inline) {\n this.moveNextPositionInternal(inline);\n }\n else {\n //If selection start is before field begin, extend selection end to field end.\n inline = inline.fieldEnd;\n this.currentWidget = inline.line;\n this.offset = this.currentWidget.getOffset(inline, 1);\n //Updates physical position in current page.\n this.updatePhysicalPosition(true);\n return;\n }\n }\n else if ((inline instanceof FieldElementBox)\n && (inline.fieldType === 0 || inline.fieldType === 1)) {\n this.currentWidget = inline.line;\n this.offset = this.currentWidget.getOffset(inline, 1);\n }\n indexInInline = 0;\n let nextOffset = this.selection.getNextValidOffset(this.currentWidget, this.offset);\n let length = this.selection.getLineLength(this.currentWidget);\n let isParagraphEnd = this.selection.isParagraphLastLine(this.currentWidget);\n if (this.offset < nextOffset) {\n this.offset = nextOffset;\n let inlineObj = this.currentWidget.getInline(this.offset, indexInInline);\n inline = inlineObj.element;\n indexInInline = inlineObj.index;\n if (!isNullOrUndefined(inline) && indexInInline === inline.length && inline.nextNode instanceof FieldElementBox) {\n let nextValidInline = this.selection.getNextValidElement(inline.nextNode);\n //Moves to field end mark.\n if (nextValidInline instanceof FieldElementBox && nextValidInline.fieldType === 1) {\n inline = nextValidInline;\n this.offset = this.currentWidget.getOffset(inline, 1);\n }\n }\n }\n else if (this.offset === nextOffset && this.offset < length + 1 && isParagraphEnd) {\n this.offset = length + 1;\n }\n else {\n this.updateOffsetToNextParagraph(indexInInline, true);\n }\n //Gets physical position in current page.\n this.updatePhysicalPosition(true);\n }", "gotoPrevHit() {\n let me = this,\n grid = me.grid,\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n found = me.found,\n prevHit;\n\n if (!found.length) return;\n\n for (let i = found.length - 1; i--; i >= 0) {\n if (found[i].index < currentIndex) {\n prevHit = found[i];\n break;\n }\n }\n\n if (prevHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: prevHit.id\n });\n } else {\n me.gotoLastHit();\n }\n }", "moveToParagraphStart() {\n if (this.isForward) {\n this.start.paragraphStartInternal(this, false);\n this.end.setPositionInternal(this.start);\n this.upDownSelectionLength = this.end.location.x;\n }\n else {\n this.end.paragraphStartInternal(this, false);\n this.start.setPositionInternal(this.end);\n this.upDownSelectionLength = this.start.location.x;\n }\n this.fireSelectionChanged(true);\n }", "setPreviousItemActive() {\n this._activeItemIndex < 0 && this._wrap ? this.setLastItemActive() : this._setActiveItemByDelta(-1);\n }", "gotoPrevHit() {\n let me = this,\n grid = me.grid,\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n found = me.found,\n prevHit;\n if (!found.length) return;\n\n for (let i = found.length - 1; i--; i >= 0) {\n if (found[i].index < currentIndex) {\n prevHit = found[i];\n break;\n }\n }\n\n if (prevHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: prevHit.id\n });\n } else {\n me.gotoLastHit();\n }\n }", "function scrollToStartHandler() {\n scrollTo({top: 0, behavior: 'smooth'});\n}", "function setup_goToStart(){\n // what happens when we move to 'goToStart' section of a trial\n wp.trialSection = 'goToStart';\n unstageArray(fb_array);\n\n // update objects\n choiceSet.arc.visible = false;\n choiceSet.arc_glow.visible = false;\n startPoint.sp.visible = true;\n startPoint.sp_glow.visible = false;\n\n // update messages\n msgs.goToStart.visible = true;\n msgs.tooSlow.visible = false;\n\n stage.update();\n }", "prevStep() {\n\n if (this.currStep > -1) {\n\n this.goTo(this.currSlide, this.currStep - 1);\n\n }\n\n }", "set start(value) {}", "function USEITEMMove(p) {\r\n if (CoreState.state == \"\") {auto_keys.push(\"Back\");}\r\n if (CoreState.state == \"MainMenu\" && MainMenuState.state == \"\") {SeekName(MainMenu,\"Items\");}\r\n if (CoreState.state == \"MainMenu\" && MainMenuState.state == \"ItemMenu\") {\r\n if (SeekCursor(ItemMenu,p.item)) {PlanStack.pop();}\r\n }\r\n}", "gotoNextHit(fromStart = false) {\n const me = this;\n if (!me.found || !me.found.length) return;\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell && !fromStart ? grid.store.indexOf(fromCell.id) : -1,\n nextHit = me.found.findIndex(hit => hit.index > currentIndex);\n\n if (nextHit !== -1) {\n me.gotoHit(nextHit);\n }\n }", "checkForBeginning() {\n if (this.leftPage !== 1) {\n this.onFirstPage = false;\n } else {\n this.onFirstPage = true;\n }\n }", "function startFrom(value) { }", "focusItem(item) {\n this._itemNavigation.setCurrentItem(item);\n item.focus();\n }", "navigateFileStart() {\n this.selection.moveCursorFileStart();\n this.clearSelection();\n }", "function jump(dest,line) {\n\tdebugMsg(\"jump(\"+dest+\",\"+line+\")\");\n\tnextStep=dest;\n\treportPublicVariables();\n\tpostMessage({\"type\":\"step\",\"line\":line});\n}", "next(){\n let targetItem = this._currentItem + 1;\n let nextItem = targetItem >= this._itemCount ? 0 : targetItem;\n this._changeActive_keepPlayState(nextItem);\n }", "function scrollSelectedItem(item, container) {\n\n\n\n //Code taken from internet - refactored slightly.\n if (item.position().top + container.height() >= container.scrollTop() + container.height()) {\n\n container.scrollTop(item.position().top - container.height() + container.scrollTop())\n\n } else if (item.position().top <= container.scrollTop()) {\n\n container.scrollTop(0 + item.position().top)\n }\n\n }", "function startFromBeginning() {\n window.scroll({\n top: 0,\n left: 0,\n behavior: 'smooth'\n });\n}" ]
[ "0.6972423", "0.6931872", "0.6901941", "0.649786", "0.6410922", "0.63501", "0.6250299", "0.6199222", "0.6168766", "0.61422896", "0.6131393", "0.61113167", "0.61062145", "0.609528", "0.60864264", "0.60864264", "0.60864264", "0.60864264", "0.60864264", "0.60789686", "0.6074162", "0.6069534", "0.6066857", "0.606509", "0.6026618", "0.6013285", "0.60096675", "0.60067105", "0.595137", "0.5938384", "0.5887161", "0.58782804", "0.58660597", "0.5860859", "0.5859287", "0.58481574", "0.5835622", "0.5822676", "0.5815889", "0.5800215", "0.5800215", "0.5800215", "0.5800215", "0.5785638", "0.57840496", "0.5783111", "0.57816464", "0.57691437", "0.5767415", "0.5761503", "0.57566386", "0.573165", "0.5729268", "0.5723722", "0.5723722", "0.5723722", "0.5723708", "0.5718312", "0.5718312", "0.5718312", "0.5718312", "0.5718312", "0.5718312", "0.5718312", "0.5718312", "0.5718312", "0.57115144", "0.5709922", "0.57065684", "0.5699562", "0.5668608", "0.5667125", "0.56598276", "0.5658383", "0.56532955", "0.5649944", "0.5645985", "0.56323004", "0.5630307", "0.5628323", "0.5598333", "0.5589654", "0.55850244", "0.5583958", "0.5578941", "0.5578461", "0.55764514", "0.55701035", "0.5558717", "0.5554922", "0.55542266", "0.5544556", "0.55412155", "0.55388784", "0.55379695", "0.55361086", "0.5535815", "0.55346483", "0.5533254", "0.5526021" ]
0.6809857
3
jump to next segment
function nextSegment() { if (editor.splitData && editor.splitData.splits) { var playerPaused = getPlayerPaused(); if (!playerPaused) { pauseVideo(); } var currSplitItem = getCurrentSplitItem(); var new_id = currSplitItem.id + 1; new_id = (new_id >= editor.splitData.splits.length) ? 0 : new_id; var idFound = true; if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) { idFound = false; } /* else if (!editor.splitData.splits[new_id].enabled) { idFound = false; new_id = (new_id >= (editor.splitData.splits.length - 1)) ? 0 : new_id; for (var i = new_id + 1; i < editor.splitData.splits.length; ++i) { if (editor.splitData.splits[i].enabled) { new_id = i; idFound = true; break; } } } */ if (!idFound) { for (var i = 0; i < new_id; ++i) { // if (editor.splitData.splits[i].enabled) { new_id = i; idFound = true; break; // } } } if (idFound) { selectSegmentListElement(new_id, !playerPaused); } if (!playerPaused) { playVideo(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jumpToSegment() {\n if (editor.splitData && editor.splitData.splits) {\n id = $(this).prop('id');\n id = id.replace('splitItem-', '');\n id = id.replace('splitItemDiv-', '');\n id = id.replace('splitSegmentItem-', '');\n\n setCurrentTime(editor.splitData.splits[id].clipBegin);\n }\n}", "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "next() {\n const newIndex = this.index + 1;\n\n if (this.isOutRange(newIndex)) {\n return;\n }\n\n this.doSwitch(newIndex);\n }", "next(){\n let next = this.currentId + 1;\n if(next >= this.list.length){\n next = this.list.length;\n }\n this.goto(next);\n }", "function gotoNext() {\n var currentIndex = findCurrentIndexInList();\n if (currentIndex == -1)\n return;\n var nextIndex = currentIndex + 1;\n // If next is == length then loop to zero\n if (nextIndex == exports.activeList.members.length) {\n nextIndex = 0;\n }\n var next = exports.activeList.members[nextIndex];\n gotoLine(next.filePath, next.line, next.col, exports.activeList);\n}", "function goToNext() {\n var nextId = getNextLocationIndex();\n if (nextId != null) {\n setCurrentLocation(nextId);\n }\n }", "function goNext( event ){\n event.preventDefault();\n go( revOffset - 1 );\n return false;\n }", "nextstep(step) {}", "function goToNextStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId+=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "function next() {\n\t\t\treturn go(current+1);\n\t\t}", "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 }", "next() {\r\n this.active = (this.active < this.len - 1) ? this.active + 1 : 0\r\n this.move('->')\r\n }", "function moveNext() {\n if (currentPage == totalPages) return;\n loadTaskList(++currentPage);\n}", "goToNext () {\n\t\t\tif (this.canGoToNext) {\n\t\t\t\tthis.goTo(this.currentSlide + 1)\n\t\t\t}\n\t\t}", "next() {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);\n }", "function next(){\n\tpdx = idx;\n\tidx++;\n\tif(idx >= 4){\n\t\tidx = 0;\n\t}\n\tchangeSlide();\n}", "function scrollToBeginningfn(segmentID)\n{\n\tif(gDataArray != [])\n\t\tsegmentID.selectedIndex = [0,0];//indicates 1st row in 1st section of segmented ui.\n}", "jump() {\n\t\t// \n\t}", "function next() {\n if ($scope.options.index < pageCount - 1) {\n $scope.options.index++;\n }\n }", "moveNext() {\n const nextStep = this.steps[this.currentStep + 1];\n if (!nextStep) {\n this.reset();\n return;\n }\n\n this.overlay.highlight(nextStep);\n this.currentStep += 1;\n }", "next() {\n const that = this;\n\n that.navigateTo(that.pageIndex + 1);\n }", "function nextSection() {\n var nav = app.navigator(),\n fromSection = d.querySelector('[data-page=\"' + nav.active() + '\"]');\n\n // Pasar a otro evento\n if (this.classList.contains('is-up')) {\n goIndex();\n return;\n }\n\n var to = nav.next(),\n toSection = d.querySelector('[data-page=\"' + to + '\"]');\n\n var index = getIndex(fromSection.parentElement.querySelectorAll('.section'), toSection);\n fromSection.parentElement.style.left = (index * -100) + 'vw';\n }", "nextStep(){\n this.search.shift()\n this.search = this.children.concat(this.search)\n\n if( this.search.length == 0){\n this.finished = true\n }\n else{\n this.state = this.search[0]\n this.children = []\n\n // If it is a final state\n if( this.blockInPath(this.state, this.maze.getFinish()) && this.state.length < this.cost){\n this.bestPath = this.state\n this.cost = this.state.length\n }\n // Branch and Bound: Examine the following paths only if they are better than the current best\n else if(this.state.length + 1 < this.cost){\n // Get the children paths with no repeating nodes\n this.children = this.getChildren(this.state).filter( child => !this.blockInPath(this.state, child[child.length - 1]) )\n \n }\n }\n \n }", "next() {\n // $(this.parentElement).data(\"obj\").select_fwd();\n $(this.parentElement).data(\"obj\").update_idx(1);\n return false;\n }", "next() {\n\n if (this.currStep < this.slides[this.currSlide].steps.length - 1) {\n\n this.nextStep();\n\n } else {\n\n this.nextSlide();\n\n }\n\n }", "function intGoNext(){\n goNext(0);\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 }", "function next() {\n\t\t\tgoToImage((curImage+1 > numImages-1 ? 0 : curImage+1), next, true);\n\t\t}", "function goNext() {\n //console.log(\"goNext: \" + options.currentPage);\n if (options.currentPage != options.total) {\n var p = options.currentPage + 1;\n loadData(p);\n setCurrentPage(p);\n options.currentPage = p;\n pageInfo();\n }\n }", "function navigateNext() {\n\n // Prioritize revealing fragments\n if (nextFragment() === false) {\n availableRoutes().down ? navigateDown() : navigateRight();\n }\n\n // If auto-sliding is enabled we need to cue up\n // another timeout\n cueAutoSlide();\n\n }", "function jump(dest,line) {\n\tdebugMsg(\"jump(\"+dest+\",\"+line+\")\");\n\tnextStep=dest;\n\treportPublicVariables();\n\tpostMessage({\"type\":\"step\",\"line\":line});\n}", "function _gotoNextAd()\n\t\t{\n\t\t\tnextAd++;\n\t\t\tif(nextAd >= player.clip.ads.length)\n\t\t\t{\n\t\t\t\tnextAd = null;\n\t\t\t}\n\t\t}", "next() {\n // if we're still navigating within the same step, just update the page number.\n // otherwise, move to the next step.\n const pageIndex = scope.currentStep().currentPageIndex,\n lastPageIndex = scope.currentStep().pages.length - 1;\n if (pageIndex < lastPageIndex) {\n scope.currentStep().currentPageIndex++;\n }\n\n else {\n scope.currentStepIndex++;\n\n // foce start at the beginning of the step.\n scope.currentStep().currentPageIndex = 0;\n }\n }", "function goToNextSlide()\n\t{\n\t\tif($currentSlide.next().length)\n\t\t{\n\t\t\tgoToSlide($currentSlide.next());\n\t\t}\n\t}", "function next_slide(ev)\n {\n ev.preventDefault();\n if (current == sync_elts.length - 1) return; // No next element\n activate(current + 1); // Move the \"active\" class\n //console.log(\"next: current = \"+current+\" t -> \"+timecodes[current]);\n seek_video();\n }", "gotoNextHit(fromStart = false) {\n const me = this;\n if (!me.found || !me.found.length) return;\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell && !fromStart ? grid.store.indexOf(fromCell.id) : -1,\n nextHit = me.found.findIndex(hit => hit.index > currentIndex);\n\n if (nextHit !== -1) {\n me.gotoHit(nextHit);\n }\n }", "nextSlide() {\n\n if (this.currSlide < this.slides.length - 1) {\n\n this.goTo(this.currSlide + 1, -1);\n\n } else {\n\n this.goToFirstSlide();\n\n }\n\n }", "gotoNextHit(fromStart = false) {\n const me = this;\n\n if (!me.found || !me.found.length) return;\n\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell && !fromStart ? grid.store.indexOf(fromCell.id) : -1,\n nextHit = me.found.findIndex((hit) => hit.index > currentIndex);\n\n if (nextHit !== -1) {\n me.gotoHit(nextHit);\n }\n }", "function next(){\n\t\t\t\t\t//check for end\n\t\t\t\t\tif( PC < 0 || PC >= tokens.length ) {\n\t\t\t\t\t\tif(com.timeout){\n\t\t\t\t\t\t\tclearTimeout(com.timeout);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//update the current PC\n\t\t\t\t\tif(PCArray.length > 0){\n\t\t\t\t\t\t$(tokens[PCArray[PCArray.length-1]]).removeClass(cls.currentToken);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t$(tokens[PC]).addClass(cls.currentToken);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//update the state for reversibility\n\t\t\t\t\tPCArray.push( PC );\n\t\t\t\t\tFPArray.push ( framepointer );\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//did we do a valid jump? \n\t\t\t\t\tif(typeof com.self[a[PC]] != 'function'){\n\t\t\t\t\t\talert(\"Runtime error: Attempted to jump to numerical token. \");\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//execute command\n\t\t\t\t\tif( !com.self[a[PC]](a[PC+1], a[PC+2], a) ) {\n\t\t\t\t\t //halted\n\t\t\t\t\t return false;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t//redraw stuff\n\t\t\t\t\tcom.sse.evolution.append(\n\t\t\t\t\t\tcom.stack.print(com.stack.getValues(), framepointer)\n\t\t\t\t\t);\n\t\t\t\t\t\n\t\t\t\t\t//update the displays\n\t\t\t\t\t$(\"#\"+ids.ssePosition).text(PC);\n\t\t\t\t\t$(\"#\"+ids.FPPosition).text(framepointer);\n\t\t\t\t\t\n\t\t\t\t\treturn true;\n\t\t\t\t}", "__nextStep() {\n this.openNextStep();\n }", "function gotoNext() {\n\tif(typeof nextInventory !== 'undefined') {\n\t\tpreviousInventory = currentInventory;\n\t\tcurrentInventory = nextInventory;\n\t\tnextInventory = undefined;\n\t}\n}", "function goToStep(step){//because steps starts with zero\nthis._currentStep=step-2;if(typeof this._introItems!==\"undefined\"){nextStep.call(this);}}", "goto(offset) {\n this[INNER_VM].goto(offset);\n }", "function next() {\n subject = context.stack.tail.head;\n index = 0;\n test( subject );\n }", "function goToNextPage() {\n\t\tif ( canNextPage() ) {\n\t\t\tgoToPage( currentPage() + 1 );\n\t\t}\n\t}", "function gotoNextPage(){\n\tvar current_pagenum = getCurrentPagenum();\n\t\n\tif(checkNextPages(current_pagenum) === true){\n\t\tvar isEndOfPagegroup = checkIsEndOfPagegroup(current_pagenum);\n\t\tvar next_pagenum = current_pagenum + 1;\n\t\t\n\t\tif(isEndOfPagegroup === true){\n\t\t\tincrementPagegroup();\n\t\t}\n\t\t\n\t\tgotoTargetPage(next_pagenum);\n\t\t\n\t\t$('div#conceptcode_pagination_holder > ul.pagination').trigger(\"gotoNextPageComplete.c2s_ui.pagination\", {oldPagenum: current_pagenum});\n\t}\n}", "function nextLoc(dir){\n\t\tvar d=1;\n\t\tswitch(dir){\n\t\t\tcase 0: d=0;break;\n\t\t\tcase 1: d=1;break;\n\t\t\tcase 2: d=2;break;\n\t\t\tcase 3: d=3;break;\n\t\t\tdefault: \"no invalid\";\n\t\t}\n\t\tvar newLocal=nav[currentL][d];\n\t\tif(newLocal>=0){\n\t\t\tcurrentL=newLocal;\n\t\t}else{\n\t\t\tupdateDisplay(\"cannot go that way\");\n\t\t}\n\t}", "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 goto ( id, duration ) {\n\t if('string'!== typeof id || steps.indexOf(id) < 0 ){\n\t return null;\n\t }\n\n\t activeStep = id;\n\ts\n\t debug(\"goto #\"+ activeStep);\n\t asqSocket.emitGoto({step: activeStep, duration: duration})\n\t return activeStep;\n\t }", "function goToNextSlide()\n {\n if($currentSlide.next().length)\n {\n goToSlide($currentSlide.next());\n }\n }", "function next() {\n slide(false, true);\n }", "_navigateNext() {\n this._navigate(this.next.id, 'endpoint');\n }", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0\n });\n }", "function goNext(){\n var childTgrp = tgrp_position - 1;\n dataTabsFrame.selectTab(\"page3-\" + childTgrp);\n}", "next(){\n \n this.firstIndex = this.firstIndex + 5\n this.display()\n \n}", "function goToNextStep() {\n\tnextSteps();\n\tupdateStepsText();\n\tconsole.log(\"hi\");\n}", "function _goToStep(step) {\n //because steps starts with zero\n this._currentStep = step - 2;\n if (typeof (this._introItems) !== 'undefined') {\n _nextStep.call(this);\n }\n }", "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 }", "goToNextStep() {\n let diffCount = 0;\n this._cells = this._cells.map((cell, index) => {\n let neighbours = this._layout.getNeighbours(index);\n\n let aliveNeighbours = neighbours.filter(listIndex => this._cells[listIndex]);\n\n if (cell) {\n // RULE NO. 1 AND NO. 3\n if (aliveNeighbours.length < 2 || aliveNeighbours.length > 3) {\n diffCount++;\n return false;\n }\n } else {\n // RULE NO. 4\n if (aliveNeighbours.length === 3) {\n diffCount++;\n return true;\n }\n }\n\n // REST GOES TO RULE NO. 2\n return cell;\n });\n\n if (diffCount > 0) {\n this._gameState = GameState.PROGRESS;\n } else {\n this._gameState = GameState.DONE;\n }\n }", "function goToNextPage() {\n updateCurrentPage((page) => page + 1);\n }", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0\n });\n }", "gotoNextHit() {\n let me = this,\n grid = me.grid,\n // start from focused cell, or if focus has left grid use lastFocusedCell\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n nextHit = me.found.find((hit) => hit.index > currentIndex);\n\n if (nextHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: nextHit.id\n });\n } else {\n me.gotoFirstHit();\n }\n }", "function nextPage() \n{\n\tgotoUrl( nextIndexPageUrl );\n}", "function nextPage(){\n if (page > 0)\n {\n setPage( page +1);\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 }", "gotoNextFrame() {\n this.timeline.gotoNextFrame();\n }", "function navigateNext(){\n ++current;\n var $thumb = $('#thumbs_container li:nth-child('+parseInt(current+1)+')').find('img');\n if(!$thumb.length) {\n --current;\n return;\n }\n loadPhoto($thumb);\n }", "function getNextRides(){\n vm.currentPage +=1;\n\n if(vm.currentPage > 3)\n vm.showCurrentPage = true;\n \n vm.getAllRides();\n }", "next() {\n const that = this,\n availableItems = that.dataSource.length;\n \n if (that.disabled || availableItems === 0) {\n return;\n }\n\n let nextItem = that._currentIndex;\n\n if(that.loop){\n nextItem = nextItem >= availableItems-1 ? 0 : nextItem + 1;\n }\n else {\n nextItem = nextItem >= availableItems-1 ? nextItem : nextItem + 1;\n }\n\n that._goToItem(nextItem);\n }", "function nextSlide(){\n goToSlide(currentSlide+1);\n}", "function nextEntry() {\n selectEntry(g_cur_entry + 1, true);\n}", "function inBetweenNext() {\r\r // =======================================================\r var idmove = charIDToTypeID( \"move\" );\r var desc10 = new ActionDescriptor();\r var idnull = charIDToTypeID( \"null\" );\r var ref7 = new ActionReference();\r var idLyr = charIDToTypeID( \"Lyr \" );\r var idOrdn = charIDToTypeID( \"Ordn\" );\r var idTrgt = charIDToTypeID( \"Trgt\" );\r ref7.putEnumerated( idLyr, idOrdn, idTrgt );\r desc10.putReference( idnull, ref7 );\r var idT = charIDToTypeID( \"T \" );\r var ref8 = new ActionReference();\r var idLyr = charIDToTypeID( \"Lyr \" );\r var idOrdn = charIDToTypeID( \"Ordn\" );\r var idNxt = charIDToTypeID( \"Nxt \" );\r ref8.putEnumerated( idLyr, idOrdn, idNxt );\r desc10.putReference( idT, ref8 );\r executeAction( idmove, desc10, DialogModes.NO );\r\r // =======================================================\r var idnextFrame = stringIDToTypeID( \"nextFrame\" );\r var desc43 = new ActionDescriptor();\r var idtoNextWholeSecond = stringIDToTypeID( \"toNextWholeSecond\" );\r desc43.putBoolean( idtoNextWholeSecond, false );\r executeAction( idnextFrame, desc43, DialogModes.NO );\r\r}", "gotoNextHit() {\n let me = this,\n grid = me.grid,\n // start from focused cell, or if focus has left grid use lastFocusedCell\n currentId = grid._focusedCell ? grid._focusedCell.id : grid.lastFocusedCell.id,\n currentIndex = grid.store.indexOf(currentId) || 0,\n nextHit = me.found.find(hit => hit.index > currentIndex);\n\n if (nextHit) {\n grid.focusCell({\n columnId: me.columnId,\n id: nextHit.id\n });\n } else {\n me.gotoFirstHit();\n }\n }", "goto(idx) {\n while (this.currentMemAddr != idx) {\n if (this.currentMemAddr < idx) {\n this.currentMemAddr++;\n this.code += \">\";\n }\n else {\n this.currentMemAddr--;\n this.code += \"<\";\n }\n }\n }", "function goToPrevStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId-=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "function nextButton() {\n $('#person').fadeOut('fast');\n if(i < 16 ){ //if/else checks if you are at the end of the carousel, and if so jumps to the other end.\n i = next;\n var person = data.people[i];\n stagePerson(person);\n console.log(i);\n next = i + 1;\n prev = i - 1;\n } else {\n i = 0;\n var person = data.people[i];\n stagePerson(person);\n next = i + 1;\n prev = i - 1;\n }\n }", "goto(offset) {\n this[_symbols__WEBPACK_IMPORTED_MODULE_7__[\"INNER_VM\"]].goto(offset);\n }", "goto(offset) {\n this[_symbols__WEBPACK_IMPORTED_MODULE_7__[\"INNER_VM\"]].goto(offset);\n }", "function moveToNext(Calvin){\n\t// console.log(\"MNext: \" + currElement);\n\t// console.log(\"Element Array Length: \" + elementIdArray.length);\n\tif(currElement>0 && currElement<elementIdArray.length){\n\t\tletThereBeLight(currElement,Calvin);\n\t\tcurrElement++;\n\t}\n\telse if(firstIteration == 0){\n\t\tletThereBeLight(currElement,Calvin);\n\t\tfirstIteration++;\n\t\tcurrElement++;\n\n\t}\n\telse if(currElement >= elementIdArray.length-1){\n\t\talert(\"You have reached the end of this guided tour! Thanks for joining us!\");\n\t\tCalvin.eraseTourGuide();\n\t\tremoveDarkness();\n\t\tcurrElement =0;\n\t\tfirstIteration=0;\n\t}\n}", "next() {\n this.index++;\n }", "function advanceSnake() {\n snake1.advance();\n if(snake2) snake2.advance();\n }", "moveToNextLine() {\n this.moveDown();\n }", "function nextPlace() {\n var place = businesses[step];\n geocode(place);\n}", "function originNextStep() {\n $scope.originStep = 'navigationhidden';\n $scope.destinationStep = 'navigationshown';\n $scope.geosuccess = 'navigationhidden';\n }", "next(enter = true) { return this.move(1, enter); }", "_goToNextCard() {\n if (this._btnNext.disabled === false) {\n var newCurrentPos = 0;\n newCurrentPos = this._currentPos + 1;\n this._goToCard(newCurrentPos, 'next');\n }\n }", "function next() {\n setCurrentPage((currentPage) => Math.min(currentPage + 1, maxPage));\n }", "previous(){\n let previous = this.currentId - 1;\n if(previous <= 1){\n previous = 1;\n }\n this.goto(previous);\n }", "function nextEdit() {\n var path = '/summaryMSA-IRS',\n currentIdx = $scope.siblingEdits.indexOf(editId);\n if (currentIdx !== ($scope.siblingEdits.length - 1)) {\n path = '/detail/' + editType + '/' + $scope.siblingEdits[currentIdx + 1];\n }\n $location.path(path);\n }", "jumpTo(step) {\n this.setState({\n stepNumber: step,\n xIsNext: (step % 2) === 0,\n }\n )\n }", "function NextLesion()\n{\n if( meNumberOfLesions + 1 <= 12 ) {\n\tmeNumberOfLesions++;\n\tmeCurrentLesion = meNumberOfLesions-1;\n\n\t//setFrameUrl('left','empty.htm');\n\t//setFrameUrl('right','empty.htm');\n\n\tif( meDominance == 'left' ){\n\t //setFrameUrl('left','selectedleft.htm');\n\t} else {\n\t\t\n\t}\n\t //setFrameUrl('left','selectedright.htm');\n\n\t//setFrameUrl('right','lesion_segments.htm');\n\n\t// header update\n\tUpdateCurrentLesion();\n }\n else {\n\talert(\"Maximum number of lesions is 12\");\n\treturn;\n }\n}", "previousstep(step) {}", "function advance() {\n /* chose the best link for our current heading */\n var selected = selectLink(bearing);\n\n /* If we're very close to a vertex, also check for a\n * link in the direction we should be turning next.\n * If there is a link in that direction (to a\n * tolerance of 15 degrees), chose that turning\n */\n if (close && nextBearing) {\n var selectedTurn = selectLink(nextBearing);\n if (selectedTurn.delta < 15) {\n selected = selectedTurn;\n incrementVertex();\n }\n }\n\n if (selected.delta > 40) {\n /* If the chosen link is in a direction more than 40\n * degrees different from the heading we want it\n * will not take us in the right direction. As no\n * better link has been found this implies that the\n * route has no coverage in the direction we need so\n * jump to the start of the next step. \n */\n jumpToVertex(nextVertexId);\n } else {\n /* Pan the viewer round to face the direction of the\n * link we want to follow and then follow the link. We\n * need to give the pan time to complete before we follow\n * the link for it to look smooth. The amount of time\n * depends on the extent of the pan.\n */\n var panAngle = getYawDelta(panoMetaData.pov.yaw, panoMetaData.links[selected.idx].yaw);\n pano.panTo({ yaw:panoMetaData.links[selected.idx].yaw, pitch:0 });\n setTimeout(function() {\n pano.followLink(panoMetaData.links[selected.idx].yaw);\n }, panAngle * 10);\n }\n }", "function moveNext() {\n if (cIndex > -1 && cIndex < 4) {\n cLoc -= cMove;\n cIndex += 1;\n target.style.marginLeft = cLoc + 'px';\n }\n}", "function getNextSegmentId() {\n\t\tif (available_ids.length == 0) {\n\t\t\treturn ++segment_id;\n\t\t}\n\t\treturn available_ids.shift();\n\t}", "function nextMove() {\n var point = points[pointId];\n when(self.session.moveTo(self.element, point.x, point.y), function() {\n pointId++;\n // End of list? Exit\n if(pointId >= points.length) {\n defer.resolve(self);\n return;\n }\n var nextPoint = points[pointId];\n setTimeout(nextMove, nextPoint.duration); //TODO: Timing is going to be off on this, can we improve it?\n });\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 }" ]
[ "0.67715377", "0.67556965", "0.67463887", "0.6522925", "0.6424442", "0.6307948", "0.6302216", "0.62982184", "0.6260498", "0.61768353", "0.61684626", "0.61383116", "0.6107105", "0.60841346", "0.60781264", "0.60467297", "0.6019503", "0.6011848", "0.6007218", "0.5990855", "0.5972361", "0.5918275", "0.5917196", "0.59025186", "0.58913636", "0.5853567", "0.584133", "0.58250344", "0.5824756", "0.5814209", "0.5800106", "0.5781698", "0.5778196", "0.5754744", "0.573916", "0.57324976", "0.57306963", "0.57219726", "0.57133377", "0.5713133", "0.57085013", "0.57076234", "0.5686414", "0.5682434", "0.5668365", "0.5667829", "0.56649715", "0.56632584", "0.56432855", "0.56364346", "0.5631752", "0.5628741", "0.5628309", "0.5618346", "0.56158376", "0.5607746", "0.56025", "0.56025", "0.56025", "0.56025", "0.56025", "0.55985636", "0.55958873", "0.5593442", "0.55905503", "0.5580507", "0.5570086", "0.55634063", "0.5560913", "0.5556079", "0.5553832", "0.55521524", "0.5548725", "0.5546786", "0.55401254", "0.55397785", "0.55341095", "0.5531228", "0.5522299", "0.5508377", "0.5508377", "0.5507899", "0.5503562", "0.54988194", "0.54904056", "0.5485981", "0.548376", "0.54828537", "0.5481411", "0.54784924", "0.5462372", "0.54602796", "0.5453076", "0.54460824", "0.5442457", "0.5441402", "0.54408914", "0.5437538", "0.5426413", "0.542252" ]
0.63948375
5
jump to previous segment
function previousSegment() { if (editor.splitData && editor.splitData.splits) { var playerPaused = getPlayerPaused(); if (!playerPaused) { pauseVideo(); } var currSplitItem = getCurrentSplitItem(); var new_id = currSplitItem.id - 1; new_id = (new_id < 0) ? (editor.splitData.splits.length - 1) : new_id; var idFound = true; if ((new_id < 0) || (new_id >= editor.splitData.splits.length)) { idFound = false; } /* else if (!editor.splitData.splits[new_id].enabled) { idFound = false; new_id = (new_id <= 0) ? editor.splitData.splits.length : new_id; for (var i = new_id - 1; i >= 0; --i) { if (editor.splitData.splits[i].enabled) { new_id = i; idFound = true; break; } } } */ if (!idFound) { for (var i = editor.splitData.splits.length - 1; i >= 0; --i) { // if (editor.splitData.splits[i].enabled) { new_id = i; idFound = true; break; // } } } if (idFound) { selectSegmentListElement(new_id, !playerPaused); } if (!playerPaused) { playVideo(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goToPrevStep(){\n unhighlightArrow(currStepId, numberToString[currStepId]);\n currStepId-=1;\n replaceStep();\n highlightArrow(currStepId, numberToString[currStepId]); \n}", "prevStep() {\n\n if (this.currStep > -1) {\n\n this.goTo(this.currSlide, this.currStep - 1);\n\n }\n\n }", "function goPrev( event ){\n event.preventDefault();\n go( revOffset + 1 );\n return false;\n }", "function goToPrevious() {\n var prevId = getPreviousLocationIndex();\n if (prevId != null) {\n setCurrentLocation(prevId);\n }\n }", "previous(){\n let previous = this.currentId - 1;\n if(previous <= 1){\n previous = 1;\n }\n this.goto(previous);\n }", "goToPrev () {\n\t\t\tif (this.canGoToPrev) {\n\t\t\t\tthis.goTo(this.currentSlide - 1)\n\t\t\t}\n\t\t}", "function navigatePrev() {\n\n // Prioritize revealing fragments\n if (previousFragment() === false) {\n if (availableRoutes().up) {\n navigateUp();\n }\n else {\n // Fetch the previous horizontal slide, if there is one\n var previousSlide = document.querySelector(HORIZONTAL_SLIDES_SELECTOR + '.past:nth-child(' + indexh + ')');\n\n if (previousSlide) {\n var v = ( previousSlide.querySelectorAll('section').length - 1 ) || undefined;\n var h = indexh - 1;\n slide(h, v);\n }\n }\n }\n\n }", "previous() {\n const newIndex = this.index - 1;\n\n if (this.isOutRange(newIndex)) {\n return;\n }\n\n this.doSwitch(newIndex);\n }", "previousstep(step) {}", "function goToPrevSlide()\n\t{\n\t\tif($currentSlide.prev().length)\n\t\t{\n\t\t\tgoToSlide($currentSlide.prev());\n\t\t}\n\t}", "function previous(){\n var goToPage = parseInt(pager.data(\"curr\")) - 1;\n goTo(goToPage);\n }", "function prev() {\n\t\t\treturn go(current-1);\n\t\t}", "movePrevious() {\n const previousStep = this.steps[this.currentStep - 1];\n if (!previousStep) {\n // this.reset();\n return;\n }\n\n this.overlay.highlight(previousStep);\n this.currentStep -= 1;\n }", "function goToPrevSlide()\n {\n if($currentSlide.prev().length)\n {\n goToSlide($currentSlide.prev());\n }\n }", "function goPrevious() {\n //console.log(\"goPrevious: \" + options.currentPage);\n if (options.currentPage != 1) {\n var p = options.currentPage - 1;\n loadData(p);\n setCurrentPage(p);\n options.currentPage = p;\n pageInfo();\n }\n }", "prev() {\n\n if (this.currStep > -1) {\n\n this.prevStep();\n\n } else {\n\n this.prevSlide();\n\n }\n\n }", "prev() {\n const that = this;\n\n that.navigateTo(that.pageIndex - 1);\n }", "prevSlide() {\n\n if (this.currSlide > 0) {\n\n this.goTo(this.currSlide - 1, -1);\n\n } else {\n\n this.goToLastSlide();\n\n }\n\n }", "function gotoPrevPage(){\n\tvar current_pagenum = getCurrentPagenum();\n\t\n\tif(checkPrevPages(current_pagenum) === true){\n\t\tvar isStartOfPagegroup = checkIsStartOfPagegroup(current_pagenum);\n\t\tvar prev_pagenum = current_pagenum - 1;\n\t\t\n\t\tif(isStartOfPagegroup === true){\n\t\t\tdecrementPagegroup();\n\t\t}\n\t\t\n\t\tgotoTargetPage(prev_pagenum);\n\t\t\n\t\t$('div#conceptcode_pagination_holder > ul.pagination').trigger(\"gotoPrevPageComplete.c2s_ui.pagination\", {oldPagenum: current_pagenum});\n\t}\n}", "function gotoPrevious() {\n\tif(typeof previousInventory !== 'undefined') {\n\t\tnextInventory = currentInventory;\n\t\tcurrentInventory = previousInventory;\n\t\tpreviousInventory = undefined;\n\t}\n}", "function previousSteps() {\n\tcurrent_step = current_step - 1;\n\tnext_step = next_step - 1;\n}", "function goToPrevious() {\n goTo(_currentContext.previous);\n }", "function prev() {\n\t\t\tgoToImage((curImage-1 < 0 ? numImages-1 : curImage-1), next ,true);\n\t\t}", "goToPrevious() {\n if (this.history.getPagesCount()) {\n this.transition = this.history.getCurrentPage().transition;\n if (!_.isEmpty(this.transition)) {\n this.transition += '-exit';\n }\n this.history.pop();\n this.isPageAddedToHistory = true;\n window.history.back();\n }\n }", "function prev() {\n\t\tvar prevStep = steps.prev();\n\t\tsetSteps(steps);\n\t\tsetCurrent(prevStep);\n\t}", "navigateToPreviousStep() {\n if (this.state.currentStepIndex <= 0) {\n return;\n }\n this.setState(prevState => ({\n currentStepIndex: prevState.currentStepIndex - 1,\n }));\n }", "function moveBack() {\n if (currentPage == 1) return;\n loadTaskList(--currentPage);\n}", "function goToPreviousStep() {\n\tpreviousSteps();\n\tupdateStepsText();\n\tconsole.log(\"hey\");\n}", "function prevSection() {\n var nav = (d.getElementById('l-front').classList.contains('is-visible')) ? navigatorFront : navigatorBack,\n fromSection = d.querySelector('[data-page=\"' + nav.active() + '\"]');\n\n // Pasar a otro evento\n if (this.classList.contains('is-up')) {\n goIndex();\n return;\n }\n\n var to = nav.prev(),\n toSection = d.querySelector('[data-page=\"' + to + '\"]');\n\n var navigator = app.parent(this, 'navigator')\n optActive = navigator.getElementsByClassName('is-active')[0],\n from = optActive.getAttribute('data-ref');\n\n var index = getIndex(fromSection.parentElement.querySelectorAll('.section'), toSection);\n fromSection.parentElement.style.left = (index * -100) + 'vw';\n \n window.location.href = window.location.pathname + \"#\" + toSection.getAttribute(\"data-page\");\n }", "moveToPreviousLine() {\n this.moveUp();\n }", "_goToPrevCard() {\n if (this._btnPrev.disabled === false) {\n var newCurrentPos = 0;\n newCurrentPos = this._currentPos - 1;\n this._goToCard(newCurrentPos, 'prev');\n }\n }", "gotoPrevFrame() {\n this.timeline.gotoPrevFrame();\n }", "moveToPreviousLine() {\n this.currentLine = this.lines[--this.currentLineNb];\n }", "function previousPage(){\n if (page > 1)\n {\n setPage(page - 1);\n }\n else {\n // do nothing\n }\n }", "goBack() {\n this.currentIdx = Math.max(0, this.currentIdx - 1);\n }", "function pagePrev()\n{\n\tif (currentPage>1) {\n\t\tcurrentPage=currentPage - 1;\n\t\tviewPage();\n\t}\n}", "runOneStepBackwards() {\n this.stateHistory.previousState()\n }", "function previousPage() {\n\t\tsetCurrentPage((page) => page - 1);\n\t}", "function goPrevPage(){\r\n // ensure page number is not less than 1\r\n if(page > 1){\r\n page -= 1;\r\n }\r\n}", "function prev() {\n slide(false, false);\n }", "function previous(){\n scope.model.currentIndex--;\n scope.model.data = scope.model.results[scope.model.currentIndex];\n scope.model.currentStart = scope.model.currentStart - scope.model.results[scope.model.currentIndex].length;\n $rootScope.$emit('setMarkers',{data:scope.model.data});\n }", "_previous() {\n if (this._page === 1) return;\n\n this._page--;\n this._loadCurrentPage();\n }", "onPrevClick(){\n if(this.state.currentPage - 1 >= 1){\n this.changePage(this.state.currentPage - 1);\n }\n }", "__previousStep() {\n this.openPreviousStep();\n }", "_navigatePrevious() {\n this._navigate(this.previous.id, 'endpoint');\n }", "gotoPrevHit() {\n const me = this;\n if (!me.found || !me.found.length) return;\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell ? grid.store.indexOf(fromCell.id) : 0,\n found = me.found;\n\n for (let i = found.length - 1; i--; i >= 0) {\n const hit = found[i];\n\n if (hit.index < currentIndex) {\n me.gotoHit(i);\n break;\n }\n }\n }", "function moveToPrev(Calvin){\n\t// console.log(\"MPrev: \" + currElement);\n\tif(currElement>1 && currElement<elementIdArray.length){\n\t\tcurrElement= currElement-2; //this needs to be -2\n\t\t\n\t\tletThereBeLight(currElement,Calvin);\n\t\tif(currElement <= 0){\n\t\t\tcurrElement =0;\n\t\t\tfirstIteration =0;\n\t\t}\n\t}\n\telse if(firstIteration == 0 || currElement <= 0){\n\t\tremoveDarkness();\n\t\talert(\"This is the start of our tour, you can't go back any farther!\");\n\t\tcurrElement =0;\n\t\tfirstIteration =0;\n\t}\n\telse if(currElement <= 1){\n\t\tcurrElement =0;\n\t\tfirstIteration =0;\n\t\tletThereBeLight(currElement,Calvin);\n\t\tconsole.log(\"currElement: \" + currElement);\n\t\talert(\"You're already at the first stop\");\n\t}\n}", "function previousPage () {\n if (!ctrl.canPageBack()) { return; }\n\n var newOffset = MdTabsPaginationService.decreasePageOffset(getElements(), ctrl.offsetLeft);\n\n // Set the new offset\n ctrl.offsetLeft = fixOffset(newOffset);\n }", "gotoPrevHit() {\n const me = this;\n\n if (!me.found || !me.found.length) return;\n\n const grid = me.grid,\n fromCell = grid.focusedCell || grid.lastFocusedCell,\n currentIndex = fromCell ? grid.store.indexOf(fromCell.id) : 0,\n found = me.found;\n\n for (let i = found.length - 1; i--; i >= 0) {\n let hit = found[i];\n if (hit.index < currentIndex) {\n me.gotoHit(i);\n break;\n }\n }\n }", "gotoPrevFrame() {\n var prevFramePlayheadPosition = this.playheadPosition - 1;\n\n if (prevFramePlayheadPosition <= 0) {\n prevFramePlayheadPosition = this.length;\n }\n\n this.gotoFrame(prevFramePlayheadPosition);\n }", "function clickedPrev(currentPage, targetSlot) {\n //console.log(\"PREV FUNCTION ACTIVATED\");\n --currentPage;\n targetSlot.spawnMenu(currentPage);\n}", "function goPrevious() {\n if (pageNum <= 1)\n return;\n pageNum--;\n renderPage(pageNum);\n }", "traversePreviousQuestion() {\r\n this.curr = this.curr.prev;\r\n }", "function goToPrevStep() {\n\n\tif (imOnStep > 0) {\n\t\t// Decrease the step number by 1\n\t\timOnStep = imOnStep - 1\n\t}\n\n\n\t// Step slides to the right (1/3 to the left, if three steps)\n\tstepsSlider.style.setProperty(`--n`, imOnStep)\n\n\t// Step number decreases (imOnStep)\n\tstepNum.textContent = `Step ${imOnStep + 1} of ${ttlNumSteps}`\n\n}", "function previusPage(){\n if(currentPage !== 1){\n currentPage--;\n }\n\n search();\n}", "function goToPreviousSlide() {\n if (getCurrentSubSlide() != -1 && getCurrentSubSlide() > 0) {\n goToSlide(getCurrentMainSlide(), getCurrentSubSlide() - 1);\n return true;\n }\n if (getCurrentMainSlide() > 0) {\n goToSlide(getCurrentMainSlide() - 1);\n return true;\n }\n}", "prev(enter = true) { return this.move(-1, enter); }", "previousSlide() {\n this.index = this.index - 1;\n if (this.index < 0) {\n this.index = 2;\n }\n this.img.src = this.tab[this.index];\n }", "function previousPage() { \n if(currentPage == 1) {\n return;\n }\n\n currentPage--;\n getArticlesForPage();\n}", "previous() {\n this._previous();\n }", "function previousPage () {\n var i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth >= ctrl.offsetLeft) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft + tab.offsetWidth - elements.canvas.clientWidth);\n }", "function previousPage () {\n var i, tab;\n for (i = 0; i < elements.tabs.length; i++) {\n tab = elements.tabs[ i ];\n if (tab.offsetLeft + tab.offsetWidth >= ctrl.offsetLeft) break;\n }\n ctrl.offsetLeft = fixOffset(tab.offsetLeft + tab.offsetWidth - elements.canvas.clientWidth);\n }", "function prevEntry() {\n selectEntry(g_cur_entry - 1, true);\n}", "function handlePrev() {\n let tempPage = page - 1;\n if (tempPage < 1) {\n tempPage = 1;\n }\n setPage(tempPage);\n }", "function goToPreviousPage() {\n\t\tif ( canPreviousPage() ) {\n\t\t\tgoToPage( currentPage() - 1 );\n\t\t}\n\t}", "function prev(){\n\tif(state == \"blank\") return;\n\tif(--cursched < 0) cursched = schedules.length-1;\n\tdraw();\n}", "gotoPrevFrame() {\n this.scriptOwner.parentClip.gotoPrevFrame();\n }", "function gotoPreviousSong() {\n if (songIndex === 0) {\n songIndex = songs.length - 1;\n } else {\n songIndex = songIndex - 1;\n }\n\n const isDiscPlayingNow = !disc.paused;\n loadSong(songs[songIndex]);\n resetProgress();\n if (isDiscPlayingNow) {\n playPauseMedia();\n }\n}", "function goPrevious() {\n\tif (pageNum <= 1)\n\t\treturn;\n\tpageNum--;\n\trenderPage(pageNum);\n}", "function prevPage(){\n\t\tvar $currPage = $pages.eq( current );\n\n\t\tif( current > 0 ) {\n\t\t\t--current;\n\t\t}\n\t\telse {\n\t\t\tcurrent = pagesCount-1;\n\t\t}\n\n\t\tanimatePage($currPage, 'pt-page-rotatePushTop');\n\t}", "back() {\n // if we're on the first page of a step, return to the previous step.\n // otherwise, if we're still navigating within the same step, just update the page number.\n if (scope.currentStep().currentPageIndex == 0) {\n scope.currentStepIndex--;\n }\n\n else {\n scope.currentStep().currentPageIndex--;\n }\n }", "previousPage() {\n if (this.getCurrentIndex() === 0) {\n if (this.isScrollLoop() && this.__pages.length > 1) {\n this._doScrollLoop();\n }\n } else {\n this.setCurrentIndex(this.getCurrentIndex() - 1);\n }\n }", "function prev_route(){\n\tif (route_index <= -1)\n\t\t\treturn;\n\t\troute_list[route_index].removeFrom(mymap);\n\t\troute_index = route_index - 1;\n\t\tif (route_index <= -1)\n\t\t\t\treturn;\n\t\troute_list[route_index].setStyle(current_style)\n\t\tvar bounds = route_list[route_index].getBounds();\n\t\tmymap.flyToBounds(bounds);\n\t\tif (route_index >= 1){\n\t\t\troute_list[route_index - 1].addTo(mymap)\n\t\t\troute_list[route_index - 1].setStyle(default_style);\n\t\t}\n}", "function previousSlide() {\n if (!sliding) {\n if (currentSlide <= 1) {\n currentSlide = maxSlides;\n } else {\n currentSlide--;\n }\n goToIndex(currentSlide);\n }\n }", "function navigatePrevious(){\n --current;\n var $thumb = $('#thumbs_container li:nth-child('+parseInt(current+1)+')').find('img');\n if(!$thumb.length) {\n ++current;\n return;\n }\n loadPhoto($thumb);\n }", "function prevState() {\n // if go out of bounds, keep at first state\n stateIndex = Math.max(0, stateIndex - 1);\n updateGraphState();\n}", "previous() {\n this.selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }", "function previousPage()\r\n{\r\n\thistory.go(-1);\r\n}", "movePrev() {\n if (this.position > 0) {\n console.debug('Move Previous');\n let nextPos = this.position > 0 ? (this.position - 1) : (this.totalSlides - 1);\n this.movePos(nextPos);\n }\n }", "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "function _previousStep() {\n this._direction = 'backward';\n\n if (this._currentStep === 0) {\n return false;\n }\n\n var nextStep = this._introItems[--this._currentStep];\n if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n this._introBeforeChangeCallback.call(this, nextStep.element);\n }\n\n _showElement.call(this, nextStep);\n }", "previousPage() {\n\t\tthis.setPage(this.state.previous);\n\t}", "function onPrevPage() {\n if (GridCurrentPageNumber > 0) {\n GridCurrentPageNumber--;\n }\n\tIsFromBackButton = true;\n loadRecordsDelayed();\n}", "prevPage() {\n if (this.page > 1) {\n this.page--;\n this.search();\n }\n }", "function _previousStep() {\n\t this._direction = 'backward';\n\n\t if (this._currentStep === 0) {\n\t return false;\n\t }\n\n\t var nextStep = this._introItems[--this._currentStep];\n\t if (typeof (this._introBeforeChangeCallback) !== 'undefined') {\n\t this._introBeforeChangeCallback.call(this, nextStep.element);\n\t }\n\n\t _showElement.call(this, nextStep);\n\t }", "function goToPreviousSlide(){\n myPresentation.goToPreviousSlide();\n displayNumberCurrentSlide();\n selectOptionInSelector(myPresentation.getCurrentSlideIndex());\n}", "function goBack() {\n pauseSlideshow();\n isRandom = false;\n toggle_sequence.innerHTML = \"Sequential\";\n if (effect == 2) {\n slideBack();\n } else {\n grabPreviousSlide();\n loadSlide();\n }\n\n }", "function moveToPrevious() {\n currentItem = currentItem - 1;\n if (currentItem < 0) currentItem = slideNum - 1;\n\n slideDisplay();\n}", "function _previousStep() {\n if(this._currentStep == 0)\n return;\n\n _showElement.call(this, this._introItems[--this._currentStep].element);\n }", "function getPrev(){\n page--\n getSearch()\n}", "prevPage() {\n if (!this.isFirstPage) {\n this.currentPageNumber--;\n }\n this.updateData();\n }", "previousStep(e) {\n if (this.state.step === 1) {\n this.props.dismiss(e);\n } else {\n let newStep = this.state.step - 1;\n console.log(newStep);\n this.setState({\n step: newStep,\n previousText: newStep === 1 ? 'Cancel' : 'Back',\n nextText: newStep === 3 ? 'Add' : 'Next',\n });\n\n }\n }", "function previousTab() {\n if (menuIsNotOpening()) {\n var selected = $ionicTabsDelegate.selectedIndex();\n if (selected !== -1) {\n $ionicTabsDelegate.select(selected + 1);\n }\n }\n }", "prev () {\n if (this._items.length < 2 || this._isMoving) {\n return\n }\n\n var currentIndex = this._items.indexOf(this._current);\n var prevIndex = this._items[currentIndex - 1] !== undefined \n ? currentIndex - 1 : this._items.length;\n this._to(prevIndex);\n }", "function prevGraph() {\nif(graphIndex === 0) {\ngraphIndex = 4;\n} else {\ngraphIndex--;\n}\nswitchGraph();\nlocation.href = '#prev-button';\n}", "prev() {\r\n this.active = (this.active > 0) ? this.active - 1 : this.len - 1\r\n this.move('<-')\r\n }", "_prev() {\n\t const currentIndex = this._getCurrentIndex();\n\t const prev = this._getPrev(currentIndex);\n\n\t if (prev) {\n\t this._flipTo(prev, currentIndex - 1);\n\t }\n\t }", "function pag_goToPreviousVenue() {\n\n // If there is no previous venue, report an error\n if (pag_previousVenues.length == 0) {\n alert(\"There are no more venues to go back to!\");\n } else {\n pag_previousVenues.pop();\n pag_setStatus('Entering venue...');\n pag_xmlRpcClient.call(\"enterPreviousVenue\");\n }\n}" ]
[ "0.77551883", "0.7520117", "0.7301945", "0.7290555", "0.726341", "0.7210053", "0.71909285", "0.71621937", "0.71262074", "0.711226", "0.7082025", "0.7069873", "0.7030981", "0.7025983", "0.69385093", "0.6928093", "0.6881588", "0.68771064", "0.6875682", "0.68724006", "0.68501216", "0.6847454", "0.6835689", "0.67842054", "0.6783771", "0.6781332", "0.6773304", "0.6768063", "0.6750289", "0.6728033", "0.6722684", "0.67162657", "0.6659063", "0.6650363", "0.6647517", "0.6634812", "0.6596168", "0.65888816", "0.65637034", "0.6533474", "0.6532413", "0.6531069", "0.65271205", "0.6518162", "0.6505523", "0.64933115", "0.64916426", "0.64810675", "0.647508", "0.64735615", "0.64676476", "0.64540726", "0.6453206", "0.6451101", "0.6450408", "0.6444276", "0.64334375", "0.6432124", "0.6430198", "0.6422632", "0.6416531", "0.6416531", "0.6412305", "0.6411425", "0.63920057", "0.63845086", "0.63824815", "0.6367575", "0.63587457", "0.63577646", "0.63550025", "0.6347855", "0.6344368", "0.634264", "0.6340985", "0.6340697", "0.63197696", "0.631894", "0.63136715", "0.6295582", "0.6295582", "0.6295582", "0.6295582", "0.6295582", "0.6295227", "0.6294311", "0.62887883", "0.6284742", "0.6278635", "0.6273592", "0.62714565", "0.6262968", "0.624899", "0.6247647", "0.62453824", "0.6236716", "0.6235799", "0.62282026", "0.6226185", "0.6208518", "0.620804" ]
0.0
-1
other add all shortcuts
function addShortcuts() { $.ajax({ url: ME_JSON, dataType: "json", async: false, success: function(data) { $.each(data.org.properties, function(key, value) { default_config[key] = value; $('#' + key.replace(".", "_")).html(value); }); } }); $.each(default_config, function(key, value) { $('#' + key.replace(".", "_")).html(value); }); // add shortcuts for easier editing shortcut.add(default_config[SPLIT_AT_CURRENT_TIME], splitButtonClick, { disable_in_input: true, }); shortcut.add(default_config[PREVIOUS_FRAME], function() { pauseVideo(); $('.video-prev-frame').click(); }, { disable_in_input: true, }); shortcut.add(default_config[NEXT_FRAME], function() { pauseVideo(); $('.video-next-frame').click(); }, { disable_in_input: true, }); shortcut.add(default_config[PLAY_PAUSE], function() { if (getPlayerPaused()) { playVideo(); } else { pauseVideo(); } }, { disable_in_input: true, }); shortcut.add(default_config[PLAY_CURRENT_SEGMENT], playCurrentSplitItem, { disable_in_input: true, }); shortcut.add(default_config[DELETE_SELECTED_ITEM], splitRemoverClick, { disable_in_input: true, }); shortcut.add(default_config[SELECT_ITEM_AT_CURRENT_TIME], selectCurrentSplitItem, { disable_in_input: true, }); shortcut.add(default_config[SET_CURRENT_TIME_AS_INPOINT], setCurrentTimeAsNewInpoint, { disable_in_input: true, }); shortcut.add(default_config[SET_CURRENT_TIME_AS_OUTPOINT], setCurrentTimeAsNewOutpoint, { disable_in_input: true, }); shortcut.add(default_config[NEXT_MARKER], nextSegment, { disable_in_input: true, }); shortcut.add(default_config[PREVIOUS_MARKER], previousSegment, { disable_in_input: true, }); shortcut.add(default_config[PLAY_ENDING_OF_CURRENT_SEGMENT], playEnding, { disable_in_input: true, }); shortcut.add(default_config[CLEAR_SEGMENT_LIST], clearSegmentList, { disable_in_input: true, }); shortcut.add(default_config[PLAY_CURRENT_PRE_POST], playWithoutDeleted, { disable_in_input: true }); shortcut.add(default_config[PLAY_CURRENT_PRE_POST_FULL], playWithoutDeletedFull, { disable_in_input: true }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addShortcuts() {\n\t\t\t\n\t\t\t// global shortcuts\n\t\t\tvar globalShortcuts = Mousetrap($document[0].body);\n\t\t\tglobalShortcuts.bind(['ctrl+alt+c'], function(){\n\t\t\t\tclear();\n\t\t\t\t$scope.$apply();\n\t\t\t});\n\t\t\t\n\t\t\tglobalShortcuts.bind(['ctrl+alt+k'], clearClipboardItems);\n\n\t\t\tglobalShortcuts.bind(['ctrl+alt+f'], selectFirst);\n\t\t\tglobalShortcuts.bind(['ctrl+alt+n'], selectNext);\n\t\t\tglobalShortcuts.bind(['ctrl+alt+p'], selectPrev);\n\t\t\tglobalShortcuts.bind(['ctrl+alt+l'], selectLast);\n\t\t}", "function registerShortcuts(globalShortcut, clipboard, stack){\n\tglobalShortcut.unregisterAll();\n\tfor(let i=0; i<STACK_SIZE; i++){\n\t\tglobalShortcut.register(`Alt+${i+1}`,_=>{\n\t\t\tclipboard.writeText(stack[i]);\n\t\t});\n\t}\n}", "registerShortcuts() {\n const shortcutManager = this.hot.getShortcutManager();\n const editorContext = shortcutManager.getContext('editor');\n\n const contextConfig = {\n group: SHORTCUTS_GROUP,\n };\n\n // Actions from fast edit works.\n if (this.isInFullEditMode() === false) {\n return;\n }\n\n editorContext.addShortcuts([{\n keys: [['ArrowUp']],\n callback: () => {\n const previousOptionIndex = this.select.selectedIndex - 1;\n\n if (previousOptionIndex >= 0) {\n this.select[previousOptionIndex].selected = true;\n }\n },\n }, {\n keys: [['ArrowDown']],\n callback: () => {\n const nextOptionIndex = this.select.selectedIndex + 1;\n\n if (nextOptionIndex <= this.select.length - 1) {\n this.select[nextOptionIndex].selected = true;\n }\n }\n }], contextConfig);\n }", "function assignShortcuts() {\n $(document).keydown(function(e) {\n switch (e.key) {\n case 'Enter':\n // For following focused elements Enter should not be used as\n // shortcut for \"submitting\" the dialog.\n var active = document.activeElement;\n if (active.tagName == 'BUTTON') return;\n if (active.tagName == 'A') return;\n if (active.tagName == 'TEXTAREA') return;\n if (active.tagName == 'INPUT' && active.type == 'checkbox') return;\n if (active.tagName == 'INPUT' && active.type == 'radio') return;\n // Enter is only be used as shortcut for the control that is\n // explicitly the default action. It's up to the extensiond eveloper\n // to add this to Ok, Yes and Close for each individual dialog.\n var control = $('.dlg-default-action')[0];\n if (control) activateControl(control);\n break;\n case 'Escape':\n var control = $('.dlg-callback-cancel')[0];\n control = control || $('.dlg-callback-no')[0];\n control = control || $('.dlg-callback-ok')[0];\n control = control || $('.dlg-callback-close')[0];\n if (control) activateControl(control);\n break;\n case 'F1':\n var control = $('.dlg-callback-help')[0];\n if (control) activateControl(control);\n break;\n default:\n return;\n }\n e.preventDefault();\n });\n }", "registerAutoShortcut() {\r\n localShortcut.register(this.mainWindow, \"CommandOrControl+R\", () => {\r\n this.mainWindow.reload();\r\n });\r\n localShortcut.register(this.mainWindow, \"F12\", () => {\r\n this.mainWindow.webContents.openDevTools();\r\n });\r\n localShortcut.register(this.mainWindow, \"CommandOrControl+F\", () => {\r\n this.mainWindow.webContents.send(\"on-find\");\r\n });\r\n }", "function AbstractShortcut(){\r\n \r\n}", "function setHotKeys() {\n hotkeys.add({\n combo: 'esc',\n description: 'End tour',\n callback: function callback() {\n self.end();\n }\n });\n\n hotkeys.add({\n combo: 'right',\n description: 'Go to next step',\n callback: function callback() {\n if (isNext()) {\n self.next();\n }\n }\n });\n\n hotkeys.add({\n combo: 'left',\n description: 'Go to previous step',\n callback: function callback() {\n if (isPrev()) {\n self.prev();\n }\n }\n });\n }", "function prepareShorcuts() {\n let shortcuts = {};\n\n $('.method-wrapper a').each( function() {\n let name = $(this).text().trim();\n\n for (let i=0; i < name.length; i++) {\n let key = name[i].toLowerCase();\n if (key !== '' && shortcuts[key] === undefined) {\n shortcuts[key] = this;\n break;\n }\n }\n });\n\n window.methodsShortcuts = shortcuts;\n\n // Shorcuts handler\n $(document).keydown( function(e) {\n if (e.ctrlKey && e.altKey) {\n let methodLink = shortcuts[e.key];\n if (methodLink !== undefined)\n methodLink.click();\n }\n });\n}", "function todoistShortcut(options0) {\n const options = typeof options0 === 'string' ? {key: options0} : options0;\n let ev = new Event('keydown');\n for (const o in options) {\n ev[o] = options[o];\n }\n if (window.originalTodoistKeydown) {\n window.originalTodoistKeydown.apply(document, [ev]);\n }\n ev = new Event('keyup');\n for (o in options) {\n ev[o] = options[o];\n }\n if (window.originalTodoistKeyup) {\n window.originalTodoistKeyup.apply(document, [ev]);\n }\n ev = new Event('keypress');\n for (o in options) {\n ev[o] = options[o];\n }\n if (window.originalTodoistKeypress) {\n window.originalTodoistKeypress.apply(document, [ev]);\n }\n }", "function setUpShortcutKeys() {\n\n //bind keys to main window\n $(document).keyup(function(e){\n\n //console.log(e.which);\n\n //show next image on x key\n if (e.which == 88 ) {\n $(\"#nextImg\").click();\n //alert( \"x pressed\" );\n return false;\n }\n\n //show previous image on z key\n if (e.which == 90) {\n $(\"#prevImg\").click();\n //alert( \"z pressed\" );\n return false;\n }\n\n if (e.which == 67) {\n clearSelectedThumbs();\n return false;\n }\n\n });\n\n\n }", "_keyboardShortcuts() {\n browser.commands.onCommand.addListener((command) => {\n if (command === 'action-accept-new') {\n this.app.modules.calls.callAction('accept-new')\n } else if (command === 'action-decline-hangup') {\n this.app.modules.calls.callAction('decline-hangup')\n } else if (command === 'action-dnd') {\n // Only toggle when calling options are enabled and webrtc is enabled.\n if (this.app.state.settings.webrtc.enabled && !this.app.helpers.callOngoing() && !this.app.helpers.callingDisabled()) {\n this.app.setState({availability: {dnd: !this.app.state.availability.dnd}})\n }\n } else if (command === 'action-hold-active') {\n this.app.modules.calls.callAction('hold-active')\n }\n })\n }", "function populateAccessCommands()\n{\t\n\tif($.browser.safari || $.browser.webkit)\n\t{\n\t\t//$('#browserText').html('Press \"Ctrl\"+\"Alt\" (or \"Ctrl\"+\"Option\" if on MacOS) + [shortcut key] to activate an action from keyboard.');\n\t\t$('#browserText').html('To activate a command from keyboard, press - \"Ctrl\"+\"Alt\"(or Option)+[keyboard shortcut below]');\n\t}\n\telse if($.browser.mozilla)\n\t{\n\t\t$('#browserText').html('Press \"Alt\"+\"Shift\"+ (or \"Ctrl\" if on MacOS)+[shortcut key] to activate an action from keyboard.');\n\t}\n\t\n \t$('.quickAccess').each(function(){\n\n \t\t\tif($('#keyboardShortcuts td:contains('+$(this).html()+')').length)\n \t\t\t{\n\n \t\t\t\t$('#keyboardShortcuts td:contains('+$(this).html()+')').next().children('.command').html($(this).attr('accesskey'));\n \t\t\t}\n \t\t\telse\n \t\t\t{\n\t \t\t$('#keyboardShortcuts').find('.last').find('.function').html($(this).html());\n\t \t\t$('#keyboardShortcuts').find('.last').find('.command').html($(this).attr('accesskey'));\n\t \t\t$('#keyboardShortcuts').find('.last').removeClass('last').closest('tbody').append('<tr class=\"last\"> <td><div class=\"function\"></div></td> <td><div class=\"command\"></div></td></tr>');\n\t \t}\n \t\t\n \t});\n}", "function setupReactions() {\n \n const isAnalyst = environment.isAnalystTask();\n \n function noDuplicateValues(_, __, group) {\n const getText = (proxy) => {\n const trimmed = proxy.value\n .replace(/\\/?((index)?.(html|htm|php))?#?\\??$$/, '')\n .replace(/^https?:\\/\\/(www[.])?/, 'https://');\n return util.normaliseUrl(trimmed).toLowerCase();\n };\n shared.noDuplicateValues(group, getText);\n }\n\n ー({\n name: 'Text',\n rootSelect: '#extraction-editing',\n select: 'textarea',\n pick: isAnalyst\n ? [1, 5, 9, 13, 17]\n : [1, 4, 7, 10, 13],\n onClick: (proxy, idx) => {\n util.attention(ref.addItem0.slice(-3), idx - 2, 'click');\n util.attention([proxy], 0, 'focus');\n },\n onFocusout: [\n shared.trim,\n noDuplicateValues,\n shared.noDuplicateVerbs,\n shared.removeQuotes,\n ],\n onInteract: [\n shared.checkCapitals,\n shared.noMoreThanXChars,\n noDuplicateValues,\n shared.noDuplicateVerbs,\n noForbiddenPhrase,\n ],\n onKeydown_CtrlShiftAltArrowLeft:\n (_, idx) => shared.item.swapLeft(idx),\n onKeydown_CtrlShiftAltArrowRight:\n (_, idx) => shared.item.swapRight(idx),\n onKeydown_CtrlAltArrowLeft:\n (_, idx) => shared.item.moveLeft(idx),\n onKeydown_CtrlAltArrowRight:\n (_, idx) => shared.item.moveRight(idx),\n onKeydown_CtrlDelete: (_, idx) => shared.item.remove(idx),\n onLoad: [\n shared.trim,\n shared.checkCapitals,\n shared.noMoreThanXChars,\n noDuplicateValues,\n shared.noDuplicateVerbs,\n noForbiddenPhrase,\n ],\n ref: 'textAreas0',\n });\n\n ー({\n name: 'Link',\n rootSelect: '#extraction-editing',\n select: 'textarea',\n pick: isAnalyst\n ? [2, 6, 10, 14, 18]\n : [2, 5, 8, 11, 14],\n onFocusout: [\n shared.requireUrl,\n shared.removeScreenshot,\n shared.removeQuotes,\n shared.noPdfLinks,\n shared.noMalformedLinks,\n shared.noHomepageLinks,\n ],\n onInteract: shared.noPdfLinks,\n onKeydown_CtrlAlt: (_, idx) => shared.item.focus(idx),\n onLoad: [\n shared.disableSpellcheck,\n shared.keepAlive,\n shared.noHomepageLinks,\n shared.noMalformedLinks,\n shared.noPdfLinks,\n ],\n onPaste: [\n shared.requireUrl,\n shared.removeBannedDomains,\n shared.removeScreenshot,\n shared.noHomepageLinks,\n shared.noMalformedLinks,\n shared.noPdfLinks,\n ],\n ref: 'linkAreas0',\n });\n \n ー({\n name: 'Screenshot',\n rootSelect: isAnalyst\n ? '#extraction-editing'\n : '.extraction-screenshots',\n select: 'textarea',\n pick: isAnalyst\n ? [3, 7, 11, 15, 19]\n : [0, 1, 2, 3, 4],\n onFocusout: [\n shared.requireUrl,\n shared.requireScreenshot,\n shared.removeQuotes,\n ],\n onKeydown_CtrlAlt: (_, idx) => shared.item.focus(idx),\n onLoad: shared.disableSpellcheck,\n onPaste: [\n shared.requireUrl,\n shared.requireScreenshot,\n ],\n ref: 'screenshots0',\n });\n\n ー({\n name: 'Dashes',\n rootSelect: '#extraction-editing',\n select: 'textarea',\n pick: isAnalyst\n ? [4, 8, 12, 16, 20]\n : [3, 6, 9, 12, 15],\n onFocusin: shared.removeDashes,\n onFocusout: [\n shared.removeQuotes,\n shared.addDashes,\n ],\n onKeydown_CtrlAlt: (_, idx) => shared.item.focus(idx),\n onLoad: [\n shared.addDashes,\n shared.tabOrder.remove,\n shared.disableSpellcheck,\n ],\n });\n\n ー({\n name: 'Analyst Comment',\n select: '.feedback-display-text',\n pick: [0],\n ref: 'analystComment',\n });\n\n ー({\n name: 'Extraction Page Url',\n rootSelect: '#extraction-editing',\n select: 'textarea',\n pick: [0],\n onKeydown_CtrlAltArrowRight: () => {\n util.attention(ref.editButton0, 0, 'click');\n shared.item.focus(0);\n },\n onLoad: [\n shared.disableSpellcheck,\n shared.removeScreenshot,\n shared.requireUrl,\n ],\n ref: 'extractionUrl0',\n });\n\n ー({\n name: 'LinksAndLP',\n rootSelect: '#extraction-editing',\n select: 'textarea',\n pick: isAnalyst\n ? [2, 6, 10, 14, 18, 0]\n : [2, 5, 8, 11, 14, 0],\n onInteract: [\n shared.noDomainMismatch,\n noDuplicateValues,\n ],\n onLoad: [\n shared.noDomainMismatch,\n noDuplicateValues,\n ],\n onPaste: [\n shared.noDomainMismatch,\n noDuplicateValues,\n ],\n ref: 'openInTabs',\n });\n\n ー({\n name: 'Final Url',\n select: 'textarea',\n pick: [65],\n ref: 'finalUrl',\n });\n\n ー({\n name: 'InvalidScreenshot',\n rootSelect: '.errorbox-good',\n rootNumber: 1,\n select: 'textarea',\n onKeydown_CtrlAltArrowRight: shared.comment.focus,\n onFocusout: shared.removeQuotes,\n onLoad: [\n shared.disableSpellcheck,\n shared.requireUrl,\n shared.requireScreenshot,\n ],\n onPaste: [\n shared.requireUrl,\n shared.requireScreenshot,\n ],\n ref: 'invalidScreenshot',\n });\n\n ー({\n name: 'Creative',\n rootSelect: '.context-item',\n rootNumber: [2],\n select: '*',\n pick: [3, 6, 8],\n onLoad: [\n shared.checkEmptyCreative,\n checkDomainMismatch,\n ],\n ref: 'creative',\n });\n\n const fall = isAnalyst\n ? [[1, 2],[5, 6],[9, 10],[13, 14],[17, 18]]\n : [[1, 2],[4, 5],[7, 8],[10, 11],[13, 14]];\n for (let pair of fall) {\n ー({\n name: 'Fall',\n rootSelect: '#extraction-editing',\n select: 'textarea',\n pick: pair,\n onPaste: fallThrough,\n });\n }\n\n const remaining = isAnalyst\n ? [0, 8, 17, 26, 35]\n : [0, 6, 13, 20, 27];\n for (let rootNumber of remaining) {\n ー({\n name: 'Remaining',\n rootSelect: '.extraction-item table',\n rootNumber,\n select: 'div, textarea',\n pick: [2, 3],\n onChange: shared.updateCharacterCount,\n onFocusin: shared.updateCharacterCount,\n onKeydown: shared.updateCharacterCount,\n onLoad: shared.updateCharacterCount,\n });\n }\n\n ー({\n name: 'StatusDropdown',\n select: 'select',\n pick: [0, 1, 2],\n ref: 'statusDropdown',\n });\n\n ー({\n name: 'Add Data',\n rootSelect: '.extraction',\n select: 'label',\n withText: 'Add Data',\n onKeydown_CtrlAltArrowRight: () => {\n util.attention(ref.addDataButton0, 0, 'click');\n shared.item.focus(0);\n },\n ref: 'addDataButton0',\n });\n\n ー({\n name: 'Edit',\n rootSelect: '.extraction',\n select: 'label',\n withText: 'Edit',\n onKeydown_CtrlAltArrowRight: () => {\n util.attention(ref.editButton0, 0, 'click');\n shared.item.focus(0);\n },\n onLoad: shared.tabOrder.add,\n ref: 'editButton0',\n });\n\n ー({\n name: 'Add Item',\n rootSelect: '#extraction-editing',\n select: 'label',\n withText: 'Add Item',\n ref: 'addItem0',\n });\n\n ー({\n name: 'Leave Blank',\n rootSelect: '#extraction-editing',\n select: 'label',\n withText: 'Leave Blank',\n ref: 'leaveBlank0',\n });\n\n ー({\n name: 'ApprovalButtons',\n rootSelect: '.primaryContent',\n rootNumber: 3,\n select: 'label',\n pick: [0, 1],\n ref: 'approvalButtons',\n });\n\n ー({\n name: 'Comment Box',\n rootSelect: '.addComments',\n select: 'textarea',\n pick: [0],\n onFocusout: util.delay(start, 200),\n onInteract: shared.removeQuotes,\n onKeydown_CtrlAltArrowRight: () => shared.item.focus(0),\n ref: 'finalCommentBox',\n });\n\n ー({\n name: 'CanOrCannotExtract',\n select: 'label',\n pick: [0, 1],\n onKeydown_CtrlAltArrowRight: () => shared.item.focus(0),\n ref: 'canOrCannotExtractButtons',\n });\n \n ー({\n name: 'Visit LP',\n select: '.lpButton button',\n pick: [0],\n css: {opacity: 1},\n });\n \n function manualSubmit() {\n const msg =\n 'Please use the Submit Hotkey instead of clicking manually.';\n user.log.warn(\n msg,\n {save: true, print: true, toast: true}\n );\n alert(msg);\n };\n manualSubmit = util.debounce(manualSubmit, 4000);\n\n ー({\n name: 'Submit Button',\n select: '.submitTaskButton',\n pick: [0],\n css: {opacity: 1},\n onFocusin: manualSubmit,\n ref: 'submitButton',\n })[0].textContent = 'Ready to submit';\n\n ー({\n name: 'Skip Button',\n select: '.taskIssueButton',\n pick: [0],\n ref: 'skipButton'\n });\n\n ー({\n name: 'Task Title',\n select: '.taskTitle',\n ref: 'taskTitle'\n });\n\n ー({\n name: 'TabRemove',\n select: 'label, button',\n onLoad: shared.tabOrder.remove,\n });\n\n ー({\n name: 'Extractions2And3',\n select: '.extraction',\n pick: [1, 2],\n css: {display: 'none'},\n });\n\n ー({\n name: 'Preview Extractions',\n select: '.extraction-preview',\n pick: [1, 2],\n css: {display: 'none'},\n });\n \n const setStatus = shared.setStatus;\n const statusReactions = {\n onKeydown_CtrlAltDigit0: setStatus('canExtract'),\n onKeydown_CtrlAltDigit1: setStatus('insufficient'),\n onKeydown_CtrlAltDigit2: setStatus('pageError'),\n onKeydown_CtrlAltDigit3: setStatus('dynamic'),\n onKeydown_CtrlAltDigit4: setStatus('nonLocale'),\n onKeydown_CtrlAltDigit5: setStatus('other'),\n onKeydown_CtrlAltDigit6: setStatus('pII'),\n onKeydown_CtrlAltDigit7: setStatus('drugDomain'),\n onKeydown_CtrlAltDigit8: setStatus('alcoholDomain'),\n onKeydown_CtrlAltDigit9: setStatus('adultDomain'),\n onKeydown_CtrlShiftAltDigit0: setStatus('canExtract'),\n onKeydown_CtrlShiftAltDigit1: setStatus('other'),\n onKeydown_CtrlShiftAltDigit2: setStatus('urlsUnchanged'),\n onKeydown_CtrlShiftAltDigit3: setStatus('urlMismatch'),\n onKeydown_CtrlShiftAltDigit4: setStatus('emptyCreative'),\n };\n \n const experimentalEscapeApprove = () => {\n if (user.config.get('use escape-key to approve')) {\n approve();\n }\n };\n \n const experimentalSubmit = () => {\n if (user.config.get('use escape-key to approve')) {\n submit();\n }\n };\n \n const submitKeys = {\n onKeydown_CtrlEnter: submit,\n onKeydown_CtrlAltEnter: submit,\n onKeydown_CtrlNumpadEnter: submit,\n onKeydown_CtrlShiftEscape: experimentalSubmit,\n };\n \n const otherKeys = {\n onKeydown_Backquote: beginTask,\n onKeydown_CtrlAltBackquote: beginTask,\n onKeydown_CtrlAltBracketLeft: shared.resetCounter,\n onKeydown_CtrlAltBracketRight: shared.skipTask,\n onKeydown_NumpadSubtract: shared.skipTask,\n onKeydown_NumpadAdd: approve,\n onKeydown_Backslash: approve,\n onKeydown_Escape: experimentalEscapeApprove,\n onKeydown_CtrlShiftDelete: shared.item.removeAll,\n };\n\n eventReactions.setGlobal({\n ...statusReactions,\n ...submitKeys,\n ...otherKeys,\n });\n }", "async function initialize_shortcut_inputs()\n {\n const digits = \"0123456789\".split(\"\");\n const letters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\");\n const functions = \"F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12\".split(\" \");\n const specials = (\n \"Comma Period Home End PageUp PageDown \" +\n \"Space Insert Delete Up Down Left Right\"\n ).split(\" \");\n const keys = digits.concat(letters).concat(functions).concat(specials);\n\n document.querySelectorAll(\".shortcut > select.key\").forEach(node =>\n {\n for (let i = 0; i < keys.length; ++i)\n {\n const option = document.createElement(\"option\");\n option.textContent = keys[i];\n node.appendChild(option);\n }\n });\n\n const controls =\n {\n \"_execute_page_action\": DOM.shortcut_bookmark_page,\n \"lock\": DOM.shortcut_lock_bookmarks,\n \"open-menu\": DOM.shortcut_open_menu\n };\n (await browser.commands.getAll()).forEach(command =>\n {\n const control = controls[command.name];\n set_shortcut(control, command.shortcut);\n\n function save()\n {\n return browser.commands.update({\n name: command.name,\n shortcut: get_shortcut(control)\n });\n }\n control.querySelectorAll(\"input, select\").forEach(element =>\n {\n element.addEventListener(\"change\", save);\n });\n });\n }", "function shortcut(shortcut,callback,opt) {\r\n//Provide a set of default options\r\nvar default_options = {\r\n'type':'keydown',\r\n'propagate':false,\r\n'target':document\r\n}\r\nif(!opt) opt = default_options;\r\nelse {\r\nfor(var dfo in default_options) {\r\nif(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];\r\n}\r\n}\r\n\r\nvar ele = opt.target\r\nif(typeof opt.target == 'string') ele = document.getElementById(opt.target);\r\nvar ths = this;\r\n\r\n//The function to be called at keypress\r\nvar func = function(e) {\r\ne = e || window.event;\r\n//Don't enable shortcut keys in Input, Textarea fields\r\nvar element;\r\nif(e.target) element=e.target;\r\nelse if(e.srcElement) element=e.srcElement;\r\nif(element.nodeType==3) element=element.parentNode;\r\n\r\nif(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;\r\n//Find Which key is pressed\r\nif (e.keyCode) code = e.keyCode;\r\nelse if (e.which) code = e.which;\r\nvar character = String.fromCharCode(code).toLowerCase();\r\n\r\nvar keys = shortcut.toLowerCase().split(\"+\");\r\n//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked\r\nvar kp = 0;\r\n\r\n//Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken\r\nvar shift_nums = {\r\n\"`\":\"~\",\r\n\"1\":\"!\",\r\n\"2\":\"@\",\r\n\"3\":\"#\",\r\n\"4\":\"$\",\r\n\"5\":\"%\",\r\n\"6\":\"^\",\r\n\"7\":\"&\",\r\n\"8\":\"*\",\r\n\"9\":\"(\",\r\n\"0\":\")\",\r\n\"-\":\"_\",\r\n\"=\":\"+\",\r\n\";\":\":\",\r\n\"'\":\"\\\"\",\r\n\",\":\"<\",\r\n\".\":\">\",\r\n\"/\":\"?\",\r\n\"\\\\\":\"|\"\r\n}\r\n//Special Keys - and their codes\r\nvar special_keys = {\r\n'esc':27,\r\n'escape':27,\r\n'tab':9,\r\n'space':32,\r\n'return':13,\r\n'enter':13,\r\n'backspace':8,\r\n\r\n'scrolllock':145,\r\n'scroll_lock':145,\r\n'scroll':145,\r\n'capslock':20,\r\n'caps_lock':20,\r\n'caps':20,\r\n'numlock':144,\r\n'num_lock':144,\r\n'num':144,\r\n\r\n'pause':19,\r\n'break':19,\r\n\r\n'insert':45,\r\n'home':36,\r\n'delete':46,\r\n'end':35,\r\n\r\n'pageup':33,\r\n'page_up':33,\r\n'pu':33,\r\n\r\n'pagedown':34,\r\n'page_down':34,\r\n'pd':34,\r\n\r\n'left':37,\r\n'up':38,\r\n'right':39,\r\n'down':40,\r\n\r\n'f1':112,\r\n'f2':113,\r\n'f3':114,\r\n'f4':115,\r\n'f5':116,\r\n'f6':117,\r\n'f7':118,\r\n'f8':119,\r\n'f9':120,\r\n'f10':121,\r\n'f11':122,\r\n'f12':123\r\n}\r\n\r\n\r\nfor(var i=0; k=keys[i],i<keys.length; i++) {\r\n//Modifiers\r\nif(k == 'ctrl' || k == 'control') {\r\nif(e.ctrlKey) kp++;\r\n\r\n} else if(k == 'shift') {\r\nif(e.shiftKey) kp++;\r\n\r\n} else if(k == 'alt') {\r\nif(e.altKey) kp++;\r\n\r\n} else if(k.length > 1) { //If it is a special key\r\nif(special_keys[k] == code) kp++;\r\n\r\n} else { //The special keys did not match\r\nif(character == k) kp++;\r\nelse {\r\nif(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase\r\ncharacter = shift_nums[character]; \r\nif(character == k) kp++;\r\n}\r\n}\r\n}\r\n}\r\n\r\nif(kp == keys.length) {\r\ncallback(e);\r\n\r\nif(!opt['propagate']) { //Stop the event\r\n//e.cancelBubble is supported by IE - this will kill the bubbling process.\r\ne.cancelBubble = true;\r\ne.returnValue = false;\r\n\r\n//e.stopPropagation works only in Firefox.\r\nif (e.stopPropagation) {\r\ne.stopPropagation();\r\ne.preventDefault();\r\n}\r\nreturn false;\r\n}\r\n}\r\n}\r\n\r\n//Attach the function with the event\r\nif(ele.addEventListener) ele.addEventListener(opt['type'], func, false);\r\nelse if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);\r\nelse ele['on'+opt['type']] = func;\r\n}", "function shortcutKeys(event) {\n stopPropagation(event);\n\n if (event.keyCode === 39) {\n handleNext();\n } else if (event.keyCode === 37) {\n handlePrev();\n } else if (event.keyCode === 27) {\n dismiss();\n }\n }", "function attachKeys() {\n var inputs = d.body.getElementsByTagName('input'),\n selects = d.body.getElementsByTagName('select'),\n textareas = d.body.getElementsByTagName('textarea');\n\n next = yud.get('next_url');\n prev = yud.get('prev_url');\n\n hotKeys.ctrl_alt_a = new yut.KeyListener(d,\n { ctrl: true, alt: true, keys: 65 }, Thoth.toggleAdminToolbar);\n\n hotKeys.n = new yut.KeyListener(d, { keys: 78 }, handleKeyNext);\n hotKeys.p = new yut.KeyListener(d, { keys: 80 }, handleKeyPrev);\n\n // Stop listening for hotkeys when a form element gets focus.\n yue.on(inputs, 'blur', enableKeys, Thoth, true);\n yue.on(inputs, 'focus', disableKeys, Thoth, true);\n yue.on(selects, 'blur', enableKeys, Thoth, true);\n yue.on(selects, 'focus', disableKeys, Thoth, true);\n yue.on(textareas, 'blur', enableKeys, Thoth, true);\n yue.on(textareas, 'focus', disableKeys, Thoth, true);\n\n enableKeys();\n }", "function registerKeyBindings() {\n // keys: alt+1 -> time frame favorite list entry 1\n for (let i = 1; i <= 10; i++) {\n cb.bindKeyDown(KEY_0 + (i % 10), (e) => cb.clickElement($('div#header-toolbar-intervals > div[class*=\"button\"]:nth-child(' + i + ')')),\n { mods: { alt: true } });\n }\n // keys: alt-f -> toggle footer chart panel\n cb.bindKeyDown(KEY_F, (e) => cb.clickElement($('#footer-chart-panel button[data-name=\"toggle-visibility-button\"]')), { mods: { alt: true } });\n // keys: alt-shift-f -> toggle footer chart panel maximiziation\n cb.bindKeyDown(KEY_F, (e) => cb.clickElement($('#footer-chart-panel button[data-name=\"toggle-maximize-button\"]')), { mods: { alt: true, shift: true } });\n // keys: alt-w -> toggle watch list (right pane)\n cb.bindKeyDown(KEY_W, (e) => cb.clickElement($('.widgetbar-tabs [data-role=\"button\"]:first-child')), { mods: { alt: true } });\n }", "function addAll() {}", "function add_man() {\n controller.keyseq(['def', DIR[3], 'jump']);\n }", "function extendAliases () {\n Array.prototype.slice.call(arguments).forEach(function (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n // short-circuit if we've already added a key\n // to the aliases array, for example it might\n // exist in both 'opts.default' and 'opts.key'.\n if (flags.aliases[key]) return\n \n flags.aliases[key] = [].concat(aliases[key] || [])\n // For \"--option-name\", also set argv.optionName\n flags.aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x) && configuration['camel-case-expansion']) {\n var c = camelCase(x)\n if (flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n }\n newAliases[c] = true\n }\n })\n flags.aliases[key].forEach(function (x) {\n flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n })\n }", "initHotkeys() {\n const PREFIX = \"alt+shift+\";\n const keys = Hotkey.getKeys();\n const rkeys = keys.filter(k => k.indexOf(PREFIX) !== -1);\n\n rkeys.forEach(k => Hotkey.removeKey(k));\n\n self.sortedRegions.forEach((r, n) => {\n Hotkey.addKey(PREFIX + (n + 1), function() {\n self.unselectAll();\n r.selectRegion();\n });\n });\n\n // this is added just for the reference to show up in the\n // settings page\n Hotkey.addKey(\"alt+shift+$n\", () => {}, \"Select a region\");\n }", "'add'( shortcut_combination, callback, opt ) {\n\t\t// Provide a set of default options\n\t\tlet default_options = {\n\t\t\t'type': 'keydown',\n\t\t\t'propagate': false,\n\t\t\t'disable_in_input': false,\n\t\t\t'target': document,\n\t\t\t'keycode': false,\n\t\t}\n\t\tif ( !opt ) opt = default_options;\n\t\telse {\n\t\t\tfor ( let dfo in default_options ) {\n\t\t\t\tif ( typeof opt[ dfo ] == 'undefined' ) opt[ dfo ] = default_options[ dfo ];\n\t\t\t}\n\t\t}\n\n\t\tlet ele = opt.target;\n\t\tif ( typeof opt.target == 'string' ) ele = document.getElementById( opt.target );\n\t\tlet ths = this;\n\t\tshortcut_combination = shortcut_combination.toLowerCase();\n\n\t\t// The function to be called at keypress\n\t\tlet func = function ( e ) {\n\t\t\te = e || window.event;\n\n\t\t\tif ( opt.disable_in_input ) { // Don't enable shortcut keys in Input, Textarea fields\n\t\t\t\tlet element;\n\t\t\t\tif ( e.target ) element = e.target;\n\t\t\t\telse if ( e.srcElement ) element = e.srcElement;\n\t\t\t\tif ( element.nodeType == 3 ) element = element.parentNode;\n\n\t\t\t\tif ( element.tagName == 'INPUT' || element.tagName == 'TEXTAREA' ) return;\n\t\t\t}\n\n\t\t\t// Find Which key is pressed\n\t\t\tif ( e.keyCode ) code = e.keyCode;\n\t\t\telse if ( e.which ) code = e.which;\n\t\t\tlet character = String.fromCharCode( code ).toLowerCase();\n\n\t\t\tif ( code == 188 ) character = ','; // If the user presses , when the type is onkeydown\n\t\t\tif ( code == 190 ) character = '.'; // If the user presses , when the type is onkeydown\n\n\t\t\tlet keys = shortcut_combination.split( '+' );\n\t\t\t// Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked\n\t\t\tlet kp = 0;\n\n\t\t\t// Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken\n\t\t\tlet shift_nums = {\n\t\t\t\t'`': '~',\n\t\t\t\t'1': '!',\n\t\t\t\t'2': '@',\n\t\t\t\t'3': '#',\n\t\t\t\t'4': '$',\n\t\t\t\t'5': '%',\n\t\t\t\t'6': '^',\n\t\t\t\t'7': '&',\n\t\t\t\t'8': '*',\n\t\t\t\t'9': '(',\n\t\t\t\t'0': ')',\n\t\t\t\t'-': '_',\n\t\t\t\t'=': '+',\n\t\t\t\t';': ':',\n\t\t\t\t\"'\": '\"',\n\t\t\t\t',': '<',\n\t\t\t\t'.': '>',\n\t\t\t\t'/': '?',\n\t\t\t\t'\\\\': '|',\n\t\t\t}\n\t\t\t// Special Keys - and their codes\n\t\t\tlet special_keys = {\n\t\t\t\t'esc': 27,\n\t\t\t\t'escape': 27,\n\t\t\t\t'tab': 9,\n\t\t\t\t'space': 32,\n\t\t\t\t'return': 13,\n\t\t\t\t'enter': 13,\n\t\t\t\t'backspace': 8,\n\n\t\t\t\t'scrolllock': 145,\n\t\t\t\t'scroll_lock': 145,\n\t\t\t\t'scroll': 145,\n\t\t\t\t'capslock': 20,\n\t\t\t\t'caps_lock': 20,\n\t\t\t\t'caps': 20,\n\t\t\t\t'numlock': 144,\n\t\t\t\t'num_lock': 144,\n\t\t\t\t'num': 144,\n\n\t\t\t\t'pause': 19,\n\t\t\t\t'break': 19,\n\n\t\t\t\t'insert': 45,\n\t\t\t\t'home': 36,\n\t\t\t\t'delete': 46,\n\t\t\t\t'end': 35,\n\n\t\t\t\t'pageup': 33,\n\t\t\t\t'page_up': 33,\n\t\t\t\t'pu': 33,\n\n\t\t\t\t'pagedown': 34,\n\t\t\t\t'page_down': 34,\n\t\t\t\t'pd': 34,\n\n\t\t\t\t'left': 37,\n\t\t\t\t'up': 38,\n\t\t\t\t'right': 39,\n\t\t\t\t'down': 40,\n\n\t\t\t\t'f1': 112,\n\t\t\t\t'f2': 113,\n\t\t\t\t'f3': 114,\n\t\t\t\t'f4': 115,\n\t\t\t\t'f5': 116,\n\t\t\t\t'f6': 117,\n\t\t\t\t'f7': 118,\n\t\t\t\t'f8': 119,\n\t\t\t\t'f9': 120,\n\t\t\t\t'f10': 121,\n\t\t\t\t'f11': 122,\n\t\t\t\t'f12': 123,\n\t\t\t}\n\n\t\t\tlet modifiers = {\n\t\t\t\tshift: { wanted: false, pressed: false},\n\t\t\t\tctrl: { wanted: false, pressed: false},\n\t\t\t\talt: { wanted: false, pressed: false},\n\t\t\t\tmeta: { wanted: false, pressed: false},\t// Meta is Mac specific\n\t\t\t};\n\n\t\t\tif ( e.ctrlKey )\tmodifiers.ctrl.pressed = true;\n\t\t\tif ( e.shiftKey )\tmodifiers.shift.pressed = true;\n\t\t\tif ( e.altKey )\tmodifiers.alt.pressed = true;\n\t\t\tif ( e.metaKey ) modifiers.meta.pressed = true;\n\n\t\t\tfor ( let i = 0; k = keys[ i ], i < keys.length; i++ ) {\n\t\t\t\t// Modifiers\n\t\t\t\tif ( k == 'ctrl' || k == 'control' ) {\n\t\t\t\t\tkp++;\n\t\t\t\t\tmodifiers.ctrl.wanted = true;\n\t\t\t\t} else if ( k == 'shift' ) {\n\t\t\t\t\tkp++;\n\t\t\t\t\tmodifiers.shift.wanted = true;\n\t\t\t\t} else if ( k == 'alt' ) {\n\t\t\t\t\tkp++;\n\t\t\t\t\tmodifiers.alt.wanted = true;\n\t\t\t\t} else if ( k == 'meta' ) {\n\t\t\t\t\tkp++;\n\t\t\t\t\tmodifiers.meta.wanted = true;\n\t\t\t\t} else if ( k.length > 1 ) { // If it is a special key\n\t\t\t\t\tif ( special_keys[ k ] == code ) kp++;\n\t\t\t\t} else if ( opt.keycode ) {\n\t\t\t\t\tif ( opt.keycode == code ) kp++;\n\t\t\t\t} else { // The special keys did not match\n\t\t\t\t\tif ( character == k ) kp++;\n\t\t\t\t\telse {\n\t\t\t\t\t\tif ( shift_nums[ character ] && e.shiftKey ) { // Stupid Shift key bug created by using lowercase\n\t\t\t\t\t\t\tcharacter = shift_nums[ character ];\n\t\t\t\t\t\t\tif ( character == k ) kp++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( kp == keys.length &&\n\t\t\t\t\t\tmodifiers.ctrl.pressed == modifiers.ctrl.wanted &&\n\t\t\t\t\t\tmodifiers.shift.pressed == modifiers.shift.wanted &&\n\t\t\t\t\t\tmodifiers.alt.pressed == modifiers.alt.wanted &&\n\t\t\t\t\t\tmodifiers.meta.pressed == modifiers.meta.wanted ) {\n\t\t\t\tcallback( e );\n\n\t\t\t\tif ( !opt.propagate ) { // Stop the event\n\t\t\t\t\t// e.cancelBubble is supported by IE - this will kill the bubbling process.\n\t\t\t\t\te.cancelBubble = true;\n\t\t\t\t\te.returnValue = false;\n\n\t\t\t\t\t// e.stopPropagation works in Firefox.\n\t\t\t\t\tif ( e.stopPropagation ) {\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.all_shortcuts[ shortcut_combination ] = {\n\t\t\t'callback': func,\n\t\t\t'target': ele,\n\t\t\t'event': opt.type,\n\t\t};\n\t\t// Attach the function with the event\n\t\tif ( ele.addEventListener ) ele.addEventListener( opt.type, func, false );\n\t\telse if ( ele.attachEvent ) ele.attachEvent( 'on' + opt.type, func );\n\t\telse ele[ 'on' + opt.type ] = func;\n\t}", "function appendShortcut(opts) {\n\t\tvar b = $(\"<button class='btn btn-info' id='btn-\" + opts.name + \"'>\" + opts.name + \"</button>\");\n\t\tb.click(() => {\n\t\t\tif (delete_shortcut) {\n\t\t\t\tb.remove();\n\t\t\t\tdelete shortcuts[opts.name];\n\n\t\t\t\twindow.localStorage.shortcuts = JSON.stringify(shortcuts);\n\t\t\t} else {\n\t\t\t\tsendRoll(opts);\n\t\t\t}\n\t\t});\n\t\tb.appendTo(\"#shortcuts\");\n\t}", "getShortcutKeys() {\n return store.getState().shortcuts;\n }", "_registerMouseShortcutsInWebsite() {\n __querySelectorLive('[s-node]', ($node) => {\n $node.parentNode.addEventListener('dblclick', (e) => {\n e.preventDefault();\n e.stopPropagation();\n this._edit(this._preselectedNode.uid);\n });\n }, {\n rootNode: this._$websiteDocument,\n });\n }", "function RegisterKeyboardShortcut(ScriptName, ShortcutsHeader, NewShortcut, ShortcutDescription, FunctionToCall, ShortcutKeysObj) {\n // Figure out what language we are using\n var language = I18n.currentLocale();\n //check for and add keyboard shourt group to WME\n try {\n var x = I18n.translations[language].keyboard_shortcuts.groups[ScriptName].members.length;\n } catch (e) {\n //setup keyboard shortcut's header\n W.accelerators.Groups[ScriptName] = []; //setup your shortcut group\n W.accelerators.Groups[ScriptName].members = []; //set up the members of your group\n I18n.translations[language].keyboard_shortcuts.groups[ScriptName] = []; //setup the shortcuts text\n I18n.translations[language].keyboard_shortcuts.groups[ScriptName].description = ShortcutsHeader; //Scripts header\n I18n.translations[language].keyboard_shortcuts.groups[ScriptName].members = []; //setup the shortcuts text\n }\n //check if the function we plan on calling exists\n if (FunctionToCall && (typeof FunctionToCall == \"function\")) {\n I18n.translations[language].keyboard_shortcuts.groups[ScriptName].members[NewShortcut] = ShortcutDescription; //shortcut's text\n W.accelerators.addAction(NewShortcut, {\n group: ScriptName\n }); //add shortcut one to the group\n //clear the short cut other wise the previous shortcut will be reset MWE seems to keep it stored\n var ClearShortcut = '-1';\n var ShortcutRegisterObj = {};\n ShortcutRegisterObj[ClearShortcut] = NewShortcut;\n W.accelerators._registerShortcuts(ShortcutRegisterObj);\n if (ShortcutKeysObj !== null) {\n //add the new shortcut\n ShortcutRegisterObj = {};\n ShortcutRegisterObj[ShortcutKeysObj] = NewShortcut;\n W.accelerators._registerShortcuts(ShortcutRegisterObj);\n }\n //listen for the shortcut to happen and run a function\n W.accelerators.events.register(NewShortcut, null, function() {\n FunctionToCall();\n });\n } else {\n alert('The function ' + FunctionToCall + ' has not been declared');\n }\n \n }", "function customizeWiki() {\n addCharSubsetMenu();\n addHelpToolsMenu();\n addDigg();\n}", "updateKeybList() {\n let modWinLin = \"Alt\";\n let modMac = \"Opt\";\n if (this.app.options.useMetaKey) {\n modWinLin = \"Win\";\n modMac = \"Cmd\";\n }\n document.getElementById(\"keybList\").innerHTML = `\n <tr>\n <th>Command</th>\n <th>Shortcut (Win/Linux)</th>\n <th>Shortcut (Mac)</th>\n </tr>\n <tr>\n <td>Activate contextual help</td>\n <td>F1</td>\n <td>F1</td>\n </tr>\n <tr>\n <td>Place cursor in search field</td>\n <td>Ctrl+${modWinLin}+f</td>\n <td>Ctrl+${modMac}+f</td>\n <tr>\n <td>Place cursor in input box</td>\n <td>Ctrl+${modWinLin}+i</td>\n <td>Ctrl+${modMac}+i</td>\n </tr>\n <tr>\n <td>Place cursor in output box</td>\n <td>Ctrl+${modWinLin}+o</td>\n <td>Ctrl+${modMac}+o</td>\n </tr>\n <tr>\n <td>Place cursor in first argument field of the next operation in the recipe</td>\n <td>Ctrl+${modWinLin}+.</td>\n <td>Ctrl+${modMac}+.</td>\n </tr>\n <tr>\n <td>Place cursor in first argument field of the nth operation in the recipe</td>\n <td>Ctrl+${modWinLin}+[1-9]</td>\n <td>Ctrl+${modMac}+[1-9]</td>\n </tr>\n <tr>\n <td>Disable current operation</td>\n <td>Ctrl+${modWinLin}+d</td>\n <td>Ctrl+${modMac}+d</td>\n </tr>\n <tr>\n <td>Set/clear breakpoint</td>\n <td>Ctrl+${modWinLin}+b</td>\n <td>Ctrl+${modMac}+b</td>\n </tr>\n <tr>\n <td>Bake</td>\n <td>Ctrl+${modWinLin}+Space</td>\n <td>Ctrl+${modMac}+Space</td>\n </tr>\n <tr>\n <td>Step</td>\n <td>Ctrl+${modWinLin}+'</td>\n <td>Ctrl+${modMac}+'</td>\n </tr>\n <tr>\n <td>Clear recipe</td>\n <td>Ctrl+${modWinLin}+c</td>\n <td>Ctrl+${modMac}+c</td>\n </tr>\n <tr>\n <td>Save to file</td>\n <td>Ctrl+${modWinLin}+s</td>\n <td>Ctrl+${modMac}+s</td>\n </tr>\n <tr>\n <td>Load recipe</td>\n <td>Ctrl+${modWinLin}+l</td>\n <td>Ctrl+${modMac}+l</td>\n </tr>\n <tr>\n <td>Move output to input</td>\n <td>Ctrl+${modWinLin}+m</td>\n <td>Ctrl+${modMac}+m</td>\n </tr>\n <tr>\n <td>Create a new tab</td>\n <td>Ctrl+${modWinLin}+t</td>\n <td>Ctrl+${modMac}+t</td>\n </tr>\n <tr>\n <td>Close the current tab</td>\n <td>Ctrl+${modWinLin}+w</td>\n <td>Ctrl+${modMac}+w</td>\n </tr>\n <tr>\n <td>Go to next tab</td>\n <td>Ctrl+${modWinLin}+RightArrow</td>\n <td>Ctrl+${modMac}+RightArrow</td>\n </tr>\n <tr>\n <td>Go to previous tab</td>\n <td>Ctrl+${modWinLin}+LeftArrow</td>\n <td>Ctrl+${modMac}+LeftArrow</td>\n </tr>\n `;\n }", "function streetToRiver_init() {\n\n var defaultWidth = 15;\n var scriptLanguage = \"us\";\n var langText;\n\n\n {\n var Config =[\n {handler: 'WME-Street-to-River_other', title: \"Other\", func:function(ev){doPOI(ev,\"OTHER\");}, key:-1, arg:{type:\"OTHER\"}},\n ];\n\n for(var i=0; i < Config.length; ++i)\n {\n WMEKSRegisterKeyboardShortcut('WME-Street-to-River', 'WME-Street-to-River', Config[i].handler, Config[i].title, Config[i].func, Config[i].key, Config[i].arg);\n }\n\n WMEKSLoadKeyboardShortcuts('WME-Street-to-River');\n\n window.addEventListener(\"beforeunload\", function() {\n WMEKSSaveKeyboardShortcuts('WME-Street-to-River');\n }, false);\n\n }\n\n /*\n I18n.translations.en.keyboard_shortcuts.groups['default'].members.WME_SreetToRiver_doPOI = \"Create a POI from the street (StreetToRiver)\";\n Waze.accelerators.addAction(\"WME_SreetToRiver_doPOI\", {group: 'default'});\n Waze.accelerators.events.register(\"WME_SreetToRiver_doPOI\", null, hotKey);\n Waze.accelerators._registerShortcuts({ 'u' : \"WME_SreetToRiver_doPOI\"});\n\n function hotKey(ev) {\n doPOI(ev,\"OTHER\")\n }\n */\n function insertButtons() {\n\n if(Waze.selectionManager.getSelectedFeatures().length === 0) return;\n\n // 2013-04-19: Catch exception\n try{\n if(document.getElementById('streetToRiver') !== null) return;\n }\n catch(e){ }\n\n\n // 2014-01-09: Add Create River and Create Railway buttons\n var btn0 = $('<button class=\"btn btn-primary\" title=\"' + getString(idTitle) + '\">' + getString(idStreetToOther) + '</button>');\n btn0.click(doOther);\n\n var btn1 = $('<button class=\"btn btn-primary\" title=\"' + getString(idTitle) + '\">' + getString(idStreetToRiver) + '</button>');\n btn1.click(doRiver);\n\n var btn2 = $('<button class=\"btn btn-primary\" title=\"' + getString(idTitle) + '\">' + getString(idStreetToForest) + '</button>');\n btn2.click(doForest);\n\n var strMeters = getString(idMeters);\n\n // 2014-01-09: Add River Width Combobox\n var selRiverWidth = $('<select id=\"riverWidth\" data-type=\"numeric\" class=\"form-control\" />');\n selRiverWidth.append( $('<option value=\"5\"> 5 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"8\"> 8 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"10\">10 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"15\">15 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"20\">20 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"25\">25 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"30\">30 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"40\">40 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"50\">50 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"80\">80 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"100\">100 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"120\">120 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"150\">150 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"180\">180 ' + strMeters + '</option>') );\n selRiverWidth.append( $('<option value=\"200\">200 ' + strMeters + '</option>') );\n\n\n // 2014-01-09: Add Unlimited size river with checkbox\n var chk = $('<input title=\"Неограниченная длина (небезопасно)\" type=\"checkbox\" id=\"_isUnlimitedSize\"/><label for=\"_isUnlimitedSize\">' + getString(idUnlimitedSize) + '</label>');\n var chkDel = $('<input type=\"checkbox\" id=\"_isDeleteSegment\"/><label for=\"_isDeleteSegment\">' + getString(idDeleteSegment) + '</label>');\n\n\n // 2014-01-09: Add streetToRiver section with new HTML controls\n var cnt = $('<section id=\"streetToRiver\" />');\n\n\n // 2014-01-09: Add River width to section\n var divGroup1 = $('<div class=\"form-group\" />');\n divGroup1.append( $('<label class=\"control-label\">' + getString(idWidth) + ':</label>') );\n divGroup1.append(selRiverWidth);\n var divControls1 = $('<div class=\"controls-container\" />');\n divControls1.append(chk);\n divControls1.append(chkDel);\n divGroup1.append(divControls1);\n cnt.append(divGroup1);\n\n\n // 2014-01-09: Add river buttons to section\n var divGroup2 = $('<div class=\"form-group\"/>');\n var divControls2 = $('<div class=\"btn-toolbar\" />');\n divControls2.append(btn0);\n divControls2.append(btn1);\n divControls2.append(btn2);\n divGroup2.append(divControls2);\n cnt.append(divGroup2);\n\n // 2014-01-09: Add Script version to section.\n var divGroup3 = $('<label><a href=\"https://github.com/waze-ua/wme-street-to-river-plus-mod\" target=\"_blank\">Street to River+ (Mod) v' + version + '</a></label>');\n cnt.append(divGroup3);\n\n\n $(\"#segment-edit-general\").append(cnt);\n\n\n // 2013-06-09: Select last river width\n var lastRiverWidth = getLastRiverWidth(15);\n console_log(\"Last river width: \" + lastRiverWidth);\n selRiverWidth = document.getElementById('riverWidth');\n if(selRiverWidth!==null){\n for(var i=0; i < selRiverWidth.options.length; i++){\n if(selRiverWidth.options[i].value == lastRiverWidth){\n selRiverWidth.selectedIndex = i;\n break;\n }\n }\n }\n\n // 2013-10-20: Last time user select unlimited size?\n var isUnlimitedSize = document.getElementById('_isUnlimitedSize');\n if(isUnlimitedSize!==null){\n isUnlimitedSize.checked = getLastIsUnlimitedSize(false);\n }\n\n var isDeleteSegment = document.getElementById('_isDeleteSegment');\n if(isDeleteSegment!==null){\n isDeleteSegment.checked = getLastIsDeleteSegment(true);\n }\n\n console_log(\"Street to River Language: \" + scriptLanguage);\n console_log(\"Street to river PLUS initialized\");\n }\n\n\n // 2014-01-09: Process River Button\n function doPOI(ev,typ) {\n var convertOK;\n var foundSelectedSegment = false;\n\n // 2013-10-20: Get river's width\n var selRiverWidth = document.getElementById('riverWidth');\n defaultWidth = parseInt(selRiverWidth.options[selRiverWidth.selectedIndex].value);\n\n setLastRiverWidth(defaultWidth);\n console_log(\"River width: \" + defaultWidth);\n\n // 2013-10-20: Is limited or unlimited?\n var isUnlimitedSize = document.getElementById('_isUnlimitedSize');\n setLastIsUnlimitedSize(isUnlimitedSize.checked);\n\n var isDeleteSegment = document.getElementById('_isDeleteSegment');\n setLastIsDeleteSegment(isDeleteSegment.checked);\n\n // 2014-01-09: Search for helper street. If found create or expand a river\n for (var s=Waze.selectionManager.getSelectedFeatures().length-1; s>=0; s--) {\n var sel = Waze.selectionManager.getSelectedFeatures()[s].model;\n if (sel.type == \"segment\") {\n // found segment\n foundSelectedSegment = true;\n convertOK = convertToLandmark(sel, typ,isUnlimitedSize.checked);\n if(isDeleteSegment.checked)\n {\n var wazeActionDeleteSegment = require(\"Waze/Action/DeleteSegment\");\n Waze.model.actionManager.add(new wazeActionDeleteSegment(sel));\n }\n }\n }\n if (! foundSelectedSegment) {\n alert(getString(idNoUsavedStreet));\n }\n\n }\n\n function doRiver(ev) {\n doPOI(ev,\"RIVER_STREAM\");\n }\n\n function doForest(ev) {\n doPOI(ev,\"FOREST_GROVE\");\n }\n function doOther(ev) {\n doPOI(ev,\"OTHER\");\n }\n\n // 2014-01-09: Base on selected helper street creates or expand an existing river/railway\n function convertToLandmark(sel, lmtype,isUnlimitedSize)\n {\n var i;\n var leftPa, rightPa, leftPb, rightPb;\n var prevLeftEq, prevRightEq;\n var street = getStreet(sel);\n\n var displacement = getDisplacement(street);\n\n // create place with a minimum area 650m2\n // for simple segments only (A-B)\n if (sel.geometry.components.length === 2) {\n var segLength = 0;\n var minArea = 560;\n var pt = [];\n pt[0] = sel.geometry.components[0];\n pt[1] = sel.geometry.components[1];\n\n var seg = new OpenLayers.Geometry.LineString(pt);\n segLength = seg.getGeodesicLength(Waze.map.getProjectionObject());\n\n // if small area is expected\n if (minArea/displacement > segLength) {\n if (segLength <= Math.sqrt(minArea)) {\n // create a minimum square\n var line = Math.sqrt(minArea);\n var segScale = line/segLength;\n displacement = line/1.18;\n pt[1].resize(segScale, pt[0], 1);\n }\n else {\n // adjust displacement (width)\n displacement = minArea/segLength;\n }\n }\n }\n\n var streetVertices = sel.geometry.getVertices();\n var polyPoints = null;\n var firstPolyPoint = null;\n var secondPolyPoint = null;\n\n var wazeActionUpdateFeatureGeometry = require(\"Waze/Action/UpdateFeatureGeometry\");\n var wazefeatureVectorLandmark = require(\"Waze/Feature/Vector/Landmark\");\n var wazeActionAddLandmark = require(\"Waze/Action/AddLandmark\");\n var wazeActionDeleteObject = require(\"Waze/Action/DeleteObject\");\n var wazeActionUpdateFeatureAddress = require(\"Waze/Action/UpdateFeatureAddress\");\n\n //streetVertices = sel.attributes.geometry.getVertices();\n\n console_log(\"Street vertices: \"+streetVertices.length);\n\n // 2013-10-13: Is new street inside an existing river?\n var bAddNew = !0;\n var riverLandmark=null;\n var repo = Waze.model.venues;\n\n var rrr, donorLandmark=null;\n for (var t in repo.objects)\n {\n riverLandmark = repo.objects[t];\n if (riverLandmark.attributes.categories[0] === lmtype)\n {\nconsole.log(\"riverLandmark.attributes.id=\"+riverLandmark.attributes.id);\nconsole.log(\"streetVertices.length=\"+streetVertices.length);\nconsole.log(\"streetVertices[0]=\"+streetVertices[0]);\nconsole.log(\"streetVertices[1]=\"+streetVertices[streetVertices.length-1]);\n\n // 2014-06-27: Veriy if the landkmark object has containsPoint function\n if (\"function\" === typeof riverLandmark.geometry.containsPoint){\n if(riverLandmark.geometry.containsPoint(streetVertices[0])){\n bAddNew = false; // Street is inside an existing river\nconsole.log(\"rrr=\"+riverLandmark.attributes.id);\n rrr=riverLandmark;\n // break;\n }\n if(riverLandmark.geometry.containsPoint(streetVertices[streetVertices.length-1])){\n// bAddNew = false; // Street is inside an existing river\nconsole.log(\"donorLandmark=\"+riverLandmark.attributes.id);\n donorLandmark=riverLandmark;\n // break;\n }\n\n }\n }\n }\n riverLandmark=rrr;\n\n // 2013-10-13: Ignore vertices inside river\n var bIsOneVerticeStreet = false;\n var firstStreetVerticeOutside = 0;\n if(!bAddNew){\n console_log(\"Expanding an existing river\");\n while(firstStreetVerticeOutside < streetVertices.length){\n if(!riverLandmark.geometry.containsPoint(streetVertices[firstStreetVerticeOutside]))\n break;\n firstStreetVerticeOutside += 1;\n }\n if(firstStreetVerticeOutside === streetVertices.length){\n alert(getString(idAllSegmentsInside));\n return false;\n }\n bIsOneVerticeStreet = firstStreetVerticeOutside === (streetVertices.length-1);\n if(bIsOneVerticeStreet){\n console_log(\"It's one vertice street\");\n }\n if(firstStreetVerticeOutside > 1){\n alert(getString(idMultipleSegmentsInside));\n return false;\n }\n console_log(\"First street vertice outside river:\" + firstStreetVerticeOutside);\n }\n\n\n // 2013-10-13: Add to polyPoints river polygon\n console_log(\"River polygon: Create\");\n var first;\n if(bAddNew)\n first = 0;\n else\n first = firstStreetVerticeOutside - 1;\n\n for (i=first; i< streetVertices.length-1; i++)\n {\n var pa = streetVertices[i];\n var pb = streetVertices[i+1];\n var scale = (pa.distanceTo(pb) + displacement) / pa.distanceTo(pb);\n\n leftPa = pa.clone();\n leftPa.resize(scale, pb, 1);\n rightPa = leftPa.clone();\n leftPa.rotate(90,pa);\n rightPa.rotate(-90,pa);\n\n leftPb = pb.clone();\n leftPb.resize(scale, pa, 1);\n rightPb = leftPb.clone();\n leftPb.rotate(-90,pb);\n rightPb.rotate(90,pb);\n\n\n var leftEq = getEquation({ 'x1': leftPa.x, 'y1': leftPa.y, 'x2': leftPb.x, 'y2': leftPb.y });\n var rightEq = getEquation({ 'x1': rightPa.x, 'y1': rightPa.y, 'x2': rightPb.x, 'y2': rightPb.y });\n if (polyPoints === null) {\n polyPoints = [ leftPa, rightPa ];\n }\n else {\n var li = intersectX(leftEq, prevLeftEq);\n var ri = intersectX(rightEq, prevRightEq);\n if (li && ri) {\n // 2013-10-17: Is point outside river?\n if(i>=firstStreetVerticeOutside){\n polyPoints.unshift(li);\n polyPoints.push(ri);\n\n // 2013-10-17: Is first point outside river? -> Save it for later use\n if(i==firstStreetVerticeOutside){\n firstPolyPoint = li.clone();\n secondPolyPoint = ri.clone();\n polyPoints = [li,ri];\n }\n }\n }\n else {\n // 2013-10-17: Is point outside river?\n if(i>=firstStreetVerticeOutside){\n polyPoints.unshift(leftPb.clone());\n polyPoints.push(rightPb.clone());\n\n // 2013-10-17: Is first point outside river? -> Save it for later use\n if(i==firstStreetVerticeOutside){\n firstPolyPoint = leftPb.clone();\n secondPolyPoint = rightPb.clone();\n polyPoints = [leftPb,rightPb];\n }\n }\n }\n }\n\n prevLeftEq = leftEq;\n prevRightEq = rightEq;\n\n // 2013-06-03: Is Waze limit reached?\n if( (polyPoints.length > 50) && !isUnlimitedSize){\n break;\n }\n }\n\n if(bIsOneVerticeStreet){\n firstPolyPoint = leftPb.clone();\n secondPolyPoint = rightPb.clone();\n polyPoints = [ leftPb,rightPb ];\n console_log(\"One vertice river:\"+polyPoints.length);\n }\n else{\n polyPoints.push(rightPb);\n polyPoints.push(leftPb);\n }\n console_log(\"River polygon: done\");\n\n // 2014-01-09: Create or expand an existing river?\n if(bAddNew){\n // 2014-01-09: Add new river\n // 2014-01-09: Create new river's Polygon\n var polygon = new OpenLayers.Geometry.Polygon(new OpenLayers.Geometry.LinearRing(polyPoints));\n\n // 2014-10-08: Creates river's Landmark\n riverLandmark = new wazefeatureVectorLandmark();\n riverLandmark.geometry = polygon;\n riverLandmark.attributes.categories.push(lmtype);\n\n // 2014-01-09: Add river's name base on Street Name\n if (street && street.name) {\n riverLandmark.attributes.name = street.name.replace(/^\\d+(m|ft)\\s*/, '');\n }\n\n // 2014-10-08: Add new Landmark to Waze Editor\n var riverLandmark_o=new wazeActionAddLandmark(riverLandmark);\n Waze.model.actionManager.add(riverLandmark_o);\n Waze.selectionManager.setSelectedModels([riverLandmark_o.landmark]);\n\n if (lmtype !== \"OTHER\")\n {\n console.log(\"bAddNew\");\n var address=riverLandmark.getAddress().attributes;\n console.log(address);\n var newAddressAtts={streetName: null, emptyStreet: true, cityName: null, emptyCity: true, stateID: address.state.id, countryID: address.country.id};\n Waze.model.actionManager.add(new wazeActionUpdateFeatureAddress(riverLandmark, newAddressAtts, {streetIDField: 'streetID'} ));\n }\n\n }\n else{\n function CalcRL(components)\n {\n var count=components.length;\n var j=count-1;\n var area=0;\n\n for(var i=0; i < count; ++i)\n {\n area+=(components[i].y*components[j].x)-(components[i].x*components[j].y);\n j=i;\n }\n return area < 0?1:-1; // 1 - по часовой, -1 - против часовой\n }\n\n // 2014-01-09: Expand an existing river\n var originalGeometry = riverLandmark.geometry.clone();\n\n if(donorLandmark) // если есть донор\n {\n var undoGeometry = riverLandmark.geometry.clone();\n var undoGeometryDonor = donorLandmark.geometry.clone();\n var components=riverLandmark.geometry.components[0].components;\n var componentsDonor=donorLandmark.geometry.components[0].components;\n\n//window.donorLandmark=donorLandmark;\n//window.riverLandmark=riverLandmark;\n\n // куда закручен массив?\n var componentsRL=CalcRL(components);\n var componentsDonorRL=CalcRL(componentsDonor);\nconsole.log(\"src=\"+componentsRL+\", donor=\"+componentsDonorRL);\n // найти индекс ближайщей точки к началу сегмента\n var dist=1000000000;\n var p1=[0,0], p2=[0,0]; // индексы ближайших точек\n for (var i1=0; i1< components.length; i1++)\n {\n var d1=Math.sqrt(Math.pow(Math.abs(components[i1].x - streetVertices[0].x),2)+Math.pow(Math.abs(components[i1].y - streetVertices[0].y),2));\n if(d1 < dist)\n {\n dist=d1;\n p1[0]=i1;\n if (componentsRL > 0)\n p1[1]=i1 === 0?components.length-1:i1-1;\n else\n p1[1]=i1 == components.length-1?0:i1+1;\n }\n }\n\nconsole.log(\"p1=\"+p1+\", dist=\"+dist);\n // ищем индекс во втором ПОИ, откуда начинать вставку.\n dist=1000000000;\n for (var i1=0; i1< componentsDonor.length; i1++)\n {\n var d1=Math.sqrt(Math.pow(Math.abs(componentsDonor[i1].x - streetVertices[streetVertices.length-1].x),2)+Math.pow(Math.abs(componentsDonor[i1].y - streetVertices[streetVertices.length-1].y),2));\n if(d1 < dist)\n {\n dist=d1;\n p2[0]=i1;\n if (componentsDonorRL > 0)\n p2[1]=i1 === 0?componentsDonor.length-1:i1-1;\n else\n p2[1]=i1 == componentsDonor.length-1?0:i1+1;\n }\n }\nconsole.log(\"p2=\"+p2+\", dist=\"+dist);\n\n var componentsNew=components.slice();\n componentsNew.length=0;\n\n // добавляем источник\n for(var i1=0; i1 <= p1[0]; ++i1)\n componentsNew.push(components[i1]);\n\n // добавляем донора\n if (componentsRL < 0)\n {\n if (componentsDonorRL < 0)\n {\n // добавляем донора по кругу\n for(var i1=p2[0]; i1 < componentsDonor.length; ++i1)\n componentsNew.push(componentsDonor[i1]);\n\n // ...остаток донора\n for(var i1=0; i1 < p2[0]; ++i1)\n componentsNew.push(componentsDonor[i1]);\n }\n else\n {\n // добавляем донора по кругу\n for(var i1=p2[0]; i1 >= 0; --i1)\n componentsNew.push(componentsDonor[i1]);\n\n // ...остаток донора\n for(var i1=componentsDonor.length-1; i1 > p2[0]; --i1)\n componentsNew.push(componentsDonor[i1]);\n }\n }\n else\n {\n if (componentsDonorRL < 0)\n {\n // добавляем донора по кругу\n for(var i1=p2[0]; i1 >= 0; --i1)\n componentsNew.push(componentsDonor[i1]);\n\n // ...остаток донора\n for(var i1=componentsDonor.length-1; i1 > p2[0]; --i1)\n componentsNew.push(componentsDonor[i1]);\n }\n else\n {\n // добавляем донора по кругу\n for(var i1=p2[0]; i1 < componentsDonor.length; ++i1)\n componentsNew.push(componentsDonor[i1]);\n\n // ...остаток донора\n for(var i1=0; i1 < p2[0]; ++i1)\n componentsNew.push(componentsDonor[i1]);\n }\n }\n\n // добавляем источник\n for(var i1=p1[0]+1; i1 < components.length; ++i1)\n componentsNew.push(components[i1]);\n\n//window.componentsNew=componentsNew\n // обновляемся\n function uniq(a) {\n var seen = {};\n return a.filter(function(item) {\n return seen.hasOwnProperty(item) ? false : (seen[item] = true);\n });\n }\n riverLandmark.geometry.components[0].components=uniq(componentsNew);\n\n Waze.model.actionManager.add(new wazeActionUpdateFeatureGeometry(riverLandmark, Waze.model.venues,undoGeometry,riverLandmark.geometry));\n Waze.model.actionManager.add(new wazeActionDeleteObject(donorLandmark, Waze.model.venues,undoGeometryDonor,donorLandmark.geometry));\n\n return true;\n }\n var riverVertices = riverLandmark.geometry.getVertices();\n console_log(\"Total river vertices:\" + riverVertices.length);\n\n // 2013-06-01: Adjust first street vertice in case of a 2 vertice river\n if(firstStreetVerticeOutside===0)\n firstStreetVerticeOutside=1;\n\n\n // 2013-06-01: Find on selected river, the nearest point from the begining of road\n\n var distance=0;\n var minDistance = 100000;\n var indexNearestPolyPoint=0;\n for(i=0; i < polyPoints.length; i++){\n distance = polyPoints[i].distanceTo(streetVertices[firstStreetVerticeOutside]);\n if(distance < minDistance){\n minDistance = distance;\n indexNearestPolyPoint = i;\n }\n }\n console_log(\"polyPoints.length: \" + polyPoints.length);\n console_log(\"indexNearestPolyPoint: \" + indexNearestPolyPoint);\n\n var indexNearestRiverVertice=0;\n var nextIndex;\n minDistance = 100000;\n for(i=0; i < riverVertices.length; i++){\n nextIndex = getNextIndex(i,riverVertices.length,+1);\n if(isIntersectingLines(riverVertices[i],riverVertices[nextIndex],streetVertices[0],streetVertices[1])){\n distance = polyPoints[indexNearestPolyPoint].distanceTo(riverVertices[i]);\n if(distance< minDistance){\n minDistance = distance;\n indexNearestRiverVertice = i;\n }\n }\n }\n console_log(\"indexNearestRiverVertice: \" + indexNearestRiverVertice);\n var nextRiverVertice = getNextIndex(indexNearestRiverVertice,riverVertices.length,1);\n\n\n\n // 2013-06-01: Is river's Polygon clockwise or counter-clockwise?\n\n\n console_log(\"indexNearestRiverVertice: \" + indexNearestRiverVertice);\n console_log(\"nextRiverVertice: \" + nextRiverVertice);\n\n console_log(\"firstPolyPoint:\" + firstPolyPoint );\n console_log(\"secondPolyPoint:\" + secondPolyPoint);\n\n var inc=1;\n var incIndex=0;\n if(isIntersectingLines(riverVertices[indexNearestRiverVertice],firstPolyPoint,riverVertices[nextRiverVertice], secondPolyPoint)){\n //inc = -1;\n console_log(\"Lines intersect: clockwise polygon\" );\n inc = +1;\n incIndex=1;\n }\n else{\n inc = +1;\n console_log(\"Lines doesn't itersect: counter-clockwise polygon\" );\n }\n\n\n // 2013-06-03: Update river's polygon (add new vertices)\n var indexLastPolyPoint =getNextIndex(index,polyPoints.length,-inc);\n var indexNextVertice=1;\n var index= polyPoints.length/2 - 1;\n\n if(bIsOneVerticeStreet)\n index +=1;\n\n for(i= 0; i < polyPoints.length; i++){\n if(!originalGeometry.containsPoint(polyPoints[index])){\n\n // 2014-01-09: Save's old Landmark\n var undoGeometry = riverLandmark.geometry.clone();\n\n // 2014-01-09: Add a new point to existing river landmark\n riverLandmark.geometry.components[0].addComponent(polyPoints[index],indexNearestRiverVertice+indexNextVertice);\n\n // 2014-01-09: Update river landmark on Waze editor\n // 2014-09-30: Gets UptdateFeatureGeometry\n Waze.model.actionManager.add(new wazeActionUpdateFeatureGeometry(riverLandmark, Waze.model.venues,undoGeometry,riverLandmark.geometry));\n //delete undoGeometry;\n\n console_log(\"Added: \" + index);\n indexNextVertice+=incIndex;\n }\n index = getNextIndex(index,polyPoints.length,inc);\n }\n\n // 2013-06-03: Notify Waze that current river's geometry change.\n //Waze.model.actionManager.add(new Waze.Action.UpdateFeatureGeometry(riverLandmark,Waze.model.landmarks,originalGeometry,riverLandmark.geometry));\n //delete originalGeometry;\n\n if (lmtype !== \"OTHER\")\n {\n console.log(\"!bAddNew\");\n var address=riverLandmark.getAddress().attributes;\n console.log(address);\n var newAddressAtts={streetName: null, emptyStreet: true, cityName: null, emptyCity: true, stateID: address.state.id, countryID: address.country.id};\n Waze.model.actionManager.add(new wazeActionUpdateFeatureAddress(riverLandmark, newAddressAtts, {streetIDField: 'streetID'} ));\n }\n\n }\n return true;\n }\n\n // 2013-06-02: Returns TRUE if line1 intersects lines2\n function isIntersectingLines(pointLine1From, pointLine1To, pointLine2From, pointLine2To){\n var segment1;\n var segment2;\n\n // 2013-06-02: OpenLayers.Geometry.segmentsIntersect requires that start and end are ordered so that x1 < x2.\n if(pointLine1From.x <= pointLine1To.x)\n segment1 = { 'x1': pointLine1From.x, 'y1': pointLine1From.y, 'x2': pointLine1To.x, 'y2': pointLine1To.y };\n else\n segment1 = { 'x1': pointLine1To.x, 'y1': pointLine1To.y ,'x2': pointLine1From.x, 'y2': pointLine1From.y };\n\n if(pointLine2From.x <= pointLine2To.x)\n segment2 = { 'x1': pointLine2From.x, 'y1': pointLine2From.y, 'x2': pointLine2To.x, 'y2': pointLine2To.y };\n else\n segment2 = { 'x1': pointLine2To.x, 'y1': pointLine2To.y ,'x2': pointLine2From.x, 'y2': pointLine2From.y };\n\n return OpenLayers.Geometry.segmentsIntersect(segment1,segment2,!1);\n }\n\n // 2013-06-02: Returns TRUE if polygon's direction is clockwise. FALSE -> counter-clockwise\n // Based on: http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order\n /*\n function isClockwise(vertices,index,count){\n var total=0;\n var nextIndex;\n\n if(count > vertices.length)\n count = vertices.length;\n\n\n for(var i=0; i < vertices.length-1; i++){\n nextIndex = getNextIndex(index,vertices.length,+1);\n total += (vertices[nextIndex].x-vertices[index].x) * (vertices[nextIndex].y+vertices[index].y);\n index = nextIndex;\n }\n return total>=0;\n }\n */\n\n // 2013-06-01: Increment/decrement index by 1\n function getNextIndex(index,length,inc){\n var next = index + inc;\n if(next == length)\n next = 0;\n if(next < 0)\n next = length-1;\n return next;\n }\n\n\n function getEquation(segment) {\n if (segment.x2 == segment.x1)\n return { 'x': segment.x1 };\n\n var slope = (segment.y2 - segment.y1) / (segment.x2 - segment.x1);\n var offset = segment.y1 - (slope * segment.x1);\n return { 'slope': slope, 'offset': offset };\n }\n\n //\n // line A: y = ax + b\n // line B: y = cx + b\n //\n // x = (d - b) / (a - c)\n function intersectX(eqa,eqb,defaultPoint) {\n if (\"number\" == typeof eqa.slope && \"number\" == typeof eqb.slope) {\n if (eqa.slope == eqb.slope)\n return null;\n\n var ix = (eqb.offset - eqa.offset) / (eqa.slope - eqb.slope);\n var iy = eqa.slope * ix + eqa.offset;\n return new OpenLayers.Geometry.Point(ix, iy);\n }\n else if (\"number\" == typeof eqa.x) {\n return new OpenLayers.Geometry.Point(eqa.x, eqb.slope * eqa.x + eqb.offset);\n }\n else if (\"number\" == typeof eqb.y) {\n return new OpenLayers.Geometry.Point(eqb.x, eqa.slope * eqb.x + eqa.offset);\n }\n return null;\n }\n\n\n function getStreet(segment) {\n if (! segment.attributes.primaryStreetID)\n return null;\n var street = segment.model.streets.getObjectById(segment.attributes.primaryStreetID);\n return street;\n }\n\n function getDisplacement(street) {\n if (!street)\n return defaultWidth;\n if (!street.name)\n return defaultWidth;\n if (street.name.match(/^(\\d+)m\\b/))\n return parseInt(RegExp.$1);\n if (street.name.match(/^(\\d+)ft\\b/))\n return parseInt(RegExp.$1) * 0.3048;\n return defaultWidth;\n }\n\n // 2013-06-09: Save current river Width\n function setLastRiverWidth(riverWidth){\n if(typeof(Storage)!==\"undefined\"){\n // 2013-06-09: Yes! localStorage and sessionStorage support!\n sessionStorage.riverWidth=Number(riverWidth);\n }\n else{\n // Sorry! No web storage support..\n console_log(\"No web storage support\");\n }\n }\n\n // 2013-06-09: Returns last saved river width\n function getLastRiverWidth(defaultRiverWidth){\n if(typeof(Storage)!==\"undefined\"){\n // 2013-06-09: Yes! localStorage and sessionStorage support!\n if(sessionStorage.riverWidth)\n return Number(sessionStorage.riverWidth);\n else\n return Number(defaultRiverWidth); // Default river width\n }\n else{\n // Sorry! No web storage support..\n return Number(defaultRiverWidth); // Default river width\n }\n }\n\n // 2013-10-20: Save current unlimited size preference\n function setLastIsUnlimitedSize(isUnlimitedSize){\n if(typeof(Storage)!==\"undefined\"){\n // 2013-06-09: Yes! localStorage and sessionStorage support!\n sessionStorage.isUnlimitedSize=Number(isUnlimitedSize);\n }\n else{\n // Sorry! No web storage support..\n console_log(\"No web storage support\");\n }\n }\n\n // 2013-10-20: Returns last saved unlimite size preference\n function getLastIsUnlimitedSize(defaultValue){\n if(typeof(Storage)!==\"undefined\"){\n // 2013-10-20: Yes! localStorage and sessionStorage support!\n if(sessionStorage.isUnlimitedSize)\n return Number(sessionStorage.isUnlimitedSize);\n else\n return Number(defaultValue); // Default preference\n }\n else{\n // Sorry! No web storage support..\n return Number(defaultValue); // Default preference\n }\n }\n\n // 2013-10-20: Save current unlimited size preference\n function setLastIsDeleteSegment(isDeleteSegment){\n if(typeof(Storage)!==\"undefined\"){\n // 2013-06-09: Yes! localStorage and sessionStorage support!\n sessionStorage.isDeleteSegment=Number(isDeleteSegment);\n }\n else{\n // Sorry! No web storage support..\n console_log(\"No web storage support\");\n }\n }\n\n // 2013-10-20: Returns last saved unlimite size preference\n function getLastIsDeleteSegment(defaultValue){\n if(typeof(Storage)!==\"undefined\"){\n // 2013-10-20: Yes! localStorage and sessionStorage support!\n if(sessionStorage.isDeleteSegment)\n return Number(sessionStorage.isDeleteSegment);\n else\n return Number(defaultValue); // Default preference\n }\n else{\n // Sorry! No web storage support..\n return Number(defaultValue); // Default preference\n }\n }\n\n // 2014-06-05: Returns WME interface language\n function getLanguage(){\n var wmeLanguage;\n var urlParts;\n\n urlParts = location.pathname.split(\"/\");\n wmeLanguage = urlParts[1].toLowerCase();\n if (wmeLanguage===\"editor\")\n wmeLanguage = \"us\";\n\n return wmeLanguage;\n\n }\n\n\n // 2014-06-05: Returns WME interface language\n /*\n function isBetaEditor(){\n var wmeEditor = location.host.toLowerCase();\n\n return wmeEditor===\"editor-beta.waze.com\";\n }\n */\n\n // 2014-06-05: Translate text to different languages\n function intLanguageStrings(){\n switch(getLanguage()){\n case \"es\": // 2014-06-05: Spanish\n case \"es-419\":\n langText = new Array(\"metros\",\"Ancho\",\"Cree una nueva calle, selecciónela y oprima este botón.\",\"Calle a Río\",\"Tamaño ilimitado\",\n \"¡No se encontró una calle sin guardar!\",\"Todos los segmentos de la calle adentro del río. No se puede continuar.\",\n \"Múltiples segmentos de la calle dentro del río. No se puede continuar\",\"Other\",\"Forest\",\"Delete segment\");\n break;\n case \"fr\": // 2014-06-05: French\n langText = new Array(\"mètres\",\"Largura\",\"Crie uma nova rua, a selecione e clique neste botão.\",\"Rue á rivière\",\"Taille illimitée (dangereux)\",\n \"Pas de nouvelle rue non enregistré trouvée!\",\"Tous les segments de la rue dans la rivière. Vous ne pouvez pas continuer.\",\n \"Plusieurs segments de rues à l'intérieur de la rivière. Vous ne pouvez pas continuer.\",\"Other\",\"Forest\",\"Delete segment\");\n break;\n case \"ru\": // 2014-06-05: Russian\n langText = new Array(\"метров\",\"Ширина\",\"Создайте новую дорогу (не сохраняйте), выберите ее и нажмите эту кнопку.\",\"Река\",\"Вся длина\",\n \"Не выделено ни одной не сохранённой дороги!\",\"Все сегменты дороги находятся внутри реки. Преобразование невозможно.\",\n \"Слишком много сегментов дороги находится внутри реки. Преобразование невозможно.\",\"Контур\",\"Лес\",\"Удалить сегмент\");\n break;\n case \"uk\": // 2018-05-03: Ukrainian\n langText = new Array(\"метрів\",\"Ширина\",\"Створіть нову дорогу (не зберігайте і не знімайте виділення) та натисніть цю кнопку.\",\"Ріка\",\"Безлімітна довжина (небезпечно)\",\n \"Не виділено жодної збереженої дороги!\",\"Усі сегменти дороги знаходяться всередині ріки. Перетворення неможливе.\",\n \"Занадто багато сегментів дороги знаходяться всередині ріки. Перетворення неможливе.\",\"Контур\",\"Ліс\",\"Видалити сегмент\");\n break;\n case \"hu\": // 2014-07-02: Hungarian\n langText = new Array(\"méter\",\"Szélesség\",\"Hozzon létre egy új utcát, válassza ki, majd kattintson erre a gombra.\",\"Utcából folyó\",\"Korlátlan méretű (nem biztonságos)\",\n \"Nem található nem mentett és kiválasztott új utca!\",\"Az útszakasz a folyón belül található! Nem lehet folytatni.\",\n \"Minden útszakasz a folyón belül található! Nem lehet folytatni.\",\"Other\",\"Forest\",\"Delete segment\");\n break;\n case \"cs\": // 2014-07-03: Czech\n langText = new Array(\"metrů\",\"Šířka\",\"Vytvořte osu řeky, vyberte segment a stiskněte toto tlačítko.\",\"Silnice na řeku\",\"Neomezená šířka (nebezpečné)\",\n \"Nebyly vybrány žádné neuložené segmenty!\",\"Všechny segmenty jsou uvnitř řeky! Nelze pokračovat.\",\n \"Uvnitř řeky je více segmentů! Nelze pokračovat.\",\"Other\",\"Forest\",\"Delete segment\");\n break;\n case \"pl\": // 2014-11-08: Polish - By Zniwek\n langText = new Array(\"metrów\",\"Szerokość\",\"Stwórz ulicę, wybierz ją i kliknij ten przycisk.\",\"Ulica w Rzekę\",\"Nieskończony rozmiar (niebezpieczne)\",\n \"Nie znaleziono nowej i niezapisanej ulicy!\",\"Wszystkie segmenty ulicy wewnątrz rzeki. Nie mogę kontynuować.\",\n \"Wiele segmentów ulicy wewnątrz rzeki. Nie mogę kontynuować.\",\"Other\",\"Forest\",\"Delete segment\");\n break;\n case \"pt-br\":// 2015-04-05: Portuguese - By esmota\n langText = new Array(\"metros\",\"Largura\",\"Criar uma nova rua, selecione e clique neste botão.\",\"Rua para Rio\",\"Comprimento ilimitado (instável)\",\n \"Nenhuma nova rua, sem salvar, selecionada!\",\"Todos os segmentos de rua estão dentro de um rio. Nada a fazer.\",\n \"Múltiplos segmentos de rua dentro de um rio. Impossível continuar.\",\"Other\",\"Forest\",\"Delete segment\");\n break;\n default: // 2014-06-05: English\n langText = new Array(\"meters\",\"Width\",\"Create a new street, select and click this button.\",\"River\",\"Unlimited size (unsafe)\",\n \"No unsaved and selected new street found!\",\"All street segments inside river. Cannot continue.\",\n \"Multiple street segments inside river. Cannot continue.\",\"Other\",\"Forest\",\"Delete segment\");\n }\n }\n\n // 2014-06-05: Returns the translated string to current language, if the language is not recognized assumes English\n function getString(stringID){\n return langText[stringID];\n }\n\n function console_log(msg) {\n //if (console.log)\n // 2013-05-19: Alternate method to valided console object\n if(typeof console != \"undefined\")\n console.log(msg);\n }\n\n // 2014-06-05: Get interface language\n scriptLanguage = getLanguage();\n intLanguageStrings();\n Waze.selectionManager.events.register(\"selectionchanged\", null, insertButtons);\n\n}", "addCommands(commands){if(this.annyang){this.annyang.addCommands(commands)}}", "function extendAliases () {\n Array.prototype.slice.call(arguments).forEach(function (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n // short-circuit if we've already added a key\n // to the aliases array, for example it might\n // exist in both 'opts.default' and 'opts.key'.\n if (flags.aliases[key]) return\n\n flags.aliases[key] = [].concat(aliases[key] || [])\n // For \"--option-name\", also set argv.optionName\n flags.aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x) && configuration['camel-case-expansion']) {\n var c = camelCase(x)\n if (c !== key && flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n newAliases[c] = true\n }\n }\n })\n flags.aliases[key].forEach(function (x) {\n flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n })\n }", "function extendAliases () {\n Array.prototype.slice.call(arguments).forEach(function (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n // short-circuit if we've already added a key\n // to the aliases array, for example it might\n // exist in both 'opts.default' and 'opts.key'.\n if (flags.aliases[key]) return\n\n flags.aliases[key] = [].concat(aliases[key] || [])\n // For \"--option-name\", also set argv.optionName\n flags.aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x) && configuration['camel-case-expansion']) {\n var c = camelCase(x)\n if (c !== key && flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n newAliases[c] = true\n }\n }\n })\n flags.aliases[key].forEach(function (x) {\n flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n })\n }", "constructor(args) {\n // Add additional contextKeyShortcuts.\n args.contextKeyShortcutsExtensions?.forEach(extensionShortcuts => {\n // Throw, if there are duplicate keys that are to be added to `contextKeyShortcuts`.\n if (Object.keys(args.contextKeyShortcuts).some(key => Object.keys(extensionShortcuts).includes(key))) {\n throw new Error('Duplicate keys found while adding `contextKeyShortcutsExtensions`.');\n }\n args.contextKeyShortcuts = { ...args.contextKeyShortcuts, ...extensionShortcuts };\n });\n super(args);\n }", "function shortcut() {\n track('Options', 'Shortcut key', 'Define the shortcut key');\n var last_shortcut = localStorage.shortcut_key;\n var ctrl = $(\"#shortcut_ctrl\").is(\":checked\");\n var shift = $(\"#shortcut_shift\").is(\":checked\");\n var key = $(\"#shortcut_key\").val();\n var shortcut = \"\";\n if (ctrl) shortcut = \"ctrl+\";\n if (shift) shortcut = shortcut + \"shift+\";\n shortcut = shortcut + key;\n localStorage.shortcut_key = shortcut;\n if (last_shortcut != null) {\n $(document).unbind('keydown', last_shortcut, requestActionOpen);\n }\n $(document).unbind('keydown', shortcut, requestActionOpen);\n $(document).bind('keydown', shortcut, requestActionOpen);\n showMessage(\"Tab Sugar can now be triggered with '\" + shortcut + \"'.\");\n chrome.browserAction.setTitle({title: \"Tab Sugar (\" + shortcut + \")\"});\n}", "shortcutKeyFor(/*opts*/) /*virtual*/ {\n\t\t\treturn 0;\n\t\t}", "function specialKeys(e, combo) {\n\t\t\tswitch (combo) {\n\n\t\t\t\t// cursor manipulation\n\t\t\t\tcase 'end':\n\t\t\t\tcase 'ctrl+e': // go to the end of the line you are currently typing on\n\t\t\t\t\tview.cursor(Number.MAX_VALUE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'home':\n\t\t\t\tcase 'ctrl+a': // go to the beginning of the line you are currently typing on\n\t\t\t\t\tview.cursor(-Number.MAX_VALUE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'left':\n\t\t\t\t\tview.cursor(-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'right':\n\t\t\t\t\tview.cursor(+1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'alt+f': // move cursor forward one word on the current line\n\t\t\t\t\tview.cursor('+w');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'alt+b': // move cursor backward one word on the current line\n\t\t\t\t\tview.cursor('-w');\n\t\t\t\t\tbreak;\n\n\t\t\t\t// command manipulation\n\t\t\t\tcase 'backspace':\n\t\t\t\tcase 'ctrl+h': // same as backspace\n\t\t\t\t\tview.deleteBefore();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'del':\n\t\t\t\t\tview.deleleAfter();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ctrl+k': // clear the line after the cursor\n\t\t\t\t\tview.deleteAllAfter();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ctrl+u': // clears the line before the cursor position\n\t\t\t\t\tview.deleteAllBefore();\n\t\t\t\t\tbreak;\n\t\t\t\t// case 'ctrl+t': // swap the last two characters before the cursor // -> default 'new tab'\n\t\t\t\t// case 'esc t': // swap the last two words before the cursor // conflicts with 'show hint'\n\t\t\t\t// case 'ctrl+w': // delete the word before the cursor // -> default 'close tab'\n\t\t\t\tcase 'space':\n\t\t\t\t\tview.put(' ');\n\t\t\t\t\tbreak;\n\n\t\t\t\t// show hint\n\t\t\t\tcase 'tab': // auto-complete\n\t\t\t\tcase 'esc':\n\t\t\t\t\tview.hint();\n\t\t\t\t\tbreak;\n\n\t\t\t\t// history manipulation\n\t\t\t\tcase 'up':\n\t\t\t\t\tview.historyCmd(-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\t\tview.historyCmd(+1);\n\t\t\t\t\tbreak;\n\t\t\t\t// case 'ctrl+r': // let’s you search through previously used commands // -> default 'reload page'\n\n\t\t\t\t// execute smth\n\t\t\t\tcase 'ctrl+l': // clears the screen, similar to the clear command\n\t\t\t\t\tview.set('clear');\n\t\t\t\t\tview.execute();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ctrl+d': // exit the current shell\n\t\t\t\t\tview.set('logout');\n\t\t\t\t\tview.execute();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'enter':\n\t\t\t\t\tview.execute();\n\t\t\t\t\tbreak;\n\t\t\t\t// case 'ctrl+c': // kill whatever you are running\n\t\t\t\t// case 'ctrl+z': // puts whatever you are running into a suspended background process. fg restores it.\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "function fixShortcut(e){return e=isMac?e.replace(\"Ctrl\",\"Cmd\"):e.replace(\"Cmd\",\"Ctrl\")}", "registerExtraKeys(options) {\n if (options) this.addKeys(options)\n var keys = {}\n keys = Object.assign(keys, CodeMirror.keyMap.sublime)\n keys = Object.assign(keys, this.ensureExtraKeys())\n this.editor.setOption(\"extraKeys\", CodeMirror.normalizeKeyMap(keys));\n }", "setKeyboardShortcuts(mapping) {\n this[keyMapSym].setMapping(mapping);\n }", "function creaShortcut() {\n var isCtrl = false;$(document).keyup(function (e) {\n if(e.which == 17) isCtrl=false;\n }).keydown(function (e) {\n if(e.which == 17) isCtrl=true;\n if(e.which == 107 && isCtrl == true) {\n ipcRenderer.send('nuovoParametro');\n return false;\n }\n });\n}", "function shortcut(e) {\r\n if (e.altKey && e.ctrlKey) {\r\n // ctrl + alt + s\r\n if (e.keyCode == 83) {\r\n runScript(true);\r\n }\r\n }\r\n}", "function setFirstLevelShortcut(s) {\n currentShortcut = s;\n processMask();\n }", "function turnOnShortcuts(){\n if (_via_changing_class){\n return;\n }\n _via_is_user_adding_attribute_name = false;\n _via_is_user_updating_attribute_value = false;\n _via_is_user_updating_attribute_name = false;\n}", "function customizeWiki() {\n addCharSubsetMenu();\n addHelpToolsMenu();\n addDigg();\n talkPage();\n}", "function bindEvents() {\n\n\t\t// callback for special keys\n\t\tfunction specialKeys(e, combo) {\n\t\t\tswitch (combo) {\n\n\t\t\t\t// cursor manipulation\n\t\t\t\tcase 'end':\n\t\t\t\tcase 'ctrl+e': // go to the end of the line you are currently typing on\n\t\t\t\t\tview.cursor(Number.MAX_VALUE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'home':\n\t\t\t\tcase 'ctrl+a': // go to the beginning of the line you are currently typing on\n\t\t\t\t\tview.cursor(-Number.MAX_VALUE);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'left':\n\t\t\t\t\tview.cursor(-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'right':\n\t\t\t\t\tview.cursor(+1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'alt+f': // move cursor forward one word on the current line\n\t\t\t\t\tview.cursor('+w');\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'alt+b': // move cursor backward one word on the current line\n\t\t\t\t\tview.cursor('-w');\n\t\t\t\t\tbreak;\n\n\t\t\t\t// command manipulation\n\t\t\t\tcase 'backspace':\n\t\t\t\tcase 'ctrl+h': // same as backspace\n\t\t\t\t\tview.deleteBefore();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'del':\n\t\t\t\t\tview.deleleAfter();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ctrl+k': // clear the line after the cursor\n\t\t\t\t\tview.deleteAllAfter();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ctrl+u': // clears the line before the cursor position\n\t\t\t\t\tview.deleteAllBefore();\n\t\t\t\t\tbreak;\n\t\t\t\t// case 'ctrl+t': // swap the last two characters before the cursor // -> default 'new tab'\n\t\t\t\t// case 'esc t': // swap the last two words before the cursor // conflicts with 'show hint'\n\t\t\t\t// case 'ctrl+w': // delete the word before the cursor // -> default 'close tab'\n\t\t\t\tcase 'space':\n\t\t\t\t\tview.put(' ');\n\t\t\t\t\tbreak;\n\n\t\t\t\t// show hint\n\t\t\t\tcase 'tab': // auto-complete\n\t\t\t\tcase 'esc':\n\t\t\t\t\tview.hint();\n\t\t\t\t\tbreak;\n\n\t\t\t\t// history manipulation\n\t\t\t\tcase 'up':\n\t\t\t\t\tview.historyCmd(-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'down':\n\t\t\t\t\tview.historyCmd(+1);\n\t\t\t\t\tbreak;\n\t\t\t\t// case 'ctrl+r': // let’s you search through previously used commands // -> default 'reload page'\n\n\t\t\t\t// execute smth\n\t\t\t\tcase 'ctrl+l': // clears the screen, similar to the clear command\n\t\t\t\t\tview.set('clear');\n\t\t\t\t\tview.execute();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ctrl+d': // exit the current shell\n\t\t\t\t\tview.set('logout');\n\t\t\t\t\tview.execute();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'enter':\n\t\t\t\t\tview.execute();\n\t\t\t\t\tbreak;\n\t\t\t\t// case 'ctrl+c': // kill whatever you are running\n\t\t\t\t// case 'ctrl+z': // puts whatever you are running into a suspended background process. fg restores it.\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// callback for usual keys\n\t\tfunction usualKeys(e) {\n\t\t\tview.put(String.fromCharCode(e.which));\n\t\t\treturn false;\n\t\t}\n\n\t\t// bind mouse click on command\n\t\tview.$body.on('click', '.row .command', { scope: view }, view.onCommandClick);\n\n\t\t// bind mouse click on \"enter\" button\n\t\tview.$body.on('click', '.enter', { scope: view }, view.onEnterClick);\n\n\t\t// if this is mobile device -> do not bind any keyboard events, just return\n\t\tif (config.isMobile) {\n\t\t\treturn;\n\t\t}\n\n\t\t// bind special keys\n\t\tMousetrap.bind([\n\t\t\t'end', 'home', 'left', 'right', 'ctrl+a', 'ctrl+e', 'alt+f', 'alt+b',\n\t\t\t'backspace', 'ctrl+h', 'del', 'ctrl+u', 'ctrl+k', 'space', // 'ctrl+t', 'esc t', 'ctrl+w',\n\t\t\t'tab', 'esc',\n\t\t\t'up', 'down', // 'ctrl+r',\n\t\t\t'ctrl+l', 'ctrl+d', 'enter' //, 'ctrl+c', 'ctrl+z'\n\t\t], specialKeys);\n\n\t\t// usual keys\n\t\tvar numbers = '1234567890'.split(''),\n\t\t english = 'abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ'.split(''),\n\t\t // russian = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ',\n\t\t russian = (function() {\n\t\t \tvar codes = [1025, 1105]; // Ё, ё\n\t\t \tfor (var i = 1040; i <= 1103; i++) { // А-Яа-я\n\t\t \t\tcodes.push(i);\n\t\t \t}\n\t\t \treturn codes.map(function(c) {\n\t\t \t\treturn String.fromCharCode(c);\n\t\t \t});\n\t\t })(),\n\t\t symbols = '!\";%:?*()_+-=@#$^&{}[]\\\\|/:;\\'<>,.~`'.split('').concat(String.fromCharCode(8470)); // №\n\n\t\t// bind usual keys\n\t\tMousetrap.bind(numbers.concat(english, russian, symbols), usualKeys);\n\n\t\t// bind paste event\n\t\t// http://stackoverflow.com/a/258325\n\t\t// listens ctrl+v and shift+ins events and transfer focus to a hidden textarea to get pasted text\n\t\tMousetrap.bind(['mod+v', 'shift+ins'], function() {\n\t\t\t// get textarea and focus it\n\t\t\tvar $textarea = $('#clipboarddata');\n\t\t\tif ($textarea.length === 0) {\n\t\t\t\t$textarea = $('<textarea/>', {\n\t\t\t\t\tid: 'clipboarddata'\n\t\t\t\t}).appendTo(view.$body);\n\t\t\t}\n\t\t\t$textarea.focus();\n\n\t\t\tif ($textarea.length !== 0) {\n\t\t\t\t// wait a bit, get text, clear and unfocus textarea\n\t\t\t\twindow.setTimeout(function() {\n\t\t\t\t\tvar text = $textarea.val();\n\t\t\t\t\t$textarea.val('');\n\t\t\t\t\t$textarea.blur();\n\t\t\t\t\tview.put(text);\n\t\t\t\t}, 10);\n\t\t\t}\n\t\t});\n\n\t\t// easter egg, doom2 god mode\n\t\tMousetrap.bind('alt+i d d q d', function() {\n\t\t\t// show doom2 banner\n\t\t\tif ($('#doom2banner').length === 0) {\n\t\t\t\t$('<img/>', {\n\t\t\t\t\tid: 'doom2banner',\n\t\t\t\t\tsrc: 'img/doom.png',\n\t\t\t\t\twidth: '640px',\n\t\t\t\t\theight: '77px',\n\t\t\t\t\tcss: {\n\t\t\t\t\t\tposition: 'fixed',\n\t\t\t\t\t\tleft: ($(window).width() - 640) / 2,\n\t\t\t\t\t\tbottom: 0\n\t\t\t\t\t}\n\t\t\t\t}).appendTo(view.$body);\n\t\t\t}\n\n\t\t\t// execute 'su' command\n\t\t\tbin.su.call(Sh);\n\t\t\tview.row(_('_godmode'));\n\t\t\tview.set('');\n\t\t\tview.execute();\n\t\t\treturn false;\n\t\t});\n\n\t\t//TODO add Konami Code\n\t\t// https://en.wikipedia.org/wiki/Konami_Code\n\t\t// ↑↑↓↓←→←→ba\n\t\t// maybe use https://github.com/mikeflynn/egg.js\n\t}", "function saveShortcuts() {\n\n\tvar v_shortcut_list = [];\n\n\tfor (var property in v_shortcut_object.shortcuts) {\n if (v_shortcut_object.shortcuts.hasOwnProperty(property)) {\n v_shortcut_list.push(v_shortcut_object.shortcuts[property]);\n }\n }\n\n\tvar input = JSON.stringify({\"p_shortcuts\": v_shortcut_list});\n\n\texecAjax('/save_shortcuts/',\n\t\t\tinput,\n\t\t\tfunction(p_return) {\n\t\t\t\tshowAlert('Shortcuts saved.');\n\n\t\t\t});\n}", "function assignAndShowShortcut(el, shortcut) {\n assignedShortcuts[shortcut] = true;\n createAndShowPopup(el, shortcut);\n // JavaScript handlers can (and often do) changet the target of the link.\n if (hasJavaScriptClickHandler(el)) return;\n if (el.tagName == 'A') {\n var href = el.href;\n if (!(href in urlMap)) {\n urlMap[href] = shortcut;\n }\n }\n }", "addBasicCommands() {\n this.addCommand(new commands.HelpCommand());\n }", "function bbedit_acpperms_undo_bits() {}", "function convertShortcut(shortcut) {\n\t\t\t\tvar i, value, replace = {};\n\n\t\t\t\tif (Env.mac) {\n\t\t\t\t\treplace = {\n\t\t\t\t\t\talt: '&#x2325;',\n\t\t\t\t\t\tctrl: '&#x2318;',\n\t\t\t\t\t\tshift: '&#x21E7;',\n\t\t\t\t\t\tmeta: '&#x2318;'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treplace = {\n\t\t\t\t\t\tmeta: 'Ctrl'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tshortcut = shortcut.split('+');\n\n\t\t\t\tfor (i = 0; i < shortcut.length; i++) {\n\t\t\t\t\tvalue = replace[shortcut[i].toLowerCase()];\n\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tshortcut[i] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn shortcut.join('+');\n\t\t\t}", "function convertShortcut(shortcut) {\n\t\t\t\tvar i, value, replace = {};\n\n\t\t\t\tif (Env.mac) {\n\t\t\t\t\treplace = {\n\t\t\t\t\t\talt: '&#x2325;',\n\t\t\t\t\t\tctrl: '&#x2318;',\n\t\t\t\t\t\tshift: '&#x21E7;',\n\t\t\t\t\t\tmeta: '&#x2318;'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treplace = {\n\t\t\t\t\t\tmeta: 'Ctrl'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tshortcut = shortcut.split('+');\n\n\t\t\t\tfor (i = 0; i < shortcut.length; i++) {\n\t\t\t\t\tvalue = replace[shortcut[i].toLowerCase()];\n\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tshortcut[i] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn shortcut.join('+');\n\t\t\t}", "function convertShortcut(shortcut) {\n\t\t\t\tvar i, value, replace = {};\n\n\t\t\t\tif (Env.mac) {\n\t\t\t\t\treplace = {\n\t\t\t\t\t\talt: '&#x2325;',\n\t\t\t\t\t\tctrl: '&#x2318;',\n\t\t\t\t\t\tshift: '&#x21E7;',\n\t\t\t\t\t\tmeta: '&#x2318;'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treplace = {\n\t\t\t\t\t\tmeta: 'Ctrl'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tshortcut = shortcut.split('+');\n\n\t\t\t\tfor (i = 0; i < shortcut.length; i++) {\n\t\t\t\t\tvalue = replace[shortcut[i].toLowerCase()];\n\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tshortcut[i] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn shortcut.join('+');\n\t\t\t}", "function actionHelp(helpAll) {\n\n \"use strict\";\n for(i = 0; i < helpAll.length; i++) {\n helpAll[i].addEventListener('click', help);\n }\n\n}", "function DDLightbarMenu_AddAdditionalQuitKeys(pAdditionalQuitKeys)\n{\n\tthis.additionalQuitKeys = this.additionalQuitKeys.concat(pAdditionalQuitKeys);\n}", "function setupHotbox() {\n hotbox.state(\"main\").button({\n position: \"center\",\n label: \"编辑\",\n key: \"F2\",\n enable: function() {\n return minder.queryCommandState(\"text\") != -1;\n },\n action: editText\n });\n }", "function applyShortcutLinksCssClasses() {\n\t\t\t$(\".popup-layout .menu li a:contains('profile')\").parent().addClass('profile');\n\t\t\t$(\".popup-layout .menu li a:contains('Logout')\").parent().addClass('logout');\n\n\t\t}", "function applyShortcutLinksCssClasses() {\n\t\t\t$(\".popup-layout .menu li a:contains('profile')\").parent().addClass('profile');\n\t\t\t$(\".popup-layout .menu li a:contains('Logout')\").parent().addClass('logout');\n\n\t\t}", "function addExtraButtons () {\n\tmw.toolbar.addButtons(\n\t{\n\t\t'imageId': 'button-redirect',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_redirect.png', \n\t\t'speedTip': 'Redirect',\n\t\t'tagOpen': '#REDIRECT[[',\n\t\t'tagClose': ']]',\n\t\t'sampleText': 'Target page name'\n\t},\n\t{\n\t\t'imageId': 'button-strike',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_strike.png', \n\t\t'speedTip': 'Strike',\n\t\t'tagOpen': '<s>',\n\t\t'tagClose': '</s>',\n\t\t'sampleText': 'Strike-through text'\n\t},\n\t{\n\t\t'imageId': 'button-enter',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_enter.png', \n\t\t'speedTip': 'Line break',\n\t\t'tagOpen': '<br/>',\n\t\t'tagClose': '',\n\t\t'sampleText': ''\n\t}, \n\t\t'imageId': 'button-hide-comment',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_hide_comment.png', \n\t\t'speedTip': 'Insert hidden Comment',\n\t\t'tagOpen': '<!-- ',\n\t\t'tagClose': ' -->',\n\t\t'sampleText': 'Comment'\n\t}, \n\t{\n\t\t'imageId': 'button-blockquote',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_blockquote.png',\n\t\t'speedTip': 'Insert block of quoted text',\n\t\t'tagOpen': '<blockquote>\\n',\n\t\t'tagClose': '\\n</blockquote>',\n\t\t'sampleText': 'Block quote'\n\t},\n\t{\n\t\t'imageId': 'button-insert-table',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_insert_table.png',\n\t\t'speedTip': 'Insert a table',\n\t\t'tagOpen': '{| class=\"wikitable\"\\n|',\n\t\t'tagClose': '\\n|}',\n\t\t'sampleText': '-\\n! header 1\\n! header 2\\n! header 3\\n|-\\n| row 1, cell 1\\n| row 1, cell 2\\n| row 1, cell 3\\n|-\\n| row 2, cell 1\\n| row 2, cell 2\\n| row 2, cell 3'\n\t},\n\t{\n\t\t'imageId': 'button-insert-reflink',\n\t\t'imageFile': '//static3.wikia.nocookie.net/psiepsilon/images/c/c9/Button_reflink.png',\n\t\t'speedTip': 'Insert a reference',\n\t\t'tagOpen': '<ref>',\n\t\t'tagClose': '</ref>',\n\t\t'sampleText': 'Insert footnote text here'\n\t}\n\t);\n}", "function set_shortcut(control, key_combination)\n {\n const components = key_combination.split(\"+\");\n control.querySelectorAll(\".mandatory-modifier input\").forEach(input =>\n {\n input.checked = input.value === components[0];\n });\n control.querySelector(\".optional-modifier input\").checked = components[1] === \"Shift\";\n control.querySelector(\".key\").value = components[components.length - 1];\n }", "constructor(wordMap, interruptMap, ignoreTheseKeys){\n\t\t/** <CONFIG/> **/\n // characters that are preferredly used for autogenerating link hints\n this.HOMEROW_CHARS = ['f', 'j', 'd', 's', 'g', 'h', 'k','l'];\n // characters that are used before deciding to make the word longer, as a second choice after all homerow combinations have been used\n this.OTHER_OKAY_CHARS = ['q','w','e','r','t','u','i','o','p','v','n','m'];\n // css class of the buttons that appear as link hints\n\t\tthis.LINKHINT_STYLE_CLASS = \"eric-reverse\";\n // css class added to the link hints when overlay mode is on. See notesToSelf/overlayMode.md\n this.LINKHINT_OVERLAY_CONTAINER_STYLE_CLASS = \"LB-overlay-container\";\n\t\t// Differ between images and not images\n\t\tthis.LINKHINT_OVERLAY_TEXT_CLASS = \"LB-overlay-wrapped-link-hint-text\";\n\t\tthis.LINKHINT_OVERLAY_IMAGE_CLASS = \"LB-overlay-wrapped-link-hint-image\";\n\n // internal config. It doesn't matter what you set here\n this.AUTOGEN_LINKHINT_ATTRIBUTE = \"brotkeysid\"; // used for counting all anchors. Throwaway property.\n // and then we add a UID to it so it works even with multiple HotkeyManagers\n this.UID = HotkeyManager.genHotkeyManagerUID();\n this.AUTOGEN_LINKHINT_ATTRIBUTE += this.UID;\n this.SWAP_CLASS_NAME_DEFAULT = \"LB-SS-swap1\"; // used for all link hints in order to swap them on and off if no other are provided\n\n // fake enum for adding more options later, for autogeneration of link hints\n // never use 0 in enums, since it could compare as equal to null or undefined or false\n this.GenerationEnum = Object.freeze({\"tag_anchor\":0b01,\"class_tagged\":0b10});\n this.GENERATION_CLASS_TAG = \"BKH\"; // default for class_tagged is the class \"BKH\", but this could be easily changed\n\n\t\t/** <CONFIG/> **/\n\n\n\t\t// initialize the string of what the user has entered to nothing\n\t\tthis.current_link_word = \"\";\n\t\t// set up the value for entering f_mode\n\t\tthis.F_MODE_PREFIX_CHAR = \"f\";\n\t\t// fake enum for easier changes instead of magic strings\n\t\tthis.ModeEnum = Object.freeze({\"f_mode\":1, \"pre_f_mode\":2, \"all_disabled\":3});\n\t\t// this.mode is used to distinguish between no f pressed yet, and when the user is entering the actual word. Avoids using hotkeys.setScope()\n\t\tthis.mode = this.ModeEnum.pre_f_mode;\n\t\t\n\t\t/*public*/ this.log_prefix = \"\"; // set this if you want. It's only used for logging\n\t\t\n\t\t// set up special keys that will interrupt the search for words at any time (and should thus not be used within valid words)\n\t\tthis.interruptMap_whenInFMode = interruptMap;\n\n\t\tthis.wordMap = wordMap;\n\t\t\n\t\t// config for key case insensitivity\n\t\tthis.fmode_caseInsensitivity = true;\n\t\tthis.interrupt_caseInsensitivity = true;\n\t\tthis.word_caseInsensitivity = true;\n\t\tthis.ignore_ShiftAndCapslock_inWordMode = true;\n\t\t\n\t\t// ignore no keys by default. Lower case stored, behaviour is case-insensitive ignoring.\n\t\tthis.ignoredKeys = [];\n\t\tif (ignoreTheseKeys != undefined) {\n\t\t\tthis.ignoredKeys = ignoreTheseKeys.map(function(b){return b.toLowerCase();});\n\t\t\tconst that = this;\n\t\t\tthis.HOMEROW_CHARS = this.HOMEROW_CHARS.filter(function(key){return !that.ignoredKeys.includes(key)});\n\t\t\tthis.OTHER_OKAY_CHARS = this.OTHER_OKAY_CHARS.filter(function(key){return !that.ignoredKeys.includes(key)});\n\t\t}\n\n // config for using overlay mode or in-content mode. True for overlay mode.\n this.setOverlayMode(true);\n\n\t\t// this css was not yet loaded (assumption may be wrong if you have multiple managers. But that just means that it will be loaded multiple times, which shouldn't be too bad.)\n this.__loadNeededJSCSSForStyleSwapping_alreadyLoaded = false;\n\n\n // set this to 0 if you need autogenerate to start overwriting previously generated link hints\n this.global_index = 0;\n\n // special iframe handling that is only implemented for autogenerateWithinId\n this.iframedocs_that_we_autogenerated_within = new Set();\n\t\t\n\t\tthis.hotkeys_init();\n\t}", "function add_i18n()\n {\n var i18n = {};\n\n i18n[I18N.LANG.EN] = {};\n i18n[I18N.LANG.EN][MODULE_NAME + '_short_desc'] = 'Enable shortcuts';\n i18n[I18N.LANG.EN][MODULE_NAME + '_full_desc'] = 'Let you use keyboard shortcuts in town to quickly access important places. The shortcuts are listed below : <br /><dl><dt>G + O</dt><dd>Overview</dd><dt>G + H</dt><dd>Home</dd><dt>G + W</dt><dd>Well</dd><dt>G + B</dt><dd>Bank</dd><dt>G + C</dt><dd>Citizens</dd><dt>G + D</dt><dd>Buildings</dd><dt>G + G</dt><dd>Gates</dd><dt>G + P</dt><dd>Town upgrades</dd><dt>G + T</dt><dd>Watchtower</dd><dt>G + M</dt><dd>Workshop</dd><dt>G + L</dt><dd>Night watch</dd></dl>';\n\n i18n[I18N.LANG.FR] = {};\n i18n[I18N.LANG.FR][MODULE_NAME + '_short_desc'] = 'Activer les raccourcis clavier';\n i18n[I18N.LANG.FR][MODULE_NAME + '_full_desc'] = 'Active des raccourcis claviers pour accéder rapidement aux places importantes en ville. Les raccourcis sont listés ci-dessous : <br /><dl><dt>G + O</dt><dd>Vue d\\'ensemble</dd><dt>G + H</dt><dd>Maison</dd><dt>G + W</dt><dd>Puits</dd><dt>G + B</dt><dd>Banque</dd><dt>G + C</dt><dd>Citoyens</dd><dt>G + D</dt><dd>Constructions</dd><dt>G + G</dt><dd>Portes</dd><dt>G + P</dt><dd>Évolutions</dd><dt>G + T</dt><dd>Tour de guet</dd><dt>G + M</dt><dd>Atelier</dd><dt>G + L</dt><dd>Veille</dd></dl>';\n\n I18N.set(i18n);\n }", "function saveShortcuts() {\n\n\tvar v_shortcut_list = [];\n\n\tfor (var property in v_shortcut_object.shortcuts) {\n if (v_shortcut_object.shortcuts.hasOwnProperty(property)) {\n v_shortcut_list.push(v_shortcut_object.shortcuts[property]);\n }\n }\n\n\tvar input = JSON.stringify({\n\t\t\"p_shortcuts\": v_shortcut_list,\n\t\t\"p_current_os\": v_current_os\n\t});\n\n\texecAjax('/save_shortcuts/',\n\t\t\tinput,\n\t\t\tfunction(p_return) {\n\t\t\t\tshowAlert('Shortcuts saved.');\n\n\t\t\t});\n}", "function addMenuCommands() {\n var navigateMenu = Menus.getMenu(Menus.AppMenuBar.NAVIGATE_MENU);\n var viewMenu = Menus.getMenu(Menus.AppMenuBar.VIEW_MENU);\n var registerCommandHandler = function (commandId, menuName, handler, shortcut, menu) {\n CommandManager.register(menuName, commandId, handler);\n menu.addMenuItem(commandId);\n KeyBindingManager.addBinding(commandId, shortcut);\n };\n\n navigateMenu.addMenuDivider();\n\n registerCommandHandler('georapbox.notes.viewNotes', Strings.COMMAND_NAME, togglePanel, 'Ctrl-Alt-Shift-N', viewMenu);\n }", "function setmouseactions() {\n setTuntematonMouseAction();\n setTunnetutMouseAction();\n setTeemaMouseAction();\n //TODO: \"vihje sana\" class + newly exposed missing\n}", "addSampleCommands() {\n this.addCommand(new sampleCommands.MagicEightBallCommand());\n this.addCommand(new sampleCommands.RollCommand());\n }", "function enableKeys() {\n var key;\n\n for (key in hotKeys) {\n if (hotKeys.hasOwnProperty(key)) {\n hotKeys[key].enable();\n }\n }\n }", "shortcutListener(e) {\n\t\tif (e.key === 'Enter') {\n\t\t\tthis.addItem();\n\t\t}\n\t}", "function addMetaKeysToCommand() {\n if (hasMetaKeys) {\n for (let [key, value] of metaKeysState.entries()) {\n if (value.selected) {\n command += value.name + '+';\n }\n }\n }\n}", "_addKeypress() {\n\t\tif (this.options.keyword) {\n\t\t\tthis.keylog = [];\n\t\t\tthis.keyword = this.options.keyword;\n\t\t\tthis._onKeypress = this._onKeypress.bind(this);\n\t\t\tdocument.addEventListener('keypress', this._onKeypress);\n\t\t}\n\t}", "function addAliases(aliases) {\n Object.assign(fileAliases, aliases);\n}", "function addAliases(aliases) {\n Object.assign(fileAliases, aliases);\n}", "function setupactions() {\n\t\tif (ts.ui.appframe) {\n\t\t\tdoaction = function(data) {\n\t\t\t\tgui.Action.ascendGlobal(document, up, data);\n\t\t\t\thandleactions();\n\t\t\t};\n\t\t} else if (ts.ui.subframe) {\n\t\t\tgui.get('main', function(main) {\n\t\t\t\tdoaction = function(data) {\n\t\t\t\t\tmain.action.descendGlobal(down, data);\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t}", "function showhelp(){\n var helpWin = document.getElementById('shortcuthelp')\n if (helpWin){\n if (helpWin.style.display == \"block\"){\n helpWin.style.display = \"none\";\n }\n else {\n helpWin.style.top = window.pageYOffset+40;\n helpWin.style.display = \"block\";\n }\n }\n else {\n helpWin = document.createElement(\"div\");\n helpText = document.createElement(\"div\");\n helpWin.setAttribute(\"id\",\"shortcuthelp\");\n helpWin.innerHTML = \"<div style='color:black; background-color:#ff6600; width:100%; font-weight:bold;'>Shortcut commands</div><div style='font-size:.8em;'><i>Use shift as a modifier</i></div>\";\n helpWin.appendChild(helpText);\n for( i in ACTIONS) {\n helpText.innerHTML += \"<pre style='display:inline'>\"+i+\"</pre> : \"+ ACTIONS[i][0]+\"<br/>\";\n if (ACTIONS[i][1].length > 0 ){\n helpText.innerHTML += \"<pre style='display:inline; padding-left:1em;'>\"+i.toUpperCase()+\"</pre> : \"+ ACTIONS[i][1]+\"<br/>\";\n }\n }\n helpWin.setAttribute(\"style\",\"display: block; position: absolute; top: \"+(window.pageYOffset+40)+\"px; right: 10px; background-color: rgb(246, 246, 239);\");\n helpText.setAttribute(\"style\",\"padding:5px;\");\n \n document.childNodes[0].childNodes[1].appendChild(helpWin);\n }\n}", "bindKeys(){\n this.installHotkey('t', () => this.setDisposition(TRIVI), '0Touched: Trivially');\n this.installHotkey('d', () => this.setDisposition(DISAB), 'NRN: Disability');\n this.installHotkey('b', () => this.setDisposition(BADNUM), '2BadNumber: Wrong Number');\n this.installHotkey('x', () => this.setDisposition(XFER), '0Touched: Transferred' );\n this.installHotkey('w', () => this.setDisposition(WILLNOTBUY), 'NRN: Will Not Buy Right Now');\n this.installHotkey('u', () => this.setDisposition(UNINSURE), 'NRN: Uninsurable');\n this.installHotkey('q', () => this.setDisposition(DNC), 'NFC: DNC List' );\n\n\n\n this.installHotkey('n', () => this.setDisposition(NOVM), '0Not Contacted: No VM');\n this.installHotkey('l', () => this.setDisposition(LEFTVM), '0Not Contacted: Left Voicemail');\n this.installHotkey('h', () => this.hangUp(), 'Hang up');\n // $j(document).bind('keydown', 'ctrl+n', this.binder('n'));\n // $j(document).bind('keydown', 'ctrl+l', this.binder('l'));\n }", "function showShortcutMenu() {\n //Builds the shortcut options\n let shortcutOptions = [\n { name: 'Nothing', val: false },\n { name: 'Launcher', val: '#LAUNCHER' },\n ];\n\n let infoFiles = storage.list(/\\.info$/).sort((a, b) => {\n if (a.name < b.name) return -1;\n else if (a.name > b.name) return 1;\n else return 0;\n });\n for (let infoFile of infoFiles) {\n let appInfo = storage.readJSON(infoFile);\n if (appInfo.src) shortcutOptions.push({\n name: appInfo.name,\n val: appInfo.id\n });\n }\n\n E.showMenu({\n '': {\n 'title': 'Shortcuts',\n 'back': showMainMenu\n },\n 'Top first': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[0]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[0] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[0] = false;\n saveSettings();\n }\n },\n 'Top second': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[1]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[1] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[1] = false;\n saveSettings();\n }\n },\n 'Top third': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[2]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[2] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[2] = false;\n saveSettings();\n }\n },\n 'Top fourth': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[3]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[3] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[3] = false;\n saveSettings();\n }\n },\n 'Bottom first': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[4]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[4] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[4] = false;\n saveSettings();\n }\n },\n 'Bottom second': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[5]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[5] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[5] = false;\n saveSettings();\n }\n },\n 'Bottom third': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[6]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[6] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[6] = false;\n saveSettings();\n }\n },\n 'Bottom fourth': {\n value: shortcutOptions.map(item => item.val).indexOf(config.shortcuts[7]),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.shortcuts[7] = shortcutOptions[value].val;\n config.fastLoad.shortcuts[7] = false;\n saveSettings();\n }\n },\n 'Swipe up': {\n value: shortcutOptions.map(item => item.val).indexOf(config.swipe.up),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.swipe.up = shortcutOptions[value].val;\n config.fastLoad.swipe.up = false;\n saveSettings();\n }\n },\n 'Swipe down': {\n value: shortcutOptions.map(item => item.val).indexOf(config.swipe.down),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.swipe.down = shortcutOptions[value].val;\n config.fastLoad.swipe.down = false;\n saveSettings();\n }\n },\n 'Swipe left': {\n value: shortcutOptions.map(item => item.val).indexOf(config.swipe.left),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.swipe.left = shortcutOptions[value].val;\n config.fastLoad.swipe.left = false;\n saveSettings();\n }\n },\n 'Swipe right': {\n value: shortcutOptions.map(item => item.val).indexOf(config.swipe.right),\n format: value => (value == -1) ? 'Unknown app!' : shortcutOptions[value].name,\n min: 0,\n max: shortcutOptions.length - 1,\n wrap: false,\n onchange: value => {\n config.swipe.right = shortcutOptions[value].val;\n config.fastLoad.swipe.right = false;\n saveSettings();\n }\n }\n });\n }", "function extendAliases (...args) {\n args.forEach(function (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n // short-circuit if we've already added a key\n // to the aliases array, for example it might\n // exist in both 'opts.default' and 'opts.key'.\n if (flags.aliases[key]) return\n\n flags.aliases[key] = [].concat(aliases[key] || [])\n // For \"--option-name\", also set argv.optionName\n flags.aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x) && configuration['camel-case-expansion']) {\n var c = camelCase(x)\n if (c !== key && flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n newAliases[c] = true\n }\n }\n })\n // For \"--optionName\", also set argv['option-name']\n flags.aliases[key].concat(key).forEach(function (x) {\n if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {\n var c = decamelize(x, '-')\n if (c !== key && flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n newAliases[c] = true\n }\n }\n })\n flags.aliases[key].forEach(function (x) {\n flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n })\n }", "function extendAliases (...args) {\n args.forEach(function (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n // short-circuit if we've already added a key\n // to the aliases array, for example it might\n // exist in both 'opts.default' and 'opts.key'.\n if (flags.aliases[key]) return\n\n flags.aliases[key] = [].concat(aliases[key] || [])\n // For \"--option-name\", also set argv.optionName\n flags.aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x) && configuration['camel-case-expansion']) {\n var c = camelCase(x)\n if (c !== key && flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n newAliases[c] = true\n }\n }\n })\n // For \"--optionName\", also set argv['option-name']\n flags.aliases[key].concat(key).forEach(function (x) {\n if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {\n var c = decamelize(x, '-')\n if (c !== key && flags.aliases[key].indexOf(c) === -1) {\n flags.aliases[key].push(c)\n newAliases[c] = true\n }\n }\n })\n flags.aliases[key].forEach(function (x) {\n flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n })\n }", "function addInputs(defaultPopup, newInput, newButton, newImage) {\r\n\tvar unusedLink = true;\r\n\tvar currentKeyword;\r\n\r\n\tnewInput.setAttribute(\"type\", \"text\");\r\n\tnewInput.setAttribute(\"maxlength\", \"100\");\r\n\r\n\t// Check that the input is valid when a key is pressed, if it is not the enter key\r\n\tnewInput.addEventListener(\"keyup\", function(e) {if (e.which !== 13) checkInput(this)});\r\n\r\n\t// Check that the input is valid when any changes are made\r\n\tnewInput.addEventListener(\"keypress\", function() {checkInput(this)});\r\n\tnewInput.addEventListener(\"paste\", function() {checkInput(this)});\r\n\r\n\tchrome.tabs.getSelected(function(tab) {\r\n\t\tvar url = tab.url;\r\n\r\n\t\t// Checks if the current tab's url is already associated with a keylink\r\n\t\tfor (var keyword in KEYLINKS) {\r\n\t\t\tif (KEYLINKS[keyword].link === url) {\r\n\t\t\t\tcurrentKeyword = keyword;\r\n\t\t\t\tunusedLink = false;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (unusedLink) {\r\n\r\n\t\t\tif (defaultPopup) {\r\n\t\t\t\tCURRENT_TAB = \"add\";\r\n\t\t\t\tdocument.getElementById(\"menutitle\").innerHTML = \"Add Bookmark\";\r\n\t\t\t} else {\r\n\t\t\t\tCURRENT_TAB = \"tooladd\";\r\n\t\t\t}\r\n\r\n\t\t\tnewButton.disabled = true;\r\n\r\n\t\t\tnewImage.src = SOURCE.add;\r\n\t\t\tnewImage.title = \"Add\";\r\n\t\t\tnewImage.dataset.add = \"true\";\r\n\r\n\t\t\tnewInput.addEventListener(\"keydown\", function(e) {\r\n\t\t\t\tcheckInput(this);\r\n\r\n\t\t\t\tif (!this.parentNode.lastChild.disabled && e.which === 13) {\r\n\r\n\t\t\t\t\tvar keyword = this.value;\r\n\t\t\t\t\tthis.value = \"\";\r\n\t\t\t\t\tthis.parentNode.lastChild.disabled = true;\r\n\t\t\t\t\taddKeylink(keyword, url);\r\n\r\n\t\t\t\t\t(this.id === \"addinput\") ? addTab() : toolbarTab();\r\n\r\n\t\t\t\t\tif (SETTINGS.CLOSE_POPUP_AFTER_KEYLINK_CHANGES_IN_ADD_TAB) window.close();\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tnewButton.addEventListener(\"click\", function() {\r\n\t\t\t\tif (!this.disabled) {\r\n\r\n\t\t\t\t\tvar keyword = this.parentNode.firstChild.value;\r\n\t\t\t\t\tthis.parentNode.firstChild.value = \"\";\r\n\t\t\t\t\tthis.disabled = true;\r\n\t\t\t\t\taddKeylink(keyword, url);\r\n\r\n\t\t\t\t\t(this.id === \"addbookmark\") ? addTab() : toolbarTab();\r\n\r\n\t\t\t\t\tif (SETTINGS.CLOSE_POPUP_AFTER_KEYLINK_CHANGES_IN_ADD_TAB) window.close();\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t} else {\r\n\r\n\r\n\r\n\t\t\tif (defaultPopup) {\r\n\t\t\t\tCURRENT_TAB = \"change\";\r\n\t\t\t\tdocument.getElementById(\"menutitle\").innerHTML = \"Change Bookmark\";\r\n\t\t\t} else {\r\n\t\t\t\tCURRENT_TAB = \"toolchange\";\r\n\t\t\t}\r\n\r\n\t\t\tnewInput.value = currentKeyword;\r\n\t\t\tOLD_KEYWORD = currentKeyword;\r\n\r\n\t\t\tnewButton.disabled = false;\r\n\r\n\t\t\tnewImage.src = SOURCE.deleting;\r\n\t\t\tnewImage.title = \"Delete\";\r\n\r\n\t\t\t// If the input is in the default popup and the keylink stats option is enabled, display keylink stats\r\n\t\t\tif (defaultPopup && SETTINGS.SHOW_KEYLINK_STATS_IN_ADD_TAB) keylinkStatistics(menu, currentKeyword);\r\n\r\n\t\t\tnewInput.addEventListener(\"focus\", function() {\r\n\t\t\t\tthis.select();\r\n\t\t\t\tOLD_KEYWORD = this.value;\r\n\t\t\t});\r\n\r\n\t\t\tnewInput.addEventListener(\"keydown\", function(e) {\r\n\t\t\t\tif (e.which === 13) this.blur();\r\n\t\t\t});\r\n\r\n\t\t\tnewInput.addEventListener(\"change\", function() {\r\n\t\t\t\tif (this.value === \"\" || !checkInput(this)) {\r\n\r\n\t\t\t\t\tconsole.log(OLD_KEYWORD);\r\n\t\t\t\t\tthis.value = OLD_KEYWORD;\r\n\t\t\t\t\tthis.style.borderColor = null;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tvar keyword = this.parentNode.firstChild.value;\r\n\r\n\t\t\t\t\tKEYLINKS[keyword] = KEYLINKS[OLD_KEYWORD];\r\n\t\t\t\t\tdelete KEYLINKS[OLD_KEYWORD];\r\n\r\n\t\t\t\t\tif (SETTINGS.CLOSE_POPUP_AFTER_KEYLINK_CHANGES_IN_ADD_TAB) window.close();\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tnewButton.addEventListener(\"click\", function() {\r\n\t\t\t\tdeleteKeylink(this);\r\n\r\n\t\t\t\t(this.id === \"addbookmark\") ? addTab() : toolbarTab();\r\n\r\n\t\t\t\tif (SETTINGS.CLOSE_POPUP_AFTER_KEYLINK_CHANGES_IN_ADD_TAB) window.close();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Suggests a possible keyword based on the webpage title\r\n\t\tif (SETTINGS.SUGGEST_KEYWORDS_WHEN_ADDING_KEYLINK && newButton.disabled) {\r\n\t\t\tvar title = titleSuggestion(tab.title);\r\n\r\n\t\t\tnewButton.disabled = false;\r\n\t\t\tnewInput.value = title;\r\n\r\n\t\t\tcheckInput(newInput);\r\n\t\t}\r\n\r\n\t\tnewInput.select();\r\n\r\n\t});\r\n\r\n}", "addAcceptedCommands(commands) {\n for(let command of commands) {\n this.addAcceptedCommand(command);\n }\n }", "function registerKeys() {\r\n var usedKeys = [\r\n 'MediaFastForward',\r\n 'MediaPause',\r\n 'MediaPlay',\r\n 'MediaRewind',\r\n 'MediaStop'\r\n ];\r\n\r\n usedKeys.forEach(\r\n function(keyName) {\r\n tizen.tvinputdevice.registerKey(keyName);\r\n }\r\n );\r\n }", "function extendAliases (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n aliases[key] = [].concat(opts.alias[key] || [])\n // For \"--option-name\", also set argv.optionName\n aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x)) {\n var c = camelCase(x)\n aliases[key].push(c)\n newAliases[c] = true\n }\n })\n aliases[key].forEach(function (x) {\n aliases[x] = [key].concat(aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n }", "function hotKeys (event) {\r\n\r\n // Get details of the event dependent upon browser\r\n event = (event) ? event : ((window.event) ? event : null);\r\n eventKey = event;\r\n // We have found the event.\r\n if (event) {\r\n\r\n // Hotkeys require that either the control key or the alt key is being held down\r\n if (event.keyCode > 111 && event.keyCode < 123) {\r\n\r\n var actionCode = event.keyCode; //save the current press PF?\r\n\r\n // Now scan through the user-defined array to see if character has been defined.\r\n for (var i = 0; i < keyActions.length; i++) {\r\n\r\n // See if the next array element contains the Hotkey character\r\n if (keyActions[i].character == actionCode) {\r\n\r\n // Yes - pick up the action from the table\r\n var action;\r\n\r\n // If the action is a hyperlink, create JavaScript instruction in an anonymous function\r\n if (keyActions[i].actionType.toLowerCase() == \"link\") {\r\n action = new Function ('location.href =\"' + keyActions[i].param + '\"');\r\n }\r\n\r\n // If the action is JavaScript, embed it in an anonymous function\r\n else if (keyActions[i].actionType.toLowerCase() == \"code\") {\r\n action = new Function (keyActions[i].param);\r\n }\r\n\r\n // Error - unrecognised action.\r\n else {\r\n alert ('Hotkey Function Error: Action should be \"link\" or \"code\"');\r\n break;\r\n }\r\n\r\n // At last perform the required action from within an anonymous function.\r\n action ();\r\n\r\n // Hotkey actioned - exit from the for loop.\r\n break;\r\n }\r\n }\r\n }else if( (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 97 && event.keyCode <= 113) || (event.keyCode >= 48 && event.keyCode <= 57)){\r\n\t\talterado = true;\r\n\t}\r\n }\r\n return true;\r\n}", "function registerCommands()\n{\n addCMD([\"cmd\", listCmds, \"Prints list of available commands\"]);\n addSynonimOf(\"cmd\", \"cmds\");\n addSynonimOf(\"cmd\", \"commands\");\n\n addCMD([\"test\", test, \"Just a test\"]);\n addCMD([\"invite\", inviteMeLink, \"I'll give you invite link to me!\", [], true]);\n\n addCMD([\"say\", say, \"I'll say some instead you! (attachments also supported!)\\n__*Syntax:*__ say <any your text>\"]);\n addCMD([\"saytts\", sayTTS, \"I'll help to pronuncate you some!\\n__*Syntax:*__ saytts <any your text>\"]);\n addCMD([\"whosaid\", sayLog, \":spy: Shsh! I'll leak you secret - who asked me to say (5 last messages)\\n\"]);\n addCMD([\"setgame\", setPlayingGame, \"I'll play any game you suggesting me!\\n\" +\n \"__*Syntax:*__ setgame <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n addCMD([\"setmusic\", setListeningMusic,\"I'll listen any music you suggesting me!\\n\" +\n \"__*Syntax:*__ setmusic <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n addCMD([\"setvideo\", setWatchingVideo, \"I'll watch any video suggesting me!\\n\" +\n \"__*Syntax:*__ setvideo <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n addCMD([\"setstream\",setStreaming, \"I'll stream anything you ask me!\\n\" +\n \"__*Syntax:*__ setstream <any your text>\\n\\n**NOTE:** Only permited users can use this command!\"]);\n\n addCMD([\"remind\", sayDelayd, \":information_desk_person: I'll remeber a thing you request me!\\n__*Syntax:*__ remind <any your text> after <time> <seconds, minutes, hours>\\n\", [], true]);\n addCMD([\"remindme\", sayDelaydME, \":information_desk_person: I'll remeber you personally a thing you request me!\\n__*Syntax:*__ remindMe <any your text> after <time> <seconds, minutes, hours>\\n\", [], true]);\n\n addCMD([\"err\", wrongFunction, \"It hurts me...\"]);\n\n addCMD([\"isbeepboop\",isBeepBoop, \"Check is this server has a beep-boop channel\"]);\n addSynonimOf(\"isbeepboop\",\"isfun\", \"Check is this server has a beep-boop/fun channel\");\n\n addCMD([\"mytime\", myTime, \"Let's check our watches? :clock: :watch: :stopwatch: :clock1: \"]);\n addCMD([\"stats\", aboutBot, \"Just my health state\"]);\n addSynonimOf(\"stats\", \"about\", \"Wanna meet me?\");\n addCMD([\"uptime\", upTimeBot, \"How long I still be here\"]);\n\n addCMD([\"help\", cmdHelp, \"Prints help of command\"]);\n\n addCMD([\"mailwohlstand\", sendEmail, \"Send email to my creator while he is offline. (Attachments are supported!) \\n\" +\n \"__*Syntax:*__ mailwohlstand <any your text>\", [], true]);\n\n addCMD([\"check-in-list\", cachedFiles_Check, \"Check the existing of something in one of built-in lists\", [], true]);\n addCMD([\"reload-lists\", cachedFiles_ReLeload, \"<Owner-Only> Reload built-in lists\", [], true]);\n\n\n foxyLogInfo( Cmds.length + \" command has been registered!\");\n}", "function addAllClipboardMI() {\n\t\t\tconsole.log(\"addAllClipboardMI()\");\n\n for(var i=0;i<vm.apiDomain.mutationInvolves.length; i++) {\n\t\t\t\taddClipboardMI(i);\n\t\t\t}\n\t\t}", "function doRegisterCommands() {\r\n GM_registerMenuCommand('Configurar ' + appName + ' ' + appVersion + '...', preferences);\r\n GM_registerMenuCommand('Ver información de depurado', showLog);\r\n }", "registerHooks() {\n this.addLocalHook('click', () => this.onClick());\n this.addLocalHook('keyup', event => this.onKeyup(event));\n }", "function selectAll() {\n\t\t\teditor.shortcuts.add('meta+a', null, 'SelectAll');\n\t\t}", "function selectAll() {\n\t\t\teditor.shortcuts.add('meta+a', null, 'SelectAll');\n\t\t}", "function selectAll() {\n\t\t\teditor.shortcuts.add('meta+a', null, 'SelectAll');\n\t\t}", "function SimpleKeyNavigation() {\n }", "function fixShortcut(name) {\n\t\t\tif(isMac) {\n\t\t\t\tname = name.replace(\"Ctrl\", \"Cmd\");\n\t\t\t} else {\n\t\t\t\tname = name.replace(\"Cmd\", \"Ctrl\");\n\t\t\t}\n\t\t\treturn name;\n\t\t}", "addAcceptedCommand(command, helpText, buttonLabel, buttonStyle) {\n let c = command.toLowerCase();\n for(let accepted of this.acceptedCommands) {\n if(c === accepted) {\n Logger.error(\"Control::addAcceptedCommand() Command already configured as accepted: \" + c);\n return;\n }\n }\n Logger.debug(\"Control::addAcceptedCommand() Command configured as accepted: \" + c);\n this.acceptedCommands.push(c);\n this.acceptedRegex.push(RegexTools.getStartCommandRegex(c));\n if(helpText != null) {\n this.acceptedHelpTexts[command] = helpText;\n }\n if(buttonLabel != null) {\n this.acceptedButtonLabels[command] = buttonLabel;\n }\n if(buttonStyle != null) {\n this.acceptedButtonStyles[command] = buttonStyle;\n }\n }", "function skipToCenter() {\r\n addNewCommand(\"Go\");\r\n addNewCommand(\"Get\");\r\n addNewCommand(\"Use\");\r\n actions[1] = \"go\"\r\n actions[2] = \"get\"\r\n actions[3] = \"use\"\r\n}", "function onPressShortcut(e) {\n if (e.ctrlKey) {\n const keyPressed = String.fromCharCode(e.keyCode).toLowerCase();\n const $tool = document.querySelector(`a[data-shortcut=\"${keyPressed}\"]`);\n\n if ($tool) {\n $tool.click();\n }\n }\n}", "function bindShortcuts() {\n // Arrow keys\n jQuery(document).bind('keydown', 'right', function(e) {\n e.preventDefault();\n _renderer.scrollRight();\n });\n\n jQuery(document).bind('keydown', 'left', function(e) {\n e.preventDefault();\n _renderer.scrollLeft();\n });\n\n jQuery(document).bind('keydown', 'up', function(e) {\n e.preventDefault();\n _renderer.scrollUp();\n });\n\n jQuery(document).bind('keydown', 'down', function(e) {\n e.preventDefault();\n _renderer.scrollDown();\n });\n\n // Vi like browsing.\n jQuery(document).bind('keydown', 'j', function() {\n _renderer.scrollRight();\n });\n\n jQuery(document).bind('keydown', 'h', function() {\n _renderer.scrollLeft();\n });\n\n jQuery(document).bind('keydown', 'k', function() {\n _renderer.scrollUp();\n });\n\n jQuery(document).bind('keydown', 'l', function() {\n _renderer.scrollDown();\n });\n\n // Page ups and downs using ctrl + arrow keys\n jQuery(document).bind('keydown', 'ctrl+up', function() {\n _renderer.pageUp();\n });\n\n jQuery(document).bind('keydown', 'ctrl+down', function() {\n _renderer.pageDown();\n });\n\n jQuery(document).bind('keydown', 'ctrl+left', function() {\n _renderer.pageLeft();\n });\n\n jQuery(document).bind('keydown', 'ctrl+right', function() {\n _renderer.pageRight();\n });\n \n jQuery(document).bind('keydown', 'i', function() {\n console.log('zoom in');\n _renderer.zoomIn();\n });\n\n jQuery(document).bind('keydown', 'o', function() {\n console.log('zoom out');\n _renderer.zoomOut();\n });\n\n _elem.mousewheel(function(event, delta) {\n var scrollLeft, scrollRight, scrollUp, scrollRight;\n\n if (event.ctrlKey) {\n // If ctrl key is down, we scroll by page.\n scrollLeft = _renderer.pageLeft;\n scrollRight = _renderer.pageRight;\n // If shift key is down, we do horizontal scroll instead of vertical.\n scrollDown = (event.shiftKey) ? _renderer.pageRight : _renderer.pageDown;\n scrollUp = (event.shiftKey) ? _renderer.pageLeft : _renderer.pageUp;\n } else {\n scrollLeft = _renderer.scrollLeft;\n scrollRight = _renderer.scrollRight;\n // If shift key is down, we do horizontal scroll instead of vertical.\n scrollDown = (event.shiftKey) ? _renderer.scrollRight : _renderer.scrollDown;\n scrollUp = (event.shiftKey) ? _renderer.scrollLeft : _renderer.scrollUp;\n }\n \n // Is mouse wheel scrolled horizontally?\n if (event.originalEvent.wheelDeltaX > 0) {\n scrollLeft();\n } else if (event.originalEvent.wheelDeltaX < 0) {\n scrollRight();\n }\n\n // Is mouse wheel scrolled vertically?\n if (event.originalEvent.wheelDeltaY > 0) {\n scrollUp();\n } else if (event.originalEvent.wheelDeltaY < 0) {\n scrollDown();\n }\n });\n }", "function extendAliases (obj) {\n Object.keys(obj || {}).forEach(function (key) {\n // short-circuit if we've already added a key\n // to the aliases array, for example it might\n // exist in both 'opts.default' and 'opts.key'.\n if (aliases[key]) return\n\n aliases[key] = [].concat(opts.alias[key] || [])\n // For \"--option-name\", also set argv.optionName\n aliases[key].concat(key).forEach(function (x) {\n if (/-/.test(x)) {\n var c = camelCase(x)\n aliases[key].push(c)\n newAliases[c] = true\n }\n })\n aliases[key].forEach(function (x) {\n aliases[x] = [key].concat(aliases[key].filter(function (y) {\n return x !== y\n }))\n })\n })\n }", "function createNormalModeKeyboardShortcuts(_) {\n var normalModeKeyboardShortcuts = [['enter', 'edit mode', switchToEditMode],\n // [ 'shift+enter', 'run cell, select below', runCellAndSelectBelow ]\n // [ 'ctrl+enter', 'run cell', runCell ]\n // [ 'alt+enter', 'run cell, insert below', runCellAndInsertBelow ]\n ['y', 'to code', convertCellToCode], ['m', 'to markdown', convertCellToMarkdown], ['r', 'to raw', convertCellToRaw], ['1', 'to heading 1', convertCellToHeading(_, 1)], ['2', 'to heading 2', convertCellToHeading(_, 2)], ['3', 'to heading 3', convertCellToHeading(_, 3)], ['4', 'to heading 4', convertCellToHeading(_, 4)], ['5', 'to heading 5', convertCellToHeading(_, 5)], ['6', 'to heading 6', convertCellToHeading(_, 6)], ['up', 'select previous cell', selectPreviousCell], ['down', 'select next cell', selectNextCell], ['k', 'select previous cell', selectPreviousCell], ['j', 'select next cell', selectNextCell], ['ctrl+k', 'move cell up', moveCellUp], ['ctrl+j', 'move cell down', moveCellDown], ['a', 'insert cell above', insertNewCellAbove], ['b', 'insert cell below', insertNewCellBelow], ['x', 'cut cell', cutCell], ['c', 'copy cell', copyCell], ['shift+v', 'paste cell above', pasteCellAbove], ['v', 'paste cell below', pasteCellBelow], ['z', 'undo last delete', undoLastDelete], ['d d', 'delete cell (press twice)', deleteCell], ['shift+m', 'merge cell below', mergeCellBelow], ['s', 'save notebook', saveNotebook],\n // [ 'mod+s', 'save notebook', saveNotebook ]\n // [ 'l', 'toggle line numbers' ]\n ['o', 'toggle output', toggleOutput$1],\n // [ 'shift+o', 'toggle output scrolling' ]\n ['h', 'keyboard shortcuts', displayKeyboardShortcuts]];\n\n if (_.onSparklingWater) {\n normalModeKeyboardShortcuts.push(['q', 'to Scala', convertCellToScala]);\n }\n\n return normalModeKeyboardShortcuts;\n }", "function LoadKeyboardShortcuts(ScriptName) {\n\tif (localStorage[ScriptName + 'KBS']) {\n\t\tvar LoadedKBS = JSON.parse(localStorage[ScriptName + 'KBS']); //JSON.parse(localStorage['WMEAwesomeKBS']);\n\t\tfor (var i = 0; i < LoadedKBS.length; i++) {\n\t\t\tW.accelerators._registerShortcuts(LoadedKBS[i]);\n\t\t}\n\t}\n }", "function keyboardShortcuts(event) {\n const {\n key\n } = event;\n console.log(key);\n switch (key) {\n case ' ':\n togglePlay();\n animatePlayback();\n if (video.paused) {\n showControls();\n } else {\n setTimeout(() => {\n hideControls();\n }, 2000);\n }\n break;\n case 'm':\n toggleMute();\n break;\n case 'f':\n toggleFullScreen();\n break;\n case 'p':\n togglePip();\n break;\n }\n}" ]
[ "0.69841486", "0.640429", "0.63478136", "0.62649816", "0.62353706", "0.61996704", "0.615741", "0.61306745", "0.6121475", "0.6035658", "0.59772706", "0.5701384", "0.56925005", "0.5683325", "0.5677872", "0.56714946", "0.56605667", "0.56552994", "0.5649782", "0.5630397", "0.56181324", "0.5610954", "0.56093395", "0.5574679", "0.5565344", "0.5564649", "0.55318063", "0.551405", "0.5495372", "0.5493859", "0.5481092", "0.5470546", "0.5470546", "0.54481834", "0.54418164", "0.5441129", "0.5433232", "0.54204583", "0.53884006", "0.53804964", "0.537686", "0.531813", "0.5277932", "0.5267067", "0.52512044", "0.52436346", "0.5238334", "0.52378416", "0.5228201", "0.5227368", "0.5220194", "0.5220194", "0.5220194", "0.52043355", "0.5198338", "0.51841515", "0.5183841", "0.5183841", "0.5183249", "0.5181414", "0.5176092", "0.5175599", "0.51730144", "0.51599675", "0.5149113", "0.5142904", "0.51386255", "0.51353866", "0.5134423", "0.51306105", "0.51120186", "0.51120186", "0.5104334", "0.509261", "0.50885147", "0.5084665", "0.50842834", "0.50842834", "0.50838625", "0.5072176", "0.5064046", "0.5058531", "0.50489104", "0.5011354", "0.50088984", "0.50083613", "0.50040525", "0.5000105", "0.5000105", "0.5000105", "0.49967793", "0.4991716", "0.49831125", "0.49773604", "0.49716398", "0.4959375", "0.49533746", "0.4949783", "0.49383482", "0.49337828" ]
0.6204524
5
init the playbuttons in the editing box
function initPlayButtons() { $('#clearList').button(); $('#clearList').click(function() { clearSegmentList(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initPlayBtn() {\n\tvar phase_intro = '<a href=\"#\" id=\"phase_intro\" class=\"border-radius\">Synopsis</a>';\n\t\n\t$('.tl_ctrl_bar').append(phase_intro);\n\t\n\t$('#phase_intro').click(function() {\n\t\tstopAnimation();\n\t\tloadIntro($(this).attr('data-ref'));\n\t\t$.cookie('phaseIntro',true);\n\t});\n\t\n\t//play button image\n\t$('#tl_controls .play_btn, #tl_controls .tl_ctrls_play').live('click', function() {\n\t\tplayAnimation();\n\t});\n\t\n\t$('#tl_controls .pause_btn, #tl_controls .tl_ctrls_pause').live('click', function() {\n\t\tstopAnimation();\n\t});\n}", "function initBtns(){\n okbtn = {\n x: (width - s_buttons.Ok.width)/2,\n y : height/1.8,\n width : s_buttons.Ok.width,\n height :s_buttons.Ok.height\n };\n \n startbtn = {\n x: (width - s_buttons.Score.width)/2,\n y : height/2.5,\n width : s_buttons.Score.width,\n height :s_buttons.Score.height\n };\n \n scorebtn = {\n x: (width - s_buttons.Score.width)/2,\n y : height/2,\n width : s_buttons.Score.width,\n height :s_buttons.Score.height\n };\n \n menubtn = {\n x:(width - 2*s_buttons.Menu.width),\n y : height/1.8,\n width : s_buttons.Menu.width,\n height :s_buttons.Menu.height\n };\n \n resetbtn = {\n x: (s_buttons.Reset.width),\n y : height/1.8,\n width : s_buttons.Reset.width,\n height :s_buttons.Reset.height\n };\n}", "function setPlaybackButtons() {\n\t\t$('.play-button').click(function(event,ui) {\n\t\t\tif(pageData.compiledMidi && (!MIDI.Player.playing)) {//if we have something to play and not already playing\n\t\t\t\tif(MIDI.Player.endTime === MIDI.Player.currentTime) {\n\t\t\t\t\tMIDI.Player.stop();//reset to start\n\t\t\t\t\tMIDI.Player.start();\n\t\t\t\t} else if(MIDI.Player.currentTime > 0) {//if not at the start\n\t\t\t\t\tMIDI.Player.resume();\n\t\t\t\t} else {\n\t\t\t\t\tMIDI.Player.start();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else if(!pageData.compiledMidi) {\n\t\t\t\talert('Please compile your Jingle before trying to play!');\n\t\t\t} \n\t\t});\n\t\t$('.pause-button').click(function(event,ui) {\n\t\t\tif(MIDI.Player.playing) {\n\t\t\t\tMIDI.Player.pause();\n\t\t\t}\n\t\t});\n\t\t$('.stop-button').click(resetPlayer);\n\t\t$('.compile-button').click(function(event,ui) {\n\t\t\tpageData.compiledMidi = false;\n\t\t\t$('.progress-bar').html('Compiling tune').css({\n\t\t\t\t'width' : '100%'\n\t\t\t});\n\t\t\tajaxHelper.compileTune(pageData.songId,function(data) {//fetch compiled tune from server and load it\n\t\t\t\tloadMidi(data);\n\t\t\t});\n\t\t});\n\t}", "function init(){\n var playButton = document.getElementById(\"play\");\n playButton.addEventListener(\"click\", play);\n}", "function init(){\n const playButton = document.getElementById('play');\n playButton.addEventListener('click', play);\n}", "function init(){\n\t\tvar playButtonA = document.getElementById('a');\n\t\tplayButtonA.addEventListener('click', playAudioA, false);\n\n\t\tvar playButtonB = document.getElementById('b');\n\t\tplayButtonB.addEventListener('click', playAudioB, false);\n\t\t\t\n\t\tvar playButtonC = document.getElementById('c');\n\t\tplayButtonC.addEventListener('click', playAudioC, false);\n\n\t\tvar playButtonD = document.getElementById('d');\n\t\tplayButtonD.addEventListener('click', playAudioD, false);\n\n\t\tvar playButtonE = document.getElementById('e');\n\t\tplayButtonE.addEventListener('click', playAudioE, false);\n\t\t\t\n\t\tvar playButtonF = document.getElementById('f');\n\t\tplayButtonF.addEventListener('click', playAudioF, false);\n\n\t\tvar playButtonG = document.getElementById('g');\n\t\tplayButtonG.addEventListener('click', playAudioG, false);\n\n\t\tvar playButtonH = document.getElementById('h');\n\t\tplayButtonH.addEventListener('click', playAudioH, false);\n\t\t\t\n\t\tvar playButtonI = document.getElementById('i');\n\t\tplayButtonI.addEventListener('click', playAudioI, false);\n\n\t\tvar playButtonJ = document.getElementById('j');\n\t\tplayButtonJ.addEventListener('click', playAudioJ, false);\n\t\t}//init end ***", "function set_buttons() {\r\n\t\r\n\t/* All the buttons needed */\r\n\tvar actions = $(\"#actions\");\r\n\tvar levels = $(\"#levels\");\r\n\tvar playButton = $(\"<button id='play'> Play </button>\");\r\n\tvar pauseButton = $(\"<button id='pause'> Pause </button>\");\r\n\tvar saveButton = $(\"<button id='save'> Save </button>\");\r\n\tvar loadButton = $(\"<button id='load'> Load </button>\");\r\n\tvar menuButton = $(\"<button id='menu'> Menu </button>\");\r\n\tvar rockButton = $(\"<button id='rock'> Rock </button>\");\r\n\tvar normalButton = $(\"<button id='normal'> Normal </button>\");\r\n\tvar skinsButton = $(\"<button id='skins'> Skins </button>\");\r\n\tvar standardSkinButton = $(\"<button id='standardSkin'> standard </button>\");\r\n\tvar cancelButton = $(\"<button id='cancel'> Cancel </button>\");\r\n\tvar restartButton = $(\"<button id='restart'> Restart </button>\");\r\n\tvar level1Button = $(\"<button id='level1'> Level 1 </button>\");\r\n\tvar level2Button = $(\"<button id='level2'> Level 2 </button>\");\r\n\t\r\n\t/* Appending them all */\r\n\tactions.append(playButton);\r\n\tactions.append(pauseButton);\r\n\tactions.append(saveButton);\r\n\tactions.append(loadButton);\r\n\tactions.append(menuButton);\r\n\tactions.append(rockButton);\r\n\tactions.append(normalButton);\r\n\tactions.append(skinsButton);\r\n\tactions.append(standardSkinButton);\r\n\tactions.append(cancelButton);\r\n\tactions.append(restartButton);\r\n\tlevels.append(level1Button);\r\n\tlevels.append(level2Button);\r\n\t\r\n\t/* can't be seen yet */\r\n\tpauseButton.hide();\r\n\tsaveButton.hide();\r\n\tmenuButton.hide();\r\n\tnormalButton.hide();\r\n\trestartButton.hide();\r\n\tcancelButton.hide();\r\n\tstandardSkinButton.hide();\r\n\tlevel1Button.hide();\r\n\tlevel2Button.hide();\r\n\t\r\n\t/* Function launched when the play button is clicked on */\r\n\tplayButton.click(function(event){\r\n\t\tplayButton.hide();\r\n\t\tloadButton.hide();\r\n\t\t$(\"#formulary\").hide();\r\n\t\t$(\"#enter\").hide();\r\n\t\t$(\"#score\").hide();\r\n\t\tmenuButton.show();\r\n\t\tlevel1Button.show();\r\n\t\tlevel2Button.show();\r\n\t\tskinsButton.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\t$(\".deleteSav\").hide();\r\n\t});\r\n\t\r\n\t/* Function launched when the pause button is clicked on */\r\n\tpauseButton.click(function(event) {\r\n\t\tGame.pause();\r\n\t\tif(Game.isPlaying == false)\r\n\t\t\tpauseButton.text(\"Play\");\r\n\t\telse\r\n\t\t\tpauseButton.text(\"Pause\");\r\n\t});\r\n\t\r\n\t/* Function launched when the save button is clicked on */\r\n\tsaveButton.click(function(event) {\r\n\t\t/* simulating a click on the pause button */\r\n\t\tif(Game.isPlaying == true)\r\n\t\t\t$(\"#pause\").trigger(\"click\"); \r\n\t\t\r\n\t\task_user_name();\r\n\t});\r\n\t\r\n\t/* function launched when the load button is clicked on */\r\n\tloadButton.click(function(event) {\r\n\t\task_load_name();\r\n\t});\r\n\t\r\n\t/* function launched when the menu button is clicked on */\r\n\tmenuButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id); /* need to stop the animation cuz it will start twice otherwise */\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); /* don't want the players to jump in the menu animation */\r\n\t\tGame.mobile.isDead = false; /* if the Mainsquare died in a level */\r\n\t\tGame.score = 0;\r\n\t\tGame.levelArrayCursor = 0;\r\n\t\t$(\"#score\").hide();\r\n\t\t$(\"#youWon\").remove(); /* remove win message */\r\n\t\t\r\n\t\t/* stopping music if any is playing */\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\t\r\n\t\t/* updating display */\r\n\t\t$(\"h1[id='large']\").show();\r\n\t\tsaveButton.hide();\r\n\t\tmenuButton.hide();\r\n\t\trestartButton.hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\tplayButton.show();\r\n\t\tpauseButton.hide();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\t$(\".deleteSav\").hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL)\r\n\t\t\trockButton.show();\r\n\t\telse\r\n\t\t\tnormalButton.show();\r\n\t\t\t\r\n\t\tskinsButton.show();\r\n\t\t\r\n\t\tdraw_menu_background();\r\n\t});\r\n\t\r\n\t/* function launched when the RockPossible button is clicked on */\r\n\trockButton.click(function(event){\r\n\t\r\n\t\tGame.mode = ROCK;\r\n\t\tCurrentSkin = SkinsR[0];\r\n\t\tGame.background = new Framework(\"#000000\", \"#ff0000\", \"white\");\r\n\t\trockButton.hide();\r\n\t\tnormalButton.show();\r\n\t\t$(\"#large\").text(\"Rockpossible Game\");\r\n\t});\r\n\t\r\n\t/* function launched when the normal button is clicked on */\r\n\tnormalButton.click(function(event){\r\n\t\r\n\t\tGame.mode = NORMAL;\r\n\t\tCurrentSkin = \"original\";\r\n\t\tGame.background = new Framework(\"#003333\", \"#00CCCC\", \"white\");\r\n\t\tnormalButton.hide();\r\n\t\trockButton.show();\r\n\t\t$(\"#large\").text(\"Rockpossible Game\");\r\n\t});\r\n\t\r\n\t/* function launched when the skins button is clicked on */\r\n\tskinsButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\tCtx.clearRect ( 0 , 0 ,Canvas.width, Canvas.height);\r\n\t\tcancelButton.show();\r\n\t\tplayButton.hide();\r\n\t\tloadButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").show();\r\n\t\t\t}\r\n\t\t\tGame.background = new Framework(\"#003333\", \"#00CCCC\", \"white\");\r\n\t\t\tGame.background.draw();\r\n\t\t\trockButton.hide();\r\n\t\t\tstandardSkinButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").show();\r\n\t\t\t}\r\n\t\t\tGame.background = new Framework(\"#000000\", \"#ff0000\", \"white\");\r\n\t\t\tGame.background.draw();\r\n\t\t\tnormalButton.hide();\r\n\t\t}\r\n\t});\t\r\n\t\r\n\tstandardSkinButton.click(function(event){\r\n\t\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); \r\n\t\tGame.mobile.isDead = false; \r\n\t\t\r\n\t\tCurrentSkin = \"original\";\r\n\t\t\r\n\t\tcancelButton.hide();\r\n\t\tplayButton.show();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\tstandardSkinButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").hide();\r\n\t\t\t}\r\n\t\t\trockButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").hide();\r\n\t\t\t}\r\n\t\t\tnormalButton.show();\r\n\t\t}\r\n\t\tdraw_menu_background();\r\n\t});\r\n\t\r\n\t/* function launched when the cancel button is clicked on */\r\n\tcancelButton.click(function(event){\r\n\t\r\n\t\treset_MainSquare_pos();\r\n\t\tstop_keydown(); /* don't want the players to jump in the menu animation */\r\n\t\tGame.mobile.isDead = false; /* if the Mainsquare died in a level */\r\n\t\t\r\n\t\tcancelButton.hide();\r\n\t\tplayButton.show();\r\n\t\tloadButton.show();\r\n\t\tskinsButton.show();\r\n\t\t$(\".deleteSav\").hide();\r\n\t\t$(\".loading\").hide();\r\n\t\t$(\"#enter\").hide();\r\n\t\tstandardSkinButton.hide();\r\n\t\t\r\n\t\tif(Game.mode == NORMAL) {\r\n\t\t\tfor(var i=0;i<SkinsN.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"N\").hide();\r\n\t\t\t}\r\n\t\t\trockButton.show();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tfor(var i=0;i<SkinsR.length;i++) {\r\n\t\t\t\t$(\"#skin\"+i+\"R\").hide();\r\n\t\t\t}\r\n\t\t\tnormalButton.show();\r\n\t\t}\r\n\t\tdraw_menu_background();\r\n\t});\t\r\n\t\r\n\t/* function launched when the restart button is clicked on */\r\n\trestartButton.click(function(event){\r\n\t\r\n\t\twindow.cancelAnimationFrame(Game.id); \r\n\t\treset_MainSquare_pos();\r\n\t\tGame.mobile.isDead = false; \r\n\t\tGame.levelArrayCursor = 0;\r\n\t\t$(\"#youWon\").remove();\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\tGame.score = 0;\r\n\t\tplay(Game.level, 0);\r\n\t\tinit_keydown();\r\n\t\t\r\n\t});\r\n\t\r\n\t/* function launched when the levels button are clicked on */\t\r\n\tlevel1Button.click(function(event){\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\treset_MainSquare_pos();\r\n\t\t$(\"h1[id='large']\").hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\tsaveButton.show();\r\n\t\tpauseButton.show();\r\n\t\trestartButton.show();\r\n\t\t\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[Game.level].id).trigger(\"pause\");\r\n\t\t\r\n\t\tplay(1, 0);\r\n\t});\r\n\t\r\n\tlevel2Button.click(function(event){\r\n\t\twindow.cancelAnimationFrame(Game.id);\r\n\t\treset_MainSquare_pos();\r\n\t\t$(\"h1[id='large']\").hide();\r\n\t\tlevel1Button.hide();\r\n\t\tlevel2Button.hide();\r\n\t\trockButton.hide();\r\n\t\tnormalButton.hide();\r\n\t\tskinsButton.hide();\r\n\t\tsaveButton.show();\r\n\t\tpauseButton.show();\r\n\t\trestartButton.show();\r\n\t\t\r\n\t\tif($(\"#\"+Musics[Game.level].id).length != 0)\r\n\t\t\t$(\"#\"+Musics[0].id).trigger(\"pause\");\r\n\t\t\r\n\t\tplay(2, 0);\r\n\t});\r\n}", "function init() {\n //go through menus\n menus = true;\n //choosing play style\n choosingStyle = true;\n //Display text and buttons\n AI.DecidePlayStyle();\n //load the board and interactable cubes\n LoadBoard();\n LoadInteractables();\n}", "function init(){\n appendButtons();\n clearVariables();\n}", "initButtons(scene){\n var obj = { Undo:function(){ scene.undo() }, Replay:function(){ scene.replay() }};\n\n this.gui.add(obj,'Undo');\n this.gui.add(obj,'Replay');\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 init_player() { // Functions specific to player role\n toggle_modal('modal_waiting_room');\n init_common();\n reset_buttons.forEach(button => {\n button.remove();\n });\n}", "function initGUI(elements, re) {\n\n // Up to now, the basic button controls had been \n // disabled. We're now ready to enable them.\n enableControls(elements);\n\n // An array that holds a bunch of callbacks to invoke whenever\n // the GUI needs to be refreshed from the model.\n var refreshSliderActions = [];\n\n // Link up the start and stop buttons.\n var playStopButton = elem(elements.playStopButton);\n\n function refreshPlayStopButtonState() {\n if (re.running) {\n playStopButton.innerHTML = \"Stop\";\n } else {\n playStopButton.innerHTML = \"Play\";\n }\n }\n refreshSliderActions.push(refreshPlayStopButtonState);\n\n playStopButton.onclick = function (event) {\n if (re.running) {\n re.stop();\n } else {\n re.start();\n }\n refreshPlayStopButtonState();\n };\n\n refreshPlayStopButtonState();\n\n function clampTempo(t) {\n return Math.round(Math.max(UI.tempo.min, Math.min(t, UI.tempo.max)));\n }\n\n // Link up the tempo change text field\n var tempoTextBox = elem(elements.tempoTextBox);\n tempoTextBox.onchange = function (event) {\n var value = parseInt(tempoTextBox.value);\n if (value >= UI.tempo.min || value <= UI.tempo.max) {\n re.tempo_bpm = value;\n }\n value = re.tempo_bpm;\n };\n tempoTextBox.onkeydown = function (event) {\n var t = re.tempo_bpm;\n\n switch (event.keyCode) {\n case 38: // Key up \n t = clampTempo(Math.max(t + 1, t * UI.tempo.incFactor));\n break;\n case 40: // Key down\n t = clampTempo(Math.min(t - 1, t * UI.tempo.decFactor));\n break;\n default: return;\n }\n\n re.tempo_bpm = t;\n tempoTextBox.value = t;\n };\n tempoTextBox.value = re.tempo_bpm;\n refreshSliderActions.push(function () {\n tempoTextBox.value = Math.round(re.tempo_bpm);\n });\n\n\n // The div into which new voices get inserted.\n var voicesDiv = elem(elements.voices);\n\n var voiceControls = [\n {label: 'phase', min: 0, max: 15, step: 1},\n {label: 'straight', min: 0, max: 1, step: 0.01},\n {label: 'offbeat', min: 0, max: 1, step: 0.01},\n {label: 'funk', min: 0, max: 1, step: 0.01},\n {label: 'random', min: 0, max: 1, step: 0.01},\n {label: 'mean', min: 0, max: 1, step: 0.01},\n {label: 'ramp', min: 0, max: 1, step: 0.01},\n {label: 'threshold', min: 0, max: 1, step: 0.01},\n {label: 'volume', min: 0, max: 1, step: 0.01}\n ];\n\n\n function addOneVoice() {\n addVoiceButton.parentNode.removeChild(addVoiceButton);\n setupVoice(re.addVoice());\n voicesDiv.insertAdjacentElement('beforeend', addVoiceButton);\n }\n\n // Setup the \"add voice\" button to add a new voice\n // to the engine.\n var addVoiceButton = elem(elements.addVoiceButton);\n addVoiceButton.innerHTML = \"Add voice\";\n addVoiceButton.style.marginTop = \"60px\";\n addVoiceButton.onclick = addOneVoice;\n removeAllChildrenOf(voicesDiv);\n setupExistingVoices();\n\n function setupVoice(voice) {\n var voiceDiv = document.createElement('div');\n voiceDiv.setAttribute('class', 'span2');\n voiceDiv.setAttribute('style', 'padding-bottom: 6px');\n voicesDiv.insertAdjacentElement('beforeend', voiceDiv);\n\n var i, N, canv;\n for (i = 0, N = voiceControls.length; i < N; ++i) {\n voiceDiv.insertAdjacentElement('beforeend',\n canv = CanvasSlider.setup(voiceControls[i], (function (field) {\n return function (val) { \n if (val === undefined) {\n return voice[field.label];\n } else {\n return voice[field.label] = val;\n };\n };\n }(voiceControls[i])), UI.slider));\n refreshSliderActions.push(canv.draw);\n }\n\n addKitSelector(voiceDiv, voice);\n }\n\n function setupExistingVoices() {\n var i, N;\n if (addVoiceButton.parentNode) {\n addVoiceButton.parentNode.removeChild(addVoiceButton);\n }\n for (i = 0, N = re.numVoices(); i < N; ++i) {\n setupVoice(re.voice(i));\n }\n voicesDiv.insertAdjacentElement('beforeend', addVoiceButton);\n\n // If the voice bank is empty, add one just to help \n // get started.\n if (re.numVoices() === 0) {\n addOneVoice();\n }\n }\n\n // Adds the two drum kit selection drop-downs to a voice's control pane.\n function addKitSelector(rootDiv, voice) {\n var kitSel = document.createElement('select');\n kitSel.setAttribute('style', 'width: 100px; height: 22px; font-size: 12px');\n var i, j, N, M, e;\n for (i = 0, N = re.kits.length; i < N; ++i) {\n e = document.createElement('option');\n e.setAttribute('value', re.kits[i].name);\n e.innerText = re.kits[i].name;\n kitSel.insertAdjacentElement('beforeend', e);\n }\n rootDiv.insertAdjacentElement('beforeend', kitSel);\n\n kitSel.onchange = function (e) {\n voice.voice.kit = kitSel.value;\n voice.voice.drum = drumSel.value;\n };\n\n kitSel.value = voice.voice.kit;\n\n // The kits are all already loaded, so the loadSampleSet\n // will trigger immediately. \n //\n // TODO: Also, we're assuming here that the set of drum \n // names is the same for all the kits. This is only temporarily \n // true and the code will have to be generalized for arbitrary \n // kit collections.\n var drumSel = document.createElement('select');\n drumSel.setAttribute('style', 'width: 100px; height: 22px; font-size: 12px');\n SampleManager.loadSampleSet(re.kits[0].name, re.kits[0].url, {\n didFinishLoadingSampleSet: function (name, sset) {\n var drums = Object.keys(sset);\n var e, i, N;\n for (i = 0, N = drums.length; i < N; ++i) {\n e = document.createElement('option');\n e.setAttribute('value', drums[i]);\n e.innerText = drums[i];\n drumSel.insertAdjacentElement('beforeend', e);\n }\n\n rootDiv.insertAdjacentElement('beforeend', drumSel);\n\n drumSel.onchange = function (e) {\n voice.voice.drum = drumSel.value;\n };\n\n kitSel.value = voice.voice.kit;\n drumSel.value = voice.voice.drum;\n }\n });\n }\n\n // Setup the presets section.\n (function () {\n var presetElems = elem(elements.presets);\n function makeActive(p) {\n var c = presetElems.children[p];\n c.style.backgroundColor = UI.preset.activeColor;\n c.setAttribute('draggable', 'true');\n }\n\n function flashPreset(p) {\n var c = presetElems.children[p];\n c.style.backgroundColor = UI.preset.flashColor;\n setTimeout(function () { c.style.backgroundColor = UI.preset.activeColor; }, 60);\n }\n\n var i, N, c;\n for (i = 0, N = presetElems.children.length; i < N; ++i) {\n c = presetElems.children[i];\n UI.preset.setStyle(c.style);\n c.innerHTML = ''+(i+1);\n\n c.ondragstart = (function (i) {\n return function (e) {\n e.dataTransfer.effectAllowed = 'all';\n e.dataTransfer.setData('Text', '' + (i + 1));\n };\n }(i));\n\n c.onclick = (function (i, c) {\n return function (e) {\n // Save a preset.\n var ilim = Math.min(re.numPresets(), i);\n re.saveAsPreset(ilim);\n makeActive(ilim);\n flashPreset(ilim);\n };\n }(i, c));\n\n if (i < re.numPresets() && re.preset(i)) {\n // If preset already exists, mark it as draggable.\n makeActive(i);\n }\n }\n }());\n\n // Setup the morpher 2D canvas.\n Morpher.setup(elements.morpher, re, UI.morpher);\n\n // Set the refresh actions to be called whenever the\n // engine's morph situation changes.\n re.onMorphUpdate = function () {\n var i, N;\n for (i = 0, N = refreshSliderActions.length; i < N; ++i) {\n refreshSliderActions[i]();\n }\n };\n\n // Setup the settings name field.\n var settingsNameField = elem(elements.settingsNameField);\n var settingsList = elem(settingsNameField.getAttribute('list'));\n settingsList.onchange = function (event) {\n settingsNameField.value = settingsList.value;\n };\n settingsList.onclick = settingsList.onchange;\n\n function refreshSettingsList() {\n removeAllChildrenOf(settingsList);\n re.list({\n didListSettings: function (settings) {\n var i, N, e;\n for (i = 0, N = settings.length; i < N; ++i) {\n e = document.createElement('option');\n e.innerText = settings[i];\n settingsList.insertAdjacentElement('beforeend', e);\n }\n settingsList.value = settingsNameField.value || settingsList.value;\n },\n onError: function (e) {\n console.error(e);\n }\n });\n }\n refreshSettingsList();\n\n // Setup the save button.\n var saveButton = elem(elements.saveButton);\n saveButton.onclick = function (e) {\n re.save(settingsNameField.value, {\n didSave: refreshSettingsList\n });\n };\n saveButton.innerText = \"Save\";\n\n // Map the load button.\n var loadButton = elem(elements.loadButton);\n loadButton.onclick = function (e) {\n disableControls(elements);\n re.load(settingsNameField.value, {\n didLoad: function () {\n initGUI(elements, re);\n re.onMorphUpdate();\n },\n onError: function (e) {\n debugger;\n console.error(e);\n alert(e.toString());\n }\n });\n };\n loadButton.innerText = \"Load\";\n\n\n // Map the download button.\n // There is a hidden \"download link\" to the virtual file\n // created by the \"Save to file\" button. Once the link\n // is prepared with an \"object URL\" containing the relevant\n // JSON data, the link is made visible in place of the\n // \"Drop file here to load\" message. Once you download the\n // file, the link is hidden and the message is shown again.\n var downloadButton = elem(elements.downloadButton);\n var prevDownloadedSnapshot;\n downloadButton.onclick = function (e) {\n re.stop();\n refreshPlayStopButtonState();\n var bb = new BlobBuilder();\n bb.append(re.snapshot());\n var filename = 'resnapshot.json';\n var downloadLink = elem(elements.downloadButton + '_link');\n downloadLink.innerText = filename;\n if (prevDownloadedSnapshot) {\n // Cleanup the thing. The object URL is kept using\n // a window-global reference by the browser and it depends\n // on us to explicitly revoke it.\n window.URL.revokeObjectURL(prevDownloadedSnapshot);\n prevDownloadedSnapshot = undefined;\n }\n downloadLink.href = prevDownloadedSnapshot = window.URL.createObjectURL(bb.getBlob('application/json'));\n downloadLink.download = filename;\n var dropMessage = elem(downloadLink.getAttribute('message'));\n var dropMessageParent = dropMessage.parentNode;\n dropMessageParent.removeChild(dropMessage);\n downloadLink.removeAttribute('hidden');\n downloadLink.onclick = function (e) {\n downloadLink.setAttribute('hidden', true);\n dropMessageParent.insertAdjacentElement('afterbegin', dropMessage);\n };\n };\n downloadButton.innerText = 'Save to file';\n\n // Add drag and drop file setting.\n // Code based on example from CSS Ninja - \n // http://www.thecssninja.com/demo/drag-drop_upload/v2/\n var dropArea = elem(elements.dropArea);\n dropArea.addEventListener(\"dragenter\", \n function (event) {\n event.stopPropagation();\n event.preventDefault();\n }, false);\n dropArea.addEventListener(\"dragover\", \n function (event) {\n event.stopPropagation();\n event.preventDefault();\n }, false);\n dropArea.addEventListener('drop', function (evt) {\n disableControls(elements);\n re.stop();\n refreshPlayStopButtonState();\n var files = evt.dataTransfer.files;\n var reader = new FileReader();\n reader.file = files[0];\n reader.addEventListener('loadend', function (evt) {\n console.log(evt.target.result);\n re.import(evt.target.result, {\n didLoad: function () {\n initGUI(elements, re);\n re.onMorphUpdate();\n },\n onError: function (e) {\n debugger;\n console.error(e);\n alert(e.toString());\n enableControls(elements);\n }\n });\n }, false);\n reader.readAsText(files[0]);\n });\n }", "function init(){\t\n\t\tbase.toggle = new Toggle (base, key);\n\t\tbase.audio = new AudioPlayer(base, key);\n\t\tbase.videos = [];\n\t\t\n\t\tfor (var i = 0; i < videoList.length; i++) {\n\t\t\tvar video = new VideoPlayer(base, videoList[i])\n\t\t\tbase.videos.push( video );\n\t\t\tvideos.push( video );\n\t\t}\n\t}", "function init(){\n\n // enable key listeners\n\n enableKeyboardKeys();\n enableSliders();\n\n\n var song = [63, 70, 78, 56, 34, 63];\n //playArrayOfNotes(song);\n\n}", "function setupAPIButtons(){\n\taddMessage(\"Event listeners console...\");\n\tFWDPageSimpleButton.setPrototype();\n\tplayButton = new FWDPageSimpleButton(\"play\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tplayButton.getStyle().marginRight = \"14px\";\n\tplayButton.getStyle().marginTop = \"6px\";\n\tplayButton.addListener(FWDPageSimpleButton.CLICK, playClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tpauseButton = new FWDPageSimpleButton(\"pause\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tpauseButton.getStyle().marginRight = \"14px\";\n\tpauseButton.getStyle().marginTop = \"6px\";\n\tpauseButton.addListener(FWDPageSimpleButton.CLICK, pauseClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tstopButton = new FWDPageSimpleButton(\"stop\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tstopButton.getStyle().marginRight = \"14px\";\n\tstopButton.getStyle().marginTop = \"5px\";\n\tstopButton.addListener(FWDPageSimpleButton.CLICK, stopClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tscrubbButton = new FWDPageSimpleButton(\"scrub to 50%\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tscrubbButton.getStyle().marginRight = \"14px\";\n\tscrubbButton.getStyle().marginTop = \"6px\";\n\tscrubbButton.addListener(FWDPageSimpleButton.CLICK, scrubbClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tvolumeButton = new FWDPageSimpleButton(\"set volume to 50%\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tvolumeButton.getStyle().marginRight = \"14px\";\n\tvolumeButton.getStyle().marginTop = \"6px\";\n\tvolumeButton.addListener(FWDPageSimpleButton.CLICK, volumeClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tmp4Button = new FWDPageSimpleButton(\"change mp4 source\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tmp4Button.getStyle().marginRight = \"14px\";\n\tmp4Button.getStyle().marginTop = \"6px\";\n\tmp4Button.addListener(FWDPageSimpleButton.CLICK, setMp4ClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tgetCurrentTimeButton = new FWDPageSimpleButton(\"get time\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tgetCurrentTimeButton.getStyle().marginRight = \"14px\";\n\tgetCurrentTimeButton.getStyle().marginTop = \"6px\";\n\tgetCurrentTimeButton.addListener(FWDPageSimpleButton.CLICK, getCurrentTimeClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tgetTotalTimeButton = new FWDPageSimpleButton(\"get duration\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tgetTotalTimeButton.getStyle().marginRight = \"14px\";\n\tgetTotalTimeButton.getStyle().marginTop = \"6px\";\n\tgetTotalTimeButton.addListener(FWDPageSimpleButton.CLICK, getTotalTimeClickHandler);\n\t\n\tapiButtonsHolder_el.appendChild(playButton.screen);\n\tapiButtonsHolder_el.appendChild(pauseButton.screen);\n\tapiButtonsHolder_el.appendChild(stopButton.screen);\n\tapiButtonsHolder_el.appendChild(scrubbButton.screen);\n\tapiButtonsHolder_el.appendChild(volumeButton.screen);\n\tapiButtonsHolder_el.appendChild(mp4Button.screen);\n\tapiButtonsHolder_el.appendChild(getCurrentTimeButton.screen);\n\tapiButtonsHolder_el.appendChild(getTotalTimeButton.screen);\n}", "function loaded () {\n textSize(30);\n noStroke();\n button = createButton('TORNADO START');\n button.mousePressed(togglePlaying);\n button.size(150, 45);\n button.position(330, 300);\n}", "function activatePlayButtons() {\n\t\n\tvar playButtons = document.getElementsByClassName(\"play-button\");\n\tconsole.log(playButtons);\n\tfor (var i = 0; i < playButtons.length; i ++) {\n\n\t\tplayButtons[i].addEventListener(\"click\", playSong);\n\t}\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 loaded() {\n play = createButton(\"PLAY TO TRIP\");\n\n //style the button\n play.position(width/2 - 75, height - 120);\n play.size(150)\n play.style('background-color', \"black\");\n play.style('font-size', '15px');\n play.style('font-weight', 'bold');\n play.style('letter-spacing','2px');\n play.style('color', \"#b0f11d\");\n play.style('padding', '15px');\n play.style('border-style', 'solid');\n play.style('border-width', '0.5px');\n play.style('border-color', \"#b0f11d\");\n\n //when the button is pressed, the function togglePlaying is called\n play.mousePressed(togglePlaying);\n console.log(\"loaded\");\n}", "function initControls() \n{\n 'use strict';\n\n // If a slide title is selected from the drop up list, show the slide.\n $('.dropdown-menu li a').on('click', function (event) {\n pfView.showSlide(event, $(this));\n });\n\n // Cycles to the previous slide\n $('#prev-slide-btn').on('click', function (){ \n pfView.moveLeft();\n });\n\n // Cycles to the next slide\n $('#next-slide-btn').on('click', function (){ \n pfView.moveRight();\n });\n\n // Listen for keydown anywhere in body.\n $('body').on('keydown', function (event) {\n return keystroke(event);\n });\n\n // Listen for keyup anywhere in body.\n $('body').on('keyup', function (event) {\n return keystroke(event);\n });\n}", "function setPlaybackControls(state){\n if (state === \"play\") {\n for (i= 0; i < inputArray.length; i++) {\n inputArray[i].disabled = false;\n }\n playButton.disabled = true;\n stopButton.disabled = false;\n } \n if (state === \"stop\") {\n for (i= 0; i < inputArray.length; i++) {\n inputArray[i].disabled = true;\n }\n playButton.disabled = false;\n stopButton.disabled = true;\n }\n}", "init() {\n this.timerSlide();\n this.nextClick();\n this.previousClick();\n this.breakSlide();\n this.playSlide();\n this.keybord();\n }", "function setupAPIButtons(){\n\taddMessage(\"Event listeners console...\");\n\tFWDPageSimpleButton.setPrototype();\n\tplayButton = new FWDPageSimpleButton(\"play\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tplayButton.getStyle().marginRight = \"14px\";\n\tplayButton.getStyle().marginTop = \"6px\";\n\tplayButton.addListener(FWDPageSimpleButton.CLICK, playClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tpauseButton = new FWDPageSimpleButton(\"pause\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tpauseButton.getStyle().marginRight = \"14px\";\n\tpauseButton.getStyle().marginTop = \"6px\";\n\tpauseButton.addListener(FWDPageSimpleButton.CLICK, pauseClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tstopButton = new FWDPageSimpleButton(\"stop\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tstopButton.getStyle().marginRight = \"14px\";\n\tstopButton.getStyle().marginTop = \"5px\";\n\tstopButton.addListener(FWDPageSimpleButton.CLICK, stopClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tscrubbButton = new FWDPageSimpleButton(\"scrub to 50%\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tscrubbButton.getStyle().marginRight = \"14px\";\n\tscrubbButton.getStyle().marginTop = \"6px\";\n\tscrubbButton.addListener(FWDPageSimpleButton.CLICK, scrubbClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tvolumeButton = new FWDPageSimpleButton(\"set volume to 50%\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tvolumeButton.getStyle().marginRight = \"14px\";\n\tvolumeButton.getStyle().marginTop = \"6px\";\n\tvolumeButton.addListener(FWDPageSimpleButton.CLICK, volumeClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tfullscreenButton = new FWDPageSimpleButton(\"go fullscreen\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tfullscreenButton.getStyle().marginRight = \"14px\";\n\tfullscreenButton.getStyle().marginTop = \"6px\";\n\tfullscreenButton.addListener(FWDPageSimpleButton.CLICK, fullscreenClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tsetPosterButton = new FWDPageSimpleButton(\"set poster src\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tsetPosterButton.getStyle().marginRight = \"14px\";\n\tsetPosterButton.getStyle().marginTop = \"6px\";\n\tsetPosterButton.addListener(FWDPageSimpleButton.CLICK, setPosterClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tsetYoutubeButton = new FWDPageSimpleButton(\"set youtube src\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tsetYoutubeButton.getStyle().marginRight = \"14px\";\n\tsetYoutubeButton.getStyle().marginTop = \"6px\";\n\tsetYoutubeButton.addListener(FWDPageSimpleButton.CLICK, setYoutubeClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tvimeoYoutubeButton = new FWDPageSimpleButton(\"set vimeo src\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tvimeoYoutubeButton.getStyle().marginRight = \"14px\";\n\tvimeoYoutubeButton.getStyle().marginTop = \"6px\";\n\tvimeoYoutubeButton.addListener(FWDPageSimpleButton.CLICK, setVimeoClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tmp4Button = new FWDPageSimpleButton(\"set mp4 source\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tmp4Button.getStyle().marginRight = \"14px\";\n\tmp4Button.getStyle().marginTop = \"6px\";\n\tmp4Button.addListener(FWDPageSimpleButton.CLICK, setMp4ClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tmp4Button = new FWDPageSimpleButton(\"set mp4 source\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tmp4Button.getStyle().marginRight = \"14px\";\n\tmp4Button.getStyle().marginTop = \"6px\";\n\tmp4Button.addListener(FWDPageSimpleButton.CLICK, setMp4ClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tgetCurrentTimeButton = new FWDPageSimpleButton(\"get time\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tgetCurrentTimeButton.getStyle().marginRight = \"14px\";\n\tgetCurrentTimeButton.getStyle().marginTop = \"6px\";\n\tgetCurrentTimeButton.addListener(FWDPageSimpleButton.CLICK, getCurrentTimeClickHandler);\n\t\n\tFWDPageSimpleButton.setPrototype();\n\tgetTotalTimeButton = new FWDPageSimpleButton(\"get duration\", \"#FFFFFF\", \"#000000\", \"#000000\", \"#FFFFFF\");\n\tgetTotalTimeButton.getStyle().marginRight = \"14px\";\n\tgetTotalTimeButton.getStyle().marginTop = \"6px\";\n\tgetTotalTimeButton.addListener(FWDPageSimpleButton.CLICK, getTotalTimeClickHandler);\n\t\n\tapiButtonsHolder_el.appendChild(playButton.screen);\n\tapiButtonsHolder_el.appendChild(pauseButton.screen);\n\tapiButtonsHolder_el.appendChild(stopButton.screen);\n\tapiButtonsHolder_el.appendChild(scrubbButton.screen);\n\tapiButtonsHolder_el.appendChild(volumeButton.screen);\n\tapiButtonsHolder_el.appendChild(fullscreenButton.screen);\n\tapiButtonsHolder_el.appendChild(setPosterButton.screen);\n\tapiButtonsHolder_el.appendChild(setYoutubeButton.screen);\n\tapiButtonsHolder_el.appendChild(vimeoYoutubeButton.screen);\n\tapiButtonsHolder_el.appendChild(mp4Button.screen);\n\tapiButtonsHolder_el.appendChild(getCurrentTimeButton.screen);\n\tapiButtonsHolder_el.appendChild(getTotalTimeButton.screen);\n}", "addBowlButton() {\n\t\tthis.play = this.add.image(config.width * 0.5, config.height * 0.12, \"play\")\n\t\t\t\t\t.setScale(0.5,0.5)\n\t\t\t\t\t.setInteractive();\n\t\tvar _self = this;\n\t\tthis.play.on('pointerdown',function(pointer){\n\t\t\t_self.play.setInteractive(false);\n\t\t\t_self.setInitialBowlerPosition();\n\t\t\t_self.playBowlerAnimation();\n\t\t});\n\t}", "function generatePlayerControls(){\n $('.player').html('<button id=\"playbtn\" class=\"btn btn-success play-btn\"><span class=\"glyphicon glyphicon-play\" aria-hidden=\"true\"></span> ');\n}", "function initButtons() {\n document.getElementById('next-arrow').addEventListener('click', gonext);\n document.getElementById('prev-arrow').addEventListener('click', goprev);\n\n//\t\tconsole.log(deck);\n//\t\tconsole.log($('.bespoke-before').length);\n\n//\t\tsetInterval(function (r) {\n//\n//\t\t\tvar value=os_count>9?9:os_count+1;\n//\t\t\tvalue=value*100/(9+1);\n//\t\t\t$('#os_value').css('width', value+'%');\n//\t\t\tgonext();\n//\n//\t\t\tconsole.log(slides);\n//\t\t\tif(os_count==4){\n//\n//\t\t\t\tos_count=0;\n//\n//\t\t\t}\n//\t\t}, 5000);\n\n\n // setTimeout(window.show, 5000);\n }", "function _generateGUI () {\n\n\t\t/**\n\t\t * $class : Class prefix\n\t\t * $prev : Previous button\n\t\t * $next : Next button\n\t\t * $play : Play/Pause button\n\t\t * $expand : Expand player button\n\t\t */\n\n\t\t// Get first track info\n\t\tvar initial_track_info = this.getTrackInfo(this.tracks[0].id);\n\n\t\t_createAudioElem.apply(this);\n\n\t\tthis.audio.src = initial_track_info.mp3;\n\n\t\tvar default_tpl = \t'<div class=\"$class-player\">' +\n\t\t\t\t\t\t\t\t'<div class=\"$class-wrapper\">' +\n\n\t\t\t\t\t\t\t\t\t'<div class=\"$class-button\">' +\n\t\t\t\t\t\t\t\t\t\t '$prev' +\n\t\t\t\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t\t\t\t\t'<div class=\"$class-button $class-button-xl\">' +\n\t\t\t\t\t\t\t\t\t\t'$play' +\n\t\t\t\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t\t\t\t\t'<div class=\"$class-button\">' +\n\t\t\t\t\t\t\t\t\t\t'$next' +\n\t\t\t\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t\t\t\t\t'<div class=\"$class-timer\">' +\n\t\t\t\t\t\t\t\t\t\t'<span data-live=\"artist\">' + initial_track_info.artist + '</span> - <span data-live=\"title\">' + initial_track_info.title + '</span> &nbsp; | &nbsp; ' +\n\t\t\t\t\t\t\t\t\t\t'<span data-live=\"timer\">00:00</span> / <span data-live=\"duration\">00:00</span>' +\n\t\t\t\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t\t\t\t\t// '<div class=\"$class-button $class-button-xs\">' +\n\t\t\t\t\t\t\t\t\t// \t'$expand' +\n\t\t\t\t\t\t\t\t\t// '</div>' +\n\n\t\t\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t\t\t'</div>';\n\n\t\tvar tpl = default_tpl;\n\t\tif (this.settings.tpl != null && this.settings.tpl.length > 3) {\n\t\t\ttpl = this.settings.tpl;\n\t\t}\n\n\t\ttpl += '<div class=\"$class-tracklist\">';\n\n\t\t// Logic for displaying tracks not contained in albums\n\t\ttpl += 'Other tracks:';\n\t\ttpl += '<ul>';\n\t\tfor (var index = 0; index < this.tracks.length; ++index) {\n\t\t\tif ( !(typeof this.tracks[index].album_id != 'undefined') ) {\n\t\t\t\tvar trackInfos = this.getTrackInfo(this.tracks[index].id);\n\t\t\t\ttpl += '<li>'+ trackInfos.track_number +'. <a data-musikp=\"'+ trackInfos.id +'\" href=\"#\">'+ trackInfos.title +'</a></li>';\n\t\t\t}\n\t\t}\n\t\ttpl += '</ul>';\n\n\t\t// Logic to display albums list\n\t\tfor (var index = 0; index < this.albums.length; ++index) {\n\n\t\t\tvar albumInfos = this.getAlbumInfo(this.albums[index].id);\n\n\t\t\ttpl += '<a data-musikp=\"'+ albumInfos.id +'\" href=\"#\">'+ albumInfos.artist +' - '+ albumInfos.title +'</a>';\n\t\t\ttpl += \t'<a data-musikp=\"'+ albumInfos.id +'\" href=\"#\">' +\n\t\t\t\t\t\t'<div class=\"$class-cover\" style=\"background-image:url(\\''+ albumInfos.cover +'\\');\"></div>'+\n\t\t\t\t\t\t\talbumInfos.artist +' - '+ albumInfos.title +\n\t\t\t\t\t'</a>';\n\t\t\ttpl += '<ul>';\n\n\t\t\tfor (var trackIndex = 0; trackIndex < albumInfos.tracks.length; ++trackIndex) {\n\n\t\t\t\tvar trackInfos = this.getTrackInfo(albumInfos.tracks[trackIndex]);\n\t\t\t\ttpl += '<li>'+ trackInfos.track_number +'. <a data-musikp=\"'+ trackInfos.id +'\" href=\"#\">'+ trackInfos.title +'</a></li>';\n\n\t\t\t}\n\n\t\t\ttpl += '</ul>';\n\n\t\t}\n\n\t\ttpl += '</div>';\n\n\t\tfunction escapeRegExp(str) { return str.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, \"\\\\$1\"); }\n\t\tfunction replaceAll(str, find, replace) { return str.replace(new RegExp(escapeRegExp(find), 'g'), replace); }\n\n\t\ttpl = replaceAll(tpl, '$class', this.settings.classPrefix);\n\t\ttpl = replaceAll(tpl, '$prev', '<span data-action=\"prev\">' + this.settings.prevBt + '</span>');\n\t\ttpl = replaceAll(tpl, '$next', '<span data-action=\"next\">' + this.settings.nextBt + '</span>');\n\t\ttpl = replaceAll(tpl, '$play', '<span data-action=\"play\">' + this.settings.playBt + '</span>');\n\t\ttpl = replaceAll(tpl, '$expand', '<span data-action=\"expand\">' + this.settings.expandBt + '</span>');\n\n\t\t$('body').append('<div class=\"'+ this.settings.classPrefix +'-gui\">'+ tpl +'</div>');\n\n\t\tsetTimeout( function () {\n\n\t\t\t$('body')\n\t\t\t\t.find('.'+ this.settings.classPrefix +'-gui')\n\t\t\t\t.addClass(''+ this.settings.classPrefix +'-loaded');\n\n\t\t}.bind(this), 1000);\n\n\t\tthis.debug('GUI opened');\n\t\tthis.isGUIVisible = true;\n\n\t\t_bindGuiEvents.apply(this);\n\n\t}", "function initEditor() {\n checkSetup();\n initFirebase();\n initConstants();\n initCanvas();\n initButton();\n initEditorData();\n initEventHandlers();\n resetEditor();\n initGrid();\n initSelectorContent();\n}", "function init() {\n\n\t\t// Bind the editor elements to variables\n\t\tbindElements();\n\n\t\t// Create event listeners for keyup, mouseup, etc.\n\t\tcreateEventBindings();\n\t}", "function setupPlayerWidget () {\n\t\t\tvar playerType = appliedSettings.videodisplay;\n\n\t\t\tif (playerType.indexOf(\"carousel-\") === 0) {\n\t\t\t\tplayerType = \"carousel\";\n\t\t\t}\n\n\t\t\tswitch (playerType) {\n\t\t\t\tcase \"inline\": \n\t\t\t\t\t// We inject an inline player inside the element that initiated the plug-in.\n\n\t\t\t\t\t// Create a video player trigger (placeholder image), used on both inline and overlayAndTrigger displays.\n\t\t\t\t\tcreatePlayerTrigger(appliedSettings.videoid);\n\n\t\t\t\t\t// Inject the placeholder INSIDE this element that's inside the orig container element.\n\t\t\t\t\t// The KT player gets injected inside this, that's why we need to give it an ID.\n\t\t\t\t\t$('<div id=\"' + appliedSettings.playerContainerId + '\"></div>').appendTo(appliedSettings.$origEl.empty()).html(me.$trigger);\n\n\t\t\t\t\t// Add placeholder/trigger video info.\n\t\t\t\t\taddPlaceholderInfo();\n\n\t\t\t\t\t// Bind the trigger to REPLACE the original element (containers the trigger) with an embeded video player.\n\t\t\t\t\tme.$trigger.click(function (evt) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tcreateInlinePlayer(appliedSettings.playerContainerId, appliedSettings.videoid);\n\n\t\t\t\t\t\t// On resize, recalculate height and reset iframe@height value. Makes the player responsive and adjust height\n\t\t\t\t\t\t// of iframe based on width of any container it's in, when the container changes width.\n\t\t\t\t\t\t$(window).resize(function(){\n\t\t\t\t\t\t\tvar $playerContainer = $(\"#\" + appliedSettings.playerContainerId),\n\t\t\t\t\t\t\t\tnewHeightStyle = {height: calcHeight($playerContainer.width()) + \"px\"};\n\n\t\t\t\t\t\t\t$playerContainer.css(newHeightStyle).children(\"iframe\").css(newHeightStyle);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"overlay\": \n\t\t\t\t\t// We make ONLY the overlay here.\n\n\t\t\t\t\t// Set the overlay and video embed width/heigt from the preset used.\n\t\t\t\t\tsetOverlayPresets();\n\n\t\t\t\t\t// Get the video's info and append the duration of the video to the trigger link if they set the option.\n\t\t\t\t\tif (appliedSettings.showvideoduration) {\n\t\t\t\t\t\tgetVideoInfo(appliedSettings.videoid, function(jsonObj){\n\t\t\t\t\t\t\tappliedSettings.$origEl.append(' <span class=\"ibm-item-note\">(' + jsonObj.formattedTime + ')</span>');\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Make overlay and attach to this object.\n\t\t\t\t\tme.overlay = ibmVp.createOverlay(appliedSettings);\n\t\t\t\t\tme.overlay.setHtml('<div id=\"' + appliedSettings.playerContainerId + '\" style=\"margin:auto;width:' + appliedSettings.overlayplayerwidth + 'px;\"></div>');\n\n\t\t\t\t\t// Bind the video to pause if the overlay is closed.\n\t\t\t\t\tme.overlay.subscribe(\"hide\", \"Videoplayer\", function(){\n\t\t\t\t\t\tme.player.sendNotification(\"pause\");\n\t\t\t\t\t});\n\n\t\t\t\t\t// If they explicitely said to show the play button on a custom trigger.\n\t\t\t\t\t// Add the play button span.\n\t\t\t\t\tif (userSettings.showimageplaybutton) {\n\t\t\t\t\t\taddPlaybutton(appliedSettings.$origEl);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Change the width to the preset overlay player widget, instead of the width of the container on the page.\n\t\t\t\t\tappliedSettings.width = appliedSettings.overlayplayerwidth;\n\n\t\t\t\t\t// Bind the element (usually an <a> but can technically be anything) that was init via the plugin to open overlay.\n\t\t\t\t\tappliedSettings.$origEl.click(function (evt) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tshowOverlayAndPlay();\n\t\t\t\t\t});\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"overlayandtrigger\":\n\t\t\t\t\t// We make both the overlay AND the trigger (image they click on to launch the overlay).\n\n\t\t\t\t\t// Set the overlay and video embed width/heigt from the preset used.\n\t\t\t\t\tsetOverlayPresets();\n\n\t\t\t\t\t// Create a video player trigger (placeholder image), used on both inline and overlayAndTrigger displays.\n\t\t\t\t\tcreatePlayerTrigger(appliedSettings.videoid);\n\n\t\t\t\t\t// Inject the trigger INSIDE the element that init'd the plug-in.\n\t\t\t\t\t$('<div></div>').appendTo(appliedSettings.$origEl.empty()).html(me.$trigger);\n\n\t\t\t\t\t// Add placeholder/trigger video info.\n\t\t\t\t\taddPlaceholderInfo();\n\n\t\t\t\t\t// Make overlay and attach to this object.\n\t\t\t\t\tme.overlay = ibmVp.createOverlay(appliedSettings);\n\t\t\t\t\tme.overlay.setHtml('<div id=\"' + appliedSettings.playerContainerId + '\"></div>');\n\n\t\t\t\t\t// Bind the video to pause if the overlay is closed.\n\t\t\t\t\tme.overlay.subscribe(\"hide\", \"Videoplayer\", function(){\n\t\t\t\t\t\tme.player.sendNotification(\"pause\");\n\t\t\t\t\t});\n\n\n\t\t\t\t\t// Change the width to the preset overlay player widget, instead of the width of the container on the page.\n\t\t\t\t\t// NOTE: This HAS to be after we create the trigger, else the trigger will use this width and automatically make a big play button.\n\t\t\t\t\tappliedSettings.width = appliedSettings.overlayplayerwidth;\n\n\t\t\t\t\t// Bind trigger -> open overlay and play.. dupe what overlay above does just on a different element.\n\t\t\t\t\tme.$trigger.click(function (evt) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tshowOverlayAndPlay();\n\t\t\t\t\t});\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"carousel\":\n\t\t\t\t\t// This creates a div element in a carousel for each video ID.\n\t\t\t\t\t// Used for both types of carouse. The only differnece is the videodisplay, and it is \n\t\t\t\t\t// determined using the passed appliedSettings in the ibmVp.createVideoCarousel function.\n\t\t\t\t\t// Then it inits the videoplayer plug-in on each. \n\t\t\t\t\t// Then it inits the carousel.\n\n\t\t\t\t\t// It's just as if the dev custom coded the elements themselves, then say \"displaytype=overlaywithtrigger\".\n\t\t\t\t\tif (appliedSettings.videoplaylistid !== \"\") {\n\t\t\t\t\t\tconsole.log(\"Video playlist for Kaltura aren't setup yet.\");\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t// Get video info from videoinfo API using CSV of IDs.\n\t\t\t\t\t\t$.getJSON(api.playlistVideos.replace(\"{playlistId}\", appliedSettings.videoplaylistid).replace(\"{maxResults}\", appliedSettings.maxnumvideos)).done(function (jsonObj) {\n\t\t\t\t\t\t\tvar videoIds = \"\";\n\n\t\t\t\t\t\t\t$.each(jsonObj.items, function(){\n\t\t\t\t\t\t\t\tvideoIds += \",\" + this.contentDetails.videoId;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tvideoIds = videoIds.substring(1);\n\n\t\t\t\t\t\t\t// Take CSV of video IDs and generate placeholder divs in a carousel, then init both.\n\t\t\t\t\t\t\tibmVp.createVideoCarousel(videoIds, appliedSettings);\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\telse if (appliedSettings.videoid.indexOf(\",\") > -1) {\n\t\t\t\t\t\t// Take CSV of video IDs and generate placeholder divs in a carousel, then init both.\n\t\t\t\t\t\tibmVp.createVideoCarousel(appliedSettings.videoid, appliedSettings);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: \n\t\t\t\t\tconsole.info(\"Video player display type unknown: \", appliedSettings.$origEl);\n\t\t\t}\n\t\t}", "init() {\n if (!this.player) return\n this.settings()\n this.listeners()\n //if (this.hasPlaylist) this.buildPlaylist()\n if (this.hasPlaylist) this.buildPlaylist()\n }", "function populatePlayBar() {\n populateDevices();\n\n //add playbutton\n let $button = $(\"<button>\", {\n type: \"button\",\n text: \"start playlist mix\",\n class: \"playback-button\"\n });\n //attach listener at element creation\n $button.on(\"click\", function () {\n handleStartButton();\n });\n $(\"#playback-container .col-12\").append($button);\n\n\n $button = $(\"<button>\", {\n type: \"button\",\n text: \"pause song\",\n class: \"playback-button\"\n });\n $button.on(\"click\", function () {\n pausePlayback();\n });\n $(\"#playback-container .col-12\").append($button);\n\n $button = $(\"<button>\", {\n type: \"button\",\n text: \"next song\",\n class: \"playback-button\"\n });\n $button.on(\"click\", function () {\n nextSongHandler();\n });\n $(\"#playback-container .col-12\").append($button);\n}", "function setupButtons(){\r\n\t\t\t$('.choice').on('click', function(){\r\n\t\t\t\tpicked = $(this).attr('data-index');\r\n\t\t\t\t$('.choice').removeAttr('style').off('mouseout mouseover');\r\n\t\t\t\t$(this).css({'font-weight':'bold', 'border-color':'#51a351', 'color':'#51a351'});\r\n\t\t\t\tif(submt){\r\n\t\t\t\t\tsubmt=false;\r\n\t\t\t\t\t$('#submitbutton').css({'color':'#fff','cursor':'pointer'}).on('click', function(){\r\n\t\t\t\t\t\t$('.choice').off('click');\r\n\t\t\t\t\t\t$(this).off('click');\r\n\t\t\t\t\t\tprocessQuestion(picked);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t}", "function init() {\n \n // popeye dom setup\n //--------------------------------------------------------------\n \n // add css \n ppyPlaceholder.css(cssPlaceholder);\n $self.css(cssSelf);\n \n // wrap popeye in placeholder \n $self.wrap(ppyPlaceholder);\n \n // wrap stage in container for extra styling (e.g. loading gfx)\n ppyStageWrap = ppyStage.wrap(ppyStageWrap).parent();\n \n // wrap caption contents in wrapper (can't use wrap() here...)\n ppyCaptionWrap = ppyCaption.wrapInner(ppyCaptionWrap).children().eq(0);\n \n // display first image\n showThumb();\n \n // add event handlers\n //--------------------------------------------------------------\n // hover behaviour for navigation\n if(opts.navigation == 'hover') {\n hideNav();\n $self.hover(\n function(){\n showNav();\n },\n function(){\n hideNav();\n }\n );\n ppyNav.hover(\n function(){\n showNav();\n },\n function(){\n hideNav();\n }\n );\n }\n if(!singleImageMode) {\n \n // previous image button\n ppyPrev.click(function(e){\n e.stopPropagation();\n previous();\n });\n \n // next image button\n ppyNext.click(function(e){\n e.stopPropagation();\n next();\n });\n \n }\n else {\n $self.addClass(sclass);\n ppyPrev.remove();\n ppyNext.remove();\n ppyPlay.remove();\n ppyPause.remove();\n ppyCounter.remove();\n }\n \n // hover behaviour for caption\n if(opts.caption == 'hover') {\n hideCaption();\n $self.hover(\n function(){\n showCaption(cap[cur]);\n },\n function(){\n hideCaption(true);\n }\n );\n }\n \n // enlarge image button\n ppySwitchEnlarge.click(function(e){\n e.stopPropagation();\n showImage();\n return false;\n });\n \n // compact image button \n ppySwitchCompact.click(function(e){\n e.stopPropagation();\n showThumb(cur);\n return false;\n });\n \n ppyStage.click(function(){\n if(enlarged) {\n showThumb(cur);\n }\n else {\n showImage();\n }\n \n });\n \n //play button\n ppyPlay.click(function(e){\n e.stopPropagation();\n \n // switch buttons\n ppyPause.removeClass('ppy-hidden');\n ppyPlay.addClass('ppy-hidden');\n \n // initiate Slideshow\n slideshow = window.setInterval( function(){\n next();\n }, opts.slidespeed);\n return false;\n });\n \n //pause button\n ppyPause.click(function(e){\n e.stopPropagation();\n \n // switch buttons\n ppyPlay.removeClass('ppy-hidden');\n ppyPause.addClass('ppy-hidden');\n \n // stop Slideshow\n window.clearInterval(slideshow);\n return false;\n });\n \n // mouseover flag\n $self.mouseenter(function(){\n ismouseover = true;\n }).mouseleave(function(){\n ismouseover = false;\n });\n \n // start autoslide\n if(opts.autoslide) {\n ppyPlay.trigger('click');\n }\n\n }", "function init() {\n setupModeButtons();\n setupSquares();\n resetGame();\n}", "function onClick () {\n\n play =! play;\n\tif(play){\n\t\tbutton.setFrames(0,0,1);\n\t}else{\n\t\tbutton.setFrames(1,1,0);\n\t}\n}", "function playControlsShow(type) {\n if( type === \"play\"){\n \n $('#tl_controls .tl_ctrls_play').hide();\n $('#tl_controls .tl_ctrls_pause').show();\n $('#tl_controls .play_btn').addClass('pause_btn');\n $('#tl_controls .play_btn').removeClass('play_btn');\n\n }else if( type === \"pause\"){\n\n $('#tl_controls .pause_btn').addClass('play_btn');\n $('#tl_controls .pause_btn').removeClass('pause_btn');\n $('#tl_controls .tl_ctrls_pause').hide();\n $('#tl_controls .tl_ctrls_play').show();\n\n }\n}", "createButtons() {\n this.settingsButton = this._createConnectionButton(TEXTURE_NAME_SETTINGS);\n this.deleteButton = this._createConnectionButton(TEXTURE_NAME_DELETE);\n }", "function init() {\n setUpModeButtons();\n setUpSquares();\n reset();\n}", "function setPlayingState() {\n status.innerText = 'Move the slider to interpolate styles.';\n status.style.color = 'black';\n playButton.innerText = 'Stop';\n playButton.disabled = false;\n alphaSlider.disabled = false;\n sampleButton1.disabled = false;\n sampleButton2.disabled = false;\n saveButton.disabled = false;\n changeChordsButton.disabled = false;\n chordInputs.forEach(c => c.disabled = true);\n chordInputs.forEach(c => c.style.color = 'gray');\n}", "function init() {\n\t\t\tconstructVideoPlayerContent(elems.container);\n\t\t\tshowControls();\n\t\t\t_.event(elems.btnBigPlay, 'click', play);\n\t\t\t_.event(elems.buttons.play, 'click', playPause);\n\t\t\t_.event(elems.video, 'click', pause);\n\t\t\t_.event(elems.buttons.volume, 'click', mute);\n\t\t\t_.event(elems.buttons.fullscreen, 'click', fullscreen);\n\t\t\t_.event(elems.video, 'loadedmetadata', function(e) {\n\t\t\t\tplaybackRate(opts.speed);\n\t\t\t\tvideoProgress = new Range(opts.progress / elems.video.duration, elems.ranges.video, {\n\t\t\t\t\tonDrop: (pct) => progress(pct, true),\n\t\t\t\t});\n\t\t\t\tvolumeSlider = new Range(opts.volume, elems.ranges.volume, {\n\t\t\t\t\tonDrag: volume,\n\t\t\t\t});\n\t\t\t\tvolume(opts.volume);\n\t\t\t\tprogress(opts.progress);\n\t\t\t\ttimestamp(0, elems.video.duration);\n\t\t\t\tif (opts.autoplay) play();\n\t\t\t});\n\t\t\t_.event(elems.video, 'timeupdate', progUpdate);\n\t\t\t_.event(elems.main, 'mousemove', showControls);\n\t\t\t_.event(elems.controls, 'mouseenter', () => showControls(true));\n\t\t\t_.event(elems.controls, 'mouseleave', () => showControls(false));\n\t\t\t_.event(window, 'keyup', handleKeyPress);\n\t\t\t_.event(document, 'fullscreenchange', handleFullscreenChange); // PREFIXES WHY\n\t\t\t_.event(document, 'msfullscreenchange', handleFullscreenChange);\n\t\t\t_.event(document, 'mozfullscreenchange', handleFullscreenChange);\n\t\t\t_.event(document, 'webkitfullscreenchange', handleFullscreenChange);\n\n\t\t\tif (opts.fullscreen) fullscreen(true);\n\t\t\telems.video.src = opts.src;\n\t\t}", "function objectInit() {\n wallCloseSpan = select('#wall-close');\n wallCloseSpan.mousePressed(wallClosePressed);\n pointCloseSpan = select('#point-close');\n pointCloseSpan.mousePressed(pointClosePressed);\n\n if (isSmartPhone) {\n for (let modal of selectAll('.modal-content')) {\n modal.removeClass('modal-content');\n modal.class('modal-content-smapho');\n }\n }\n\n startButton = createButton('Start');\n startButton.mousePressed(startAlgo);\n startButton.class('button');\n startButton.parent('#navbar')\n\n resetButton = createButton('Reset');\n resetButton.mousePressed(reset);\n resetButton.class('button');\n resetButton.parent('#navbar');\n\n resetAllButton = createButton('Remove Walls');\n resetAllButton.mousePressed(resetAll);\n resetAllButton.class('button');\n resetAllButton.parent('#navbar');\n}", "play () {\n\t\t\t\n\t\tthis.playButton = $('#playButton') // Init Bouton play\n\n\t\tthis.options.play ? this.options.play = false : this.options.play = true \n\n\t\tif (this.options.play === true) { // Si l'option play est égal à true\n\n\t\t\tthis.playButton.removeClass('carousel__play') // Enlève la classe carousel__play\n\t\t\tthis.playButton.addClass('carousel__pause') // Ajoute la classe carousel__pause\n\t\t\t\t\n\t\t\tthis.interval = window.setInterval(() => { // Définis l'intervale\n\t\t\t\t\n\t\t\t\tthis.gotoItem(this.currentItem + 1, this.options.animation) // Appel de la methode GotoItem avec le slide auquel j'ajoute 1 et l'animation à true\n\t\t\t\t\n\t\t\t}, this.options.timer) // 5 secondes entre les défillements\n\t\t\t\n\t\t} else if (this.options.play === false) { // Si option play est égal à false\n\t\t\t\n\t\t\tthis.playButton.removeClass('carousel__pause') // Enleve la classe carousel__pause\n\t\t\tthis.playButton.addClass('carousel__play') // Ajoute la classe carousel__play\n\t\t\t\n\t\t\tclearInterval(this.interval) // Nettoyage de l'intervale\n\t\t}\n\t\t\t\t\n\t}", "function play(){\n\tvar container = $(\"container\");\n\tvar levels = [\"Easy\",\"Medium\",\"Hard\",\"Back\"];\n\tvar button;\n\n\t//rimuovo tutti i bottoni\n\tremoveButtons();\n\n\t//aggiungo i bottoni per la scelta del livello difficoltà\n\tfor (var i = 0; i < levels.length; i++) {\n\t\tbutton=createButton(levels[i]);\n\t\tcontainer.appendChild(button);\n\t}\n\n\tbutton.onclick=back;\n}", "function initPreGame() {\r\n\tstartButton = new NButton.buttonBuilder()\r\n\t\t.withText(\"Start\")\r\n\t\t.withPos(width / 2 - 75, height - 100)\r\n\t\t.withWidth(150)\r\n\t\t.withHeight(75)\r\n\t\t.withTextSize(25)\r\n\t\t.build();\r\n\tpreGameMainMenu = new NButton.buttonBuilder()\r\n\t\t.withText(\"Main Menu\")\r\n\t\t.withPos(50, height - 100)\r\n\t\t.withWidth(150)\r\n\t\t.withHeight(75)\r\n\t\t.withTextSize(25)\r\n\t\t.build();\r\n\tbuttonPalletLeft = [];\r\n\tbuttonPalletRight = [];\r\n\tcreateButtonPallet(50, 250, buttonPalletLeft);\r\n\tcreateButtonPallet(width - 50 - 4 * 50 - 3 * 4, 250, buttonPalletRight);\r\n\tp1input = createInput('Player One');\r\n\tp1input.position(55 + 10, 220 + 10);\r\n\tp1input.hide();\r\n\tp1input.size(150, 40);\r\n\tp1input.style('font-size', '20px');\r\n\tp2input = createInput('Player Two');\r\n\tp2input.position(width - 250 + 10, 220 + 10);\r\n\tp2input.hide();\r\n\tp2input.size(150, 40);\r\n\tp2input.style('font-size', '20px');\r\n\tbuttonPalletLeft[9].selected = true;\r\n\tbuttonPalletRight[10].selected = true;\r\n\tcolorsSelected = {\r\n\t\tp1col: buttonPalletLeft[9].col,\r\n\t\tp2col: buttonPalletRight[10].col,\r\n\t\tp1name: \"Player One\",\r\n\t\tp2name: \"Player Two\"\r\n\t};\r\n}", "function initGraphics() {\n stage.addChild(howToPlay);\n howToPlay.on(\"click\", function (event) {\n startGame(event);\n initMuteUnMute();\n });\n}", "function enableButtons() {\n $('#play').attr('disabled', false);\n $('#step').attr('disabled', false);\n}", "function loadMenuButtons(){\n texts = [];\n texts.push(new Text(WIDTH/2, HEIGHT/25, WIDTH/6, \"OCTE\", -WIDTH/10, false));\n //texts.push(new Text(WIDTH/2, HEIGHT*0.2, WIDTH/50, \"(overly complicated tennis experience)\", -WIDTH/10, false));\n buttons = [];\n buttons.push(new Button(WIDTH/2, HEIGHT/2 - HEIGHT/10 + HEIGHT/150, WIDTH*0.2, HEIGHT/15, \"1player\", \"1 PLAYER\", 0, {}));\n buttons.push(new Button(WIDTH/2, HEIGHT/2 + HEIGHT/150, WIDTH*0.2, HEIGHT/15, \"2player\", \"2 PLAYERS\", 0, {}));\n buttons.push(new Button(WIDTH/2, HEIGHT/2 + HEIGHT/10 + HEIGHT/150, WIDTH*0.2, HEIGHT/15, \"options\", \"OPTIONS\", 0, {}));\n}", "function bindPlayBtn() {\n\n // play/pause button\n $(\".playBtn\").on(\"click\", function () {\n\n if (Player.isPause()) {\n Player.play(Player.currentID);\n } else {\n Player.pause();\n }\n });\n\n // next music button\n $(\".nextBtn\").on(\"click\", function() {\n Player.next();\n });\n\n // previous music button\n $(\".prevBtn\").on(\"click\", function() {\n Player.prev();\n });\n\n // play progress bar\n $(\".line\").on({\n \"mousedown\": function(event) {\n $(Player.audioObj).unbind(\"timeupdate\", updateProgress);\n },\n \"change\": function(){\n\n if( !isNaN(Player.audioObj.duration) ){\n Player.audioObj.currentTime = $(\".line\").val() * Player.audioObj.duration;\n if(!Player.isPause){\n Player.audioObj.play();\n }\n }\n\n Lyric.relocateLyric(Player.audioObj.currentTime, 0, Lyric.labelTimes.length - 1);\n },\n \"mouseup\": function(){\n $(Player.audioObj).on(\"timeupdate\", updateProgress);\n }\n });\n\n // playlist UI\n $(\".list ul\").on(\"click\", function(event){\n var target = event.target;\n if(target.nodeName.toLowerCase()==\"span\"){\n target=target.parentElement;\n }\n $(\".selected\").removeClass(\"selected\");\n $(target).addClass(\"selected\");\n });\n $(\".list ul\").on(\"dblclick\", function(event){\n var target = event.target;\n if(target.nodeName.toLowerCase()==\"span\"){\n target=target.parentElement;\n }\n Player.play(target.getAttribute(\"data-id\"))\n });\n\n // audio's volume adjust bar\n $(\".volume\").click(function(){\n if($(\".vol\").get(0).style.visibility==\"hidden\"){\n $(\".vol\").get(0).style.visibility=\"visible\";\n $(\".vol\").get(0).style.display=\"block\";\n }else{\n $(\".vol\").get(0).style.visibility=\"hidden\";\n $(\".vol\").get(0).style.display=\"none\";\n }\n })\n $(\".volGroove\").on(\"mousedown\", function(){\n changeVolumn();\n if(event.target.className == \"volBtn\"){\n $(document).on({\n \"mousemove\": function(event){\n changeVolumn();\n },\n \"mouseup\": function(){\n $(document).unbind(\"mousemove\");\n $(document).unbind(\"mouseup\");\n }\n })\n }\n });\n\n // play circle mode switch button\n changeCycleStyle(Player.cycle);\n $(\".loop\").on(\"click\", function(){\n $(this).removeClass(\"single\");\n $(this).removeClass(\"listing\");\n $(this).removeClass(\"random\");\n Player.setCycle(Player.cycle + 1 );\n changeCycleStyle(Player.cycle);\n });\n \n function changeCycleStyle(n){\n switch(n){\n case 0:\n $(\".loop\").addClass(\"listing\");\n break;\n case 1:\n $(\".loop\").addClass(\"single\");\n break;\n case 2:\n $(\".loop\").addClass(\"random\");\n break;\n }\n }\n \n function changeVolumn(){\n var v = $(\"#footer\").get(0).offsetTop - event.clientY - 18;\n v = (v < 0)? 0: (v > 90)? 90: v;\n $(\".volBtn\").css(\"bottom\", v + \"px\");\n $(\".currVol\").css(\"height\", v + 3 + \"px\");\n AudManager.gain.gain.value = v / 90;\n if(v === 0){\n $(\".volume\").addClass(\"mute\");\n } else {\n $(\".volume\").removeClass(\"mute\");\n }\n };\n }", "function Init() {\n \n playGame = false;\n\n statusTab.hide();\n board.hide();\n gameEnd.hide();\n \n startButton.click(function(event) {\n event.preventDefault();\n StartPlaying();\n });\n\n resetButton.click(function(event) {\n event.preventDefault();\n RestartGame();\n });\n}", "get btn_play() { return $(\"~Btn-Play\"); }", "onPlayButtonClick() {\n\t\tif ( this.target ) this.target.play();\n\t\tthis.trigger( 'play' );\n\t}", "init() {\n this.editor.style.width = this.width;\n this.editor.style.height = this.height;\n this.bar.setupToolbar();\n\n this.createTag(\"\", this.getActiveTags(), this.getActiveStyle());\n\n let tools = document.querySelectorAll(\".editor-button\");\n tools.forEach(t => {\n t.addEventListener('click', (e) => {\n this.updateStyle(e);\n });\n });\n }", "function initButtons() {\n $('#wizard-next-button').click(nextPhase);\n $('#wizard-previous-button').click(previousPhase);\n $('.wizard-phase').hide();\n $('.wizard-phase-button').click(function () {\n setPhase($(this).attr('data-phase'));\n });\n $('#wizard-done-button').click(function () {\n doneCallbacks.every(function (callback) {\n return callback() !== false;\n });\n });\n }", "_initializePresetButtons() {\n\n // Store some members will will use frequently.\n this._presetDirectory = Gio.File.new_for_path(Me.path + '/presets');\n this._presetList = this._builder.get_object('preset-list');\n\n // The sort column and type cannot be set in glade, so we do this here.\n this._presetList.set_sort_column_id(1, Gtk.SortType.ASCENDING);\n\n // Now add all presets to the user interface. We simply assume all *.json files in the\n // preset directory to be presets. No further checks are done for now...\n const presets = this._presetDirectory.enumerate_children(\n 'standard::*', Gio.FileQueryInfoFlags.NONE, null);\n\n while (true) {\n const presetInfo = presets.next_file(null);\n\n if (presetInfo == null) {\n break;\n }\n\n if (presetInfo.get_file_type() == Gio.FileType.REGULAR) {\n const suffixPos = presetInfo.get_display_name().indexOf('.json');\n if (suffixPos > 0) {\n const presetFile = this._presetDirectory.get_child(presetInfo.get_name());\n const row = this._presetList.append();\n const presetName = presetInfo.get_display_name().slice(0, suffixPos);\n this._presetList.set_value(row, 0, presetName);\n this._presetList.set_value(row, 1, presetFile.get_path());\n }\n }\n }\n\n // Load a preset whenever the selection changes.\n this._builder.get_object('preset-treeview')\n .connect('row-activated', (treeview, path) => {\n try {\n const [ok, iter] = treeview.get_model().get_iter(path);\n if (ok) {\n const path = treeview.get_model().get_value(iter, 1);\n Preset.load(Gio.File.new_for_path(path));\n }\n\n } catch (error) {\n utils.debug('Failed to load Preset: ' + error);\n }\n });\n\n // Open a save-dialog when the save button is pressed.\n this._builder.get_object('save-preset-button').connect('clicked', (button) => {\n const dialog = new Gtk.FileChooserDialog({\n title: _('Save Preset'),\n action: Gtk.FileChooserAction.SAVE,\n do_overwrite_confirmation: true,\n transient_for: button.get_toplevel(),\n modal: true\n });\n\n // Show only *.json files per default.\n const jsonFilter = new Gtk.FileFilter();\n jsonFilter.set_name(_('JSON Files'));\n jsonFilter.add_mime_type('application/json');\n dialog.add_filter(jsonFilter);\n\n // But allow showing all files if required.\n const allFilter = new Gtk.FileFilter();\n allFilter.add_pattern('*');\n allFilter.set_name(_('All Files'));\n dialog.add_filter(allFilter);\n\n // Add our action buttons.\n dialog.add_button(_('Cancel'), Gtk.ResponseType.CANCEL);\n dialog.add_button(_('Save'), Gtk.ResponseType.OK);\n\n // Show the preset directory per default.\n dialog.set_current_folder_uri(this._presetDirectory.get_uri());\n\n // Also make updating presets easier by pre-filling the file input field with the\n // currently selected preset.\n const presetSelection = this._builder.get_object('preset-selection');\n const [ok, model, iter] = presetSelection.get_selected();\n if (ok) {\n const name = model.get_value(iter, 0);\n dialog.set_current_name(name + '.json');\n }\n\n // Save preset file when the OK button is clicked.\n dialog.connect('response', (dialog, response_id) => {\n if (response_id === Gtk.ResponseType.OK) {\n try {\n let path = dialog.get_filename();\n\n // Make sure we have a *.json extension.\n if (!path.endsWith('.json')) {\n path += '.json';\n }\n\n // Now save the preset!\n const file = Gio.File.new_for_path(path);\n const exists = file.query_exists(null);\n const success = Preset.save(file);\n\n // If this was successful, we add the new preset to the list.\n if (success && !exists) {\n const fileInfo =\n file.query_info('standard::*', Gio.FileQueryInfoFlags.NONE, null);\n const suffixPos = fileInfo.get_display_name().indexOf('.json');\n const row = this._presetList.append();\n const presetName = fileInfo.get_display_name().slice(0, suffixPos);\n this._presetList.set_value(row, 0, presetName);\n this._presetList.set_value(row, 1, file.get_path());\n }\n\n } catch (error) {\n utils.debug('Failed to save preset: ' + error);\n }\n }\n\n dialog.destroy();\n });\n\n dialog.show();\n });\n\n // Open the preset directory with the default file manager.\n this._builder.get_object('open-preset-directory-button').connect('clicked', () => {\n Gio.AppInfo.launch_default_for_uri(this._presetDirectory.get_uri(), null);\n });\n\n // Create a random preset when the corresponding button is pressed.\n this._builder.get_object('random-preset-button').connect('clicked', () => {\n Preset.random();\n });\n }", "function JukeBox(){\n this.songs = [];\n this.back = document.getElementById(\"back\");\n this.playpause = document.getElementById(\"playpause\");\n this.next = document.getElementById(\"next\");\n this.shuffle = document.getElementById(\"shuffle\");\n}", "function initializeControls() {\n const controls = quotes\n .map((el, i) => {\n return `\n <li class=\"site-testimonials__control-item\">\n <button class=\"site-testimonials__control-button\">\n <span class=\"visually-hidden\">Go to Slide ${i + 1}</span>\n </button>\n </li>\n `;\n })\n .join('');\n\n buttonContainer.innerHTML = controls;\n }", "function initGame(){\n\t// show pickers and new game button\n\tnewGameBtn.classList.remove('hide')\n\tselectX.classList.remove('hide')\n\tselectO.classList.remove('hide')\n\n\t// enable pickers and new game button\n\tnewGameBtn.removeAttribute('disabled')\n\tselectXhuman.removeAttribute('disabled')\n\tselectXcomputer.removeAttribute('disabled')\n\tselectOhuman.removeAttribute('disabled')\n\tselectOcomputer.removeAttribute('disabled')\n\n\t// add event lister for new game button\n\tnewGameBtn.addEventListener('click', newGame, {once : true})\n}", "play(buttonEl) {\n console.log(this)\n playSongLyrics(this.lyrics, this.voice)\n playDrums(this.drums)\n //also play bg song\n playBackgroundSong(this.backgroundSong, this.duration, buttonEl)\n }", "function init(){\r\n\tmodeButton[1].style.borderBottom = \"3px solid #232323\";\t\t\t\t//starts out in the \"HARD\" mode\r\n\t\r\n\t//Setup event listeners\r\n\troundListeners();\r\n\tmodeButtonListeners();\t\r\n\tresetListeners()\r\n\tsquareListeners();\r\n\r\n\treset();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n}", "function initializeControlButtons(){\n sixteenBtn.addEventListener('click', function(){\n /// TOGGLE ACTIVE CLASS ///\n sixteenBtn.classList.add('active');\n thirtyTwoBtn.classList.remove('active');\n\n /// UPDATE GAME DIMENSIONS ///\n dimensions = { row: 16, col: 16 };\n });\n\n thirtyTwoBtn.addEventListener('click', function(){\n /// TOGGLE ACTIVE CLASS ///\n sixteenBtn.classList.remove('active');\n thirtyTwoBtn.classList.add('active');\n\n /// UPDATE GAME DIMENSIONS ///\n dimensions = { row: 32, col: 32 };\n });\n\n startBtn.addEventListener('click', function(){\n generateBoard(dimensions.row, dimensions.col);\n\n addGridCellListeners();\n\n startGame();\n });\n\n restartBtn.addEventListener('click', function(){\n clearBoard();\n resetGame();\n });\n\n }", "initBtn() {\n this.btn.setTexture(constants.BUTTON_SPIN.key);\n this.btnDisplay = \"Spin\";\n }", "function init() {\n\t\tdemobo.setController( {\n\t\t\turl : ui.controllerUrl\n\t\t});\n\t\t// your custom demobo input event dispatcher\n\t\tdemobo.mapInputEvents( {\n\t\t\t'playPauseButton' : playPause,\n\t\t\t'playButton' : playPause,\n\t\t\t'pauseButton' : playPause,\n\t\t\t'loveButton' : love,\n\t\t\t'spamButton' : ban,\n\t\t\t'nextButton' : next,\n\t\t\t'channelTab' : sendStationList,\n\t\t\t'stationItem' : chooseStation,\n\t\t\t'volumeSlider' : setVolume,\n\t\t\t'demoboVolume' : onVolume,\n\t\t\t'demoboApp' : function() {\n\t\t\t\trefreshController();\n\t\t\t\thideDemobo();\n\t\t\t}\n\t\t});\n\t\tshowDemobo();\n\t\tsetupSongUpdateListener();\n\t}", "initializeButtons() {\n this.settingsScreen[\"start-quiz-button\"].addEventListener(\"click\", () =>\n this.settingsComplete()\n )\n this.quizScreen[\"submit-question-button\"].addEventListener(\"click\", () =>\n this.submitQuestion()\n )\n this.quizScreen[\"next-question-button\"].addEventListener(\"click\", () =>\n this.displayNextQuestionOrSummary()\n )\n this.summaryScreen[\"play-again-yes\"].addEventListener(\"click\", () =>\n this.playAgain()\n )\n }", "function initButton(){\n //console.log('initButton');\n //修改个人信息\n $('#edit').click(function(){});\n if(o_length > 0){\n //自制音乐\n //上一页\n $('#original_musics_left_button').click(function(){\n //console.log('original_musics_left_button');\n if(o_page == 1){return;}\n o_page--;\n $('#original_musics').html(\"\");\n for(var i = 0; i <= 9; i++){\n if(o_data.length-((o_page-1)*10+i)-1 < 0){return;}\n createItem(o_data[o_data.length-((o_page-1)*10+i)-1]);\n $('#original_musics').append(l);\n }\n initHover();\n });\n //下一页\n $('#original_musics_right_button').click(function(){\n //console.log('original_musics_right_button');\n if(o_page == Math.ceil(o_length/10)){return;}\n o_page++;\n $('#original_musics').html(\"\");\n for(var i = 0; i <= 9; i++){\n if(o_data.length-((o_page-1)*10+i)-1 < 0){return;}\n createItem(o_data[o_data.length-((o_page-1)*10+i)-1]);\n $('#original_musics').append(l);\n }\n initHover();\n });\n }\n if(d_length > 0){\n //改编音乐\n //上一页\n $('#derivative_musics_left_button').click(function(){\n //console.log('derivative_musics_left_button');\n if(d_page == 1){return;}\n d_page--;\n $('#derivative_musics').html(\"\");\n for(var i = 0; i <= 9; i++){\n if(d_data.length-((d_page-1)*10+i)-1 < 0){return;}\n createItem(d_data[d_data.length-((d_page-1)*10+i)-1]);\n $('derivative_musics').append(l);\n }\n initHover();\n });\n //下一页\n $('#derivative_musics_right_button').click(function(){\n //console.log('derivative_musics_right_button');\n if(d_page == Math.ceil(d_length/10)){return;}\n d_page++;\n $('#derivative_musics').html(\"\");\n for(var i = 0; i <= 9; i++){\n if(d_data.length-((d_page-1)*10+i)-1 < 0){return;}\n createItem(d_data[d_data.length-((d_page-1)*10+i)-1]);\n $('#derivative_musics').append(l);\n }\n initHover();\n });\n }\n if(c_length > 0){\n //收藏音乐\n //上一页\n $('#collected_musics_left_button').click(function(){\n //console.log('derivative_musics_left_button');\n if(c_page == 1){return;}\n c_page--;\n $('#collected_musics').html(\"\");\n for(var i = 0; i <= 9; i++){\n if(c_data.length-((c_page-1)*10+i)-1 < 0){return;}\n createItem(c_data[c_data.length-((c_page-1)*10+i)-1]);\n $('collected_musics').append(l);\n }\n initHover();\n });\n //下一页\n $('#collected_musics_right_button').click(function(){\n //console.log('collected_musics_right_button');\n if(c_page == Math.ceil(c_length/10)){return;}\n c_page++;\n $('#collected_musics').html(\"\");\n for(var i = 0; i <= 9; i++){\n if(c_data.length-((c_page-1)*10+i)-1 < 0){return;}\n createItem(c_data[c_data.length-((c_page-1)*10+i)-1]);\n $('#collected_musics').append(l);\n }\n initHover();\n });\n }\n}", "function InsertButtonsToToolBar()\n{\n//Strike-Out Button\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png\",\n \"speedTip\": \"Strike\",\n \"tagOpen\": \"<s>\",\n \"tagClose\": \"</s>\",\n \"sampleText\": \"Strike-through text\"}\n//Line break button\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png\",\n \"speedTip\": \"Line break\",\n \"tagOpen\": \"<br />\",\n \"tagClose\": \"\",\n \"sampleText\": \"\"}\n//Superscript\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png\",\n \"speedTip\": \"Superscript\",\n \"tagOpen\": \"<sup>\",\n \"tagClose\": \"</sup>\",\n \"sampleText\": \"Superscript text\"}\n//Subscript\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png\",\n \"speedTip\": \"Subscript\",\n \"tagOpen\": \"<sub>\",\n \"tagClose\": \"</sub>\",\n \"sampleText\": \"Subscript text\"}\n//Small Text\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/5/58/Button_small.png\",\n \"speedTip\": \"Small\",\n \"tagOpen\": \"<small>\",\n \"tagClose\": \"</small>\",\n \"sampleText\": \"Small Text\"}\n//Comment\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png\",\n \"speedTip\": \"Insert hidden Comment\",\n \"tagOpen\": \"<!-- \",\n \"tagClose\": \" -->\",\n \"sampleText\": \"Comment\"}\n//Gallery\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png\",\n \"speedTip\": \"Insert a picture gallery\",\n \"tagOpen\": \"\\n<gallery>\\n\",\n \"tagClose\": \"\\n</gallery>\",\n \"sampleText\": \"Image:Example.jpg|Caption1\\nImage:Example.jpg|Caption2\"}\n//Block Quote\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png\",\n \"speedTip\": \"Insert block of quoted text\",\n \"tagOpen\": \"<blockquote>\\n\",\n \"tagClose\": \"\\n</blockquote>\",\n \"sampleText\": \"Block quote\"}\n// Table\nmwCustomEditButtons[mwCustomEditButtons.length] = {\n \"imageFile\": \"http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png\",\n \"speedTip\": \"Insert a table\",\n \"tagOpen\": '{| class=\"wikitable\"\\n|-\\n',\n \"tagClose\": \"\\n|}\",\n \"sampleText\": \"! header 1\\n! header 2\\n! header 3\\n|-\\n| row 1, cell 1\\n| row 1, cell 2\\n| row 1, cell 3\\n|-\\n| row 2, cell 1\\n| row 2, cell 2\\n| row 2, cell 3\"}\n}", "function setupPlayerWidget () {\n\t\t\tvar playerType = appliedSettings.videodisplay;\n\n\t\t\tif (playerType.indexOf(\"carousel-\") === 0) {\n\t\t\t\tplayerType = \"carousel\";\n\t\t\t}\n\n\t\t\tappliedSettings.$origEl.addClass(\"ibm-video-player-con\");\n\n\t\t\tswitch (playerType) {\n\t\t\t\tcase \"inline\": \n\t\t\t\t\t// We inject an inline player inside the element that initiated the plug-in.\n\n\t\t\t\t\t// Create a video player trigger (placeholder image), used on both inline and overlayAndTrigger displays.\n\t\t\t\t\tcreatePlayerTrigger(appliedSettings.videoid);\n\n\t\t\t\t\t// Inject the placeholder INSIDE this element that's inside the orig container element. \n\t\t\t\t\t// The YT player object REPLACES this. \n\t\t\t\t\t$('<div></div>').appendTo(appliedSettings.$origEl.empty()).html(me.$trigger);\n\n\t\t\t\t\t// Add placeholder/trigger video info.\n\t\t\t\t\taddPlaceholderInfo();\n\n\t\t\t\t\t// Bind the trigger to REPLACE the original element (containers the trigger) with an embeded video player.\n\t\t\t\t\tme.$trigger.click(function (evt) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tcreateInlinePlayer($(\" > div\", appliedSettings.$origEl), appliedSettings.videoid);\n\n\t\t\t\t\t\t// On resize, recalculate height and reset iframe@height value. Makes the player responsive and adjust height\n\t\t\t\t\t\t// of iframe based on width of any container it's in, when the container changes width.\n\t\t\t\t\t\t$(window).resize(function(){\n\t\t\t\t\t\t\tvar $playerIframe = $(me.player.getIframe()),\n\t\t\t\t\t\t\t\tnewHeight = calcHeight($playerIframe.parent().width());\n\n\t\t\t\t\t\t\t$playerIframe.attr(\"height\", newHeight + \"px\");\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"overlay\": \n\t\t\t\t\t// We make ONLY the overlay here.\n\t\t\t\t\t// The trigger is the element they put the widget on. It has to be on the link.\n\n\t\t\t\t\t// Set the overlay and video embed width/heigt from the preset used.\n\t\t\t\t\tsetOverlayPresets();\n\n\t\t\t\t\t// Get the video's info and append the duration of the video to the trigger link if they set the option.\n\t\t\t\t\tif (appliedSettings.showvideoduration) {\n\t\t\t\t\t\tgetVideoInfo(appliedSettings.videoid, function(jsonObj){\n\t\t\t\t\t\t\tappliedSettings.$origEl.append(' <span class=\"ibm-item-note\">(' + jsonObj.formattedTime + ')</span>');\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Make overlay and attach to this object.\n\t\t\t\t\tme.overlay = ibmVp.createOverlay(appliedSettings);\n\t\t\t\t\tme.overlay.setHtml('<div id=\"' + appliedSettings.id + '-tmpcon\"></div>');\n\n\t\t\t\t\t// Bind the video to pause if the overlay is closed.\n\t\t\t\t\tme.overlay.subscribe(\"hide\", \"Videoplayer\", function(){\n\t\t\t\t\t\tme.player.pauseVideo();\n\t\t\t\t\t});\n\n\t\t\t\t\t// If they explicitely said to show the play button on their implied custom trigger (use userSettings),\n\t\t\t\t\t// add the play button class and span.\n\t\t\t\t\tif (userSettings.showimageplaybutton) {\n\t\t\t\t\t\tappliedSettings.$origEl.addClass(playerPlaceholderClass);\n\t\t\t\t\t\taddPlaybutton(appliedSettings.$origEl);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Change the width to the preset overlay player widget, instead of the width of the container on the page.\n\t\t\t\t\tappliedSettings.width = appliedSettings.overlayplayerwidth;\n\n\t\t\t\t\t// Bind the element (usually an <a> but can technically be anything) that was init via the plugin to open overlay.\n\t\t\t\t\tappliedSettings.$origEl.click(function (evt) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tshowOverlayAndPlay();\n\t\t\t\t\t});\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"overlayandtrigger\":\n\t\t\t\t\t// We make both the overlay AND the trigger (image they click on to launch the overlay).\n\n\t\t\t\t\t// Set the overlay and video embed width/heigt from the preset used.\n\t\t\t\t\tsetOverlayPresets();\n\n\t\t\t\t\t// Create a video player trigger (placeholder image), used on both inline and overlayAndTrigger displays.\n\t\t\t\t\tcreatePlayerTrigger(appliedSettings.videoid);\n\n\t\t\t\t\t// Inject the trigger INSIDE the element that init'd the plug-in.\n\t\t\t\t\t$('<div></div>').appendTo(appliedSettings.$origEl.empty()).html(me.$trigger);\n\n\t\t\t\t\t// Add placeholder/trigger video info.\n\t\t\t\t\taddPlaceholderInfo();\n\n\t\t\t\t\t// Make overlay and attach to this object.\n\t\t\t\t\tme.overlay = ibmVp.createOverlay(appliedSettings);\n\t\t\t\t\tme.overlay.setHtml('<div id=\"' + appliedSettings.id + '-tmpcon\"></div>');\n\n\t\t\t\t\t// Bind the video to pause if the overlay is closed.\n\t\t\t\t\tme.overlay.subscribe(\"hide\", \"Videoplayer\", function(){\n\t\t\t\t\t\tme.player.pauseVideo();\n\t\t\t\t\t});\n\n\t\t\t\t\t// Change the width to the preset overlay player widget, instead of the width of the container on the page.\n\t\t\t\t\t// NOTE: This HAS to be after we create the trigger, else the trigger will use this width and automatically make a big play button.\n\t\t\t\t\tappliedSettings.width = appliedSettings.overlayplayerwidth;\n\n\t\t\t\t\t// Bind trigger -> open overlay and play.. dupe what overlay above does just on a different element.\n\t\t\t\t\tme.$trigger.click(function (evt) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tshowOverlayAndPlay();\n\t\t\t\t\t});\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"carousel\":\n\t\t\t\t\t// This creates a div element in a carousel for each video ID.\n\t\t\t\t\t// Used for both types of carouse. The only differnece is the videodisplay, and it is \n\t\t\t\t\t// determined using the passed appliedSettings in the ibmVp.createVideoCarousel function.\n\t\t\t\t\t// Then it inits the videoplayer plug-in on each. \n\t\t\t\t\t// Then it inits the carousel.\n\n\t\t\t\t\t// It's just as if the dev custom coded the elements themselves, then say \"displaytype=overlaywithtrigger\".\n\t\t\t\t\tif (appliedSettings.videoplaylistid !== \"\") {\n\t\t\t\t\t\t// Get video info from videoinfo API using CSV of IDs.\n\t\t\t\t\t\t$.getJSON(api.playlistVideos.replace(\"{playlistId}\", appliedSettings.videoplaylistid).replace(\"{maxResults}\", appliedSettings.maxnumvideos)).done(function (jsonObj) {\n\t\t\t\t\t\t\tvar videoIds = \"\";\n\n\t\t\t\t\t\t\t$.each(jsonObj.items, function(){\n\t\t\t\t\t\t\t\tvideoIds += \",\" + this.contentDetails.videoId;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tvideoIds = videoIds.substring(1);\n\n\t\t\t\t\t\t\t// Take CSV of video IDs and generate placeholder divs in a carousel, then init both.\n\t\t\t\t\t\t\tibmVp.createVideoCarousel(videoIds, appliedSettings);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse if (appliedSettings.videoid.indexOf(\",\") > -1) {\n\t\t\t\t\t\t// Take CSV of video IDs and generate placeholder divs in a carousel, then init both.\n\t\t\t\t\t\tibmVp.createVideoCarousel(appliedSettings.videoid, appliedSettings);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: \n\t\t\t\t\tconsole.info(\"Video player display type unknown: \", appliedSettings.$origEl);\n\t\t\t}\n\t\t}", "function loadButtons() {\n\tgetNumbers();\n getOperators();\n getExecuteOperationButton();\n\tgetClearButton();\n\tgetclearEverythingButton();\n\tgetRemoveLastButton();\n\tgetOpenParenthesesButton();\n\tgetCloseParenthesesButton();\n\tgetSquareButton();\n\tgetSquareRootButton();\n\tgetAnsButton();\n}", "initialize() {\n this.display = 0;\n this.initButtons();\n this.initClipBoard();\n this.pasteFromClipBoard();\n this.initDblClick();\n }", "createControls() {\n var muteControl = this.options.muted ? 'fa-volume-off' : 'fa-volume-up'\n var playPauseControl = this.options.autoplay ? 'fa-pause' : 'fa-play'\n\n var controlsHTML =\n ' \\\n <div class=\"controls\"> \\\n <a href=\"#\" class=\"playButton button fa ' +\n playPauseControl +\n '\"></a> \\\n <a href=\"#\" class=\"muteButton button fa ' +\n muteControl +\n '\"></a> \\\n <a href=\"#\" class=\"fullscreenButton button fa fa-expand\"></a> \\\n </div> \\\n '\n\n $(this.element).append(controlsHTML, true)\n\n // hide controls if option is set\n if (this.options.hideControls) {\n $(this.element)\n .find('.controls')\n .hide()\n }\n\n // wire up controller events to dom elements\n // this.attachControlEvents();\n }", "function SetUI(options2)\n{\n\tlet rightC = $(\".middle-controls-buttons\");\n\tlet mainP = $(\"#main-panel\");\n\n\tlet divP = $(\"<div id=yml_lyricsPanel class='style-scope ytmusic-player-page'></div>\").html(\"<header id=yml_musicName></header><pre id=yml_lyricsText class='style-scope ytmusic-player-baryt-formatted-string'>Lyrics:</pre>\");\n\tlet divB = $(\"<div id=yml_lyricsButton class='right-controls-buttons style-scope ytmusic-player-bar'></div>\").html(\"<a class='yml_Button style-scope ytmusic-player-bar yt-formatted-string' style='color:inherit;'>Lyrics</a>\");\n\n\tlet divPB = $(\"<div id=yml_PanelButtons class='style-scope ytmusic-player-page'></div>\").html(\"<a class='yml_Button' id=yml_addLyricsButton>Add lyrics</a><a class='yml_Button' id=yml_optionButton style='padding-left: 10px;'>Options</a>\");\n\n\tlet divPO = $(\"<div id=yml_optionsPanel class='style-scope ytmusic-player-page'></div>\").html(\"<a class='style-scope ytmusic-player-baryt-formatted-string' style='color:inherit; font-family:inherit;'>Options:</a><form>\\\n<br>\\\n\t<input type=checkbox name=debug id=yml_debug >Debug</input><br> \\\n\t<input type=checkbox name=contextmenu id=yml_contextmenu >Context menu</input><br> \\\n<ul id='image-list1' class='sortable-list'>\\\n\t\t<br>\\\n\t<li class='ui-state-default ui-state-disabled' id='0'>\" + options2[\"providers\"][0][\"name\"] + \"</li>\\\n\t<li class='ui-state-default' id='1'><span>\" + options2[\"providers\"][1][\"name\"] + \"</span></li>\\\n\t<li class='ui-state-default' id='2'><span>\" + options2[\"providers\"][2][\"name\"] + \"</span></li>\\\n\t<li class='ui-state-default' id='3'><span>\" + options2[\"providers\"][3][\"name\"] + \"</span></li>\\\n\t<li class='ui-state-default' id='4'><span>\" + options2[\"providers\"][4][\"name\"] + \"</span></li>\\\n</ul >\\\n\t\t<br>\\\n\t\t<a class='yml_Button' id=yml_clearCache >Clear cache</a><br> \\\n</form>\");\n\n\t$(divP).append(divPB);\n\t$(divP).prepend(divPO);\n\t$(mainP).append(divP);\n\t$(rightC).append(divB);\n\n\t$(divP).hide();\n\t$(divPO).hide();\n\n\tUIValues(options2);\n}", "function reenablePlayButton() {\r\n document.getElementById(\"pg-2-play-button\").disabled = false;\r\n}", "function load_new_tuning(tuning){\n //set buttons\n let option, audio, string;\n for(let i = 6; i >= 1; i--){\n option = tuning[i];\n string = document.getElementById(i);\n let pos = find_index(option);\n string.onclick = function(){\n sounds[pos].play();\n };\n string.innerHTML = option;\n }\n}", "#buildhowToPlayButton() {\n this.howToPlayButton.addEventListener('click', () => {\n this.howToPlayText.style.display = 'block';\n this.aboutText.style.display = 'none';\n });\n }", "function playButtonStart(startLevelUpdate, modeUpdate)\r\n\t{\t\r\n\t\tplayButton = new newButton((buttonHeight + 40), buttonWidth, \"orange\", \"orange\", (940 / 2) - 60, 215, stage, \"Iniciar\", textFont, \"white\");\r\n\t\tchangeButton = new newButton((buttonHeight + 110), buttonWidth, \"orange\", \"orange\", (940 / 2) - 94, 255, stage, \"Escuchas: Original\", textFont, \"white\");\r\n\r\n\t\tmodeText = new newText(\"Modo: \" + modeUpdate, textFont, \"darkorange\", stage, (25*10), (75*1.25));\r\n\r\n\t\tplayButton.addListeners(\"darkorange\");\r\n\t\tchangeButton.addListeners(\"darkorange\");\r\n\r\n\t\tplayButton.newContainer.addEventListener(\"click\", stopPlaying);\r\n\t\tchangeButton.newContainer.addEventListener(\"click\", changeMessage);\r\n\r\n\t\tif (startLevelUpdate == \"Easy\")\r\n\t\t{\r\n\t\t\tactivateButtons();\r\n\t\t\tgainModifier = 10;\r\n\t\t\tgameControl.generateIconigta(\"Fácil\");\r\n\t\t\tconsole.log(gameControl.Guess)\r\n\t\t}\r\n\t\telse if (startLevelUpdate == \"Medium\")\r\n\t\t{\r\n\t\t\tactivateButtons();\r\n\t\t\tnewPlayer.Correct = 20;\r\n\t\t\tnewPlayer.level = \"Intermedio\";\r\n\t\t\tbuttonActiveMedium = true;\r\n\t\t\tgainModifier = 6;\r\n\t\t\tgameControl.generateIconigta(\"Intermedio\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tactivateButtons();\r\n\t\t\tnewPlayer.Correct = 30;\r\n\t\t\tnewPlayer.level = \"Avanzado\";\r\n\t\t\tbuttonActiveHard = true;\r\n\t\t\tgainModifier = 3;\r\n\t\t\tgameControl.generateIconigta(\"Avanzado\");\r\n\t\t}\r\n\t\tif (modeUpdate == \"Cortes\") {gainModifier *= -1;}\r\n\r\n\t\tgameFilter.gain.value = gainModifier;\r\n\t\tgameFilter.frequency.value = gameControl.Guess;\r\n\r\n\t\tgainText = new newText(\"Ganancia: \" + gainModifier.toString() + \" dB\", textFont, \"darkorange\", stage, (25*28), (75*1.25));\r\n\t\trightText.createText.text = \"Aciertos: \" + newPlayer.subCounter.toString();\r\n\t\tlevelText.createText.text = \"Nivel: \" + newPlayer.level;\r\n\r\n\t\tinitEasy.newContainer.removeAllChildren();\r\n\t\tinitMedium.newContainer.removeAllChildren();\r\n\t\tinitAdvanced.newContainer.removeAllChildren();\r\n\r\n\t\tstage.removeChild(initText.createText);\r\n\r\n\t\tstage.update();\r\n\r\n\t\tdelete initText;\r\n\t\tdelete initEasy;\r\n\t\tdelete initMedium;\r\n\t\tdelete initAdvanced;\r\n\t}", "function addPlayButtons() {\r\n // get a list of questions to remove the screen reader offensive material.\r\n var questions = document.getElementsByClassName(\"questionDisplay\");\r\n for (var question = 0; question < questions.length; ++question) {\r\n try {\r\n // save question for speech synthesis\r\n var questionText = questions[question]\r\n .getElementsByClassName(\"wysiwygtext\")[0]\r\n .textContent.trim();\r\n // save answers for speech synthesis\r\n var answerText = \"\";\r\n var answers = questions[question].getElementsByClassName(\"multiChoice\");\r\n for (var n = 0; n < answers.length; ++n) {\r\n answerText +=\r\n \"\\n\" +\r\n (n + 1) +\r\n \" \" +\r\n answers[n]\r\n .getElementsByClassName(\"multiContent\")[0]\r\n .textContent.trim();\r\n }\r\n //consider true or false questions, which are layed out differently.\r\n if (\r\n answers.length == 0 &&\r\n questions[question].innerHTML.match(\"questionResponses.trueFalse\")\r\n ) {\r\n questionText = \"True or false. \" + questionText;\r\n //answerText += \"\\n1 True\";\r\n //answerText += \"\\n2 False\";\r\n }\r\n // replace _____ in questions with \"[blank]\" instead.\r\n questionText = questionText.replace(/[_]{2,}/g, \"[blank]\");\r\n\r\n // append the answer to the question so it can be read together.\r\n questionText += answerText + \"\\n\";\r\n\r\n //add a button to the question to play it in a speech synthesizer.\r\n var btn = document.createElement(\"button\");\r\n btn.id = \"btnPlay_\" + question;\r\n btn.name = btn.id;\r\n btn.className = \"btnPlay\";\r\n btn.textContent = \"Play\";\r\n btn.type = \"button\";\r\n btn.style.marginRight = \"1em\";\r\n btn.onclick = (function (id, msg) {\r\n return function () {\r\n if (document.getElementById(id).textContent == \"Stop\") {\r\n // if something is already playing, just cancel it.\r\n window.speechSynthesis.cancel();\r\n } else {\r\n document.getElementById(id).textContent = \"Stop\"; // otherwise, start playing and set the button to allow stoppage\r\n window.speechSynthesis.cancel();\r\n var questionUtterance = new SpeechSynthesisUtterance(\r\n pronunciationHint(msg)\r\n );\r\n try {\r\n if (document.querySelector(\"#speed\").options.length > 0) {\r\n questionUtterance.voice = speechSynthesis.getVoices()[\r\n document.querySelector(\"#voice\").value\r\n ];\r\n }\r\n questionUtterance.rate = document.querySelector(\"#speed\").value;\r\n questionUtterance.pitch = document.querySelector(\"#pitch\").value;\r\n } catch (err) {\r\n console.log(\"Error setting voice options: \" + err);\r\n }\r\n window.speechSynthesis.speak(questionUtterance);\r\n var timer = window.setInterval(restartSpeech, 15000);\r\n questionUtterance.onend = function () {\r\n // add an event to reset the text to \"Play\"\r\n document.getElementById(id).textContent = \"Play\";\r\n clearInterval(timer);\r\n };\r\n }\r\n };\r\n })(btn.id, questionText);\r\n //var questionForInjectingButton = questions[question].getElementsByClassName(\"wysiwygtext\")[0];\r\n questions[question]\r\n .getElementsByClassName(\"wysiwygtext\")[0]\r\n .parentNode.prepend(btn);\r\n } catch (err) {\r\n console.log(\"An error has occurred\\n\" + err);\r\n }\r\n }\r\n}", "function initialiseControls()\n{\n\n\n /* Create Input Panel */\n PIEaddDisplayText(\"Time1 ds\",0);\n PIEaddDisplayText(\"Time2 ds\",0);\n PIEaddDisplayText(\"Time3 ds\",0);\n PIEaddDisplayText(\"Time4 ds\",0);\n PIEaddDisplayText(\"Time5 ds\",0);\n\n}", "@action handlePlayButtonClick() {\n this.currentPlayState = PlaylistModel.playState.PLAYING;\n }", "function media_controller(ytplayer_name,tag) {\r\n // === Canvas Button ===\r\n function drawStopButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect( 8, 7,12,13);\r\n }\r\n function drawStepBackButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect(20, 7.9, 3,11.3);\r\n ctx.beginPath(); ctx.moveTo(18, 8); ctx.lineTo(17, 8); ctx.lineTo( 6,14); ctx.lineTo(17,19); ctx.lineTo(18,19); ctx.lineTo(18, 8);\r\n ctx.fill(); \r\n }\r\n function drawFrameButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect( 5, 7.9, 3,11.3);\r\n ctx.beginPath(); ctx.moveTo(10, 8); ctx.lineTo(11, 8); ctx.lineTo(22,14); ctx.lineTo(11,19); ctx.lineTo(10,19); ctx.moveTo(10, 8);\r\n ctx.fill(); \r\n }\r\n function drawPlayButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.beginPath(); ctx.moveTo( 6, 7); ctx.lineTo(21,14); ctx.lineTo( 6,20); ctx.lineTo( 6, 7);\r\n ctx.fill(); \r\n }\r\n function drawPauseButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect( 8, 6, 4,15);\r\n ctx.fillRect(16, 6, 4,15);\r\n }\r\n function drawMemoButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect ( 6, 5, 7, 3);\r\n ctx.fillRect ( 6, 5, 3,14);\r\n ctx.clearRect( 7, 6, 5, 1);\r\n ctx.clearRect( 7, 6, 1,12);\r\n }\r\n function drawLoopButton(ctx,color) {\r\n ctx.clearRect(0,0,35,26); ctx.fillStyle=color;\r\n ctx.beginPath();\r\n ctx.arc(25,15 ,5.9,Math.PI/2,-Math.PI/2,true);\r\n ctx.arc(25,14.6,4 ,-Math.PI/2,Math.PI/2,false);\r\n ctx.fill();\r\n ctx.fillRect(13,19,12,2.2);\r\n ctx.beginPath();\r\n ctx.arc(13,14.2,4.5,-Math.PI/2,Math.PI/2,true);\r\n ctx.arc(13,14.4,6.5,Math.PI/2,-Math.PI/2,false);\r\n ctx.fill();\r\n ctx.fillRect(9,9,2,3);\r\n ctx.fillRect(11,9,3,2);\r\n ctx.fillRect(12,7.4,6,3);\r\n ctx.beginPath(); ctx.moveTo(11, 4); ctx.lineTo(14, 4); ctx.lineTo(21, 9); ctx.lineTo(14,14); ctx.lineTo(11,14); ctx.lineTo(18, 9); ctx.lineTo(11, 4);\r\n ctx.fill();\r\n }\r\n function drawRewindButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect(8, 7, 1.2,13.5);\r\n ctx.beginPath(); ctx.moveTo(21, 7); ctx.lineTo( 8,14); ctx.lineTo(21,20); ctx.lineTo(21, 7);\r\n ctx.fill(); \r\n }\r\n function drawLimitButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n ctx.fillRect (15,18, 7, 3);\r\n ctx.fillRect (19, 6, 3,14);\r\n ctx.clearRect(16,19, 5, 1);\r\n ctx.clearRect(20, 7, 1,12);\r\n }\r\n function drawFreezeButton(ctx,color) {\r\n ctx.clearRect(0,0,28,26); ctx.fillStyle=color;\r\n switch (getValue('CUSTOM_FREEZE_BUTTON')) {\r\n case 0: default: // Original\r\n ctx.fillRect(11, 6, 2, 3); ctx.fillRect(15, 6, 2, 3); // Eyes\r\n ctx.fillRect(13,10, 2, 1); // Nose\r\n ctx.fillRect(13, 2, 2, 1); ctx.fillRect(10, 3, 3, 1); ctx.fillRect(15, 3, 3, 1); ctx.fillRect( 9, 4, 1, 2); ctx.fillRect(18, 4, 1, 2); ctx.fillRect( 8, 6, 1, 2); ctx.fillRect(19, 6, 1, 2); ctx.fillRect( 9, 8, 1, 3); ctx.fillRect(18, 8, 1, 3); ctx.fillRect(10,10, 1, 2); ctx.fillRect(17,10, 1, 2); ctx.fillRect(11,12, 2, 1); ctx.fillRect(15,12, 2, 1); ctx.fillRect(11,13, 6, 1); ctx.fillRect(11,14, 1, 1); ctx.fillRect(16,14, 1, 1); // Head\r\n ctx.fillRect( 5,13, 2, 1); ctx.fillRect(21,13, 2, 1); ctx.fillRect( 5,14, 1, 1); ctx.fillRect( 7,14, 2, 1); ctx.fillRect(19,14, 2, 1); ctx.fillRect(22,14, 1, 1); ctx.fillRect( 4,15, 1, 1); ctx.fillRect( 9,15,10, 1); ctx.fillRect(23,15, 1, 1); ctx.fillRect( 5,16, 5, 1); ctx.fillRect(13,16, 3, 1); ctx.fillRect(19,16, 5, 1); ctx.fillRect(10,17, 2, 1); ctx.fillRect(15,17, 4, 1); ctx.fillRect( 9,18, 2, 1); ctx.fillRect(12,18, 3, 1); ctx.fillRect(18,18, 1, 1); ctx.fillRect( 4,19, 5, 1); ctx.fillRect(11,19, 2, 1); ctx.fillRect(15,19, 2, 1); ctx.fillRect(19,19, 5, 1); ctx.fillRect( 4,20, 1, 2); ctx.fillRect( 8,20, 3, 1); ctx.fillRect(17,20, 3, 1); ctx.fillRect(23,20, 1, 1); ctx.fillRect( 6,21, 2, 1); ctx.fillRect(20,21, 3, 1); ctx.fillRect( 5,22, 1, 1); // Bones\r\n break;\r\n case 1: // Eject Button\r\n ctx.fillRect( 7, 17,14,5);\r\n ctx.beginPath(); ctx.moveTo(14, 5); ctx.lineTo( 7,15); ctx.lineTo(21.5,15); ctx.lineTo(14.5, 5);\r\n ctx.fill(); \r\n break;\r\n }\r\n }\r\n function drawEULinkButton(ctx,color,line) {\r\n ctx.clearRect(0,0,34,26); ctx.fillStyle=color;\r\n ctx.fillRect (12, 8, 9, 9);\r\n ctx.fillRect (13, 9, 9, 9);\r\n ctx.clearRect(13, 9, 7, 7);\r\n if(line) { ctx.fillRect(10,22,14,1.2); }\r\n }\r\n function drawFSLinkButton(ctx,color,line) {\r\n ctx.clearRect(0,0,56,26); ctx.fillStyle=color;\r\n ctx.beginPath();\r\n ctx.arc(14,12,3,Math.PI*70/180,-Math.PI*70/180,true);\r\n ctx.arc(14,12,2,-Math.PI*60/180,Math.PI*60/180,false);\r\n ctx.fill();\r\n ctx.beginPath(); ctx.moveTo(20, 7); ctx.lineTo(10,12); ctx.lineTo(20,17); ctx.lineTo(18,17); ctx.lineTo(8,12); ctx.lineTo(18, 7); ctx.lineTo(20, 7);\r\n ctx.fill();\r\n ctx.fillRect (35, 8, 9, 9);\r\n ctx.fillRect (36, 9, 9, 9);\r\n ctx.clearRect(36, 9, 7, 7);\r\n if(line) { ctx.fillRect(7,22,41,1.2); }\r\n }\r\n function drawThumb(ctx) {\r\n ctx.fillRect(27, 3, 6, 3);\r\n ctx.fillRect(27, 7, 6, 3);\r\n ctx.fillRect(27,11, 6, 3);\r\n ctx.fillRect(27,15, 6, 3);\r\n ctx.fillRect(27,19, 6, 3);\r\n }\r\n function draw4DIV3Button(ctx,color) {\r\n ctx.clearRect(0,0,38,26); ctx.fillStyle=color;\r\n ctx.globalAlpha=0.6;\r\n drawThumb(ctx);\r\n ctx.fillRect( 5,19,21, 3);\r\n ctx.globalAlpha=1;\r\n ctx.fillRect( 5, 3,21,15);\r\n ctx.beginPath(); ctx.moveTo(13, 7); ctx.lineTo(17.5,10); ctx.lineTo(13,13); ctx.moveTo(13, 7);\r\n ctx.globalCompositeOperation = 'destination-out'; ctx.fill(); ctx.globalCompositeOperation = 'source-over';\r\n }\r\n function drawWIDEButton(ctx,color) {\r\n ctx.clearRect(0,0,38,26); ctx.fillStyle=color;\r\n ctx.globalAlpha=0.6;\r\n drawThumb(ctx);\r\n ctx.fillRect( 5,15,21, 7);\r\n ctx.globalAlpha=1;\r\n ctx.fillRect( 5, 3,21,11);\r\n ctx.beginPath(); ctx.moveTo(13, 5); ctx.lineTo(17.5, 8); ctx.lineTo(13,11); ctx.moveTo(13, 5);\r\n ctx.globalCompositeOperation = 'destination-out'; ctx.fill(); ctx.globalCompositeOperation = 'source-over';\r\n }\r\n function drawBARButton(ctx,color) {\r\n ctx.clearRect(0,0,38,26); ctx.fillStyle=color;\r\n ctx.globalAlpha=0.6;\r\n drawThumb(ctx);\r\n ctx.fillRect( 5,15,21, 7);\r\n ctx.globalAlpha=1;\r\n ctx.fillRect( 5, 3,21, 3);\r\n }\r\n\r\n var ytplayer = $(ytplayer_name);\r\n if(!ytplayer) { show_alert('Media Controller Disabled: \"'+ytplayer_name+'\" not found'); return; }\r\n if(ytplayer.getAttribute('mc_embedtype')) { show_debug('Trying to rebind Media Controller to \"'+ytplayer_name+'\" (dropped)'); return; }\r\n else { show_debug('Binding Media Controller to \"'+ytplayer_name+'\" (Success)'); }\r\n ytplayer.setAttribute('mc_embedtype',tag);\r\n show_debug('Bind MC '+ytplayer_name+' ('+tag+')');\r\n\r\n // Media Controller display mode\r\n var ytplayer_offsetLeft=0; var ytplayer_width=getWidth(ytplayer);\r\n if(ytplayer_width<=0) { ytplayer_width=getWidth(ytplayer.parentNode); }\r\n if(ytplayer_width>960) { ytplayer_offsetLeft=(ytplayer_width-960)/2; ytplayer_width=960; }\r\n\r\n var MC_height=26; var MC_leftB2=167; var MC_topB2=-1; var MC_leftB3=480-166;\r\n if(ytplayer_width<480-126) { MC_leftB2=(ytplayer_width-244)/2+117; MC_leftB3=ytplayer_width-30; }\r\n if(ytplayer_width<300) { MC_leftB2=19; MC_leftB3=145; MC_topB2=26; }\r\n\r\n var yt_p=ytplayer.parentNode; var yt_ns; var yt_c=ytplayer;\r\n if(yt_p.tagName==\"OBJECT\") { yt_c=yt_p; yt_p.setAttribute('mc_embedtype',3); yt_ns=yt_p.nextSibling; yt_p=yt_p.parentNode; }\r\n else { yt_ns=ytplayer.nextSibling; }\r\n\r\n if(arguments.callee.count) {\r\n arguments.callee.count++;\r\n } else {\r\n arguments.callee.count=1;\r\n if(getValue('USE_IMAGE_FOR_BUTTON')>0) { OPTIONS_BOX['LIGHT_COLOR_MC_BACKGROUND'][3]='E8E8E8'; OPTIONS_BOX['LIGHT_COLOR_MC_TOGGLE_LOOP'][3]='D0D0FF'; }\r\n var glo='0.9'; if(USE_DARK_COLORS) { glo='0.2'; }\r\n GM_addGlobalStyle('.yte-MC-button { border: 1px solid '+color('MC_BORDER')+'; border-top:0; cursor:pointer; '+MakeBRadiusCSS('0 0 3px 3px')+MakeGradientCSS('rgba(255,255,255,'+glo+')','rgba(255,255,255,0)')+'background-color:'+color('MC_BACKGROUND')+' }'\r\n +'.yte-MC-button:hover { '+MakeBoxShadowCSS('5px',colorShadow('MC_BACKGROUND'))+'; z-index:5; }'\r\n +'.yte-MC-button[Lvalue]:not([Lvalue=\"0\"]) { background-color:'+color('MC_TOGGLE_LOOP')+' }'\r\n +'.yte-MC-button[Bvalue], .yte-MC-button[Evalue] { background-color:'+color('MC_TOGGLE_BEG_END')+' }'\r\n +'.yte-MC-button-red { border: 1px solid '+color('MC_BORDER')+'; border-top:0; cursor:pointer; '+MakeBRadiusCSS('0 0 3px 3px')+MakeGradientCSS('rgba(255,255,255,'+glo+')','rgba(255,255,255,0)')+'background-color:'+color('MC_BG_RED')+'; }'\r\n +'.yte-MC-button-red:hover { '+MakeBoxShadowCSS('5px',colorShadow('MC_BG_RED'))+'; z-index:5; }'\r\n +'.yte-MC-button-blue { border: 1px solid '+color('MC_BORDER')+'; border-top:0; '+MakeBRadiusCSS('0 0 3px 3px')+MakeGradientCSS('rgba(255,255,255,'+glo+')','rgba(255,255,255,0)')+' background-color:'+color('MC_BG_BLUE_OUT')+' }'\r\n +'.yte-MC-button-blue:hover { '+MakeBoxShadowCSS('5px',colorShadow('MC_BORDER'))+'; background-color:'+color('MC_BG_BLUE_IN')+'; z-index:5; }'\r\n +'body[YTE-LightOff] .yte-MC-button { border-color:'+color_change(1,'MC_BORDER')+'; '+MakeGradientCSS('rgba(255,255,255,0.1)','rgba(255,255,255,0)')+'; background-color:'+color_change(1,'MC_BACKGROUND')+'; }'\r\n +'body[YTE-LightOff] .yte-MC-button[Lvalue]:not([Lvalue=\"0\"]) { background-color:'+color_change(1,'MC_TOGGLE_LOOP')+' }'\r\n +'body[YTE-LightOff] .yte-MC-button[Bvalue], body[YTE-LightOff] .yte-MC-button[Evalue] { background-color:'+color_change(1,'MC_TOGGLE_BEG_END')+' }'\r\n +'body[YTE-LightOff] .yte-MC-button:hover { '+MakeBoxShadowCSS('5px',colorGlow('MC_BACKGROUND',1))+' }'\r\n +'body[YTE-LightOff] .yte-MC-button-red { border-color:'+color_change(1,'MC_BORDER')+'; '+MakeGradientCSS('rgba(255,255,255,0.1)','rgba(255,255,255,0)')+'; background-color:'+color_change(1,'MC_BG_RED')+'; }'\r\n +'body[YTE-LightOff] .yte-MC-button-red:hover { '+MakeBoxShadowCSS('5px',colorGlow('MC_BG_RED',1))+' }'\r\n +'body[YTE-LightOff] .yte-MC-button-blue { border: 1px solid '+color_change(1,'MC_BORDER')+';'+MakeBRadiusCSS('0 0 3px 3px')+MakeGradientCSS('rgba(255,255,255,0.1)','rgba(255,255,255,0)')+' background-color:'+color_change(1,'MC_BG_BLUE_OUT')+' }'\r\n +'body[YTE-LightOff] .yte-MC-button-blue:hover { '+MakeBoxShadowCSS('5px',colorGlow('MC_BORDER',1))+'; background-color:'+color_change(1,'MC_BG_BLUE_IN')+'; z-index:5; }'\r\n );\r\n }\r\n\r\n mediabar=document.createElement('div');\r\n //mediabar.setAttribute('id','Media_Controller-'+ytplayer_name);\r\n mediabar.setAttribute('style','position:relative; width:'+ytplayer_width+'px; margin-bottom:5px; padding-bottom:3px; z-index:550;'\r\n +'height:'+(MC_height+MC_topB2-1)+'px; border:0px; color:'+color('MC_TEXT_OUT')+' !important; line-height:1em !important');\r\n\r\n // === Media Controller Bar ===\r\n // 1st group\r\n var buttonStop=document.createElement('div');\r\n buttonStop.setAttribute('title',getText(\"stop\"));\r\n buttonStop.setAttribute('class','yte-MC-button');\r\n buttonStop.setAttribute('style','left: 0px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonStopCtx=addTransparentCanvas(buttonStop,28,26).getContext('2d');\r\n drawStopButton(buttonStopCtx,color('MC_TEXT_OUT'));\r\n buttonStop.addEventListener('mouseover', function() { drawStopButton(buttonStopCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonStop.addEventListener('mouseout', function() { drawStopButton(buttonStopCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonStop.addEventListener('click', function() { player_stop(ytplayer_name); }, true);\r\n user_select(buttonStop,'none');\r\n mediabar.appendChild(buttonStop);\r\n\r\n var buttonStepBack=document.createElement('div');\r\n buttonStepBack.setAttribute('title',getText(\"stepb\"));\r\n buttonStepBack.setAttribute('class','yte-MC-button');\r\n buttonStepBack.setAttribute('style','left:29px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonStepBackCtx=addTransparentCanvas(buttonStepBack,28,26).getContext('2d');\r\n drawStepBackButton(buttonStepBackCtx,color('MC_TEXT_OUT'));\r\n buttonStepBack.addEventListener('mouseover', function() { drawStepBackButton(buttonStepBackCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonStepBack.addEventListener('mouseout', function() { drawStepBackButton(buttonStepBackCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonStepBack.addEventListener('click', function() { player_stepback(ytplayer_name); }, true);\r\n user_select(buttonStepBack,'none');\r\n mediabar.appendChild(buttonStepBack);\r\n\r\n var buttonFrame=document.createElement('div');\r\n buttonFrame.setAttribute('title',getText(\"stepf\"));\r\n buttonFrame.setAttribute('class','yte-MC-button');\r\n buttonFrame.setAttribute('style','left:58px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonFrameCtx=addTransparentCanvas(buttonFrame,28,26).getContext('2d');\r\n drawFrameButton(buttonFrameCtx,color('MC_TEXT_OUT'));\r\n buttonFrame.addEventListener('mouseover', function() { drawFrameButton(buttonFrameCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonFrame.addEventListener('mouseout', function() { drawFrameButton(buttonFrameCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonFrame.addEventListener('click', function() { player_frame(ytplayer_name); }, true);\r\n user_select(buttonFrame,'none');\r\n mediabar.appendChild(buttonFrame);\r\n\r\n var buttonPlay=document.createElement('div');\r\n buttonPlay.setAttribute('title',getText(\"play\"));\r\n buttonPlay.setAttribute('class','yte-MC-button');\r\n buttonPlay.setAttribute('style','left:87px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonPlayCtx=addTransparentCanvas(buttonPlay,28,26).getContext('2d');\r\n drawPlayButton(buttonPlayCtx,color('MC_TEXT_OUT'));\r\n buttonPlay.addEventListener('mouseover', function() { drawPlayButton(buttonPlayCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonPlay.addEventListener('mouseout', function() { drawPlayButton(buttonPlayCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonPlay.addEventListener('click', function() { player_play(ytplayer_name); }, true);\r\n user_select(buttonPlay,'none');\r\n mediabar.appendChild(buttonPlay);\r\n\r\n var buttonPause=document.createElement('div');\r\n buttonPause.setAttribute('title',getText(\"pause\"));\r\n buttonPause.setAttribute('class','yte-MC-button');\r\n buttonPause.setAttribute('style','left:116px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonPauseCtx=addTransparentCanvas(buttonPause,28,26).getContext('2d');\r\n drawPauseButton(buttonPauseCtx,color('MC_TEXT_OUT'));\r\n buttonPause.addEventListener('mouseover', function() { drawPauseButton(buttonPauseCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonPause.addEventListener('mouseout', function() { drawPauseButton(buttonPauseCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonPause.addEventListener('click', function() { player_pause(ytplayer_name); }, true);\r\n user_select(buttonPause,'none');\r\n mediabar.appendChild(buttonPause);\r\n\r\n\r\n // 2nd group\r\n var buttonMemo=document.createElement('div');\r\n buttonMemo.setAttribute('id',ytplayer_name+'-Memo_state');\r\n buttonMemo.setAttribute('title',getText(\"begin\"));\r\n buttonMemo.setAttribute('class','yte-MC-button');\r\n buttonMemo.setAttribute('style','left:'+MC_leftB2+'px; top:'+(MC_topB2+1)+'px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n //buttonMemo.removeAttribute('Bvalue');\r\n var buttonMemoCtx=addTransparentCanvas(buttonMemo,28,26).getContext('2d');\r\n drawMemoButton(buttonMemoCtx,color('MC_TEXT_OUT'));\r\n buttonMemo.addEventListener('mouseover', function() { drawMemoButton(buttonMemoCtx,color('MC_TEXT_TOGGLE_IN')); }, true);\r\n buttonMemo.addEventListener('mouseout', function() { drawMemoButton(buttonMemoCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonMemo.addEventListener('click', function() { player_memo(ytplayer_name); }, true);\r\n user_select(buttonMemo,'none');\r\n mediabar.appendChild(buttonMemo);\r\n\r\n var buttonLoop=document.createElement('div');\r\n buttonLoop.setAttribute('id',ytplayer_name+'-Loop_state');\r\n buttonLoop.setAttribute('title',getText(\"loop\"));\r\n buttonLoop.setAttribute('class','yte-MC-button');\r\n buttonLoop.setAttribute('style','left:'+(MC_leftB2+29)+'px; top:'+(MC_topB2+1)+'px; position:absolute; width:37px; height:'+MC_height+'px; overflow:hidden');\r\n buttonLoop.setAttribute('Lvalue',getValue('MC_LOOP_AT_START'));\r\n var buttonLoopCtx=addTransparentCanvas(buttonLoop,35,26).getContext('2d');\r\n drawLoopButton(buttonLoopCtx,color('MC_TEXT_OUT'));\r\n buttonLoop.addEventListener('mouseover', function() { drawLoopButton(buttonLoopCtx,color('MC_TEXT_TOGGLE_IN')); }, true);\r\n buttonLoop.addEventListener('mouseout', function() { drawLoopButton(buttonLoopCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonLoop.addEventListener('click', function() { player_loop(ytplayer_name); }, true);\r\n user_select(buttonLoop,'none');\r\n mediabar.appendChild(buttonLoop);\r\n\r\n var buttonRewind=document.createElement('div');\r\n buttonRewind.setAttribute('title',getText(\"rewnd\"));\r\n buttonRewind.setAttribute('class','yte-MC-button');\r\n buttonRewind.setAttribute('style','left:'+(MC_leftB2+67)+'px; top:'+(MC_topB2+1)+'px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonRewindCtx=addTransparentCanvas(buttonRewind,28,26).getContext('2d');\r\n drawRewindButton(buttonRewindCtx,color('MC_TEXT_OUT'));\r\n buttonRewind.addEventListener('mouseover', function() { drawRewindButton(buttonRewindCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonRewind.addEventListener('mouseout', function() { drawRewindButton(buttonRewindCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonRewind.addEventListener('click', function() { player_rewind(ytplayer_name); }, true);\r\n user_select(buttonRewind,'none');\r\n mediabar.appendChild(buttonRewind);\r\n\r\n var buttonLimit=document.createElement('div');\r\n buttonLimit.setAttribute('id',ytplayer_name+'-Limit_state');\r\n buttonLimit.setAttribute('title',getText(\"end\"));\r\n buttonLimit.setAttribute('class','yte-MC-button');\r\n buttonLimit.setAttribute('style','left:'+(MC_leftB2+96)+'px; top:'+(MC_topB2+1)+'px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n //buttonLimit.removeAttribute('Evalue');\r\n var buttonLimitCtx=addTransparentCanvas(buttonLimit,28,26).getContext('2d');\r\n drawLimitButton(buttonLimitCtx,color('MC_TEXT_OUT'));\r\n buttonLimit.addEventListener('mouseover', function() { drawLimitButton(buttonLimitCtx,color('MC_TEXT_TOGGLE_IN')); }, true);\r\n buttonLimit.addEventListener('mouseout', function() { drawLimitButton(buttonLimitCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonLimit.addEventListener('click', function() { player_limit(ytplayer_name); }, true);\r\n user_select(buttonLimit,'none');\r\n mediabar.appendChild(buttonLimit);\r\n\r\n\r\n // 3rd group\r\n var buttonFreeze=document.createElement('div');\r\n buttonFreeze.setAttribute('title',getText(\"kill\"));\r\n buttonFreeze.setAttribute('class','yte-MC-button-red');\r\n buttonFreeze.setAttribute('style','left:'+MC_leftB3+'px; position:absolute; width:28px; height:'+MC_height+'px; overflow:hidden');\r\n var buttonFreezeCtx=addTransparentCanvas(buttonFreeze,28,26).getContext('2d');\r\n //buttonFreeze.firstChild.style.setProperty('margin-top','1px','');\r\n drawFreezeButton(buttonFreezeCtx,color('MC_TEXT_OUT'));\r\n buttonFreeze.addEventListener('mouseover', function() { drawFreezeButton(buttonFreezeCtx,color('MC_TEXT_ACTION_IN')); }, true);\r\n buttonFreeze.addEventListener('mouseout', function() { drawFreezeButton(buttonFreezeCtx,color('MC_TEXT_OUT')); }, true);\r\n buttonFreeze.addEventListener('click', function() { player_freeze(ytplayer_name); }, true);\r\n user_select(buttonFreeze,'none');\r\n mediabar.appendChild(buttonFreeze);\r\n\r\n // 4th group\r\n if(gvar.isWatchPage) {\r\n if(!gvar.isVerifAgePage) {\r\n var eurl=get_embedURL();\r\n if(eurl) {\r\n var buttonEULink=document.createElement('a');\r\n buttonEULink.setAttribute('title',getText(\"embed\"));\r\n buttonEULink.setAttribute('class','yte-MC-button-blue');\r\n buttonEULink.setAttribute('style','position:absolute; top:0px; right:'+0+'px; width:34px; height:'+MC_height+'px; display: block; overflow:hidden');\r\n buttonEULink.setAttribute('href',eurl);\r\n buttonEULink.setAttribute('target','_blank');\r\n var buttonEULinkCtx=addTransparentCanvas(buttonEULink,34,26).getContext('2d');\r\n drawEULinkButton(buttonEULinkCtx,color('MC_TEXT_BLUE_OUT'),false);\r\n user_select(buttonEULink,'none');\r\n mediabar.appendChild(buttonEULink);\r\n buttonEULink.addEventListener('mouseover' , function() { drawEULinkButton(buttonEULinkCtx,color('MC_TEXT_BLUE_IN'),true); }, true);\r\n buttonEULink.addEventListener('mouseout' , function() { drawEULinkButton(buttonEULinkCtx,color('MC_TEXT_BLUE_OUT'),false); }, true);\r\n buttonEULink.addEventListener('click' , function() { player_freeze.freeze=1; player_freeze(ytplayer_name); }, true);\r\n if(ytplayer_width<480) { buttonEULink.style.visibility='hidden'; }\r\n } else { show_alert('Media Controller : Global variable for \"Embed URL\" not found',0); }\r\n\r\n var fsurl=get_newfullscreenURL();\r\n if(fsurl) {\r\n var buttonFSLink=document.createElement('a');\r\n buttonFSLink.setAttribute('title',getText(\"fscr\"));\r\n buttonFSLink.setAttribute('class','yte-MC-button-blue');\r\n buttonFSLink.setAttribute('style','position:absolute; top:0px; right:'+35+'px; width:56px; height:'+MC_height+'px; display: block; overflow:hidden');\r\n buttonFSLink.setAttribute('href',fsurl);\r\n buttonFSLink.setAttribute('target','_blank');\r\n var buttonFSLinkCtx=addTransparentCanvas(buttonFSLink,56,26).getContext('2d');\r\n drawFSLinkButton(buttonFSLinkCtx,color('MC_TEXT_BLUE_OUT'),false);\r\n user_select(buttonFSLink,'none');\r\n mediabar.appendChild(buttonFSLink);\r\n buttonFSLink.addEventListener('mouseover' , function() { drawFSLinkButton(buttonFSLinkCtx,color('MC_TEXT_BLUE_IN'),true); }, true);\r\n buttonFSLink.addEventListener('mouseout' , function() { drawFSLinkButton(buttonFSLinkCtx,color('MC_TEXT_BLUE_OUT'),false); }, true);\r\n buttonFSLink.addEventListener('click' , function() { player_freeze.freeze=1; player_freeze(ytplayer_name); }, true);\r\n if(ytplayer_width<480) { buttonFSLink.style.visibility='hidden'; }\r\n } else { show_alert('Media Controller : Global variable for \"Fullscreen URL\" not found',0); }\r\n }\r\n\r\n mediabar.style.setProperty('margin-left','auto','');\r\n mediabar.style.setProperty('margin-right','auto','');\r\n\r\n gvar.buttonStop=buttonStop; gvar.buttonStepBack=buttonStepBack; gvar.buttonFrame=buttonFrame; gvar.buttonPlay=buttonPlay; gvar.buttonPause=buttonPause;\r\n gvar.buttonMemo=buttonMemo; gvar.buttonLoop=buttonLoop; gvar.buttonRewind=buttonRewind; gvar.buttonLimit=buttonLimit; gvar.buttonFreeze=buttonFreeze;\r\n }\r\n\r\n // Light Off\r\n if(gvar.isWatchPage || gvar.isBetaChannel) {\r\n mediaController_resize(ytplayer_name,mediabar);\r\n change_mediaController_color(USE_DARK_COLORS,mediabar);\r\n yt_p.style.setProperty('z-index','550','');\r\n var YTPoverlay=mLightOff.display(0,ytplayer_name,yt_p);\r\n YTPoverlay.addEventListener('click', function() { mLightOff.display(0,ytplayer_name); }, true);\r\n YTPoverlay.addEventListener('mouseover', function() { mLightOff.display(1,ytplayer_name); }, true);\r\n // Turn off the light at start\r\n if(getValue('LIGHT_OFF_AT_START')>0) { mLightOff.create(); }\r\n window.setTimeout( function() { change_media_controller_display(mediabar); },30);\r\n }\r\n\r\n // 5th group\r\n if(gvar.isBetaChannel) {\r\n var buttonSize4=document.createElement('div');\r\n buttonSize4.setAttribute('title','640x480');\r\n buttonSize4.setAttribute('class','yte-MC-button');\r\n buttonSize4.setAttribute('style','right:'+96+'px; position:absolute; width:38px; height:'+MC_height+'px; overflow:hidden;');\r\n var buttonSize4Ctx=addTransparentCanvas(buttonSize4,38,26).getContext('2d');\r\n draw4DIV3Button(buttonSize4Ctx,color('MR_DRAW_TEXT_OUT'));\r\n buttonSize4.addEventListener('mouseover', function() { draw4DIV3Button(buttonSize4Ctx,color('MR_DRAW_TEXT_IN')); }, true);\r\n buttonSize4.addEventListener('mouseout', function() { draw4DIV3Button(buttonSize4Ctx,color('MR_DRAW_TEXT_OUT')); }, true);\r\n buttonSize4.addEventListener('click', function() { setSizePlayer(1,ytplayer_name); }, true);\r\n user_select(buttonSize4,'none'); mediabar.appendChild(buttonSize4);\r\n\r\n var buttonSizeW=document.createElement('div');\r\n buttonSizeW.setAttribute('title','640x360');\r\n buttonSizeW.setAttribute('class','yte-MC-button');\r\n buttonSizeW.setAttribute('style','right:'+135+'px; position:absolute; width:38px; height:'+MC_height+'px; overflow:hidden;');\r\n var buttonSizeWCtx=addTransparentCanvas(buttonSizeW,38,26).getContext('2d');\r\n drawWIDEButton(buttonSizeWCtx,color('MR_DRAW_TEXT_OUT'));\r\n buttonSizeW.addEventListener('mouseover', function() { drawWIDEButton(buttonSizeWCtx,color('MR_DRAW_TEXT_IN')); }, true);\r\n buttonSizeW.addEventListener('mouseout', function() { drawWIDEButton(buttonSizeWCtx,color('MR_DRAW_TEXT_OUT')); }, true);\r\n buttonSizeW.addEventListener('click', function() { setSizePlayer(2,ytplayer_name); }, true);\r\n user_select(buttonSizeW,'none'); mediabar.appendChild(buttonSizeW);\r\n\r\n var buttonSizeU=document.createElement('div');\r\n buttonSizeU.setAttribute('title','640x0');\r\n buttonSizeU.setAttribute('class','yte-MC-button');\r\n buttonSizeU.setAttribute('style','right:'+174+'px; position:absolute; width:38px; height:'+MC_height+'px; overflow:hidden;');\r\n var buttonSizeUCtx=addTransparentCanvas(buttonSizeU,38,26).getContext('2d');\r\n drawBARButton(buttonSizeUCtx,color('MR_DRAW_TEXT_OUT'));\r\n buttonSizeU.addEventListener('mouseover', function() { drawBARButton(buttonSizeUCtx,color('MR_DRAW_TEXT_IN')); }, true);\r\n buttonSizeU.addEventListener('mouseout', function() { drawBARButton(buttonSizeUCtx,color('MR_DRAW_TEXT_OUT')); }, true);\r\n buttonSizeU.addEventListener('click', function() { setSizePlayer(3,ytplayer_name); }, true);\r\n user_select(buttonSizeU,'none'); mediabar.appendChild(buttonSizeU);\r\n\r\n gvar.buttonStop=buttonStop; gvar.buttonStepBack=buttonStepBack; gvar.buttonFrame=buttonFrame; gvar.buttonPlay=buttonPlay; gvar.buttonPause=buttonPause;\r\n gvar.buttonMemo=buttonMemo; gvar.buttonLoop=buttonLoop; gvar.buttonRewind=buttonRewind; gvar.buttonLimit=buttonLimit; gvar.buttonFreeze=buttonFreeze;\r\n gvar.buttonSize4=buttonSize4; gvar.buttonSizeW=buttonSizeW; gvar.buttonSizeU=buttonSizeU;\r\n\r\n var ButtonLightOff=mLightOff.addButton(ytplayer.id,LIGHT_OFF_BUTTON_ID,0)\r\n ButtonLightOff.setAttribute('style','right:'+0+'px; position:absolute; width:29px; height:'+MC_height+'px; overflow:hidden;');\r\n ButtonLightOff.setAttribute('class','yte-MC-button');\r\n mediabar.appendChild(ButtonLightOff);\r\n }\r\n\r\n if(gvar.isGoogleWatch) {\r\n //yt_p.parentNode.insertBefore(mediabar,yt_p.nextSibling);\r\n yt_p.insertBefore(mediabar, yt_ns);\r\n var wp=$('watch-panel'); if(wp) { wp.style.setProperty('padding-top','5px','important'); }\r\n } else {\r\n yt_p.insertBefore(mediabar, yt_ns);\r\n // Horizontal offset fix\r\n var leftdiff=getAbsoluteLeft(mediabar)-getAbsoluteLeft(ytplayer)-ytplayer_offsetLeft;\r\n if(leftdiff!=0) { mediabar.style.left=(-leftdiff)+'px'; }\r\n }\r\n\r\n // Vertical offset fix\r\n var ytplayer_height=getHeight(ytplayer);\r\n var topdiff=getAbsoluteTop(mediabar)-ytplayer_height-getAbsoluteTop(ytplayer);\r\n if(topdiff!=0) { mediabar.style.top=(-topdiff)+'px'; }\r\n\r\n player_check_limit(ytplayer_name);\r\n}", "function init() {\n\t// Page elements that we need to change\n\tG.currTitleEl = document.getElementById('current-title');\n\tG.currImageEl = document.getElementById('current-image');\n\tG.currTextEl = document.getElementById('current-text');\n\tG.currChoicesEl = document.getElementById('current-choices-ul');\n\tG.audioEl = document.getElementById('audio-player');\n\t\n\t// Start a new game\n\tnewGame(G);\n}", "initButtons() {\n const self = this;\n const actions = [\n {\n id: 'compile',\n run: () => {\n self.compile();\n },\n },\n {\n id: 'save',\n run: () => {\n self.save();\n },\n },\n ];\n\n for (let action of actions) {\n const a = document.getElementById(action.id);\n a.addEventListener('click', action.run);\n this.views[action.id] = a;\n }\n }", "create() {\n // add button \"play again\"\n this.playBtn = this.add.text(game.scale.width / 2, game.scale.height / 2, \"PLAY AGAIN\", {\n fontSize: \"72px Arial\"\n });\n this.playBtn.setOrigin(0.5);\n // create interactive box on the text to have possibility to click on it\n this.playBtn.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.playBtn.width, this.playBtn.height), Phaser.Geom.Rectangle.Contains);\n\n this.mainMenuBtn = this.add.text(this.playBtn.x, this.playBtn.y + 72, \"MAIN MENU\", {\n fontSize: \"72px Arial\"\n });\n this.mainMenuBtn.setOrigin(0.5);\n this.mainMenuBtn.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.playBtn.width, this.playBtn.height), Phaser.Geom.Rectangle.Contains);\n\n this.gameOver = this.add.text(game.scale.width / 2, this.playBtn.y / 2, \"GAME OVER\", {\n fontSize: \"96px Arial\"\n });\n this.gameOver.setOrigin(0.5);\n\n this.pointsTxt = this.add.text(game.scale.width / 2, this.gameOver.y + ((this.playBtn.y - this.gameOver.y) / 2), \"You got \" + this.score + \" points\", {\n fontSize: \"48px Arial\"\n });\n this.pointsTxt.setOrigin(0.5);\n\n // initialize action to buttons \"play again\" and \"main menu\"\n this.playBtn.on('pointerdown', function () {\n this.scene.start(\"PlayGame\");\n }, this);\n this.mainMenuBtn.on('pointerdown', function () {\n this.scene.start(\"Boot\", gameOptions);\n }, this);\n }", "function controls(e) {\r\n const item = e.target;\r\n if (item.classList[1] === \"play-top\") {\r\n up();\r\n } else if (item.classList[1] === \"play-left\") {\r\n left();\r\n } else if (item.classList[1] === \"play-right\") {\r\n right();\r\n } else if (item.classList[1] === \"play-bottom\") {\r\n down();\r\n } else if (\r\n item.classList[0] === \"pause-play\" ||\r\n item.classList[0] === \"checkbox-input__pause\"\r\n ) {\r\n pause = !pause;\r\n }\r\n}", "function switchAudioComponentsToPreviewMode() {\n $('._audio_editor_component ._player_content').css('opacity', 1);\n $('.msie ._audio_editor_component ._double_slider .ui-slider-range').css('opacity', 1);\n $('._audio_editor_component').css('opacity', 0.2);\n $('._audio_editor_component ._remove').hide();\n $('._audio_editor_component ._media_player_slider .ui-slider-handle').hide();\n $('._audio_editor_component ._audio_component_icon').css('visibility', 'hidden');\n}", "function setupPlayers() {\n firstPlayer = new STComboBox();\n secondPlayer = new STComboBox();\n\n firstPlayer.Init('first_player');\n secondPlayer.Init('second_player');\n getPlayers();\n}", "function init(){\n speak(quiz[currentquestion]['question'])\n\t\t//add title\n \n\t\tif(typeof quiztitle !== \"undefined\" && $.type(quiztitle) === \"string\"){\n\t\t\t$(document.createElement('h2')).text(quiztitle).appendTo('#frame');\n\t\t} else {\n\t\t\t$(document.createElement('h2')).text(\"Quiz\").appendTo('#frame');\n\t\t}\n \n\t\t\n\t\t//add pager and questions\n\t\tif(typeof quiz !== \"undefined\" && $.type(quiz) === \"array\"){\n\t\t\t//add pager\n \n\t\t\t$(document.createElement('p')).addClass('pager').attr('id','pager').text('Domanda 1 di ' + quiz.length).appendTo('#frame');\n\t\t\t//add first question\n\t\t\t$(document.createElement('h3')).addClass('question').attr('id', 'question').text(quiz[0]['question']).appendTo('#frame');\n\t\t\t//add image if present\n\t\t\tif(quiz[0].hasOwnProperty('image') && quiz[0]['image'] != \"\"){\n\t\t\t\t$(document.createElement('img')).addClass('question-image').attr('width','100px').attr('id', 'question-image').attr('src', quiz[0]['image']).attr('alt', (quiz[0]['question'])).appendTo('#frame');\n\t\t\t}\n\t\t\t\n\t\t\t$(document.createElement('p')).addClass('explanation').attr('id','explanation').html('').appendTo('#question');\n\t\t\t\n\t\t\t//questions holder\n\t\t\t$(document.createElement('ul')).attr('id', 'choice-block').appendTo('#frame');\n\t\t\t\n\t\t\t//add choices\n\t\t\taddChoices(quiz[0]['choices']);\n\t\t\t\n\t\t\t\n\t\t\tsetupButtons();\n\t\t}\n\t}", "function onPlayStart(){\n\t\t\n\t\tg_objThis.trigger(t.events.PLAY_START);\n\t\t\n\t\tif(g_objButtonClose)\n\t\t\tg_objButtonClose.hide();\n\t}", "addReplayButton() {\n this.interface.gui.add(this.gameOrchestrator, 'replayMoves').name('Replay Moves');\n }", "function _init_controls(){\n try{\n self.label = Titanium.UI.createLabel({\n text:'',\n top:parseInt(self.screen_height/3,10)-80,\n color:self.font_color,\n font:{\n fontSize:self.normal_font_size,\n fontWeight:self.font_weight\n },\n textAlign:'center',\n width:200,\n height:30\n });\n win.add(self.label);\n\n self.start_btn = Titanium.UI.createButton({\n backgroundColor:'blue',\n borderRadius:3,\n color:'#fff',\n font:{\n fontSize:self.normal_font_size,\n fontWeight:self.font_weight\n },\n title:'Start Recording',\n width:200,\n height:40, \n top:parseInt(self.screen_height/3,10)-40\n });\n win.add(self.start_btn);\n\n self.pause_btn = Titanium.UI.createButton({\n backgroundColor:'blue',\n borderRadius:3,\n color:'#fff',\n font:{\n fontSize:self.normal_font_size,\n fontWeight:self.font_weight\n },\n title:'Pause Recording',\n width:200,\n height:40,\n top:parseInt(self.screen_height/3,10)-40\n });\n win.add(self.pause_btn);\n self.pause_btn.visible = false;\n\n self.done_btn = Titanium.UI.createButton({\n backgroundColor:'blue',\n borderRadius:3,\n color:'#fff',\n font:{\n fontSize:self.normal_font_size,\n fontWeight:self.font_weight\n },\n title:'Finish Recording',\n width:200,\n height:40,\n top:parseInt(self.screen_height/3,10)+40\n });\n win.add(self.done_btn);\n self.done_btn.visible = false;\n\n self.start_btn.addEventListener('click',function(){\n _event_for_start_btn();\n });\n\n self.pause_btn.addEventListener('click',function(){\n _event_for_pause_btn();\n });\n\n self.done_btn.addEventListener('click', function(){\n _event_for_done_btn();\n }); \n }catch(err){\n self.process_simple_error_message(err,window_source+' - _init_controls');\n return;\n }\n }", "function init() {\n appendSongToDOM();\n }", "function init() {\n intro.style.display = \"grid\";\n winner.style.display = \"none\";\n newGame.style.display = \"none\";\n heading.style.display = \"none\";\n cards.style.display = \"none\";\n}", "function createDivsForColors() {\n playBtn();\n}", "function setPlayerListeners() {\n player.addEventListener('ended', playNext);\n player.addEventListener('click', playNext);\n \n var playPause = document.getElementById('play_pause_button');\n playPause.addEventListener('click', playPauseAudio);\n \n var next = document.getElementById('next_button');\n next.addEventListener('click', playNext);\n \n var random = document.getElementById('random_button');\n random.addEventListener('click', playRandom);\n}", "function setupButtons(){\n\tfor (let i = 0; i<modeButtons.length; i++){\n\t\tmodeButtons[i].addEventListener(\"click\",function(){\n\t\t\tfor(let j = 0; j<modeButtons.length; j++){\n\t\t\t\tmodeButtons[j].classList.remove(\"selected\");\n\t\t\t}\n\t\t\tthis.classList.add(\"selected\");\n\t\t\tthis.textContent === \"Easy\" ? numSquares = 3 : numSquares = 6;\n\t\t\treset();\n\t\t});\n\t}\n\t//add listener to the reset button\n\tresetButton.addEventListener(\"click\", function(){\n\t\treset();\n\t});\n}", "function showEditorButtons() {\n\tdocument.getElementById('button-editor').style.display = 'none';\n\tdocument.getElementById('cldraw-seasons-separator').style.display = 'none';\n\tdocument.getElementById('cldraw-add-season').style.display = 'none';\n\tfor (let i = 0; i < potSize; i++) {\n\t\tif (i < 12) {\n\t\t\tif (attrW[i][0] !== String.fromCharCode(65 + i) || attrR[i][0] !== String.fromCharCode(65 + i)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tif ((attrW[i][0] !== '' && attrW[i][0] != null) || (attrR[i][0] !== '' && attrR[i][0] != null)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\tdocument.getElementById('button-editor').style.display = '';\n\tdocument.getElementById('cldraw-seasons-separator').style.display = '';\n\tdocument.getElementById('cldraw-add-season').style.display = '';\n}", "initiate() {\n this.#buildStartGameButton();\n this.#buildhowToPlayButton();\n this.#buildAboutButton();\n this.#startHeaderAnimation();\n }", "function init(){\ndocument.querySelector('#power').onclick=openClose;\ndocument.querySelector('#sliderBack').onmouseout=slideStart;\ndocument.querySelector('#sliderBack').onmousedown=slideStop;\ndocument.querySelector('#sliderBack').onmousemove=slider;\ndocument.querySelector('#playButton').onmousedown=startPlaying;\ndocument.querySelector('#stopButton').onmousedown=stopPlaying;\ndocument.querySelector('#pauseButton').onmousedown=pausePlaying;\ndocument.querySelector('#preview').onmousedown=lengthSwitch;\ndocument.querySelector('#full').onmousedown=lengthSwitch;\n\n\n//getting all the audio players and setting there volume to 0.02 as the page \nvar allAudioPlayers= document.querySelectorAll(\"audio\");\n\t \n\t for(var i=0; i<allAudioPlayers.length ; i++)\n\t{\n\t\t\t\tallAudioPlayers[i].volume=0.02;\n\t\t\t\tallAudioPlayers[i].addEventListener('ended' , stopPlay);\n\t\t\t\t//adding eventlistener ended to check if the audio has stopped playing\n\t\t\t\t//Note: event listerners cannot travel downwards in DOM-level ( body - element(any))\n\t\t\t\t//But can travel upwards in DOM-level ( element(any) - body)\n\t}\n//getting all the songs and attaching an onclick event to each of them\t\n\tvar AllSongs=document.querySelectorAll('.songname');\n\tfor(var i=0; i<AllSongs.length ; i++)\n\t{\n\t\tAllSongs[i].onclick=songSelect;\n\t\t\n\t}\t\n\t//getting all the volume numbers and attaching an onclick event to each of them\t\n\tvar VolumeNumbers=document.querySelectorAll('.number');\n\tfor(var i=0; i<VolumeNumbers.length ; i++)\n\t{\n\t\tVolumeNumbers[i].onclick=volumeControl;\n\t}\n}", "function initEditorAction($pre) {\r\n $pre.each(function () {\r\n var editorId = $(this).attr('id');\r\n var editor = init_editor(editorId);\r\n var $script_type = $(this).siblings().find(\"input[name='script_type']\");\r\n var $fullScreen = $(this).siblings(\"button[name='fullScreen']\");\r\n ModifyScriptType(editor, $script_type);\r\n fullScreen(editor, $fullScreen);\r\n exitFullscreen(editor);\r\n console.log($(this).attr('id'))\r\n })\r\n}", "function initWidgetUI() {\n $(\".widget-wrapper\").each(function () {\n var widgetId = extractObjectIdFromElementId($(this).attr(\"id\"));\n styleWidgetButtons(widgetId);\n });\n }" ]
[ "0.6722494", "0.66835535", "0.65846854", "0.6552051", "0.65383506", "0.6518687", "0.6467552", "0.6455862", "0.64248395", "0.63270956", "0.63224787", "0.63103634", "0.6309897", "0.62934166", "0.6272553", "0.6233695", "0.6221517", "0.6208214", "0.620332", "0.61538094", "0.608284", "0.6062746", "0.6055553", "0.60547835", "0.6050545", "0.6039012", "0.6004434", "0.60020894", "0.5995131", "0.5988436", "0.5986199", "0.5981731", "0.59798825", "0.5979365", "0.59646374", "0.59503907", "0.5943497", "0.59409446", "0.59364104", "0.5934356", "0.5932511", "0.59317654", "0.5923219", "0.59180653", "0.5914139", "0.5903539", "0.59023", "0.58954966", "0.5892743", "0.5888175", "0.58786607", "0.58620584", "0.5861622", "0.58570796", "0.5854503", "0.5852259", "0.58367026", "0.58356184", "0.5834342", "0.5831239", "0.5829068", "0.5820064", "0.581924", "0.58147067", "0.58142287", "0.5812801", "0.58037984", "0.57990575", "0.5796352", "0.5794713", "0.57775545", "0.57767504", "0.57649034", "0.5764009", "0.5760658", "0.5757301", "0.575648", "0.57563084", "0.5748562", "0.5739255", "0.5736939", "0.5733194", "0.5730464", "0.57280445", "0.5724571", "0.5720194", "0.5718485", "0.571217", "0.57055575", "0.5703784", "0.5702087", "0.5696928", "0.5696865", "0.5696703", "0.56923556", "0.56867844", "0.56851983", "0.56796974", "0.56788814", "0.56780785" ]
0.65114444
6
parses the initial smil file and adds segments if already available
function parseInitialSMIL() { if (editor.parsedSmil) { ocUtils.log("Smil found. Parsing"); var insertedSplitItem = false; // check whether SMIL has already cutting points if (editor.parsedSmil.par) { editor.splitData.splits = []; editor.parsedSmil.par = ocUtils.ensureArray(editor.parsedSmil.par); var lastEnd = 0; $.each(editor.parsedSmil.par, function(key, value) { value.video = ocUtils.ensureArray(value.video); var clipBegin = (value && value.video[0] && value.video[0].clipBegin) ? (parseFloat(value.video[0].clipBegin) / 1000) : 0; var clipEnd = (value && value.video[0] && value.video[0].clipEnd) ? (parseFloat(value.video[0].clipEnd) / 1000) : getDuration(); if ((clipBegin != undefined) && (clipEnd != undefined)) { if ((key > 0) && (lastEnd != clipBegin)) { ocUtils.log("Inserting a split element (1): (" + lastEnd + " - " + clipBegin + ")"); editor.splitData.splits.push({ clipBegin: parseFloat(lastEnd), clipEnd: parseFloat(clipBegin), enabled: false }); } ocUtils.log("Inserting a split element (2): (" + clipBegin + " - " + clipEnd + ")"); editor.splitData.splits.push({ clipBegin: clipBegin, clipEnd: clipEnd, enabled: true }); lastEnd = clipEnd; } }); for (var i = 0; i < editor.splitData.splits.length; ++i) { if (checkPrevAndNext(i, false).inserted) { i = 0; } } // check last segment var duration = getDuration(); if (editor.splitData.splits.length > 0) { var current = editor.splitData.splits[editor.splitData.splits.length - 1]; if (current.clipEnd != duration) { if ((current.clipEnd < (duration - minSegmentLength)) || (current.clipEnd <= minSegmentLength)) { ocUtils.log("Inserting a last split element (auto): (" + current.clipEnd + " - " + duration + ")"); var newLastItem = { clipBegin: parseFloat(current.clipEnd), clipEnd: duration, enabled: true }; // add the new item to the end editor.splitData.splits.push(newLastItem); insertedLastItem = true; } else { ocUtils.log("Extending the last split element to (auto): (" + current.clipBegin + " - " + duration + ")"); current.clipEnd = duration; } } } else { ocUtils.log("Inserting a split element (auto): (" + 0 + " - " + duration + ")"); var newItem = { clipBegin: 0, clipEnd: duration, enabled: true }; // add the new item editor.splitData.splits.push(newItem); } } ocUtils.log("Done parsing smil."); } else { ocUtils.log("No smil found."); if (editor.splitData && editor.splitData.splits) { var duration = editor.mediapackageParser.duration / 1000; ocUtils.log("Inserting a split element: (" + 0 + " - " + duration + ")"); if (!insertedSplitItem) { editor.splitData.splits.push({ clipBegin: 0, clipEnd: parseFloat(duration), enabled: true }); } } } editor.splitData.splits[0].enabled = !insertedFirstItem; editor.splitData.splits[editor.splitData.splits.length - 1].enabled = !insertedLastItem; window.setTimeout(function() { if (!insertedFirstItem) { if (editor.splitData.splits.length == 1) { $('#splitSegmentItem-0').css('width', '100%'); } $('#splitSegmentItem-0').click(); } else { $('#splitSegmentItem-1').click(); } }, initMS); prepareUI(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onCodePathSegmentStart(segment) {\n const info = {\n uselessContinues: getUselessContinues([], segment.allPrevSegments),\n returned: false\n };\n\n // Stores the info.\n segmentInfoMap.set(segment, info);\n }", "resetMainLoaderReplaceSegments() {\n const buffered = this.tech_.buffered();\n const bufferedEnd = buffered.end(buffered.length - 1);\n\n // Set the replace segments flag to the buffered end, this forces fetchAtBuffer\n // on the main loader to remain, false after the resetLoader call, until we have\n // replaced all content buffered ahead of the currentTime.\n this.mainSegmentLoader_.replaceSegmentsUntil = bufferedEnd;\n this.mainSegmentLoader_.resetLoaderProperties();\n this.mainSegmentLoader_.resetLoader();\n }", "function processInput() {\n\n\tvar boundaryInfo = getCourseBoundaries(fileContents);\n\tvar boundaries = boundaryInfo.boundaries;\n\tvar oneSection = RegExp( sectionChunk, 'gim' );\n\tvar j = 0;\n\tfor (var i = 0; i < boundaryInfo.boundaries.length ; ++i) {\n\t\tvar courseSection = fileContents.substring(boundaries[i], boundaries[i+1]);\n\t\twhile(true) {\n\t\t\tvar result = oneSection.exec(courseSection);\n\t\t\tif (!result) break;\n\t\t\tvar sectionInfo = { \n\t\t\t\ttimes : result[4].trim().split('\\n'),\n\t\t\t\trooms : result[5].trim().split('\\n'),\n\t\t\t\tinstructors : result[6].trim().split('\\n'),\n\t\t\t\tdates\t\t\t\t: result[7].trim().split('\\n'),\n\t\t\t};\n\t\t\tsections[j] = {\n\t\t\t\tname : boundaryInfo.courses[i].name,\n\t\t\t\tdisc : boundaryInfo.courses[i].disc,\n\t\t\t\tnum : boundaryInfo.courses[i].num,\n\t\t\t\tCFID : result[1],\n\t\t\t\tsectionName : result[2],\n\t\t\t\tsectionType : result[3],\n\t\t\t\tisFull : ( result[8].trim()[0] === 'O' ? false : true ), // Is it open? TODO: Make case insensitive.\n\t\t\t\tdays : getSessions( sectionInfo ),\n\t\t\t};\n\t\t\t++j;\n\t\t}\n\t\toneSection.lastIndex = 0;\n\t}\n\tconsole.log( JSON.stringify(sections, null, 1) ); // DEBUG\n}", "function loadSegments() {\n var regions = JSON.parse(localStorage.regions);\n regions.forEach(function (region) {\n wavesurfer.addRegion(region);\n });\n}", "onBegin() {\n this.fileNames.clear();\n this.fileMappings = {};\n }", "function handleFileLine(originalFileName) {\n let fileName = originalFileName.toLowerCase().replace('\\\\', '/'); // Normalize the name by bringing to lower case and replacing backslashes:\n localCull = true;\n // saveThisCommentLine = false;\n let isEmpty = part.steps.length === 0 && step.isEmpty();\n\n if (isEmpty && !self.mainModel) { // First model\n self.mainModel = part.ID = fileName;\n }\n else if (isEmpty && self.mainModel && self.mainModel === part.ID) {\n console.warn(\"Special case: Main model ID change from \" + part.ID + \" to \" + fileName);\n self.mainModel = part.ID = fileName;\n }\n else { // Close model and start new as no FILE directive has been encountered:\n closeStep(false);\n\n if (!part.ID) { // No ID in main model: \n console.warn(originalFileName, 'No ID in main model - setting default ID', defaultID);\n console.dir(part); console.dir(step);\n part.ID = defaultID;\n if (!self.mainModel) {\n self.mainModel = defaultID;\n }\n }\n // if (!skipPart) {\n self.setPartType(part);\n loadedParts.push(part.ID);\n // }\n // skipPart = false;\n self.onProgress(part.ID);\n\n part = new LDRPartType();\n inHeader = true;\n part.ID = fileName;\n }\n part.name = originalFileName;\n modelDescription = null;\n }", "function parse(fileName) {\n\n var baseDir = path.dirname(fileName);\n\n var jsonData = parseFile(fileName);\n if (!jsonData) {\n return null;\n }\n\n jsonData = replace(baseDir, jsonData, 'segment');\n if (!jsonData) {\n return null;\n }\n\n\n if (jsonData.hasOwnProperty('segment')) {\n if (!Array.isArray(jsonData.segment)) {\n console.error('segment must be array');\n return null;\n }\n for (var i = 0; i < jsonData.segment.length; i++) {\n\n var segment = jsonData.segment[i];\n segment = replace(baseDir, segment, 'host');\n if (!segment) {\n return null;\n }\n segment = replace(baseDir, segment, 'gateway');\n if (!segment) {\n return null;\n }\n jsonData.segment[i] = segment;\n }\n }\n\n jsonData = replace(baseDir, jsonData, 'event');\n\n //console.log(JSON.stringify(jsonData));\n return jsonData;\n}", "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 parse_fasta_files(files){\n for (var i = 0, f; f = files[i]; i++) {\n var reader = new FileReader();\n // Closure to capture the file information.\n reader.onload = function(event){\n var contents = event.target.result;\n fasta = contents.trim();\n\n // split on newlines... \n var sequences = fasta.split('\\n>');\n sequences[0] = sequences[0].replace('>', '');\n // get ID from first line\n // ID: tr|K4PEV9|K4PEV9_9VIRU\n // rec_ids = [K4PEV9, K4PEV9_9VIRU]\n var seq1_data = sequences[0].split('\\n');\n var l1_data = seq1_data[0].split(' ');\n var rec_ids = l1_data[0].split('|').slice(1,);\n var seq1_id = rec_ids[0];\n var seq1_str = seq1_data.slice(1,).join('').trim();\n var predicteds = infer_batches(seq1_str);\n // var text = document.createTextNode(predicteds + \"\\n\");\n // outputStatusElement.appendChild(text);\n // status(predicteds);\n\n for (var j = 1, seq; seq = sequences[j]; j++){\n var lines = sequences[j].split('\\n');\n // join the remaining lines back into a single string without newlines and \n // trailing or leading spaces\n var seq_str = lines.slice(1,).join('').trim();\n if (!seq_str){\n return false;\n }\n var predicteds = infer_batches(seq_str);\n //status(predicteds);\n // var text = document.createTextNode(predicteds + \"\\n\");\n // outputStatusElement.appendChild(text);\n var seq_id = rec_ids[j];\n }\n\n };\n reader.readAsText(f, \"UTF-8\");\n }\n}", "function loadStructureHandler(text)\r\n\t{\r\n\t var content = text.split(\"\\n\");\r\n\t //console.log(content[1]);\r\n\t BuildStructure(name,content,callback, new ProgressDialog(\"Assimilating PDB file \"+name+\"...\"));\r\n\t}", "formatSegments (isProtein) {\n\t\tvar variants = isProtein ? this.attributes.variantDataProtein : this.attributes.variantDataDna;\n\t\tvar sequences = isProtein ? this.attributes.alignedProteinSequences : this.attributes.alignedDnaSequences;\n\t\t// make sure they're sorted by start\n\t\tvariants = _.sortBy(variants, d => {\n\t\t\treturn d.start;\n\t\t});\n\n\t\t// merge segments\n\t\tvar mergedSegments = _.reduce(variants, (memo, d) => {\n\t\t\treturn this._mergeOrAddSegment(memo, d);\n\t\t}, []);\n\n\t\t// add in needed summarized segments\n\t\t// first one\n\t\tif (mergedSegments[0].start > 1) {\n\t\t\tmergedSegments.push({\n\t\t\t\tvisible: false,\n\t\t\t\tstart: 1,\n\t\t\t\tend: mergedSegments[0].start\n\t\t\t});\n\t\t}\n\t\t// loop through and connect visible segments with summarized segments\n\t\tvar _visibleSegments = _.where(mergedSegments, { visible: true });\n\t\t_visibleSegments.forEach( (d, i) => {\n\t\t\t// must not be last or visible\n\t\t\tif (d.visible && i < _visibleSegments.length - 1) {\n\t\t\t\tmergedSegments.push({\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tstart: d.end,\n\t\t\t\t\tend: _visibleSegments[i + 1].start\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\t\n\t\tvar _last = _.max(mergedSegments, d => { return d.end; });\n\t\tvar _maxLength = _.max(sequences, d => { return d.sequence.length; }).sequence.length;\n\t\t// add last if last segment is visible and not at the end\n\t\tif (_last.end < _maxLength) {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength,\n\t\t\t\tvisible: false\n\t\t\t});\n\t\t// add last if visible\n\t\t} else {\n\t\t\tmergedSegments.push({\n\t\t\t\tstart: _last.end,\n\t\t\t\tend: _maxLength + 1,\n\t\t\t\tvisible: true\n\t\t\t});\n\t\t}\n\t\t\n\t\t// change starts and ends to domains\n\t\tmergedSegments = _.map(mergedSegments, d => {\n\t\t\td.domain = [d.start, d.end];\n\t\t\treturn d;\n\t\t});\n\t\t// sort\n\t\tmergedSegments = _.sortBy(mergedSegments, d => {\n\t\t\treturn d.start;\n\t\t});\n\t\treturn mergedSegments;\n\t}", "*_parseLines(lines) {\n const reTag = /^:([0-9]{2}|NS)([A-Z])?:/;\n let tag = null;\n\n for (let i of lines) {\n\n // Detect new tag start\n const match = i.match(reTag);\n if (match || i.startsWith('-}') || i.startsWith('{')) {\n if (tag) {yield tag;} // Yield previous\n tag = match // Start new tag\n ? {\n id: match[1],\n subId: match[2] || '',\n data: [i.substr(match[0].length)]\n }\n : {\n id: 'MB',\n subId: '',\n data: [i.trim()],\n };\n } else { // Add a line to previous tag\n tag.data.push(i);\n }\n }\n\n if (tag) { yield tag; } // Yield last\n }", "_parseMappings(aStr, aSourceRoot) {\n const generatedMappings = (this.__generatedMappingsUnsorted = [])\n const originalMappings = (this.__originalMappingsUnsorted = [])\n for (let i = 0; i < this._sections.length; i++) {\n const section = this._sections[i]\n\n const sectionMappings = []\n section.consumer.eachMapping((m) => sectionMappings.push(m))\n\n for (let j = 0; j < sectionMappings.length; j++) {\n const mapping = sectionMappings[j]\n\n // TODO: test if null is correct here. The original code used\n // `source`, which would actually have gotten used as null because\n // var's get hoisted.\n // See: https://github.com/mozilla/source-map/issues/333\n let source = util.computeSourceURL(\n section.consumer.sourceRoot,\n null,\n this._sourceMapURL\n )\n this._sources.add(source)\n source = this._sources.indexOf(source)\n\n let name = null\n if (mapping.name) {\n this._names.add(mapping.name)\n name = this._names.indexOf(mapping.name)\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n const adjustedMapping = {\n source,\n generatedLine:\n mapping.generatedLine + (section.generatedOffset.generatedLine - 1),\n generatedColumn:\n mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name,\n }\n\n generatedMappings.push(adjustedMapping)\n if (typeof adjustedMapping.originalLine === 'number') {\n originalMappings.push(adjustedMapping)\n }\n }\n }\n }", "function loadFiles() {\n\tfs.readFile(path + 'server/res/blockInfo.csv', 'utf8', function(err, data) {\n\t\tif(err) {\n\t\t\tlog(\"Error reading blockInfo file\", 2);\n\t\t\tlog(err, 2);\n\t\t}\n\t\tcsvParse(data, {delimiter: ';'}, function(errr, output) {\n\t\t\tif(errr) {\n\t\t\t\tlog(\"Error reading blockInfo file #2\", 2);\n\t\t\t\tlog(errr, 2);\n\t\t\t}\n\t\t\tfor(let i = 1; i < output.length; i++) {\n\t\t\t\tvar info = {};\n\t\t\t\tvar cur = output[i];\n\t\t\t\tinfo.id = Number(cur[0]);\n\t\t\t\tinfo.solid = Number(cur[1]);\n\t\t\t\tinfo.breakable = Number(cur[2]);\n\t\t\t\tinfo.breakTime = Number(cur[3]);\n\t\t\t\tinfo.energyCost = Number(cur[4]);\n\t\t\t\tinfo.stoneCost = Number(cur[5]);\n\t\t\t\tinfo.needBlock = Number(cur[6]);\n\t\t\t\tinfo.name = cur[7];\n\t\t\t\tinfo.textureOffset = new Vector2(Number(cur[8]), Number(cur[9]));\n\t\t\t\tinfo.multiTexture = Number(cur[10]);\n\t\t\t\tinfo.damage = Number(cur[11]);\n\t\t\t\tblockInfo.push(info);\n\t\t\t}\n\t\t\tsetup();\n\t\t});\n\t});\n}", "function processFile(data, lcov) {\n\tvar lines = data.split('\\n'),\n\t\tcurrentFileName = '',\n\t\tcurrentCoverageFile = null;\n\n\tfor(var i = 0, l = lines.length; i < l; i++) {\n\t\tvar line = lines[i];\n\t\tif(line === 'end_of_record' || line === '') {\n\t\t\tcurrentFileName = '';\n\t\t\tcurrentCoverageFile = null;\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prefixSplit = line.split(':'),\n\t\t\tprefix = prefixSplit[0];\n\n\t\tif(prefix === 'SF') {\n\t\t\tcurrentFileName = prefixSplit[1];\n\t\t\tcurrentCoverageFile = findCoverageFile(lcov, currentFileName);\n\t\t\tif(currentCoverageFile) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrentCoverageFile = new coverageFile(currentFileName);\n\t\t\tlcov.push(currentCoverageFile);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(prefix === 'DA') {\n\t\t\tvar numberSplit = prefixSplit[1].split(','),\n\t\t\t\tlineNumber = parseInt(numberSplit[0], 10),\n\t\t\t\thits = parseInt(numberSplit[1], 10);\n\t\t\tvar existingDA = findDA(currentCoverageFile.DARecords, lineNumber);\n\t\t\tif(existingDA) {\n\t\t\t\texistingDA.hits += hits;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar newDA = new DA(lineNumber, hits);\n\t\t\tcurrentCoverageFile.DARecords.push(newDA);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(prefix === 'BRDA') {\n\t\t\tvar numberSplit = prefixSplit[1].split(','),\n\t\t\t\tlineNumber = parseInt(numberSplit[0], 10),\n\t\t\t\tblockNumber = parseInt(numberSplit[1], 10),\n\t\t\t\tbranchNumber = parseInt(numberSplit[2], 10),\n\t\t\t\thits = parseInt(numberSplit[3], 10);\n\t\t\tvar existingBRDA = findBRDA(currentCoverageFile.BRDARecords, blockNumber, branchNumber, lineNumber);\n\t\t\tif(existingBRDA) {\n\t\t\t\texistingBRDA.hits += hits;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar newBRDA = new BRDA(lineNumber, blockNumber, branchNumber, hits);\n\t\t\tcurrentCoverageFile.BRDARecords.push(newBRDA);\n\t\t\tcontinue;\n\t\t}\n\t\t//We could throw an error here, or, we could simply ignore it, since we're not interested.\n\t\t//throw new Error('Unknown Prefix \"' + prefix + '\"');\n\t}\n\treturn lcov;\n}", "function init() {\n let input = fs.readFileSync(filepath, \"utf-8\").split(\"\\n\"); // didn't want to use async/await just for this.\n // Last line will always be cardinal directions (and thus not a coordinate)\n directions = input.pop().split(\"\");\n // Everything else is a coordinate, data should reflect that. Also parse to Integers to make adding easier later.\n input = input.map((e) => {\n let arr = e.split(\" \").map((e) => Number.parseInt(e));\n return { x: arr[0], y: arr[1] };\n });\n // First element will always be room size...\n roomSize = input.shift();\n // Next in line is the hoover's starting position..\n position = input.shift();\n // ...and whatever left is dirt. Literally. Well, in a virtual sense.\n dirtLeft = input;\n }", "parse() {\n /**\n * The first two bytes are a bitmask which states which features are present in the mapFile\n * The second two bytes are.. something?\n */\n const featureFlags = this.take(2, \"featureFlags\").readUInt16LE(0);\n this.take(2, \"unknown01\");\n if (featureFlags & 0b000000000000001) {\n this.robotStatus = this.take(0x2C, \"robot status\");\n }\n\n\n if (featureFlags & 0b000000000000010) {\n this.mapHead = this.take(0x28, \"map head\");\n this.parseImg();\n }\n if (featureFlags & 0b000000000000100) {\n let head = asInts(this.take(12, \"history\"));\n this.history = [];\n for (let i = 0; i < head[2]; i++) {\n // Convert from ±meters to mm. UI assumes center is at 20m\n let position = this.readFloatPosition(this.buf, this.offset + 1);\n // first byte may be angle or whether robot is in taxi mode/cleaning\n //position.push(this.buf.readUInt8(this.offset)); //TODO\n this.history.push(position[0], position[1]);\n this.offset += 9;\n }\n }\n if (featureFlags & 0b000000000001000) {\n // TODO: Figure out charge station location from this.\n let chargeStation = this.take(16, \"charge station\");\n this.chargeStation = {\n position: this.readFloatPosition(chargeStation, 4),\n orientation: chargeStation.readFloatLE(12)\n };\n }\n if (featureFlags & 0b000000000010000) {\n let head = asInts(this.take(12, \"virtual wall\"));\n\n this.virtual_wall = [];\n this.no_go_area = [];\n\n let wall_num = head[2];\n\n for (let i = 0; i < wall_num; i++) {\n this.take(12, \"virtual wall prefix\");\n let body = asFloat(this.take(32, \"Virtual walls coords\"));\n\n if (body[0] === body[2] && body[1] === body[3] && body[4] === body[6] && body[5] === body[7]) {\n //is wall\n let x1 = Math.round(ViomiMapParser.convertFloat(body[0]));\n let y1 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[1]));\n let x2 = Math.round(ViomiMapParser.convertFloat(body[4]));\n let y2 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[5]));\n\n this.virtual_wall.push([x1, y1, x2, y2]);\n } else {\n //is zone\n let x1 = Math.round(ViomiMapParser.convertFloat(body[0]));\n let y1 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[1]));\n let x2 = Math.round(ViomiMapParser.convertFloat(body[2]));\n let y2 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[3]));\n let x3 = Math.round(ViomiMapParser.convertFloat(body[4]));\n let y3 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[5]));\n let x4 = Math.round(ViomiMapParser.convertFloat(body[6]));\n let y4 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[7]));\n\n this.no_go_area.push([x1, y1, x2, y2, x3, y3, x4, y4]);\n }\n\n this.take(48, \"unknown48\");\n }\n }\n if (featureFlags & 0b000000000100000) {\n let head = asInts(this.take(12, \"area head\"));\n let area_num = head[2];\n\n this.clean_area = [];\n\n for (let i = 0; i < area_num; i++) {\n this.take(12, \"area prefix\");\n let body = asFloat(this.take(32, \"area coords\"));\n\n let x1 = Math.round(ViomiMapParser.convertFloat(body[0]));\n let y1 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[1]));\n let x2 = Math.round(ViomiMapParser.convertFloat(body[2]));\n let y2 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[3]));\n let x3 = Math.round(ViomiMapParser.convertFloat(body[4]));\n let y3 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[5]));\n let x4 = Math.round(ViomiMapParser.convertFloat(body[6]));\n let y4 = Math.round(ViomiMapParser.MAX_MAP_HEIGHT - ViomiMapParser.convertFloat(body[7]));\n\n this.clean_area.push([x1, y1, x2, y2, x3, y3, x4, y4]);\n\n this.take(48, \"unknown48\");\n }\n }\n if (featureFlags & 0b000000001000000) {\n let navigateTarget = this.take(20, \"navigate\");\n this.navigateTarget = {position: this.readFloatPosition(navigateTarget, 8)};\n }\n if (featureFlags & 0b000000010000000) {\n let realtimePose = this.take(21, \"realtime\");\n this.realtimePose = {position: this.readFloatPosition(realtimePose, 9)};\n }\n\n if (featureFlags & 0b000100000000000) {\n //v6 example: 5b590f5f00000001\n //v7 example: e35a185e00000001\n this.take(8, \"unknown8\");\n this.parseRooms();\n // more stuff i don't understand\n this.take(50, \"unknown50\");\n this.take(5, \"unknown5\");\n this.points = [];\n try {\n this.parsePose();\n } catch (e) {\n Logger.warn(\"Unable to parse Pose\", e); //TODO\n }\n }\n this.take(this.buf.length - this.offset, \"trailing\");\n\n // TODO: one of them is just the room outline, not actual past navigation logic\n return this.convertToValetudoMap({\n image: this.img,\n zones: this.rooms,\n //TODO: at least according to all my sample files, this.points is never the path\n //Why is this here?\n //path: {points: this.points.length ? this.points : this.history},\n path: {points: this.history},\n goto_target: this.navigateTarget && this.navigateTarget.position,\n robot: this.realtimePose && this.realtimePose.position,\n charger: this.chargeStation && this.chargeStation.position,\n virtual_wall: this.virtual_wall,\n no_go_area: this.no_go_area,\n clean_area: this.clean_area\n });\n }", "function sam2sv(samfile) {\n var sam = new SR(fs.createReadStream(samfile));\n\n sam.on('alignment', function(aln) {\n /**\n * get the original breakpoint which generated this clipped sequence\n **/\n var bp = BPInfo.parse(aln.name);\n\n var rev = aln.flags.reversed;\n var unmapped = aln.flags.unmapped;\n\n /**\n * if unmapped, assumes INSERTION\n **/\n if (unmapped) {\n printSVInfo({\n rname: bp.rname,\n start: bp.start,\n end : bp.start +1,\n type : 'INS',\n len : '*',\n rname2 : '=',\n others : {\n LR : bp.LR,\n size: bp.size\n }\n });\n return;\n }\n\n /**\n * get mapped reference info from rname\n **/\n var f = FASTAName.parse(aln.rname);\n\n /**\n * get the position of another breakpoint\n *\n * if original LR equals L, and not reversed,\n * or original LR equals R, and reversed,\n **/\n\n var start = Number(aln.pos) -1;\n var theOtherBPStart = f.start + ((bp.LR == 'L' ^ rev)? (start + aln.cigar.len()) : start);\n\n\n /**\n * if rname is different, assumes InterChromosomal Translocation\n **/\n if (f.code != bp.code) {\n\n /**\n * < the definition of translocation patterns >\n * \n * Let's think of two chromosomes, A and C\n *\n * <chromosome A>\n * AAAAAAAAAAAA|AAAAAA (+ strand)\n * aaaaaaaaaaaa|aaaaaa (- strand)\n *\n * <chromosome A>\n * CCCCCCCCCCCC|CCCCCC (+ strand)\n * cccccccccccc|cccccc (- strand)\n *\n * <translocation type 1>\n * AAAAAAAAAAAA|CCCCCC\n * aaaaaaaaaaaa|cccccc\n *\n * <translocation type 2>\n * AAAAAAAAAAAA|cccccccccccccc\n * aaaaaaaaaaaa|CCCCCCCCCCCCCC\n *\n * <translocation type 3>\n * CCCCCCCCCCCC|AAAAAA\n * cccccccccccc|aaaaaa\n *\n * <translocation type 4>\n * ccccc|AAAAAA\n * CCCCC|aaaaaa\n *\n **/\n\n /**\n * get the second breakpoint\n **/\n var bp2 = {\n code : f.code,\n rname : f.rname,\n start : theOtherBPStart,\n LR : (bp.LR == 'R' ^ rev) ? 'L' : 'R'\n };\n\n /**\n * name the smaller breakpoint as bpA, and the other, bpB\n **/\n var BPIsLargerThanBP2 = (bp.code > bp2.code);\n var bpA = (BPIsLargerThanBP2) ? bp2 : bp;\n var bpB = (BPIsLargerThanBP2) ? bp : bp2;\n\n /**\n * get the type of translocation\n **/\n var subtype = (bpA.LR == 'R') ? 1: 3;\n if (rev) subtype++;\n\n printSVInfo({\n rname : bpA.rname,\n start : bpA.start,\n end : bpA.start + 1,\n type : 'CTX',\n subtype : subtype,\n len : \"*\",\n rname2 : bpB.rname,\n start2 : bpB.start,\n others : {\n LR : (bpA.code == bp.code) ? 'L' : 'R', // for balancing\n size : bp.size\n }\n });\n return;\n }\n\n\n // filter if bp.start equals to the other bp.start\n if (theOtherBPStart == bp.start) {\n return;\n }\n\n\n // set the smaller one as SV start\n var start = (theOtherBPStart > bp.start) ? bp.start: theOtherBPStart;\n\n var len = Math.abs(theOtherBPStart - bp.start);\n\n\n /**\n * if the start of a left clipped sequence is smaller than the other breakpoint or vice versa,\n * it's tandem duplication.\n **/\n var isDup = (bp.LR == 'L' ^ (bp.start > theOtherBPStart));\n\n /**\n * if rev: INV\n *\n * if isDup: DUP\n * else DEL\n **/\n var type = (rev)? 'INV' : (isDup)? 'DUP' : 'DEL';\n\n\n printSVInfo({\n rname : bp.rname,\n start : start, // 0-based coordinate system\n end : start + len, // 0-based coordinate system\n type : type,\n len : len,\n rname2 : '=',\n others : {\n LR : bp.LR,\n size : bp.size\n }\n });\n });\n}", "function appendInitSegment(sourceBuffer) {\r\n\t// no-op if already appended an INIT segment or\r\n\t// if we are still processing an append operation\r\n\tif (!sourceBuffer || !sourceBuffer.needsInitSegment || sourceBuffer.appendingData) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Download and append segment\r\n\tsourceBuffer.appendingData = true;\r\n\tsourceBuffer.appendBuffer(initFrameData[0]);\r\n\tsourceBuffer.needsInitSegment = false;\r\n}", "function loadExistingSegmentValues() {\n\n // header update\n UpdateCurrentLesion();\n\n if ( meCompletedLesions[meCurrentLesion] ) {\n for (var i = 0; i < meIndicateSegmentNumber.length; i++) {\n if( meSegmentsInvolved[i][meCurrentLesion] == 1 ) {\n\tgetById('right', 'dd' + i + 'd' + meCurrentLesion).checked = true;\n\tgetFrame('right').lightUpRow('row_' + i + meCurrentLesion);\n }\n }\n }\n else {\n resetExistingFormGlobalVars();\n resetAnswersForLesion(meCurrentLesion);\n }\n}", "function preload(){ //loads all files before main funciton\nfor (let i = 0; i < meshFileDirectory.length; i ++){ //for every file listed in meshFileDirectory...\n request[i] = new XMLHttpRequest(); //request the data\n request[i].open('GET', 'assets/'+meshFileDirectory[i]+'.obj'); //open/setup request\n request[i].send();\n\n request[i].onload = () => { //on receiving the file\n meshFileParsedData[i] = convertObjFileToMeshBlob(request[i].response); //parse it to isolate all arrays and faces and put that info in blob\n requestComplete++; //keep track of how many requests have been competed\n if (requestComplete === meshFileDirectory.length){ //if all requests have finished, start main\n main();\n }\n }\n}\n}", "parsingDidStart(requestContext) {\n console.log(`Parsing started !`)\n }", "function addSegEndsFromSequences(){\n //Add all the starting segEnds and internal segJoins\n for(var i=0;i<seqArr.length;i++){\n var length=parseInt(seqArr[i]['length']),\n seqId=seqArr[i]['id'];\n segEndArr[segEndArr.length]=[seqId,0,'POS_STRAND']\n segEndArr[segEndArr.length]=[seqId,length-1,'NEG_STRAND']\n segJoinArr[segJoinArr.length]=[[seqId,0,'POS_STRAND'],[seqId,length-1,'NEG_STRAND'],'internal',length]\n }\n segmentize();\n}", "parseFlsFile(baseFile) {\r\n this.extension.logger.addLogMessage('Parse fls file.');\r\n const rootDir = path.dirname(baseFile);\r\n const outDir = this.getOutDir(baseFile);\r\n const flsFile = path.resolve(rootDir, path.join(outDir, path.basename(baseFile, '.tex') + '.fls'));\r\n if (!fs.existsSync(flsFile)) {\r\n this.extension.logger.addLogMessage(`Cannot find fls file: ${flsFile}`);\r\n return;\r\n }\r\n this.extension.logger.addLogMessage(`Fls file found: ${flsFile}`);\r\n const ioFiles = this.parseFlsContent(fs.readFileSync(flsFile).toString(), rootDir);\r\n ioFiles.input.forEach((inputFile) => {\r\n // Drop files that are also listed as OUTPUT or should be ignored\r\n if (ioFiles.output.includes(inputFile) ||\r\n this.isExcluded(inputFile) ||\r\n !fs.existsSync(inputFile)) {\r\n return;\r\n }\r\n // Drop the current rootFile often listed as INPUT and drop any file that is already in the texFileTree\r\n if (baseFile === inputFile || inputFile in this.cachedContent) {\r\n return;\r\n }\r\n if (path.extname(inputFile) === '.tex') {\r\n // Parse tex files as imported subfiles.\r\n this.cachedContent[baseFile].children.push({\r\n index: Number.MAX_VALUE,\r\n file: inputFile\r\n });\r\n this.parseFileAndSubs(inputFile);\r\n }\r\n else if (this.fileWatcher && !this.filesWatched.includes(inputFile)) {\r\n // Watch non-tex files.\r\n this.fileWatcher.add(inputFile);\r\n this.filesWatched.push(inputFile);\r\n }\r\n });\r\n ioFiles.output.forEach((outputFile) => {\r\n if (path.extname(outputFile) === '.aux' && fs.existsSync(outputFile)) {\r\n this.parseAuxFile(fs.readFileSync(outputFile).toString(), path.dirname(outputFile).replace(outDir, rootDir));\r\n }\r\n });\r\n }", "sBegin() {\n // We are essentially peeking at the first character of the chunk. Since\n // S_BEGIN can be in effect only when we start working on the first chunk,\n // the index at which we must look is necessarily 0. Note also that the\n // following test does not depend on decoding surrogates.\n // If the initial character is 0xFEFF, ignore it.\n if (this.chunk.charCodeAt(0) === 0xFEFF) {\n this.i++;\n this.column++;\n }\n this.state = S_BEGIN_WHITESPACE;\n }", "function onReadMTLFile(fileString, mtl) {\n var lines = fileString.split('\\n'); // Break up into lines and store them as array\n lines.push(null); // Append null\n var index = 0; // Initialize index of line\n\n // Parse line by line\n var line; // A string in the line to be parsed\n var name = \"\"; // Material name\n var sp = new StringParser(); // Create StringParser\n while ((line = lines[index++]) != null) {\n sp.init(line); // init StringParser\n var command = sp.getWord(); // Get command\n if (command == null)\n continue; // check null command\n\n switch (command) {\n case '#':\n continue; // Skip comments\n case 'newmtl': // Read Material chunk\n name = mtl.parseNewmtl(sp); // Get name\n continue; // Go to the next line\n case 'Kd': // Read normal\n if (name == \"\") continue; // Go to the next line because of Error\n var material = mtl.parseRGB(sp, name);\n mtl.materials.push(material);\n //name = \"\";\n continue; // Go to the next line\n case 'map_Kd':\n if (name == \"\") continue; // Go to the next line because of Error\n var tex = mtl.parseTexName(sp, name);\n if (tex.texture) {\n var i = mtl.fileName.lastIndexOf(\"/\");\n var dirPath = \"\";\n if (i > 0) {\n dirPath = mtl.fileName.substr(0, i + 1);\n tex.texture = dirPath + tex.texture;\n }\n mtl.texture = tex.texture;\n }\n mtl.materials.push(tex);\n name = \"\";\n continue; // Go to the next line\n }\n }\n mtl.complete = true;\n}", "function xdmParser(xdmFilePath) {\n\ttry {\n\t //Get JPEG file size in bytes\n\t var fileStats = fs.statSync(xdmFilePath);\n\t var fileSizeInBytes = fileStats[\"size\"];\n\n\t var fileBuffer = new Buffer(fileSizeInBytes);\n\n //Get JPEG file descriptor\n\t var xdmFileFD = fs.openSync(xdmFilePath, 'r');\n\n\t //Read JPEG file into a buffer (binary)\n\t fs.readSync(xdmFileFD, fileBuffer, 0, fileSizeInBytes, 0);\n\n\t var bufferIndex, segIndex = 0, segDataTotalLength = 0, XMLTotalLength = 0;\n\t for (bufferIndex = 0; bufferIndex < fileBuffer.length; bufferIndex++) {\n\t var markerIndex = findMarker(fileBuffer, bufferIndex);\n\t if (markerIndex != -1) {\n // 0xFFE1 marker is found\n\t var segHeader = findHeader(fileBuffer, markerIndex);\n\t if (segHeader) {\n\t // Header is found\n\t // If no header is found, go find the next 0xFFE1 marker and skip this one\n // segIndex starts from 0, NOT 1\n\t var segSize = fileBuffer[markerIndex + 2] * 16 * 16 + fileBuffer[markerIndex + 3];\n\t var segDataStart;\n\n\t // 2-->segSize is 2-byte long\n // 1-->account for the last 0 at the end of header, one byte\n\t segSize -= (segHeader.length + 2 + 1);\n\t // 2-->0xFFE1 is 2-byte long\n\t // 2-->segSize is 2-byte long\n\t // 1-->account for the last 0 at the end of header, one byte\n\t segDataStart = markerIndex + segHeader.length + 2 + 2 + 1;\n\t \n\t if (segHeader == header1) {\n // StandardXMP\n\t var GUIDPos = findGUID(fileBuffer, segDataStart, segSize);\n\t var GUID = fileBuffer.toString('ascii', GUIDPos, GUIDPos + 32);\n\t var segData_xap = new Buffer(segSize - 54);\n\t fileBuffer.copy(segData_xap, 0, segDataStart + 54, segDataStart + segSize);\n\t fs.appendFileSync(outputXAPFile, segData_xap);\n\t }\n\t else if (segHeader == header2) {\n // ExtendedXMP\n\t var segData = new Buffer(segSize - 40);\n\t fileBuffer.copy(segData, 0, segDataStart + 40, segDataStart + segSize);\n\t XMLTotalLength += (segSize - 40);\n\t fs.appendFileSync(outputXMPFile, segData);\n\t }\n\t bufferIndex = markerIndex + segSize;\n\t segIndex++;\n\t segDataTotalLength += segSize;\n\t }\n\t }\n\t else {\n // No more marker can be found. Stop the loop\n\t break;\n\t };\n\t }\n\t} catch(ex) {\n\t\tconsole.log(\"Something bad happened! \" + ex);\n\t}\n}", "function handleSegments(tokens) {\n // Handle a single segment (after comma separation)\n function handleSegment(segment) {\n if (segment[1].text == 'null') {\n return { intertype: 'value', ident: '0', type: 'i32' };\n } else if (segment[1].text == 'zeroinitializer') {\n Types.needAnalysis[segment[0].text] = 0;\n return { intertype: 'emptystruct', type: segment[0].text };\n } else if (segment[1].text in PARSABLE_LLVM_FUNCTIONS) {\n return parseLLVMFunctionCall(segment);\n } else if (segment[1].type && segment[1].type == '{') {\n Types.needAnalysis[segment[0].text] = 0;\n return { intertype: 'struct', type: segment[0].text, contents: handleSegments(segment[1].tokens) };\n } else if (segment[1].type && segment[1].type == '<') {\n Types.needAnalysis[segment[0].text] = 0;\n return { intertype: 'struct', type: segment[0].text, contents: handleSegments(segment[1].item.tokens[0].tokens) };\n } else if (segment[1].type && segment[1].type == '[') {\n Types.needAnalysis[segment[0].text] = 0;\n return { intertype: 'list', type: segment[0].text, contents: handleSegments(segment[1].item.tokens) };\n } else if (segment.length == 2) {\n Types.needAnalysis[segment[0].text] = 0;\n return { intertype: 'value', type: segment[0].text, ident: toNiceIdent(segment[1].text) };\n } else if (segment[1].text === 'c') {\n // string\n var text = segment[2].text;\n text = text.substr(1, text.length-2);\n return { intertype: 'string', text: text, type: 'i8*' };\n } else if (segment[1].text === 'blockaddress') {\n return parseBlockAddress(segment);\n } else {\n throw 'Invalid segment: ' + dump(segment);\n }\n };\n return splitTokenList(tokens).map(handleSegment);\n }", "load() {\n this.mainSegmentLoader_.load();\n if (this.audioPlaylistLoader_) {\n this.audioSegmentLoader_.load();\n }\n }", "function processRoute (data){\n console.log(\"reitti: \", data);\n var segments = data.routes[0].segments;\n segmentNames.length = 0;\n segmentKind.length = 0;\n\tsegmentDuration.length = 0;\n \n $.each(segments, function(index, value){\n processSegments(value);\n });\n printRoute();\n preparePolyline(data);\n initMap();\n}", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n\t activeStream = bufferStream, segments = [], polygon = [], clean = true;\n\t }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "async function loadFile(){ \n let prev=undefined;\n let data='';\n let chunks=0;\n let totalOffset=0;\n \n let readStream = fs.createReadStream(filePath,{ highWaterMark: chunkSize, encoding: 'utf8' });\n \n for await(chunk of readStream) {\n if(prev === undefined) {\n prev = chunk;\n chunks+=1;\n } else {\n data= prev + chunk;\n prev = chunk;\n chunks+=1; \n let offset = 0;\n let index;\n while ((index = data.indexOf(prefix, offset)) > -1 ) {\n indices.push(index+totalOffset);\n offset = index+1;\n }\n totalOffset+=chunk.length;\n }\n }\n}", "resetSegments() {\n var i;\n for(i = 0; i < this.numSegments; i ++ ){\n this.segmentGenerated[i] = segmentStatus.NOT_GENERATED;\n }\n }", "function segmentHandler(type, data) {\n switch (type) {\n case 0xC0: // Some actual image data, including image dimensions\n case 0xC1:\n case 0xC2:\n case 0xC3:\n // Get image dimensions\n metadata.height = data.getUint16(5);\n metadata.width = data.getUint16(7);\n\n // We're done. All the EXIF data will come before this segment\n // So call the callback\n callback(metadata);\n break;\n\n case 0xE1: // APP1 segment. Probably holds EXIF metadata\n try {\n parseAPP1(data, metadata);\n }\n catch (e) {\n errback(e.toString());\n return;\n }\n // Intentional fallthrough here to read the next segment\n\n default:\n // A segment we don't care about, so just go on and read the next one\n if (!getNextSegment(segmentHandler))\n errback('unexpected end of JPEG file');\n }\n }", "function readSie() {\n // trick_output.log will contain the S_sie.resource file\n fs.readFile('./src/trick/logs/trick_output.log', 'utf8', function(err, contents) {\n \n // Remove first line of trick_output.log (non-xml line)\n contents = contents.split('\\n');\n contents.shift();\n\n // Reconstruct into XML string \n var xmlString = \"\";\n contents.forEach(function(v) { \n xmlString += (v + '\\n'); \n });\n \n // Parse XML and store as JSON object\n parser.parseString(xmlString, function (err, result) {\n extractElements(result);\n\t\t\t});\n\t\t\t\n\t\t\tsieIsParsed(true);\n });\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function start() {\n\tsetupMap();\n\tconsole.log(\"parse\",api_url);\n\treadTextFile(api_url, parseText);\n}", "function polygonStart() {\n (activeStream = bufferStream, segments = [], polygon = [], clean = true);\n }", "function parseFile() {\n\n // Code for parsing file.\n // We plan to use the built in string methods of html5 to find the\n // individual instructions and pull that whole line out.\n var returnInstructions = fileContents.split(\"\\n\");\n var legendArray = [\"\"];\n var parseCounter = 0;\n\n for (var i = 0; i < returnInstructions.length; i++) {\n\n returnInstructions[i] = returnInstructions[i].trim();\n\n if (i < 5) {\n\n console.log(\"\\\"\"+returnInstructions[i]+\"\\\"\");\n\n }\n\n if (returnInstructions[i].indexOf(\"$\") != -1 &&\n\n returnInstructions[i].substring(0, 1) != \"\" &&\n returnInstructions[i].substring(0, 1) != \"#\" &&\n returnInstructions[i].substring(0, 6) != \"syscall\") {\n\n if(returnInstructions[i].indexOf(\"#\") != -1) {\n\n returnInstructions[i] = returnInstructions[i].slice(0,returnInstructions[i].indexOf(\"#\"));\n\n }\n\n var pieces = returnInstructions[i].split(\" \");\n var type = instType(pieces[0]);\n\n if (type == \"r\" || type == \"i\") {\n\n legendArray[parseCounter] = returnInstructions[i];\n parseCounter++;\n\n }\n\n }\n\n }\n\n //Added empty instructions on the end to ensure functionality of program.\n legendArray[parseCounter] = \" \";\n legendArray[parseCounter + 1] = \" \";\n legendArray[parseCounter + 2] = \" \";\n legendArray[parseCounter + 3] = \" \";\n legendArray[parseCounter + 4] = \" \";\n legendArray[parseCounter + 5] = \" \";\n legendArray[parseCounter + 6] = \" \";\n legendArray[parseCounter + 7] = \" \";\n legendArray[parseCounter + 8] = \" \";\n legendArray[parseCounter + 9] = \" \";\n legendArray[parseCounter + 10] = \" \";\n instListCounter = parseCounter + 10;\n return legendArray;\n\n}", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "function polygonStart() {\n activeStream = bufferStream, segments = [], polygon = [], clean = true;\n }", "start() {\n running = true;\n if (splitsStorage.usesSegments()) mySegmentsUpdaterTask.start();\n }", "parseIconFiles() {\n this.iconFiles.forEach(iconFile => {\n const name = path.basename(iconFile, '.svg').substring(2);\n const svgMarkup = fs.readFileSync(path.resolve(this.distIconsFolder, iconFile), 'utf8');\n const content = Parser.getContent(svgMarkup);\n const iconObject = {\n name,\n content,\n };\n\n this.output.icons.push(iconObject);\n });\n }", "function parsedFile(lines) {\n let rounds = 0;\n let players = [];\n let root = {};\n\n lines.forEach((line) => {\n if (line.indexOf('InitGame') !== -1) {\n rounds = getInitGame(root, rounds);\n }\n\n if (line.indexOf('killed') !== -1) {\n kill(root[`game_${rounds}`], line);\n }\n\n if (line.indexOf('ClientUserinfoChanged') !== -1) {\n instancePlayers(root[`game_${rounds}`], line);\n }\n });\n return root;\n}", "async loadStartData() {\n console.timeStart('track');\n for (let document of this.documents.all()) {\n if (this.shouldTrackFile(vscode_uri_1.URI.parse(document.uri).fsPath)) {\n this.trackOpenedDocument(document);\n }\n }\n if (this.alwaysIncludeGlobPattern) {\n let alwaysIncludePaths = await util_1.promisify(glob_1.glob)(this.alwaysIncludeGlobPattern, {\n cwd: this.startPath || undefined,\n absolute: true,\n });\n for (let filePath of alwaysIncludePaths) {\n filePath = vscode_uri_1.URI.file(filePath).fsPath;\n if (this.shouldTrackFile(filePath)) {\n this.trackFile(filePath);\n }\n }\n }\n await this.trackFileOrFolder(this.startPath);\n console.timeEnd('track', `${this.map.size} files tracked`);\n this.startDataLoaded = true;\n }", "function loaded(evt) {\n var fileString = evt.target.result;\n lines = fileString.split('\\n');\n for (var i=0, item; item = lines[i]; i++) {\n fields = item.split(',');\n markers.push({\n lat: parseFloat(fields[0]),\n lng: parseFloat(fields[1]),\n status: fields[2],\n });\n }\n console.log(markers)\n initialize();\n}", "function preprocessScams() {\n let total_2 = 0;\n if (!fs.existsSync(\"./_site/scams/\")) {\n fs.mkdirSync(\"./_site/scams/\");\n }\n fs.readFile('./_layouts/scams.html', 'utf8', function(err, data) {\n const template_1 = template.replace(\"{{ content }}\", data);\n fs.readFile('./_layouts/scams_2.html', 'utf8', function(err, data2) {\n const template_2 = template.replace(\"{{ content }}\", data2);\n fs.readFile('./_site/data/scams.json', 'utf8', function(err, data3) {\n const scams = JSON.parse(data3).sort(\n function(x, y) {\n if ('status' in x && 'status' in y) {\n if (x['status'][x['status'].length - 1]['time'] < y['status'][y['status'].length - 1]['time']) {\n return 1;\n } else if (x['status'][x['status'].length - 1]['time'] == y['status'][y['status'].length - 1]['time']) {\n return 0;\n } else {\n return -1;\n }\n } else {\n return 0;\n }\n });\n fs.readFile('./_site/data/addresses.json', 'utf8', function(err, data4) {\n const addresses = JSON.parse(data4);\n let pages = [];\n let active = 0;\n let inactive = 0;\n for (var key = 0, len = scams.length; key < len; key++) {\n total_2++;\n var layout = \"\";\n var color_status = \"Unknown\"\n var status = \"unknown\";\n if ('status' in scams[key]) {\n status = scams[key]['status'][0]['status'];\n if (status == \"Active\") {\n status = \"offline\";\n color_status = '<i class=\"warning sign icon\"></i> Active';\n active++;\n } else if (status == \"Offline\") {\n status = \"activ\";\n color_status = '<i class=\"checkmark icon\"></i> Offline';\n inactive++;\n } else if (status == \"Suspended\") {\n color_status = '<i class=\"remove icon\"></i> Suspended';\n }\n }\n if ('category' in scams[key]) {\n switch (scams[key]['category']) {\n case \"Phishing\":\n var category = '<i class=\"address book icon\"></i> Phishing';\n break;\n case \"Scamming\":\n var category = '<i class=\"payment icon\"></i> Scamming';\n break;\n case \"Fake ICO\":\n var category = '<i class=\"dollar icon\"></i> Fake ICO';\n break;\n default:\n var category = scams[key]['category'];\n }\n } else {\n var category = '<i class=\"remove icon\"></i> None';\n }\n if ('subcategory' in scams[key]) {\n if (scams[key]['subcategory'].toLowerCase() == \"wallets\") {\n var subcategory = '<i class=\"credit card alternative icon\"></i> ' + scams[key]['subcategory'];\n } else if (fs.existsSync(\"_static/img/\" + scams[key]['subcategory'].toLowerCase().replace(/\\s/g, '') + \".png\")) {\n var subcategory = \"<img src='/img/\" + scams[key]['subcategory'].toLowerCase().replace(/\\s/g, '') + \".png' class='subcategoryicon'> \" + scams[key]['subcategory'];\n } else {\n console.log(\"Warning: No subcategory icon was found for \" + scams[key]['subcategory']);\n var subcategory = scams[key]['subcategory'];\n }\n } else {\n var subcategory = '<i class=\"remove icon\"></i> None';\n }\n if (key % 100 === 0) {\n pages[Math.floor(key / 100)] = \"\";\n }\n pages[Math.floor(key / 100)] += \"<tr><td>\" + category + \"</td><td>\" + subcategory + \"</td><td class='\" + status.toLowerCase() + \"'>\" + color_status + \"</td><td>\" + scams[key]['name'] + \"</td><td class='center'><a href='/scam/\" + scams[key]['id'] + \"'><i class='search icon'></i></a></td></tr>\";\n if (total_2 == scams.length) {\n let all_pages = \"\";\n pages.forEach(function(page, index) {\n all_pages += page;\n });\n layout = template_1.replace(/{{ scams.total }}/ig, scams.length);\n layout = layout.replace(/{{ scams.table }}/ig, all_pages);\n layout = layout.replace(/{{ scams.pagination }}/ig, \"\");\n layout = layout.replace(/{{ scams.active }}/ig, active);\n layout = layout.replace(/{{ addresses.total }}/ig, Object.keys(addresses).length);\n layout = layout.replace(/{{ scams.inactive }}/ig, inactive);\n if (!fs.existsSync(\"./_site/scams/all/\")) {\n fs.mkdirSync(\"./_site/scams/all/\");\n }\n fs.writeFile(\"./_site/scams/all/index.html\", layout, function(err) {\n if (err) {\n return console.log(err);\n }\n });\n pages.forEach(function(page, index) {\n var pagination = \"<div class='ui pagination menu'>\";\n if (index == 0) {\n var loop = [1, 6];\n } else if (index == 1) {\n var loop = [0, 5];\n } else {\n var loop = [-1, 4];\n }\n for (var i = loop[0]; i < loop[1]; i++) {\n var item_class = \"item\";\n var href = \"/scams/\" + (index + i) + \"/\";\n if ((index + i) > pages.length || (index + i) < 1) {\n item_class = \"disabled item\";\n href = \"#\";\n } else if (i == 1) {\n item_class = \"active item\";\n }\n pagination += \"<a href='\" + href + \"' class='\" + item_class + \"'>\" + (index + i) + \"</a>\";\n }\n pagination += \"</div>\";\n if (index == 0) {\n layout = template_1.replace(/{{ scams.total }}/ig, scams.length);\n layout = layout.replace(/{{ scams.table }}/ig, page);\n layout = layout.replace(/{{ scams.pagination }}/ig, pagination);\n layout = layout.replace(/{{ scams.active }}/ig, active);\n layout = layout.replace(/{{ addresses.total }}/ig, Object.keys(addresses).length);\n layout = layout.replace(/{{ scams.inactive }}/ig, inactive);\n fs.writeFile(\"./_site/scams/index.html\", layout, function(err) {\n if (err) {\n return console.log(err);\n }\n });\n }\n layout = template_2.replace(/{{ scams.table }}/ig, page);\n layout = layout.replace(/{{ scams.pagination }}/ig, pagination);\n if (!fs.existsSync(\"./_site/scams/\" + (index + 1) + \"/\")) {\n fs.mkdirSync(\"./_site/scams/\" + (index + 1) + \"/\");\n }\n if (minify) {\n layout = htmlmin(layout);\n }\n fs.writeFile(\"./_site/scams/\" + (index + 1) + \"/index.html\", layout, function(err) {\n if (err) {\n return console.log(err);\n }\n });\n });\n }\n }\n });\n });\n });\n });\n}" ]
[ "0.53671", "0.5225171", "0.5184004", "0.51376367", "0.4997676", "0.49649376", "0.49582064", "0.49030071", "0.48689047", "0.48493445", "0.48305067", "0.48299035", "0.47819272", "0.4769737", "0.47503036", "0.47479227", "0.4735416", "0.47334087", "0.47054288", "0.47010988", "0.4683995", "0.4677665", "0.46662506", "0.46655634", "0.46544275", "0.46520087", "0.4628163", "0.45920688", "0.4587073", "0.458055", "0.45411614", "0.45411614", "0.45411614", "0.45411614", "0.45411614", "0.4539633", "0.4539633", "0.4539633", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45318842", "0.45315468", "0.45307234", "0.4527884", "0.4515397", "0.45123965", "0.4508167", "0.45001808", "0.4500098", "0.44968194", "0.44968194", "0.44968194", "0.44968194", "0.44472176", "0.4445996", "0.44456345", "0.4445064", "0.44439903", "0.44397196" ]
0.65977293
0
when player is ready
function playerReady() { cancelCanplayTimeout(); ocUtils.log("Player ready"); if (!editor.ready) { ocUtils.log("Initializing the editor"); editor.ready = true; $("#cancelButton").css("color", "#FFFFFF"); // create additional data output $('#videoHolder').append('<div id="segmentsWaveform"></div>'); $('#segmentsWaveform').append('<div id="splitSegments"></div>'); $('#segmentsWaveform').append('<div id="imageDiv"><img id="waveformImage" alt="waveform"/></div>'); $('#segmentsWaveform').append('<div id="currentTimeDiv"></div>'); editor.player.bind("timeupdate", function() { positionWaveformAndTimeIndicator(); }); if (workflowInstance.mediapackage && workflowInstance.mediapackage.duration) { // create standard split point editor.splitData.splits.push({ clipBegin: 0, clipEnd: parseFloat(workflowInstance.mediapackage.duration) / 1000, enabled: true }); } editor.smil = null; editor.parsedSmil = null; if (workflowInstance.mediapackage && workflowInstance.mediapackage.metadata && workflowInstance.mediapackage.metadata.catalog) { var presenter_smil = false; var presentation_smil = false; var episode_smil = false; $.each(workflowInstance.mediapackage.metadata.catalog, function(key, value) { // load smil if there is already one if (value.type == SMIL_FLAVOR_PRESENTER) { presenter_smil = true; ocUtils.log("Found presenter smil"); } else if (value.type == SMIL_FLAVOR_PRESENTATION) { presentation_smil = true; ocUtils.log("Found presentation smil"); } else if (value.type == SMIL_FLAVOR_EPISODE) { episode_smil = true; ocUtils.log("Found episode smil"); } }); if (presenter_smil || presentation_smil || episode_smil) { // download smil editor.getSmil(function() { parseInitialSMIL(); }); } } } $("#loadingDisplay").hide(); $("#thePlayer").show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onPlayerReady(){\n\t\tg_isPlayerReady = true;\n\t\t\n\t}", "function onPlayerReady(e) {\n}", "function onPlayerReady(event) {\r\n playerReady = true;\r\n\r\n }", "function onPlayerReady(event) {\n \n}", "function onPlayerReady(event) {\n console.log(\"Player is ready\");\n }", "function onPlayerReady() {\n console.log(\"player is ready\");\n if (queue.content) queue.pop();\n}", "function playerReady() {\n if (game) {\n game.playerReady(player);\n // all the game events\n subscribe('unit.move', unitMove);\n subscribe('unit.attack', unitAttack);\n subscribe('unit.skip', unitSkip);\n console.log( \"playerReady\" );\n }\n }", "function onPlayerReady() {\n // Yes it is intentionally left empty. DO NOT remove this function!\n}", "function onPlayerReady(event) {\n console.log('player ready');\n}", "function onReady() {\n\t\t\t \tsendNowPlaying();\n\t\t\t \tsendCurState();\t\n\t\t\t }", "function onPlayerReady() {\n console.log(\"onPlayerReady\");\n if (self.player.getPlayerState() === YT.PlayerState.CUED) {\n self.mobileDetected = true;\n } else {\n self.mobileDetected = false;\n }\n self.playerReady = true;\n self.dispatch(\"ready\");\n }", "function onPlayerReady()\n{\n\tvar videotime = 0;\n\tvar timeupdater = null;\n \tfunction updateTime()\n \t{\n \tvar oldTime = videotime;\n \tif(player && player.getCurrentTime)\n \t{\n \t\tvideotime = player.getCurrentTime();\n \t}\n \tif(videotime !== oldTime)\n \t{\n \t\tonProgress(videotime);\n \t}\n \t}\n \ttimeupdater = setInterval(updateTime, 100);\n}", "function onPlayerReady(event) {\n\talert('ready');\n}", "function player_ready(device_id) {\r\n\r\n /*If the player is ready after an error, remove error banner,\r\n change to non-error state and re-initialise the UI*/\r\n if (error_state) {\r\n (\"#error_banner\").animate({ bottom: \"+=40px\" }, 500);\r\n error_state = false;\r\n reset_player();\r\n }\r\n\r\n //If we are ready for the first time.\r\n if (first_load) {\r\n first_load = false;\r\n //TODO hide loader.\r\n }\r\n\r\n //Update some UI to give info to the user.\r\n local_track.name = \"Ready To Play.\";\r\n local_track.artists[0].name = \"Visit any Spotify player and choose 'Custom LED Player' as a device.\";\r\n\r\n }", "function onFedPlayerReady(event){\n\t\t/* left blank on purpose */\n\t}", "function onPlayerLoaded() {\n\t\tvideo.fp_play(0);\n\t\t//installControlbar();\n\t}", "function flashPlayerReady() {\n $game.log(\"flash player ready!\");\n $game.useFlash = true;\n $game.audio.playerReady = true;\n $game.audio.audioDuration = ($game.audio.flashPlayer.getTotalTime()/1000);\n $game.audioloaded = true;\n}", "function onPlayerReady(event) {\n \tconsole.log('player! onPlayerReady');\n // event.target.playVideo();\n $win.trigger('yt-player:ready');\n // playNext();\n }", "handlePlayerLoaded(player) {\n super.handlePlayerLoaded();\n game.send_command('player_ready', {});\n\n // This will make the new local player visible\n // to others connected people\n player.updateLocalPlayer();\n }", "function onPlayerReady(event) {\n Controller.load_video();\n }", "function onNewPlayer (data) {\n \n}", "function isPlayerReady() {\n if ( !window.Popcorn.player ) {\n setTimeout( function () {\n isPlayerReady();\n }, 300 );\n } else {\n constructMedia();\n }\n }", "setReady(){\n this.ready = true;\n this.showGame = true;\n this.playerDB.update(this.props());\n }", "playerSwitchComplete(){\n this.switchPlayer();\n }", "function onPlayerReady(event) {\n videosLoaded++;\n allVideosLoaded();\n}", "function onPlayerReady(event) {\r\n getPlayerData( player.getDuration(), player.getCurrentTime() ); \r\n event.target.playVideo();\r\n }", "function onPlayerReady(event) {\n socket.emit('playerReady', {player: player,\n \t \t\t\t\t\t\t\troom: roomID});\n }", "function onPlayerReady(event) {\n // event.target.playVideo();\n changeStatus(\"Pause\");\n }", "async onPlayerAdded(player) {}", "function onPlayerReady(event) {\n console.log(event);\n $scope.ready = true;\n }", "function playerReady(obj) {\n\tvar elPlayer = document.getElementById(obj.id);\n\t/*\n\t * This is kind of where the jw player begins to break down a bit.\n\t * The way the jw player tracks all its internal data that the javascript\n\t * wants to know about is by passing bits of information into various \n\t * listeners. In order to have multiple videos loaded on a page we need\n\t * to be able to distinguish the various bits of information passed by each one.\n\t */\n\tplayer = new Player(elPlayer, 'jw');\n\tPlayerList.push(player);\n\tPlayerDaemon().init(elPlayer);\n}", "onPlayStateChange() {}", "function onPlayerReady(event) {\n event.target.loadVideoById(link,0,'medium');\n event.target.playvideo();\n\t invokeAtIntervals();\n\n }", "function PendingPlayerState() { }", "function onPlayerReady(event) {\n event.target.loadVideo();\n }", "function onPlayerReady() {\r\n player.playVideo();\r\n /*let time = player.getCurrentTime();\r\n if(player.stopVideo()){\r\n let time2 = player.getCurrentTime();\r\n \r\n player.playVideo(time2);\r\n }*/\r\n \r\n }", "function checkReady() {\n this.ready = true;\n playGame();\n}", "function videoReady() { }", "function onPlayerReady(event) {\n var player = event.target;\n iframe = $('#player');\n setupListener();\n}", "function playerReady(obj) {\n var player = document.getElementById(obj.id);\n if (player) {\n \tplayer.addModelListener(\"STATE\", \"vp.website.mediaStateTracker\");\n \tplayer.addControllerListener(\"SEEK\", \"vp.website.mediaSeekTracker\");\n }\n}", "function onPlayerReady(event) {\r\n event.target.playVideo();\r\n }", "function VideoPlayer_NotifyLoaded()\n{\n\t//update the video properties\n\tVideoPlayer_UpdateOptions(this.InterpreterObject);\n\t//update the video SRC\n\tVideoPlayer_UpdateSource(this.InterpreterObject);\n}", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function playerReady(obj) {\r\n\tvar id = obj['id'];\r\n\tvar version = obj['version'];\r\n\tvar client = obj['client'];\r\n\t//console.log('the videoplayer '+id+' has been instantiated');\r\n\tplayer[id] = document.getElementById(id);\r\n\taddListeners(id);\r\n}", "function setupPlayer() {\n\t\"use strict\";\n\tjsReady = true;\n\tif ( 'undefined' === typeof player ) {\n\t\tplayer = GetPlayer();\n\t}\n\t\n}", "function onYouTubePlayerReady(playerId) {\r\n plController.onPlayerReady()\r\n}", "function loaded() {\n\tsong.play();\n}", "function playerLoop(){\n //...//\n }", "function onPlayerReady(event) {\n\t// When the player is created, but not started\n\tconsole.log(\"Video Started\")\n\tlivePlayer.player = event.target\n\t// livePlayer.player.mute()\n\tlivePlayer.player.seekTo(0)\n\tlivePlayer.player.playVideo()\n\n\t$('#vidTitle').text(livePlayer.player.getVideoData().title)\n\t$('#vidAuthor').text(\"By \" + livePlayer.player.getVideoData().author)\n\n\n\tvar t = setInterval(function(){\n\t\tif(livePlayer.player.getVideoData().author != \"\"){\n\t\t\t$('#vidAuthor').text(\"By \" + livePlayer.player.getVideoData().author)\n\t\t\tclearInterval(t)\n\t\t}\n\t}, 100);\n}", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerReady(event) {\n\t event.target.playVideo();\n }", "function onPlayerReady(event) {\n // event.target.playVideo();\n event.target.loadPlaylist(listeVideosNature);\n}", "function onPlayerReady(event) {\n\t\t\tevent.target.playVideo();\n\t\t}", "function onPlayerReady(event) {\n event.target.playVideo();\n\n }", "function onPlayerReady(event) {\n //event.target.playVideo();\n event.target.pauseVideo();\n }", "function onPlayerReady(event) {\n event.target.mute();\n }", "function vimeoPlayerReady(){options=jQuery(window).data(\"okoptions\");var a=jQuery(\"#okplayer\")[0];player=$f(a),window.setTimeout(function(){jQuery(\"#okplayer\").css(\"visibility\",\"visible\")},2e3),player.addEvent(\"ready\",function(){OKEvents.v.onReady(),OKEvents.utils.isMobile()?OKEvents.v.onPlay():(player.addEvent(\"play\",OKEvents.v.onPlay),player.addEvent(\"pause\",OKEvents.v.onPause),player.addEvent(\"finish\",OKEvents.v.onFinish)),player.api(\"play\")})}", "function onPlayerReady(event) {\n console.log(\"Player ready\");\n console.log(player.getPlayerState());\n console.log(event.data);\n console.log(event.target);\n event.target.playVideo();\n}", "function getReady() {\n me.ready = true;\n update(\"ready\", true);\n $('#me .state').html(\"Ready\");\n $('#me .btn-ready').html(\"Cancel\");\n $('#me .btn-ready').addClass(\"btn-cancel-ready\");\n $('#me .btn-ready').removeClass(\"btn-ready\");\n // check if the opponent is ready\n playersRef.child(opponentKey + \"/ready\").once('value', function (snap) {\n if (snap.val()) {\n newGame();\n }\n });\n}", "function onPlayerReady(event) {\n\n\tloadVideoId();\n\tevent.target.playVideo();\n\n}", "function wait() {\n\t\tsetTimeout(getPlayer() ? attach : wait, 100);\n\t}", "function onPlayerReady(event) {\n // player.setPlaybackRate(2);\n function updateTime() {\n var oldTime = videoTime;\n if (player && player.getCurrentTime) {\n videoTime = player.getCurrentTime();\n }\n if (videoTime !== oldTime) {\n onProgress(videoTime);\n }\n }\n timeUpdater = setInterval(updateTime, 100);\n}", "function player() {}", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerStateChange(event) {\n\n }", "function onPlayerReady(event) {\n // event.target.playVideo();\n }", "function onPlayerReady(event) {\n\tcurrentTime = player.getCurrentTime();//目前播放秒數\n\ttotalTime = player.getDuration()-1;//總共秒數\n\t$(\".videoControl .time .current\").html(toHMS(currentTime));\n\t$(\".videoControl .time .entire\").html(toHMS(totalTime));\n\t}", "ready(){\n this.on_pause(this);\n }", "function onPlayerReady(event) {\n console.log(\"player is ready\");\n event.target.pauseVideo();\n}", "init() {\n\t\tthis.players.forEach( player => {\n\t\t\tplayer.isReady = false;\n\t\t\t//player.socket.removeAllListeners();\n\t\t});\n\t\tthis.results = [];\n\t\tthis.io.to(this.roomID).emit('can-play-again', );\n\t\tconsole.log('ready to play new game');\n\t}", "function onPlayerReady(event) {\n event.target.playVideo();\n console.log(\"start!!\");\n}", "function ready() {\n if(player1 && player2) {\n $('#choose').css('opacity', 0.0);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n $('#ready').animate({opacity: 0.0}, 700);\n $('#ready').animate({opacity: 1.0}, 700);\n };\n}", "function onPlayerReady(event) {\n //writeUserData(video)\n //event.target.playVideo();\n}", "function Play(){\n\t\tDebug.Log(\"Playing?\");\n\t\tplaying = true;\n\t\tBotReady();\n\t}", "function onPlayerReady(event) {\n event.target.playVideo();\n }", "function onPlayerReady(event) {\n mobileStartFlag = true;\n nextVideo();\n}", "function getReady() {\n $(\"#overLayForm\").css(\"display\", \"none\");\n _song.pause();\n _song.currentTime = 0;\n $(\"#overLayMessage\").text(\"READY\");\n $(\"#overLaySubMess\").text(\"\");\n $(\"#recordButt2\").css(\"display\", \"none\");\n setTimeout(function() {\n $(\"#overLayMessage\").text(\"SET\");\n setTimeout(function() {\n _song.play();\n _started = true;\n _recording = true;\n if (!_restarted) record();\n $(\"#overLayMessage\").text(\"\");\n $(\"#restartButt\").css(\"visibility\", \"visible\");\n $(\"#saveNowButt\").css(\"visibility\", \"visible\");\n $(\"#recordButt\").text(\"pause\");\n }, _readyTimer);\n }, _readyTimer);\n }", "function OnRemotePlayerReady(ID : String)\n{\n\t// Update the checkbox on our UI\n\tvar playerCount : int = player.GetPlayerCount();\n\tfor (var i=0; i < playerCount; i++) {\n\t\tvar p : PlayerListElement = player.GetPlayerInfoByIndex(i);\n\t\tif (p.ID == ID) {\n\t\t\tisPlayerReadyList[i] = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\t// Now look at how the ready list has changed and determine whether we can\n\t// begin the game\n\tUpdateWaitingForPlayersStatus();\n}", "function onPlayerReady(event) {\n event.target.pauseVideo();\n }", "onReady() {}", "function OnNewPlayerRegistered(ID : String)\n{\n\t// Reset all the ready flags when a new player joins\n\tfor (var i=0; i < ConfigurationDirector.GetAbsoluteMaxPlayerCount(); i++) {\n\t\tisPlayerReadyList[i] = false;\n\t}\n\tUpdateWaitingForPlayersStatus();\n}", "function onPlayerReady(event) {\n event.target.playVideo();\n sendVideoProgressToAndroidDevice(); \n startVideoProgress();\n startAdTimer(testAd);\n }", "function Nimbb_initCompleted(idPlayer) {\n\t \t/* Get a reference to the player since it was successfully created. */\n\t \t_Nimbb = document[idPlayer];\n\t}", "function onPlayerReady(event) {\n console.log('onPlayerREady', event);\n event.target.playVideo();\n }", "playerStateChanged(playerCurrentState) {\n // console.log('player current update state', playerCurrentState)\n }", "function onPlayerReady(event) {\n console.log(\"GO Video\");\n // event.target.playVideo();\n}", "function onPlayerReady() {\n document.getElementById('audioplayer').addListeners();\n}", "function onPlayerReady(event) {\n \n console.log('onPlayerReady:'+event.data);\n //event.target.playVideo();\n}", "function onPlayerReady(event) {\n\t//event.target.playVideo();\n}", "function onPlayerReady(event) {\n\tevent.target.playVideo();\n}", "ready() { }", "ready() { }", "ready() { }", "ready() { }", "ready() { }", "ready() { }", "ready() { }", "ready() { }" ]
[ "0.88452995", "0.84850425", "0.8466784", "0.8276076", "0.8212175", "0.81919545", "0.81737125", "0.81549764", "0.802907", "0.8003171", "0.77981424", "0.7715783", "0.77065784", "0.766083", "0.76386726", "0.7619629", "0.7523268", "0.74400383", "0.74060965", "0.7345141", "0.73416233", "0.7331959", "0.7326255", "0.72906566", "0.7269955", "0.7265905", "0.7249739", "0.72050506", "0.71431535", "0.7133056", "0.7101566", "0.7091308", "0.7089856", "0.7085379", "0.70468044", "0.70423424", "0.7042061", "0.7040015", "0.70280933", "0.69780475", "0.6976344", "0.6964709", "0.6963272", "0.6958196", "0.6947055", "0.6946883", "0.6935666", "0.6932628", "0.69289416", "0.6922007", "0.6922007", "0.6922007", "0.6904225", "0.6900104", "0.6890936", "0.6888584", "0.6883387", "0.6877737", "0.6877073", "0.6875966", "0.6859516", "0.6857311", "0.6856641", "0.68446374", "0.6819825", "0.6819575", "0.68160427", "0.6814966", "0.6814755", "0.6802332", "0.6800772", "0.6794797", "0.67841846", "0.67822415", "0.678176", "0.6777903", "0.6770802", "0.6768244", "0.67493397", "0.67468345", "0.67467993", "0.6746535", "0.6745122", "0.67427397", "0.6729027", "0.6723985", "0.6709528", "0.6707908", "0.6699324", "0.6686506", "0.66845196", "0.6680109", "0.66625863", "0.6654445", "0.6654445", "0.6654445", "0.6654445", "0.6654445", "0.6654445", "0.6654445", "0.6654445" ]
0.0
-1
Returns an object containing a latitude and longitude (in degrees) representing the given city. The latitude and longitude will generally be at a relevant central location within the city (e.g. downtown).
async function fetchLatLngOfCity(city, state) { const apiKey = config.MAP_QUEST_API_KEY; const endpoint = `https://www.mapquestapi.com/geocoding/v1/address?key=${apiKey}&inFormat=kvp&outFormat=json&location=${city}, ${state}&thumbMaps=false`; const response = await fetch(endpoint); const json = await response.json(); // Skip first element in json, which consists of unneeded headers. return json.results[0].locations[0].latLng; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "distanceTo(city) {\n let xDistance = Math.abs(this.x - city.x);\n let yDistance = Math.abs(this.y - city.y);\n let distance = Math.sqrt((xDistance * xDistance) + (yDistance * yDistance));\n\n return distance;\n }", "function distanceFromGrenoble(city) {\n console.log(\"distanceFromGrenoble - implement me !\");\n var GrenobleLat = 45.166667;\n var GrenobleLong = 5.716667;\n\n const R = 6371e3; // metres\n const φ1 = GrenobleLat * Math.PI / 180; // φ, λ in radians\n const φ2 = city.latitude * Math.PI / 180;\n const Δφ = (city.latitude - GrenobleLat) * Math.PI / 180;\n const Δλ = (city.longitude - GrenobleLong) * Math.PI / 180;\n\n const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +\n Math.cos(φ1) * Math.cos(φ2) *\n Math.sin(Δλ / 2) * Math.sin(Δλ / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n const d = (R * c) / 1000; // in klm\n\n return d;\n}", "function distanceFromGrenoble(city){\n\n var GrenobleLat = 45.166667;\n var GrenobleLong = 5.716667;\n var cityLat = parseFloat(city.latitude);\n var cityLong = parseFloat(city.longitude);\n var R = 6371e3; // metres\n var φ1 = GrenobleLat.toRadians();\n var φ2 = cityLat.toRadians();\n var Δφ = (cityLat - GrenobleLat).toRadians();\n var Δλ = (cityLong - GrenobleLong).toRadians();\n var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ/2) * Math.sin(Δλ/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var distance = R * c;\n\n\nreturn parseInt(distance / 1000);\n\n}", "function getLonLatFromCity(displayData) {\n longitude = displayData.coord.lon;\n latitude = displayData.coord.lat;\n}", "function Location (city, geoData) {\r\n this.search_query = city;\r\n this.formatted_query = geoData.display_name;\r\n this.latitude = geoData.lat;\r\n this.longitude = geoData.lon;\r\n }", "function Location(city, data) {\n this.search_query = city;\n this.formatted_query = data.results[0].formatted_address;\n this.latitude = data.results[0].geometry.location.lat;\n this.longitude = data.results[0].geometry.location.lng;\n}", "function getXY(lat, lon) {\n return {\n cx: lon * 2.6938 + 465.4,\n cy: lat * -2.6938 + 227.066\n };\n }", "function Location (city, geoData) {\r\n this.search_query = city;\r\n this.formatted_query = geoData[0].display_name;\r\n this.latitude = geoData[0].lat;\r\n this.longitude = geoData[0].lon;\r\n}", "function getCityAndCoords() {\n // returns array of ['cityKey', [long, lat], ...]\n var cityAndCoordinates = []\n\n GeoCities.forEach(function(city) {\n cityAndCoordinates.push(city.key, city.location.reverse())\n })\n return cityAndCoordinates;\n}", "function calculateNearestCity(latitude, longitude) {\n // Convert Degrees to Radians\n function Deg2Rad(deg) {\n return deg * Math.PI / 180;\n }\n function PythagorasEquirectangular(lat1, lon1, lat2, lon2) {\n lat1 = Deg2Rad(lat1);\n lat2 = Deg2Rad(lat2);\n lon1 = Deg2Rad(lon1);\n lon2 = Deg2Rad(lon2);\n var R = 6371; // km\n var x = (lon2 - lon1) * Math.cos((lat1 + lat2) / 2);\n var y = lat2 - lat1;\n var d = Math.sqrt(x * x + y * y) * R;\n return d;\n }\n var minDif = 99999;\n var closest = locationsList.default;\n\n // loop through each location, matching a close city then the next closest and so on\n for (var key in locationsList) {\n /* eslint-disable no-prototype-builtins */\n if (locationsList.hasOwnProperty(key)) {\n /* eslint-enable no-prototype-builtins */\n if (key != \"default\") {\n var evalutedLocation = locationsList[key];\n var dif = PythagorasEquirectangular(latitude, longitude, evalutedLocation.latlon.split(\", \")[0], evalutedLocation.latlon.split(\", \")[1]);\n if (dif < minDif) {\n closest = evalutedLocation;\n closest.id = key;\n minDif = dif;\n }\n }\n }\n }\n return closest;\n }", "function getWeather(url, city) {\n return {\n url: url,\n city: city\n }\n}", "function getCityWeather(cityLat, cityLon) {\n fetch(\n \"https://api.openweathermap.org/data/2.5/onecall?lat=\" + cityLat + \"&lon=\" + cityLon + \"&exclude=minutely,hourly,current&units=imperial&appid=6cc51fec452ce9ba1156eafe5282e54f\"\n ).then(function(response) {\n return response.json();\n }).then(function(data) {\n displayWeather(data);\n });\n}", "function getCity(lat, lon) {\n $.getJSON('https://api.opencagedata.com/geocode/v1/json?q=' + lat + ',' + lon + '&key=fdff99045fa8472c8f854a7dcb17e90a', function(location) {\n console.log(location.results[0].components.city);\n currCity = location.results[0].components.city;\n currState = location.results[0].components.state_code;\n currCountry = location.results[0].components.country;\n\n if (currCountry === 'United States of America') {\n $('#city').html(currCity + ', ' + currState);\n } else {\n $('#city').html(currCity + ', <br>' + currCountry);\n }\n });\n }", "function getCityInfoByName(city_name) {\n\tif (contents == null) {\n\t\tcontents = {};\n\t\tconst text = fs.readFileSync(csv_file, \"utf-8\");\n\t\tconst array = text.split(\"\\r\\n\");\n\t\tfor (let i = 0; i < array.length; i++) {\n\t\t\tconst line = array[i].split(\",\");\n\t\t\tif (i == 0) {\n\t\t\t\tkeys = line;\n\t\t\t} else {\n\t\t\t\tconst object = new Object();\n\t\t\t\tfor (let j = 0; j < keys.length; j++) {\n\t\t\t\t\tobject[keys[j]] = line[j];\n\t\t\t\t}\n\t\t\t\tif (line.length > 0) {\n\t\t\t\t\tcontents[line[0]] = object;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tcity_inform = contents[city_name];\n\tconst city = new city_info();\n\tif (city_inform) {\n\t\tcity.name = city_name;\n\t\tcity.latitude = city_inform.lat;\n\t\tcity.longitude = city_inform.lng;\n\t\tcity.country = city_inform.country;\n\t\tcity.province = city_inform.province;\n\t\tcity.status = \"need update\";\n\t}\n\treturn city;\n}", "function getCityLocation(data) {\n if (data) {\n let { results: res } = data;\n let { 0: obj } = res;\n let city = obj.address_components[0].long_name;\n let location = obj.geometry.location;\n let { lat, lng: lon } = location;\n lat = parseFloat(lat).toFixed(3);\n lon = parseFloat(lon).toFixed(3);\n APIrqs(lat, lon, city);\n\n }\n\n}", "function getCoordinatesForCity(cityName) {\n var url = `${GOOGLE_MAPS_API_URL}?address=${cityName}&key=${GOOGLE_MAPS_API_KEY}`;\n \n return (\n fetch(url)\n .then(response => response.json())\n .then(data => data.results[0].geometry.location)\n );\n }", "async function coordinates(city){\n var data = await fetchAsync(city)\n var coords = data.results[0].geometry.location\n return coords;\n}", "function Location(cityName, geoData) {\n this.search_query = cityName;\n this.formatted_query = geoData[0].display_name;\n this.latitude = geoData[0].lat;\n this.longitude = geoData[0].lon;\n}", "function getLoc(cityName) {\n\tlet positie = \"\";\n\tgetData(`https://geocode.search.hereapi.com/v1/geocode?apiKey=${apiHereKey}&q=${cityName},%20NL`)\n\t.then(result => {\n\t\treturn result.json();\n\t})\n\n\t.then(coorData => {\n\t\tpositie = coorData.items[0].position;\n\t});\n\treturn positie;\n}", "function Location(city, localData){\n this.search_query = city;\n this.formatted_query = localData.display_name;\n this.latitude = localData.lat;\n this.longitude = localData.lon;\n}", "function WGS84ToMercator(longitude, latitude)\n{\n var lngRad = longitude * Math.PI / 180.0;\n var latRad = latitude * Math.PI / 180.0;\n\n var x = lngRad;\n var y = Math.log(Math.tan(Math.PI / 4.0 + latRad / 2.0));\n\n x /= Math.PI;\n y /= Math.PI;\n\n var result = [x,y];\n return result;\n}", "function Location( cityName, data ) {\n this.search_query = cityName;\n this.formatted_query = data[0].display_name;\n this.latitude = data[0].lat;\n this.longitude = data[0].lon;\n}", "function geoCity(obj) {\n var resultArr = [];\n var resArr = obj['results'];\n resArr.forEach(function(city){\n var tempObj = {}\n tempObj[city[\"providedLocation\"][\"location\"]] =\n [\n city[\"locations\"][0][\"displayLatLng\"][\"lat\"],\n city[\"locations\"][0][\"displayLatLng\"][\"lng\"]\n ]\n resultArr.push(tempObj);\n })\n return resultArr;\n }", "function city(top, left) {\n this.top = top;\n this.left = left;\n }", "function getCityCoords(somecity) {\n var cityAndCoordinates = getCityAndCoords();\n\n var cityCoordinates = cityAndCoordinates[cityAndCoordinates.indexOf(somecity) + 1]\n return cityCoordinates;\n}", "function coor(lat, long) {\n this.lat = lat;\n this.long = long;\n }", "function Location(city, locationData) {\n this.city = city;\n this.formatted_query = locationData[0].display_name;\n this.latitude = locationData[0].lat;\n this.longitude = locationData[0].lon;\n}", "function getLatLon (cityInput) {\n var city = localStorage.getItem(\"city\");\n var search = apiUrl + city.split(' ').join('+') + apiKey;\n console.log(search);\n\n fetch(search)\n .then(function (response) {\n if (response.ok) {\n console.log(response);\n response.json().then(function (data) {\n var latitude = data.coord.lat;\n var longitude = data.coord.lon;\n console.log(latitude, longitude);\n var exclude = \"&exclude=minutely,hourly\";\n var units = \"&units=imperial\";\n var newSearch = apiUrlOneCall + \"lat=\" + latitude + \"&lon=\" + longitude + units + exclude + apiKey;\n requestWeather(newSearch);\n console.log(newSearch);\n console.log(data);\n });\n } else {\n alert('Error: ' + response.statusText);\n }\n })\n .catch(function (error) {\n alert('Unable to connect to OpenWeatherApp');\n });\n}", "function getWindSpeed(city) {\n return city.wind.speed;\n}", "function getWeatherParams(city, units){\n return {\n q : city,\n APPID: 'a40a4d710830fea15c9ff1e9b8f833cb',\n units: units \n }\n}", "function City (location, minCustomerPerHour, maxCustomerPerHour, avgSalePerCustomer, hoursOfOperationArray,\n photo, ingredients) {\n this.location = location; \n this.minCustomerPerHour = minCustomerPerHour;\n this.maxCustomerPerHour = maxCustomerPerHour;\n this.avgSalePerCustomer = avgSalePerCustomer;\n this.hoursOfOperationArray = hoursOfOperationArray;\n this.photo = photo;\n this.ingredients = ingredients;\n}", "function City(query, data){\n this.search_query = query;\n this.formatted_query = data.formatted_address;\n this.latitude = data.geometry.location.lat;\n this.longitude = data.geometry.location.lng;\n this.id;\n}", "function getGeoLocation() {\n showPage('results');\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(returnedPosition) {\n let position = {};\n position.longitude = returnedPosition.coords.longitude;\n position.latitude = returnedPosition.coords.latitude;\n getCityByLocation(position);\n });\n }\n}", "function getNearestCity(lat, lon) {\n const nearestCityURL = `https://geocodeapi.p.rapidapi.com/GetNearestCities?latitude=${lat}&longitude=${lon}&range=0`;\n const options = {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-host\": \"geocodeapi.p.rapidapi.com\",\n \"x-rapidapi-key\": \"57b3727e23msh192554544a0e32dp1cabd6jsnbf7625af0664\"\n }\n };\n fetch(nearestCityURL, options)\n .then(nearbyCitiesData => {\n if (nearbyCitiesData.ok) {\n return nearbyCitiesData.json();\n }\n throw new Error(nearbyCitiesData.statusText);\n })\n .then(nearbyCitiesDataJson => storeCityData(nearbyCitiesDataJson))\n .catch(err => {\n // Reveals the results section so the error message can display for user\n showHide();\n $('#results-message').text('Something went wrong. Try again!');\n });\n}", "function getWeather(city, callback) {\n request({\n url: 'http://api.openweathermap.org/data/2.5/weather',\n qs: {\n q: city,\n units: 'imperial',\n APPID: 'eac2948bfca65b78a8c5564ecf91d00e'\n }\n }, function(err, response, body) {\n if (err) {\n // call the callback\n callback(err);\n return;\n }\n // convert the body in JSON format to a JS object\n var data = JSON.parse(body);\n // call the callback, passing null for err to signal success\n callback(null, data);\n });\n}", "function LatLonToMercator(lat, lon) {\n var rMajor = 6378137;\n var shift = Math.PI * rMajor;\n var z = lon * shift / 180;\n var x = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);\n x = x * shift / 180;\n \n return {'Z': z, 'X': x};\n }", "function getCoords2(location) {\r\n return { lat: Number(location.lat), lng: Number(location.long) };\r\n}", "function CitiesLocationWeather(cityLocation) {\n currentLat = mainCities[cityLocation].lat;\n currentLong = mainCities[cityLocation].lon;\n currentRegion = mainCities[cityLocation].region;\n currentCity = cityLocation.replace(/_/g, ' ');\n currentCountry = mainCities[cityLocation].country;\n \n //call the function getWeather and apply the data above to this function\n getWeather(); \n }", "function getCoordintes() { \n\tvar options = { \n\t\tenableHighAccuracy: true, \n\t\ttimeout: 5000, \n\t\tmaximumAge: 0 \n\t}; \n\n\tfunction success(pos) { \n\t\tvar crd = pos.coords; \n\t\tvar lat = crd.latitude.toString(); \n\t\tvar lng = crd.longitude.toString(); \n\t\tvar coordinates = [lat, lng]; \n\t\tconsole.log(`Latitude: ${lat}, Longitude: ${lng}`); \n\t\tgetCity(coordinates); \n\t\treturn; \n\n\t} \n\n\tfunction error(err) { \n\t\tconsole.warn(`ERROR(${err.code}): ${err.message}`); \n\t} \n\n\tnavigator.geolocation.getCurrentPosition(success, error, options); \n}", "function getCityLocation(cityName) {\n var url = \"https://maps.googleapis.com/maps/api/geocode/json?address=\" + cityName + \"&key=AIzaSyDXoktJ4NGVFwy52MuWTQMyNoNJzmIU3ck\"\n\n Fetcher(url)\n .then(cityMap => initMap(cityMap, cityName))\n .catch(err => console.log(\"A problem occured with your fetch operation\\n\", err.message))\n\n}", "function getCoordintes() { \n\tvar options = { \n\t\tenableHighAccuracy: true, \n\t\ttimeout: 5000, \n\t\tmaximumAge: 0 \n\t}; \n\tfunction success(pos) { \n\t\tvar crd = pos.coords; \n\t\tvar lat = crd.latitude.toString(); \n\t\tvar lng = crd.longitude.toString(); \n\t\tvar coordinates = [lat, lng]; \n\t\tgetCity(coordinates); \n\t\treturn; \n\t} \n\tfunction error(err) { \n\t\tconsole.warn(`ERROR(${err.code}): ${err.message}`); \n\t} \n\tnavigator.geolocation.getCurrentPosition(success, error, options); \n}", "function coordinatesLookup (url, city) { // Passed in NominatimUrl and user input\n fetch(url + city) // Call the Nominatim Api with the completed url\n .then(res => res.json()) // Return the JSON response\n .then(function (data) { // Extract the Latitude and Longitude of the user input city\n let lat = data[0].lat;\n let lon = data[0].lon;\n\n const weatherUrl = `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&units=metric&appid=${apiKey}`; // Template Literal for API call construction\n\n weatherLookup(weatherUrl); // Call the Open Weather Api with the returned Latitude and Longitude values input into the API call\n })\n}", "function ModelCity() {\n this.knownCity = null;\n this.knownCityNoOfYears = null;\n }", "function getLocation(currLoc){\n latitude = Math.floor(currLoc.lat * 10000 + 0.5) / 10000;\n longitude = Math.floor(currLoc.lng * 10000 + 0.5) / 10000;\n\n let cityCord = {appid: weatherAPIId, lat: latitude, lon: longitude, units: \"imperial\" };\n let formatted = queryBuilder(cityCord);\n\n processRequest(formatted);\n}", "function latLon2ThreeMeters(lat, lon) {\n var coordinates = hackMapProjection(lat, lon, OBJECT_POSITION[0], OBJECT_POSITION[1]);\n // -7915118.7, 5215761.9\n // -71.102721,42.364666\n console.log(coordinates.x, -coordinates.y)\n return {'x': coordinates.x, 'y': 0, 'z': -coordinates.y};\n}", "function getCoords() {\r\n\r\n\t// use real coords in the future\r\n\t// in the future use this -> navigator.geolocation.getCurrentPosition(function(geo) { })\r\n\treturn { \r\n\t\tlatitude: '' + 33.501 + parseInt(Math.random() * 1000),\r\n\t\tlongitude: '' + -82.51 + parseInt(Math.random() * 1000)\r\n\t}\r\n}", "function getCity(lat, lon, callback){\n $.ajax({\n url: 'http://maps.googleapis.com/maps/api/geocode/json?latlng='+lat+','+lon,\n type: \"GET\"\n }).done(function(ret) { \n var indice = ret.results.length - 4,\n status = (ret.status == \"OK\" && ret.results),\n city;\n try{\n city = ret.results[indice].formatted_address;\n }catch(e){\n city = null;\n status = false;\n }\n callback(status,city);\n });\n}", "async getLocationCity(latitude, longitude) {\r\n this.filterItemsJson = [];\r\n const apiCurrentLocation = `${process.env.GOOGLE_GEO_CODE_URL}${latitude},${longitude}&key=${this.apiKey}`;\r\n const filterItemsJson = await dxp.api(apiCurrentLocation);\r\n const currentCountryLocation = filterItemsJson.results[1].address_components;\r\n const city = this.findResult(currentCountryLocation, 'locality');\r\n const state = this.findResult(currentCountryLocation, 'administrative_area_level_1');\r\n const country = this.findResult(currentCountryLocation, 'country');\r\n const currentLocationSearch = {};\r\n currentLocationSearch['description'] = `${city}, ${state}, ${country}`;\r\n return currentLocationSearch;\r\n }", "function City(x, y) {\n \tthis.x = x;\n \tthis.y = y;\n \tthis.active = true;\n }", "function UserLocation(position) {\r\n NearestCity(position.coords.latitude, position.coords.longitude);\r\n}", "function xyz_from_lat_lng(lat, lng, radius) {\r\n var phi = (90 - lat) * PI180;\r\n var theta = (360 - lng) * PI180;\r\n\r\n return {\r\n x: radius * Math.sin(phi) * Math.cos(theta),\r\n y: radius * Math.cos(phi),\r\n z: radius * Math.sin(phi) * Math.sin(theta)\r\n };\r\n}", "function webMercatorToLatLong(x, y){\n var lon = (x / 20037508.34) * 180\n var lat = (y / 20037508.34) * 180\n lat = 180 / Math.PI * ( 2 * Math.atan(Math.exp(lat * Math.PI / 180)) - Math.PI / 2)\n return [lat, lon]\n}", "async function geoCityToCoords(conv, city, gender, occasion) {\n var lat;\n var lng;\n // Connecting to maps api\n await axios.get(`https://maps.googleapis.com/maps/api/geocode/json?address=${city}}&key=AIzaSyDRzIANAmqLQ3Dyl5yJzuy49oJBzlmhBQA`)\n .then((result) => {\n console.log(result);\n lat = result.data.results[0].geometry.location.lat;\n lng = result.data.results[0].geometry.location.lng;\n console.log(`The lattitude is ${lat} and longitude is ${lng}`);\n })\n .catch((error) => {\n console.log(\"Trouble getting lattitude and longitude.\");\n console.log(error);\n });\n return getLocationIdForAccuweather(conv, lat, lng, city, gender, occasion);\n\n}", "function getNearByCity (latitude, longitude){\n var defer = $q.defer();\n\n // // fake cuz google started rejecting my api requests....\n // defer.resolve({data: {\n // results: [{'formatted_address': 'here i am'}]\n // }});\n\n\n var url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + latitude +',' + longitude +'&sensor=true';\n $http({method: 'GET', url: url}).\n success(function(data, status, headers, config) {\n defer.resolve({data : data});\n }).\n error(function(data, status, headers, config) {\n defer.reject({error: 'City not found'});\n });\n return defer.promise;\n }", "async function getCityInfoByName(city) {\n const url = `https://api.opencagedata.com/geocode/v1/json?q=${city}&key=${\n properties.opencage\n }&language=${locales.opencageLocal[localStorage.currentLocale]}`\n\n const res = await fetch(url)\n const data = await res.json()\n\n const { geometry } = data.results[0]\n addInformationAboutCity(data)\n getCityWeather(geometry)\n mapRender(geometry)\n\n if (fahrenheit.classList.contains(\"disabled\")) {\n fahrenheit.classList.remove(\"disabled\")\n celsius.classList.add(\"disabled\")\n }\n}", "function getGeoLocation() {\n \"use strict\";\n var cords = [];\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function (position) {\n cords.push(position.coords.latitude);\n cords.push(position.coords.longitude);\n //When you take them, use them to find the weather\n getWeatherFromCords(cords);\n });\n }\n}", "function cityLocation(cityName, cityDistance) {\n var locationAPIKey = \"&appid=0888bb26c1d027c60cb2417244156801\";\n var locationURL = \"https://api.openweathermap.org/data/2.5/weather?units=imperial&q=\" + cityName + locationAPIKey;\n $.ajax({\n url: locationURL,\n method: \"GET\"\n }).then(function (response) {\n var long = response.coord.lon;\n var lat = response.coord.lat;\n var temp = Math.round(response.main.temp)\n\n getTrails(lat, long, cityDistance, temp); //passing longitude and latitude parameters to get trail results\n })\n }", "function getCity(coordinates) {\n\tvar xhr = new XMLHttpRequest();\n\tvar lat = coordinates[0];\n\tvar lng = coordinates[1];\n\n\t// Paste your LocationIQ token below.\n\txhr.open('GET', \"https://us1.locationiq.com/v1/reverse.php?key=pk.49fd5203799fe38a65295fec96174630&lat=\"+lat+\"&lon=\"+lng+\"&format=json\", true);\n\txhr.send();\n\txhr.onreadystatechange = processRequest;\n\txhr.addEventListener(\"readystatechange\", processRequest, false);\n\n\tfunction processRequest(e) {\n\t\tif (xhr.readyState == 4 && xhr.status == 200) {\n\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\tvar city = response.address.city;\n\t\t\tsetAddr(response.address);\n\t\t\treturn;\n\t\t}\n\t}\n}", "function getWeather(city) {\n fetch(\n `https://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&id=524901&appid=${api.key}`\n )\n .then((data) => {\n return data.json();\n })\n .then(displayWeather);\n}", "function getWGS84(coordObj){\n var lat = parseFloat(coordObj.lat);\n var lon = parseFloat(coordObj.lon);\n \n var fLat = (Math.floor(lat/100.0) + (lat % 100)/60.0); \n var fLon = (Math.floor(lon/100.0) + (lon % 100)/60.0); \n \n return {\"lat\":fLat, \"lon\":fLon};\n}", "function City(city_name, city_id) {\n this.city_name = city_name;\n this.city_id = city_id;\n}", "function NearestCity(latitude, longitude) {\r\n var mindif = 99999;\r\n var closest;\r\n /*for (index = 0; index < positions.length; ++index) {\r\n var dif = PythagorasEquirectangular(latitude, longitude, positions[index][0], positions[index][1]);\r\n if (dif < mindif) {\r\n closest = index;\r\n mindif = dif;\r\n }\r\n }*/\r\n jQuery.each(positions, function(i, val) {\r\n var dif = PythagorasEquirectangular(latitude, longitude, val.lat, val.long);\r\n if (dif < mindif) {\r\n closest = i;\r\n mindif = dif;\r\n }\r\n });\r\n // echo the nearest city\r\n //console.log($(\".r27_map[data-index='\" + closest + \"']\").closest('.contact-detail'), closest);\r\n //$(\".r27_map[data-index='\" + closest + \"']\").closest('.contact-detail').insertAfter($(\".location-list\"));\r\n }", "function lonToMetres (lon,lat) {\n return lon * 111200 * Math.cos(lat * (Math.PI/180));\n}", "function convertLocation(context, lon, lat) {\n var result = {};\n result.lon = (parseFloat(lon) + 180) * (context.canvas.width / 360);\n result.lat = (parseFloat(lat) + 90) * (context.canvas.height / 180);\n return result;\n }", "function promiseToGetLatLonlsFullFulled(cityLatLong) {\n return cityLatLong.json();\n}", "function getSunrise(city) {\n return city.sys.sunrise;\n}", "function getLocation(city) {\n document.getElementById(\"spinner\").style.display = \"block\";\n fetch(\n `https://geocode.search.hereapi.com/v1/geocode?q=${city}&apiKey=${hereAPIKey}` //getting the location of the city\n )\n .then((items) => {\n document.getElementById(\"spinner\").style.display = \"none\";\n return items.json();\n })\n .then(calcLonLat);\n // console.log(calcLonLat());\n}", "async function fetchWeather(city) {\n return new Promise(async (resolve, reject) => {\n API_Url = `https://api.openweathermap.org/data/2.5/onecall?lat=${city[\"lat\"]}&lon=${city[\"lon\"]}&exclude=hourly,minutely,hourly&units=metric&appid=${OPENWEATHERMAP_API_KEY}`;\n const body = await axios.get(API_Url);\n const data = await body.data;\n resolve(data);\n });\n}", "function getCoordinates(city) {\n $.get('https://api.openweathermap.org/data/2.5/weather?q=' + city + '&appid=' + apiKey)\n .then(function (response) {\n console.log(response)\n })\n}", "function geodeticToGeocentric(p, es, a) {\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z ? p.z : 0; //Z value not always supplied\n\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if (Latitude < -_constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"] && Latitude > -1.001 * _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"]) {\n Latitude = -_constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"];\n } else if (Latitude > _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"] && Latitude < 1.001 * _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"]) {\n Latitude = _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"];\n } else if (Latitude < -_constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"]) {\n /* Latitude out of range */\n //..reportError('geocent:lat out of range:' + Latitude);\n return { x: -Infinity, y: -Infinity, z: p.z };\n } else if (Latitude > _constants_values__WEBPACK_IMPORTED_MODULE_0__[\"HALF_PI\"]) {\n /* Latitude out of range */\n return { x: Infinity, y: Infinity, z: p.z };\n }\n\n if (Longitude > Math.PI) {\n Longitude -= (2 * Math.PI);\n }\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n return {\n x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n z: ((Rn * (1 - es)) + Height) * Sin_Lat\n };\n} // cs_geodetic_to_geocentric()", "function updateLatLongFromCity(cityName) {\n\n var geocoder = new google.maps.Geocoder();\n geocoder.geocode({\n 'address': cityName\n }, function (results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n map.setCenter(new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()));\n } else {\n alert(\"Something got wrong \" + status);\n }\n });\n}", "function getWeather(city) {\n var lat = \"\";\n var lon = \"\";\n\n // Grab weather data, then make two additional API calls to get UV index and 5-day forecast\n $.ajax({\n url: `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${APIKEY}&units=imperial`,\n method: \"GET\"\n }).then(function(response) {\n lat = response.coord.lat;\n lon = response.coord.lon;\n saveToLocalStorage();\n renderCitySidebar();\n \n // Get UV index data using latitude and longitude from previous API call, then call renderWeatherDisplay function\n $.ajax({\n url: `https://api.openweathermap.org/data/2.5/uvi/forecast?appid=${APIKEY}&lat=${lat}&lon=${lon}&cnt=1`,\n method: \"GET\"\n }).then(function(responseUV) {\n renderWeatherDisplay(response, responseUV);\n });\n\n // Get 5 day forecast by using latitude and longitude from first API call, then call renderFiveDayForecast function\n $.ajax({\n url: `https://api.openweathermap.org/data/2.5/onecall?lat=${lat}&lon=${lon}&appid=${APIKEY}&units=imperial&exclude=current,minutely,hourly`,\n method: \"GET\"\n }).then(renderFiveDayForecast);\n });\n }", "async function retrieveWeatherData(city, unit){\n setLocation({city,unit});\n }", "function getCenter (coord1, coord2) {\n if (!coord2) {\n return coord1\n }\n const lat = (coord1.lat + coord2.lat) / 2\n let lng = (coord1.lng + coord2.lng) / 2\n if ((coord1.lng > 90 && coord2.lng < -90) || (coord2.lng > 90 && coord1.lng < -90)) {\n lng = (coord1.lng + coord2.lng + 360) / 2\n if (lng > 180) {\n lng -= 360\n }\n }\n return {lat, lng}\n}", "function locationLookup (url, city) {\n console.log(city);\n console.log(url+city);\n fetch(url + city)\n .then(function (response) { return response.json() } )\n .then(function (data) {\n var lat = data[0].lat; // Extract Latitudinal data for user_search\n var lon = data[0].lon; // Extract Longitudinal data for user_search\n\n historyUpdate(lat, lon); // Parse lat & lon into the localStorage update call\n weatherLookup(lat, lon); // Parse lat & lon into weather API\n })\n}", "function getWeather(city){\n fetch(`${api.webUrl}weather?q=${city}&units=metric&appid=${api.apiKey}`)\n .then(weather => {\n return weather.json();\n }).then(displayWeather);\n}", "static async getGeoData() {\n try {\n const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${APIKey}`);\n const data = await response.json();\n return (data.coord);\n } catch(err) {\n alert(err);\n }\n }", "function geoLoc(arrOfCities) {\n \n // Function to generate query string to send MapQuest API\n function bulkQry(arr) {\n resultString = \"\";\n arr.forEach(function(city) {\n // For any cities with a space in name replace with underscore\n let temp = city.replace(/\\s+/g, '_');\n // Location query per MapQuest API\n resultString = resultString.concat('&location='+temp);\n })\n return resultString;\n }\n\n /*\n *Function to get distance in miles between two geographic\n *points(Adapted from StackOverflow post) accounting for curvature of\n *the Earth.\n */\n function getDist(lat1, lon1, lat2, lon2) {\n var R = 3959; // miles\n // Function to convert lat/lon degrees into radians\n function toRad(degrees) {\n return degrees * (Math.PI/180);\n }\n var dLat = toRad(lat2-lat1);\n var dLon = toRad(lon2-lon1);\n var lat1 = toRad(lat1);\n var lat2 = toRad(lat2);\n\n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * \n Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n // return distance\n return d;\n }\n\n // Function to generate an array of city location objects\n function geoCity(obj) {\n var resultArr = [];\n var resArr = obj['results'];\n resArr.forEach(function(city){\n var tempObj = {}\n tempObj[city[\"providedLocation\"][\"location\"]] =\n [\n city[\"locations\"][0][\"displayLatLng\"][\"lat\"],\n city[\"locations\"][0][\"displayLatLng\"][\"lng\"]\n ]\n resultArr.push(tempObj);\n })\n return resultArr;\n }\n\n // Function to find shortest distance between two cities\n function shortestDist (citiesArray) {\n var shortObj = {\n \"cityA\" : \"\",\n \"cityB\" : \"\",\n \"distance\" : 0\n }\n // Get distance between each city pair and compare against current shortest\n for(var i = 0; i < citiesArray.length; i++) {\n for(var j = i + 1; j < citiesArray.length; j++) {\n var cityA = citiesArray[i];\n var keyA = Object.keys(cityA)[0];\n var cityB = citiesArray[j];\n var keyB = Object.keys(cityB)[0];\n var distance = getDist(cityA[keyA][0], cityA[keyA][1], cityB[keyB][0], cityB[keyB][1]); \n if((distance < shortObj[\"distance\"]) || (shortObj[\"distance\"] === 0)) {\n shortObj[\"cityA\"] = keyA.replace(/_/g, ' ');\n shortObj[\"cityB\"] = keyB.replace(/_/g, ' ');\n shortObj[\"distance\"] = Math.ceil(distance);\n }\n }\n }\n return shortObj;\n }\n\n /*\n *Function to make bulk API call to MapQuest API (Up to 100 locations per\n *call) then return the two closest cities\n */\n\n function getGeoBulk(qry){\n var apiAdd = `http://www.mapquestapi.com/geocoding/v1/batch?key=${key['mapQuest']}`;\n \n // Basic get request pulled from Node.js documentation \n http.get(apiAdd += qry, function(res) {\n var statusCode = res.statusCode;\n var contentType = res.headers['content-type'];\n\n let error;\n if (statusCode !== 200) {\n error = new Error(`Request Failed.\\n` + `Status Code: ${statusCode}`);\n } else if (!/^application\\/json/.test(contentType)) {\n error = new Error(`Invalid content-type.\\n` + `Expected application/json but received ${contentType}`);\n }\n if (error) {\n console.log(error.message);\n // consume response data to free up memory\n res.resume();\n return;\n }\n\n res.setEncoding('utf8');\n let rawData = '';\n res.on('data', function(chunk) {rawData += chunk});\n res.on('end', function(){\n try {\n // Parse JSON to object\n var locData = JSON.parse(rawData);\n // Generate array of City/Location objects\n var cityArr = geoCity(locData);\n // Get object containing cities with the shortest distance\n var shortObj = shortestDist(cityArr);\n // Return result of shortestDist function\n return console.log(\n \"\\n\" + shortObj[\"cityA\"] + \n \"\\n\" + shortObj[\"cityB\"] \n );\n\n } catch (e) {\n console.log(e.message);\n }\n });\n }).on('error', function(e) {\n console.log(`Got error: ${e.message}`);\n });\n }\n \n var query = bulkQry(arrOfCities);\n getGeoBulk(query);\n}", "function getCoor(position) {\n let pos = {\n lat: position.coords.latitude,\n lng: position.coords.longitude,\n };\n console.log(pos.lat, pos.lng);\n}", "function varylocation(latitude, longitude, distance) {\n // Convert to meters, use Earth radius, convert to radians\n var radians = (distance * 1609.344 / 6378137) * (180 / Math.PI);\n return {\n latitude: latitude + radians,\n longitude: longitude + radians / Math.cos(latitude * Math.PI / 180)\n };\n}", "function getCoordApi(city) {\n var coordApi = \"https://api.openweathermap.org/data/2.5/weather?q=\" + city + \"&appid=\" + APIkey;\n fetch(coordApi)\n .then(function (response) {\n if (response.status !== 200) {\n $('#currentWeather').html(`<p class=\"title is-3\">I'm sorry, we cannot find \"${city}\"</p>`);\n $('#forecast').html('');\n $('#forecastTitle').html('');\n return;\n } else {\n searchHistory(city); // only add to history if valid search\n };\n\n return response.json();\n })\n .then(function (data) {\n\n getForecastApi(data.coord); // pass the data.coord object into One Call API request\n\n });\n}", "function geodeticToGeocentric(p, es, a) {\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z ? p.z : 0; //Z value not always supplied\n\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {\n Latitude = -HALF_PI;\n } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {\n Latitude = HALF_PI;\n } else if (Latitude < -HALF_PI) {\n /* Latitude out of range */\n //..reportError('geocent:lat out of range:' + Latitude);\n return { x: -Infinity, y: -Infinity, z: p.z };\n } else if (Latitude > HALF_PI) {\n /* Latitude out of range */\n return { x: Infinity, y: Infinity, z: p.z };\n }\n\n if (Longitude > Math.PI) {\n Longitude -= (2 * Math.PI);\n }\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n return {\n x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n z: ((Rn * (1 - es)) + Height) * Sin_Lat\n };\n} // cs_geodetic_to_geocentric()", "function CityExpoler(search_query, formatted_query, latitude, longitude) {\n this.search_query = search_query,\n this.formatted_query = formatted_query,\n this.latitude = latitude,\n this.longitude = longitude\n}", "function cs_geodetic_to_geocentric (cs, p) {\n\n/*\n * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n * according to the current ellipsoid parameters.\n *\n * Latitude : Geodetic latitude in radians (input)\n * Longitude : Geodetic longitude in radians (input)\n * Height : Geodetic height, in meters (input)\n * X : Calculated Geocentric X coordinate, in meters (output)\n * Y : Calculated Geocentric Y coordinate, in meters (output)\n * Z : Calculated Geocentric Z coordinate, in meters (output)\n *\n */\n\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z;\n var X; // output\n var Y;\n var Z;\n\n var Error_Code=0; // GEOCENT_NO_ERROR;\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if( Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI )\n Latitude = -HALF_PI;\n else if( Latitude > HALF_PI && Latitude < 1.001 * HALF_PI )\n Latitude = HALF_PI;\n else if ((Latitude < -HALF_PI) || (Latitude > HALF_PI))\n { /* Latitude out of range */\n Error_Code |= GEOCENT_LAT_ERROR;\n }\n\n if (!Error_Code)\n { /* no errors */\n if (Longitude > PI)\n Longitude -= (2*PI);\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = cs.a / (Math.sqrt(1.0e0 - cs.es * Sin2_Lat));\n X = (Rn + Height) * Cos_Lat * Math.cos(Longitude);\n Y = (Rn + Height) * Cos_Lat * Math.sin(Longitude);\n Z = ((Rn * (1 - cs.es)) + Height) * Sin_Lat;\n\n }\n\n p.x = X;\n p.y = Y;\n p.z = Z;\n return Error_Code;\n}", "function projectLatLng(latitude, longitude){\n return merc.forward([longitude, latitude]);\n}", "function Coords(latitude, longitude) {\n //Controlamos que el objeto se instancia mediante constructor\n if (!(this instanceof Coords)) throw new InvalidAccessConstructorException();\n\n //Propiedades privadas\n var _latitude = latitude;\n var _longitude = longitude;\n\n //Propiedades públicas de acceso\n Object.defineProperty(this, 'latitude', { //Permite ver y modificar latitude\n get: function () {\n return _latitude;\n },\n set: function (value) {\n //Comprobamos que value no sea vacio\n value = (typeof value !== 'undefined') ? value : \"\";\n if (!value) throw new EmptyValueException(\"latitude\");\n _latitude = value;\n }\n });\n\n Object.defineProperty(this, 'longitude', { //Permite ver y modificar longitude\n get: function () {\n return _longitude;\n },\n set: function (value) {\n //Comprobamos que value no sea vacio\n value = (typeof value !== 'undefined') ? value : \"\";\n if (!value) throw new EmptyValueException(\"longitude\");\n _longitude = value;\n }\n });\n}//Fin del constructor Coords", "function getCity(query, radius, userLoc) {\n\treturn new Promise((resolve, reject) => {\n\t\tif (userLoc != \"unset\") {\n\t\t\tRestaurant.find({\n\t\t\t\t$and: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcity: {\n\t\t\t\t\t\t\t$regex: query,\n\t\t\t\t\t\t\t$options: \"i\"\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlocation: {\n\t\t\t\t\t\t\t$near: {\n\t\t\t\t\t\t\t\t$geometry: {\n\t\t\t\t\t\t\t\t\ttype: \"Point\",\n\t\t\t\t\t\t\t\t\tcoordinates: [userLoc.lat, userLoc.lng]\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t$maxDistance: radius\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}).then((results, err) => {\n\t\t\t\tresolve(results);\n\t\t\t});\n\t\t} else {\n\t\t\tRestaurant.find({\n\t\t\t\tcity: {\n\t\t\t\t\t$regex: query,\n\t\t\t\t\t$options: \"i\"\n\t\t\t\t}\n\t\t\t}).then((results, err) => {\n\t\t\t\tresolve(results);\n\t\t\t});\n\t\t}\n\t});\n}", "function getDefaultCenter() {\n\t\treturn { latitude: 40.1451, longitude: -99.6680 };\n\t}", "function UserLocation(position) {\r\n console.log(position.coords.latitude, position.coords.longitude);\r\n NearestCity(position.coords.latitude, position.coords.longitude);\r\n console.log(position.coords.latitude);\r\n }", "function fetchWeather(city) {\n return fetch(\n `https://api.openweathermap.org/data/2.5/weather?q=${city}&units=metric&appid=${apiKey}`\n )\n .then((response) => response.json())\n .then((response) => {\n\n const lon = response.coord.lon;\n const lat = response.coord.lat;\n\n return fetchOnecall(lon, lat).then((onecallResponse) => {\n return {\n currentWeather: response,\n onecallWeather: onecallResponse,\n };\n });\n })\n .catch(function(err){\n console.log('not founddd');\n alert(\"City not found. Please enter a correct city name.\")\n });\n}", "function getMeters(x, y){\n var Rad = y * Math.PI/180;\n var FSin = Math.sin(Rad);\n return {\n x: x * 0.017453292519943 * 6378137,\n y: 6378137 / 2.0 * Math.log((1.0 + FSin) / (1.0 - FSin))\n };\n}", "function lonlat2xyz( coord ){\n\n\tvar lon = coord[0] * to_radians;\n\tvar lat = coord[1] * to_radians;\n\n\tvar x = Math.cos(lat) * Math.cos(lon);\n\n\tvar y = Math.cos(lat) * Math.sin(lon);\n\n\tvar z = Math.sin(lat);\n\n\treturn [x, y, z];\n}", "function getCoords(location) {\n const latitude = location.coords.latitude;\n const longitude = location.coords.longitude;\n const id = \"location1\";\n\n fetchCurrentWeather(latitude, longitude, id);\n}", "async function getGeoData(city, username = 'jenny_wjertzoch') {\n const url = geoNamesURL + city + '&maxRows=10&username=' + username\n try {\n return await getResponse(url)\n } catch (error) {\n throw error\n }\n}", "function toGeoPoint(latitude, longitude) {\r\n var fakeGeoPoint = { latitude: latitude, longitude: longitude };\r\n validateLocation(fakeGeoPoint);\r\n return fakeGeoPoint;\r\n}", "_locationToPoint(loc) {\n const coords = {};\n coords.x = (this.drawModule.width * (loc.Lon + 180)) / 360;\n coords.y = (this.drawModule.height * (loc.Lat + 90)) / 180;\n return coords;\n }", "function createMoonLocation(name, latitude, longitude, height ){\n this.name=name;\n this.latitude=parseFloat(latitude);\n this.longitude=parseFloat(longitude);\n if (height===undefined){\n this.height=0;\n } else {\n this.height=parseFloat(height);\n }\n this.dpBase=ChannelId+\".\"+this.name;\n}", "function City (cityLocations, minCustomerPerHour, maxCustomerPerHour, avgSalePerCustomer, hoursOfOperationArray, ingredientsArray, photo) {\n this.cityLocations = cityLocations; \n this.minCustomerPerHour = minCustomerPerHour;\n this.maxCustomerPerHour = maxCustomerPerHour;\n this.avgSalePerCustomer = avgSalePerCustomer;\n this.hoursOfOperationArray = hoursOfOperationArray;\n this.ingredientsArray = ingredientsArray;\n this.photo = photo;\n\n allCities.push(this);\n}", "static getWeather(city) {\n return Promise.resolve(`The weather of ${city} is Cloudy`);\n }", "function getWeatherCurrent(city, cityid, lat, lon)\n {\n var url = '';\n if (city == '' && cityid == 0) // query via lat/lon\n {\n url = '/weather/current/geo/' + lat + '/' + lon;\n }\n else if (city == '') // query via cityid\n {\n url = '/weather/current/cityid/' + cityid;\n }\n else \n {\n url = '/weather/current/cityname/' + city;\n }\n return axios.get(url);\n }" ]
[ "0.6626432", "0.64797866", "0.6473476", "0.64460015", "0.6222453", "0.621869", "0.6212259", "0.6185457", "0.61765385", "0.61601037", "0.60824305", "0.60278165", "0.595868", "0.5958314", "0.59498996", "0.5924764", "0.5908419", "0.58820266", "0.5860566", "0.5833695", "0.5803632", "0.5777621", "0.57768476", "0.5753102", "0.573798", "0.5735686", "0.5732706", "0.5730482", "0.5728713", "0.5706591", "0.5687875", "0.5677691", "0.56655174", "0.56630677", "0.5648651", "0.56226057", "0.5600636", "0.55913115", "0.55633944", "0.5562078", "0.5541346", "0.5527577", "0.55203766", "0.54902846", "0.5488201", "0.54860044", "0.5485627", "0.547916", "0.5474574", "0.54720783", "0.5470987", "0.54481846", "0.544634", "0.54394174", "0.5436496", "0.5435661", "0.54237235", "0.54102415", "0.5409727", "0.5404011", "0.5382958", "0.53791946", "0.5376029", "0.53682804", "0.5367932", "0.5359829", "0.53546304", "0.53510827", "0.5347478", "0.53136075", "0.5312593", "0.5311424", "0.53087306", "0.53016514", "0.53016114", "0.5299778", "0.52971804", "0.52961767", "0.52840173", "0.52747446", "0.527256", "0.5267802", "0.5266935", "0.52592933", "0.5259166", "0.52570015", "0.5247722", "0.5242461", "0.5236655", "0.5226493", "0.5223735", "0.5221198", "0.5220632", "0.5220325", "0.5220285", "0.5213567", "0.52131855", "0.5212018", "0.5203254", "0.5196751" ]
0.5579104
38
Returns the number of miles in one degree of longitude for a location at the given latitude.
function calculateMilesPerDegreeLng(lat) { const latRadians = degreesToRadians(lat); return Math.cos(latRadians) * MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function metersPerDegree(lat) {\n return EQUATOR_DEGREE_LEN * Math.cos(lat * Math.PI / 180);\n}", "function getMiles (distanceInMeters) {\n return (distanceInMeters*0.000621371192).toFixed(1)\n}", "function milesToLngDegrees(miles, lat) {\n return miles / calculateMilesPerDegreeLng(lat);\n }", "function distanceInMiles(lat1, lon1, lat2, lon2) {\n if(lat1 == lat2 && lon1 == lon2)\n\treturn 0.;\n \n var rad = 3963.;\n var deg2rad = Math.PI/180.;\n var ang = Math.cos(lat1 * deg2rad) * Math.cos(lat2 * deg2rad) * Math.cos((lon1 - lon2)*deg2rad) + Math.sin(lat1 * deg2rad) * Math.sin(lat2 * deg2rad);\n return Math.acos(ang) * 1.02112 * rad;\n}", "function metersToMiles(meters) {\n return meters / 1609.344;\n }", "function kilometersToMiles(distance) {\n return distance * 0.62;\n}", "function getDistanceFromLatLonInMiles(lat1,lon1,lat2,lon2) {\n var R = 3595; // Radius of the earth in mi\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1);\n var a =\n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c; // Distance in mi\n return d;\n}", "function latToMeters(dLat) {\n\t return dLat * 110946.257617;\n\t}", "function kilometersToMiles(kilometers) {\n\tvar miles = kilometers * 0.621371;\n\treturn miles;\n}", "function latLonToMeters( lat, lon )\n {\n var mx = lon * this.originShift / 180.0;\n var my = Math.log( Math.tan((90 + lat ) * Math.PI / 360.0)) / (Math.PI / 180.0);\n my = my * this.originShift / 180.0;\n return [mx, my];\n }", "function latLonToMeters( lat, lon )\n {\n var mx = lon * this.originShift / 180.0;\n var my = Math.log( Math.tan((90 + lat ) * Math.PI / 360.0)) / (Math.PI / 180.0);\n my = my * this.originShift / 180.0;\n return [mx, my];\n }", "function degtometerslat(latdeg) {\n lat = deg2rad(latdeg);\n m1 = 111132.92; // latitude calculation term 1\n m2 = -559.82; // latitude calculation term 2\n m3 = 1.175; // latitude calculation term 3\n m4 = -0.0023; // latitude calculation term 4\n latlen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) + (m4 * Math.cos(6 * lat));\n return latlen;\n }", "function getMiles(i) {\n let n = i*0.000621371192;\n return Math.round( n * 100 ) / 100;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function lonToMeters(dLon, atLat) {\n\t return Math.abs(atLat) >= 90 ? 0 :\n\t dLon * 111319.490793 * Math.abs(Math.cos(atLat * (Math.PI/180)));\n\t}", "function metersToMilesFixed(meters) {\n var num = meters * 0.00062137;\n return num.toFixed(1);\n }", "function metersToMiles( meters ) {\n\treturn Math.round( ( meters * 0.000621371 ) * 100 ) / 100;\n}", "function kmToMiles(km){\n miles = km*0.621371;\n return miles;\n}", "function getDegreeWidthOfWidthAtLat(latWidth, lat){\n return latWidth/getMeterWidthAtLat(1, lat);\n}", "function distanceInMeter(lat1, lon1, lat2, lon2) {\n\tvar R = 6371;\n\tvar dLat = (lat2-lat1) * Math.PI / 180;\n\tvar dLon = (lon2-lon1) * Math.PI / 180;\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) *\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\tvar d = R * c;\n\treturn d * 1000;\n}", "function degtometerslon(latdeg) {\n lat = deg2rad(latdeg);\n p1 = 111412.84; // longitude calculation term 1\n p2 = -93.5; // longitude calculation term 2\n p3 = 0.118; // longitude calculation term 3\n longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) + (p3 * Math.cos(5 * lat));\n return longlen;\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function metersToLongitudeDegrees(distance, latitude) {\r\n var radians = degreesToRadians(latitude);\r\n var num = Math.cos(radians) * EARTH_EQ_RADIUS * Math.PI / 180;\r\n var denom = 1 / Math.sqrt(1 - E2 * Math.sin(radians) * Math.sin(radians));\r\n var deltaDeg = num * denom;\r\n if (deltaDeg < EPSILON) {\r\n return distance > 0 ? 360 : 0;\r\n }\r\n else {\r\n return Math.min(360, distance / deltaDeg);\r\n }\r\n}", "distance(loc) {\n var lat1 = loc[LAT];\n var lon1 = loc[LONG];\n\n var lat2 = lat1; // default lat2 to safe default value\n var lon2 = lon1; // default lat2 to safe default value\n\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((p)=>{\n lat2 = p.coords.latitude;\n lon2 = p.coords.longitude;\n }, \n (e)=>{});\n }else{\n return 0; // oops! Cannot get geolocation return a safe distance \n }\n\n var lat1 = loc[0]; //const LAT = 0;\n var lon1 = loc[1]; //const LONG = 1;\n var theta = lon1 - lon2;\n // var dist = Math.sin(Math.deg2rad(lat1)) * Math.sin(Math.deg2rad(lat2)) \n // + Math.cos(Math.deg2rad(lat1)) * Math.cos(Math.deg2rad(lat2)) * Math.cos(Math.deg2rad(theta));\n var dist = mySin(lat1) * mySin(lat2) \n + myCos(lat1) * myCos(lat2) * myCos(theta);\n dist = Math.rad2deg( Math.acos( dist ) );\n //dist = Math.rad2deg(dist);\n var miles = dist * 60 * 1.1515;\n return miles;\n }", "function lonToMetres (lon,lat) {\n return lon * 111200 * Math.cos(lat * (Math.PI/180));\n}", "function changeToMiles(place) {\n var distance = place.distance;\n distance = distance / 1609.34;\n var integer = Math.floor(distance);\n var decimal = distance - integer;\n if (decimal <= 0.5) {\n distance = Math.floor(distance);\n } else {\n distance = Math.ceil(distance);\n }\n place.distance = distance;\n}", "function calcUp(lat) {\n let dist = +lat - 40 // subtract the base from the value (lowest value)\n return Math.floor(dist * 10) // turn ito a percentage value\n}", "function tfnewGetMeters( miles ) {\n\n return miles * 1609.344;\n\n}", "function getDist(charLatlng, myLatlng) {\n\n var lat2 = charLatlng.lat();\n var lon2 = charLatlng.lng();\n var lat1 = myLatlng.lat();\n var lon1 = myLatlng.lng();\n\n var R = 3961; // miles \n var x1 = lat2-lat1;\n var dLat = x1.toRad(); \n var x2 = lon2-lon1;\n var dLon = x2.toRad(); \n var a = (Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2));\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; \n\n return Math.round(d*100)/100; //round\n}", "function kmToMiles(km) {\n return km * 0.62137;\n }", "function getMetersPerPixel() {\n if (!_map) return 0;\n var y = _map.getSize().y,\n x = _map.getSize().x;\n // calculate the distance the one side of the map to the other using the haversine formula\n var maxMeters = _map.containerPointToLatLng([0, y]).distanceTo(_map.containerPointToLatLng([x, y]));\n return maxMeters / x;\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n var radlat1 = Math.PI * lat1/180\r\n var radlat2 = Math.PI * lat2/180\r\n var radlon1 = Math.PI * lon1/180\r\n var radlon2 = Math.PI * lon2/180\r\n var theta = lon1-lon2\r\n var radtheta = Math.PI * theta/180\r\n var subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n subAngle = Math.acos(subAngle)\r\n subAngle = subAngle * 180/Math.PI // convert the degree value returned by acos back to degrees from radians\r\n dist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius where radius is 3956 miles\r\n if (unit==\"K\") { dist = dist * 1.609344 } // convert miles to km\r\n if (unit==\"N\") { dist = dist * 0.8684 } // convert miles to nautical miles\r\n return dist\r\n}", "function getMapRadiusKM(){\n let mapBoundNorthEast = map.getBounds().getNorthEast();\n let mapDistance = mapBoundNorthEast.distanceTo(map.getCenter());\n return mapDistance/1000;\n}", "function markerSize(magnitude) {\n let multiplier = 50000\n if (magnitude <= 0) {\n return multiplier;\n }\n return (Math.sqrt(magnitude) * multiplier) + multiplier;\n}", "function milesToLatDegrees(miles) {\n const MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR = 69.0;\n return miles / MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR;\n }", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n\tvar radlat1 = Math.PI * lat1/180;\r\n\tvar radlat2 = Math.PI * lat2/180;\r\n\tvar radlon1 = Math.PI * lon1/180;\r\n\tvar radlon2 = Math.PI * lon2/180;\r\n\tvar theta = lon1-lon2;\r\n\tvar radtheta = Math.PI * theta/180;\r\n\tvar subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n\tsubAngle = Math.acos(subAngle);\r\n\tsubAngle = subAngle * 180/Math.PI; // convert the degree value returned by acos back to degrees from radians\r\n\tdist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius )\r\n\t// where radius of the earth is 3956 miles\r\n\tif (unit==\"K\") { dist = dist * 1.609344 ;} // convert miles to km\r\n\tif (unit==\"N\") { dist = dist * 0.8684 ;} // convert miles to nautical miles\r\n\treturn dist;\r\n}", "function convertToKilometers(miles) {\n return miles * 1.60934\n}", "function metersToLon(m, atLat) {\n\t return Math.abs(atLat) >= 90 ? 0 :\n\t m / 111319.490793 / Math.abs(Math.cos(atLat * (Math.PI/180)));\n\t}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n\n var a = 0.5 - c((lat2 - lat1) * p)/2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p))/2;\n\n return 2 * 3959 * Math.asin(Math.sqrt(a)); // Earth's Radius = 3959 miles\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c* 0.6213712; // Distance in Miles\n return d;\n}", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n // convert to miles\n d = d * 0.621371;\n var dis = d.toFixed(2);\n return dis;\n}", "function meters(km) {\n\treturn km * 1000;\n}", "function metersToInches(meters){\n return (meters * 39.3701);\n}", "getDistanceFromLatLonInKm(lat1, lon1) {\n const R = 6371; // Radius of the earth in km\n const dLat = this.deg2rad(this.latitude - lat1);\n const dLon = this.deg2rad(this.longitude - lon1);\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.deg2rad(lat1)) *\n Math.cos(this.deg2rad(this.latitude)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n const d = R * c; // Distance in km\n this.distance = d.toFixed();\n }", "function getMetersPerPixel() {\n if (!_map) return 0;\n var y = _map.getSize().y,\n x = _map.getSize().x;\n // calculate the distance the one side of the map to the other using the haversine formula\n var maxMeters = _map.containerPointToLatLng([0, y]).distanceTo(_map.containerPointToLatLng([x, y]));\n return maxMeters / x;\n }", "function getDistance(lat1, lng1, lat2, lng2) {\n var R = earthRadius;\n var dLat = toRad(lat2 - lat1);\n var dLon = toRad(lng2 - lng1);\n var lat1 = toRad(lat1);\n var lat2 = toRad(lat2);\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n //return d;\n return d * 0.62137; // convert to miles\n }", "function getDistanceInMiles(p1, p2) {\n return kilometersToMiles(getDistanceInKilometers(p1, p2));\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function kilometersToMiles(km) {\n\tmiles = km / 1.609;\n\tmessage = km + ' kilometers is ' + miles + ' miles.'\n\treturn message;\n}", "function metersToInches(meters) {\n return meters * 39.3701;\n}", "function approxNumTiles(region, maxZoom) {\n // Compute the Earth's circumference in meters.\n var earthCircumference = 2 * Math.PI * 6378137;\n // Compute the area in projected \"meters\" per tile at the given max zoom level.\n var areaPerTile = Math.pow(earthCircumference / Math.pow(2, maxZoom), 2);\n // Compute the area of bounds of the region in projected \"meters\".\n var boundsArea = region.bounds().area(1, 'SR-ORG:6627');\n // A heuristic to approximate the number of map tiles required to cover the bounds\n // of the region at the given max zoom level.\n var approxSizeInTiles = boundsArea.divide(areaPerTile).sqrt().add(1).ceil().pow(2);\n // Finally, account approximately for the lower zoom levels.\n return approxSizeInTiles.multiply(4/3).ceil();\n}", "function getDistanceFromLatLonInM(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2 - lat1).toRad();\n var dLon = (lon2 - lon1).toRad();\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n return d * 1000;\n}", "function coordinateDistance(latitude1, longitude1, latitude2, longitude2) {\n\n\tvar h = haversin(radian(latitude2 - latitude1)) + Math.cos(radian(latitude2))*Math.cos(radian(latitude1))*haversin(radian(longitude2 - longitude1));\n\n\t//h needs to be less than 1 (possible floating point error); it's mentioned in the wikipedia article\n\tif(h > 1.0) {\n\t\th = 1.0;\n\t}\n\n\t// distance = 2 * (earth radius) * arcsin ( sqrt ( h ) )\n\t// 3963.191 = earth's radius in miles\n\treturn 2.0 * 3963.191 * Math.asin(Math.sqrt(h));\n}", "function GroundResolution(latitude, levelOfDetail){\n laitude = clip(latitude, MinLatitude, MaxLatitude);\n return Math.cos(latitude * Math.PI / 180) * 2 * Math.PI * EarthRadius / MapSize(levelOfDetail);\n}", "function calcDistance(lat1,lat2,lon1,lon2) {\n var R = 6371; // km\n var dLat = ((lat2)-(lat1)).toRad();\n var dLon = ((lon2)-(lon1)).toRad();\n var lat1 = (lat1).toRad();\n var lat2 = (lat2).toRad();\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //km\n //return d;\n //miles\n return parseInt(parseInt(d)*.62137);\n}", "function distance(lat1, lng1, lat2, lng2, miles) { // miles optional\n if (typeof miles === \"undefined\"){miles=false;}\n function deg2rad(deg){return deg * (Math.PI/180);}\n function square(x){return Math.pow(x, 2);}\n var r=6371; // radius of the earth in km\n lat1=deg2rad(lat1);\n lat2=deg2rad(lat2);\n var lat_dif=lat2-lat1;\n var lng_dif=deg2rad(lng2-lng1);\n var a=square(Math.sin(lat_dif/2))+Math.cos(lat1)*Math.cos(lat2)*square(Math.sin(lng_dif/2));\n var d=2*r*Math.asin(Math.sqrt(a));\n if (miles){\n return d * 0.621371;\n } //return miles\n else{\n return d;\n } //return km\n}", "function latScale(value) {\n\treturn Math.round((value - minlat) * parseInt(map.css('width')) / (maxlat - minlat));\n}", "function Earthradius(lat) {\n return Math.sqrt((6378137.0 * 6378137.0 * Math.cos(lat) * 6378137.0 * 6378137.0 * Math.cos(lat) + 6356752.3 * 6356752.3 * Math.sin(lat) * 6356752.3 * 6356752.3 * Math.sin(lat)) / (6378137.0 * Math.cos(lat) * 6378137.0 * Math.cos(lat) + 6356752.3 * Math.sin(lat) * 6356752.3 * Math.sin(lat)));\n}", "function longitudeBitsForResolution(resolution, latitude) {\r\n var degs = metersToLongitudeDegrees(resolution, latitude);\r\n return (Math.abs(degs) > 0.000001) ? Math.max(1, log2(360 / degs)) : 1;\r\n}", "function convertToMiles (km) {\n console.log(\"This is the Answer to Task 5a ----> \" + km + \" km is equal to \" + km * 0.62137119 + \" miles.\");\n}", "function paceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"mile\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"220\":\r\n\t\t\treturn 0.125;\r\n\t\tcase \"440\":\r\n\t\t\treturn 0.25;\r\n\t\tcase \"880\":\r\n\t\t\treturn 0.50;\r\n\t\tcase \"200\":\r\n\t\t\treturn 0.124274;\r\n\t\tcase \"400\":\r\n\t\t\treturn 0.248548;\r\n\t\tcase \"800\":\r\n\t\t\treturn 0.497097;\r\n\t\tcase \"1500\":\r\n\t\t\treturn 0.932057;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "function distance(lat1, lon1, lat2, lon2) {\n var R = 6371 // Radius of the earth in km\n var dLat = rad(lat2-lat1) // rad below\n var dLon = rad(lon2-lon1)\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(rad(lat1)) * Math.cos(rad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2)\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a))\n var d = R * c // Distance in km\n return (d / 1.609344).toPrecision(3) // Convert to mi\n}", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n \n d = ConvertKmToMile(d);\n console.log(d);\n return d;\n}", "function getRangeofLonLat(lon, lat, kilometer){\n console.log(kilometer/110.574)\n var constant = kilometer/110.574;\n\n if(lon > 0){\n var minLongitude = lon + kilometer/(111.320*Math.cos((lat + constant)* (Math.PI/180)))\n var maxLongitude = lon - kilometer/(111.320*Math.cos((lat - constant)* (Math.PI/180)))\n }else{\n var minLongitude = lon - kilometer/(111.320*Math.cos((lat - constant)* (Math.PI/180)))\n var maxLongitude = lon + kilometer/(111.320*Math.cos((lat + constant)* (Math.PI/180)))\n }\n\n if(lat < 0){\n var minLatitude = lat + constant\n var maxLatitude = lat - constant\n }else{\n var minLatitude = lat - constant\n var maxLatitude = lat + constant\n }\n\n return {minLatitude: minLatitude,\n maxLatitude: maxLatitude,\n minLongitude: minLongitude,\n maxLongitude: maxLongitude\n}\n}", "function markerSize(population) {\n return population / 60;\n}", "function radiusToMeters(radius)\n{\n\treturn parseInt((radius * 1000)/.62);\n}", "function markerSize(magnitude) {\n return magnitude* 1300;\n}", "function markerSize(magnitude) {\n\n // multiply magnitude by a large number so we can actually see it on the map\n return magnitude * 25000;\n \n}", "function getDistance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1 / 180;\n var radlat2 = Math.PI * lat2 / 180;\n var radlon1 = Math.PI * lon1 / 180;\n var radlon2 = Math.PI * lon2 / 180;\n var theta = lon1 - lon2;\n var radtheta = Math.PI * theta / 180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515; //Miles\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n return dist;\n }", "getDistanceByLatLon(taxi_lat, taxi_lon, point_lat, point_lon) {\r\n\t\t\treturn (6371 * Math.acos(\r\n\t\t\t\t\t\tMath.cos(point_lat * Math.PI /180) *\r\n\t\t\t\t\t\tMath.cos(taxi_lat * Math.PI /180) *\r\n\t\t\t\t\t\tMath.cos((taxi_lon * Math.PI /180) - (point_lon * Math.PI /180)) +\r\n\t\t\t\t\t\tMath.sin(point_lat * Math.PI / 180) *\r\n\t\t\t\t\t\tMath.sin(taxi_lat * Math.PI / 180)) \r\n\t\t\t\t\t) ;\r\n\t\t}", "function markerSize(magnitude) {\n return magnitude / 0.00005;\n }", "function calcDistance(lat1,lat2,lon1,lon2) {\n var R = 6371; // km\n var dLat = (parseInt(lat2)-parseInt(lat1)).toRad();\n var dLon = (parseInt(lon2)-parseInt(lon1)).toRad();\n var lat1 = parseInt(lat1).toRad();\n var lat2 = parseInt(lat2).toRad();\n\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //km\n //return d;\n //miles\n return parseInt(parseInt(d)*.62137);\n}", "function distanceCalc(point1, point2) {\n \n var R = 6371; // Radius of the earth in km\n var dLat = (point2.lat - point1.lat) * Math.PI / 180; // deg2rad below\n var dLon = (point2.lng - point1.lng) * Math.PI / 180;\n var a = \n 0.5 - Math.cos(dLat)/2 + \n Math.cos(point1.lat * Math.PI / 180) * Math.cos(point2.lat * Math.PI / 180) * \n (1 - Math.cos(dLon))/2;\n var d = R * 2 * Math.asin(Math.sqrt(a));\n\n //this returns all measurements in KM , lets format this as miles.\n var miles = d/1.609344;\n \n return miles;\n}", "function distanceMeter(km)\n {\n var meters=km*1000;\n return meters;\n\n }", "function WGS84EarthRadius(lat){\n\t// http://en.wikipedia.org/wiki/Earth_radius\n var An = WGS84_a*WGS84_a * Math.cos(lat);\n var Bn = WGS84_b*WGS84_b * Math.sin(lat);\n var Ad = WGS84_a * Math.cos(lat);\n var Bd = WGS84_b * Math.sin(lat);\n return Math.sqrt( (An*An + Bn*Bn)/(Ad*Ad + Bd*Bd) );\n}", "function distanceLatLon(lat1, lon1, lat2, lon2, unit) {\n if ((lat1 == lat2) && (lon1 == lon2)) {\n return 0;\n }\n else {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n return dist;\n }\n}", "function distance(lat1, long1, lat2, long2) {\n var R = 3959; // Earth's radius in miles\n var x = (long2 - long1) * Math.cos((lat1 + lat2)/2);\n var y = lat2 - lat1;\n var d = Math.sqrt(x*x + y*y) * R;\n return d;\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1);\n var a =\n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c; // Distance in km\n return d;\n}", "function distance(lon1, lat1, lon2, lat2) {\n var R = 6371; // Radius of the earth in km\n var dLat = (lat2 - lat1) * Math.PI / 180; // deg2rad below\n var dLon = (lon2 - lon1) * Math.PI / 180;\n var a = \n 0.5 - Math.cos(dLat)/2 + \n Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * \n (1 - Math.cos(dLon))/2;\n\n return R * 2 * Math.asin(Math.sqrt(a));\n}", "function formatLengthMiles(meters) {\n var sMeters = meters * 0.621371192;\n var miles = parseInt(sMeters / 1000);\n var commaMiles = parseInt((sMeters - miles * 1000 + 50) / 100);\n var ret = miles + \".\" + commaMiles + \" miles\";\n return(ret);\n}", "function distanceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"miles\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"m\":\r\n\t\t\treturn 0.000621371;\r\n\t\tcase \"yds\":\r\n\t\t\treturn 0.000568182;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "function latLngToPixels( lat, lng, zoom )\n {\n var meters = this.latLonToMeters( lat, lng, zoom );\n return this.metersToPixels( meters[ 0 ], meters[ 1 ], zoom );\n }", "function latLngToPixels( lat, lng, zoom )\n {\n var meters = this.latLonToMeters( lat, lng, zoom );\n return this.metersToPixels( meters[ 0 ], meters[ 1 ], zoom );\n }", "function distanceFromGrenoble(city){\n\n var GrenobleLat = 45.166667;\n var GrenobleLong = 5.716667;\n var cityLat = parseFloat(city.latitude);\n var cityLong = parseFloat(city.longitude);\n var R = 6371e3; // metres\n var φ1 = GrenobleLat.toRadians();\n var φ2 = cityLat.toRadians();\n var Δφ = (cityLat - GrenobleLat).toRadians();\n var Δλ = (cityLong - GrenobleLong).toRadians();\n var a = Math.sin(Δφ/2) * Math.sin(Δφ/2) + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ/2) * Math.sin(Δλ/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var distance = R * c;\n\n\nreturn parseInt(distance / 1000);\n\n}", "function distcalc(lat1, lng1, lat2, lng2) {\n\t//from www.movable-type.co.uk/scripts/latlong.html\n\tvar R = 6371; \n\tvar dLat = (lat2-lat1) * Math.PI / 180;\n\tvar dLng = (lng2-lng1) * Math.PI / 180;\n\tvar lat1 = lat1 * Math.PI / 180;\n\tvar lat2 = lat2 * Math.PI / 180;\n\t\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\tMath.sin(dLng/2) * Math.sin(dLng/2) * Math.cos(lat1) * Math.cos(lat2); \n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\tvar d = (R * c)*0.6214; //in miles\n\treturn d.toFixed(2);\n}", "function getDist(lat, lon, oLat, oLon) {\n\n\tvar xS = Math.pow((lat - oLat), 2);\n\tvar yS = Math.pow((lon - oLon), 2);\n\t\n\tvar dist = Math.sqrt(xS + yS);\n\treturn dist;\n}", "function getDist(lat1, lon1, lat2, lon2) {\n var R = 3959; // miles\n // Function to convert lat/lon degrees into radians\n function toRad(degrees) {\n return degrees * (Math.PI/180);\n }\n var dLat = toRad(lat2-lat1);\n var dLon = toRad(lon2-lon1);\n var lat1 = toRad(lat1);\n var lat2 = toRad(lat2);\n\n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.sin(dLon/2) * Math.sin(dLon/2) * \n Math.cos(lat1) * Math.cos(lat2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n // return distance\n return d;\n }", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "function computeDistance( lat1, lon1, lat2, lon2 ) {\r\n\tvar degreeToSM = 60 * 1.15078; // 60 NM * (NM->SM factor)\r\n\tvar dlat = Math.abs( lat1 - lat2 ) * degreeToSM;\r\n\tvar dlon = Math.abs( lon1 - lon2 ) * degreeToSM * Math.cos( lat1 * Math.PI / 180 );\r\n\treturn Math.sqrt( dlat * dlat, dlon * dlon );\r\n}", "function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {\n \n function deg2rad(deg) {\n return deg * (Math.PI/180)\n }\n\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n return d;\n}", "distance(lat1, lon1) {\n if (lat1 === this.latitude && lon1 === this.longitude) {\n return 0;\n }\n else {\n const radlat1 = (Math.PI * lat1) / 180;\n const radlat2 = (Math.PI * this.latitude) / 180;\n const theta = lon1 - this.longitude;\n const radtheta = (Math.PI * theta) / 180;\n let dist = Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n dist = dist * 1.609344;\n return dist;\n }\n }", "static getDistanceFromLatLonInMiles(lat1, lon1, lat2, lon2, dist) {\n var R = 3958.8; // Radius of the earth in miles\n var dLat = this.deg2rad(lat2 - lat1);\n var dLon = this.deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.deg2rad(lat1)) *\n Math.cos(this.deg2rad(lat2)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in miles\n return d < dist ? true : false;\n }", "function getDistanceFromLatLng(lat1, lng1, lat2, lng2, miles) { // miles optional\r\n if (typeof miles === \"undefined\"){miles=false;}\r\n function deg2rad(deg){return deg * (Math.PI/180);}\r\n function square(x){return Math.pow(x, 2);}\r\n var r=6371; // radius of the earth in km\r\n lat1=deg2rad(lat1);\r\n lat2=deg2rad(lat2);\r\n var lat_dif=lat2-lat1;\r\n var lng_dif=deg2rad(lng2-lng1);\r\n var a=square(Math.sin(lat_dif/2))+Math.cos(lat1)*Math.cos(lat2)*square(Math.sin(lng_dif/2));\r\n var d=2*r*Math.asin(Math.sqrt(a));\r\n if (miles){return d * 0.621371;} //return miles\r\n else{return d;} //return km\r\n }", "function longLatDistance (lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad(); \n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) * \n Math.sin(dLon/2) * Math.sin(dLon/2); \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c;\n //sys.puts(d.toString() + \"km from here\");\n return d;\n}", "function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2 - lat1); // deg2rad below\n var dLon = deg2rad(lon2 - lon1);\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in km\n return d;\n }" ]
[ "0.6847206", "0.65184087", "0.6455167", "0.6389776", "0.6337094", "0.6299651", "0.62856066", "0.627952", "0.6212539", "0.6208797", "0.6208797", "0.6180989", "0.61774427", "0.61760384", "0.61760384", "0.61760384", "0.6118838", "0.6102353", "0.6068052", "0.6062848", "0.6039356", "0.6007328", "0.5963096", "0.59613836", "0.59613836", "0.59613836", "0.59500855", "0.59393525", "0.5918255", "0.5915033", "0.5892373", "0.58706796", "0.5836547", "0.5820109", "0.58157474", "0.5805667", "0.5805185", "0.5788432", "0.57541", "0.57533914", "0.57491124", "0.5729937", "0.56951666", "0.5692932", "0.56923425", "0.56874317", "0.5681425", "0.5680573", "0.5675053", "0.5668224", "0.5663317", "0.5644464", "0.5644464", "0.5643066", "0.5638715", "0.56194717", "0.5617677", "0.55651057", "0.5544878", "0.5541171", "0.55331796", "0.55158955", "0.5515875", "0.55059713", "0.5502126", "0.54987353", "0.54955685", "0.5493464", "0.5484697", "0.54749155", "0.54677474", "0.54667014", "0.5450275", "0.5445973", "0.5443871", "0.543306", "0.5432035", "0.54147774", "0.54125446", "0.5409288", "0.54069185", "0.5396407", "0.53948677", "0.53936756", "0.53904104", "0.53878754", "0.53871673", "0.53871673", "0.538493", "0.5381399", "0.5373566", "0.5366289", "0.5363515", "0.5362987", "0.53369063", "0.53320235", "0.53309673", "0.53187674", "0.5303707", "0.5302083" ]
0.7869492
0
Converts the given number of degrees to radians.
function degreesToRadians(degrees) { return degrees * Math.PI / 180; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function radians(n) {\n return n * (Math.PI / 180);\n }", "function toRadians(num) {\n\treturn num * Math.PI / 180;\n}", "function degreesToRadians(n) {\n return (n * (Math.PI / 180));\n }", "toRadians(number) {\n return number * (Math.PI / 180);\n }", "function degreeToRadians(n){\n return (n / 180 * Math.PI).toFixed(2);\n}", "function toRad(num) {\r\n\treturn num * Math.PI / 180;\r\n}", "function degToRad(d) {\n return d * Math.PI / 180\n}", "function degToRad(d) {\n return d * Math.PI / 180;\n}", "function radians(xx) {return (Math.PI * xx / 180.0);}", "function toRad(value) {\n return value * Math.PI / 180;\n}", "function radiansToDegrees(n) {\n return ((180 / Math.PI) * n);\n }", "function convertToRadians(val) { return convertToDegrees(val) * Math.PI / 180; }", "function degToRad(degrees) {\n return degrees * Math.PI / 120;\n}", "function toDeg(num) {\r\n\treturn num * 180 / Math.PI;\r\n}", "function degToRad(degrees) {\r\n return degrees * Math.PI / 180;\r\n}", "function degrees_to_radians(degrees)\n{\n let pi = Math.PI;\n return (degrees * pi)/180;\n}", "function deg2Rad(x) {\n return x * Math.PI / 180;\n}", "function degToRad(degrees) {\n return degrees * Math.PI / 180;\n}", "function degToRad(degrees) {\n return degrees * Math.PI / 180;\n}", "function degToRad(degrees) {\n return degrees * Math.PI / 180;\n}", "function degToRad(degrees) {\n return degrees * Math.PI / 180;\n}", "function degToRad(angle_degrees) {\n return angle_degrees/180*Math.PI;\n }", "function degToRad(degrees) {\n return degrees * Math.PI / 180;\n}", "function degToRad(degrees) {\n return degrees * Math.PI / 180;\n}", "static degToRad(degrees) {\n return degrees * 0.0174532925;\n }", "function degToRad(degrees) {\r\n return degrees * Math.PI / 180;\r\n}", "function degToRad(degrees) {\r\n return degrees * Math.PI / 180;\r\n}", "function degToRad(degrees) {\r\n return degrees * Math.PI / 180;\r\n}", "function degToRad(degrees) {\n return degrees * (Math.PI / 180);\n}", "function degToRad(degrees) \n{\n return degrees * Math.PI / 180.0;\n}", "function degreesToRadians(degrees) {\r\n if (typeof degrees !== 'number' || isNaN(degrees)) {\r\n throw new Error('Error: degrees must be a number');\r\n }\r\n return (degrees * Math.PI / 180);\r\n}", "function degToRad(degrees) {\n return degrees * (Math.PI / 180);\n }", "function toRad(Value)\n{\n return Value * Math.PI / 180;\n}", "function toRad(x) {\n return x * Math.PI / 180;\n}", "function degreeToRad(degree) {\n\treturn degree *Math.PI / 180 ;\n}", "function toRad(degrees) {\r\n\t\treturn degrees * Math.PI/180;\r\n\t}", "function toRad(x) {\n return x * Math.PI / 180;\n}", "function degToRad(degrees) {\r\n\treturn degrees * Math.PI / 180;\r\n}", "function toRad(Value) {\n return (Value * Math.PI) / 180;\n}", "function toRad(Value) {\n return (Value * Math.PI) / 180;\n}", "function toRad(Value) {\n return (Value * Math.PI) / 180;\n}", "function deg2rad(d) {\r\n return d * (Math.PI / 180);\r\n}", "function toRad(degrees) {\n return degrees * (Math.PI/180);\n }", "function toRad(val) {\n return val * Math.PI / 180;\n}", "function toRad(x) {\n return x * Math.PI / 180;\n}", "function toRad(Value) {\n return Value * Math.PI / 180;\n}", "function toRad(Value) {\n return Value * Math.PI / 180;\n}", "function toRad(Value) {\n return Value * Math.PI / 180;\n}", "function toRad(Value) {\n return Value * Math.PI / 180;\n}", "function toRad(Value) {\n return Value * Math.PI / 180;\n}", "function toRad(Value) {\n return (Value * Math.PI) / 180;\n }", "function toRad(Value)\n{\n return Value * Math.PI / 180;\n}", "function toRad(Value)\n{\n return Value * Math.PI / 180;\n}", "function toRad(Value)\n{\n return Value * Math.PI / 180;\n}", "function inRad(num) {return num * Math.PI / 180;}", "function toRad(Value) {\r\n return Value * Math.PI / 180;\r\n }", "function toRad(Value) \n{\n return Value * Math.PI / 180;\n}", "function toRad(Value) \n{\n return Value * Math.PI / 180;\n}", "function deg2rad(_degrees) {\n return (_degrees * Math.PI) / 180;\n}", "function degToRad (degrees) {\n\treturn degrees * Math.PI/180;\n}", "function radians(degrees) {\n return map(degrees, function (degrees) {\n return degrees / 180 * Math.PI;\n });\n}", "function radians(degrees) {\n return map(degrees, function (degrees) {\n return degrees / 180 * Math.PI;\n });\n}", "function degToRad(degrees) {\n\treturn degrees * Math.PI / 180;\n}", "function toRadian(deg) { return deg * 2 * Math.PI / 360; }", "function toRad(Value) \n {\n return Value * Math.PI / 180;\n }", "function degrees_to_radians(degrees)\n{\n\tvar pi = Math.PI;\n\treturn degrees * (pi/180);\n}", "function toRadians(degrees){\n return degrees * Math.PI / 180; \n}", "function toRad(Value) \n {\n return Value * Math.PI / 180;\n }", "function convertToRadians(val) {\n return convertToDegrees(val) * Math.PI / 180;\n }", "function toRadian(degree) {\n return degree * Math.PI / 180;\n}", "function rad(x) {return x*Math.PI/180;}", "toRadian(deg) \r\n\t{\r\n\t\treturn (22 * deg)/(7*180)\r\n\t}", "function degreeToRad(deg){\n\t\treturn(deg * Math.PI / 180);\n}", "function toRad(Value) \n {\n return Value * Math.PI / 180;\n }", "function toRad(Value) \n {\n return Value * Math.PI / 180;\n }", "function toRad(Value) \n {\n return Value * Math.PI / 180;\n }", "function toRad(Value) {\n\treturn (Value * Math.PI) / 180;\n}", "function degToRad(angle)\r\n{\r\n\treturn angle*(Math.PI)/180;\r\n}", "function toRad(Value)\n {\n return Value * Math.PI / 180;\n }", "static radToDeg(radians) {\n return radians * 57.295779513;\n }", "toRad(Value) {\n return Value * Math.PI / 180;\n }", "function deg2rad(Value) {\n return (Value * Math.PI) / 180;\n }", "function radians(degrees)\n{\n var pi = Math.PI;\n return degrees * (pi/180);\n}", "function radians(degrees)\n{\n var pi = Math.PI;\n return degrees * (pi/180);\n}", "function convertRad(input) {\n\treturn (Math.PI * input) / 180;\n}", "function toRadians (angle) { return angle * (Math.PI / 180);}", "function toRad(deg)\n{\n return deg * Math.PI / 180;\n}", "function deg2rad(degrees) {\n return degrees * Math.PI / 180;\n}", "function rad2deg(radians) {\n return radians * 180 / Math.PI;\n}", "function toRad(Value)\n {\n return Value * Math.PI / 180;\n }", "function to_radians(angle_in_degrees) {\n\treturn angle_in_degrees * Math.PI / 180;\n}", "function _toRad(deg)\n{\n return deg * Math.PI / 180;\n}", "function radians(degrees) {\r\n return degrees * (Math.PI / 180);\r\n }", "function rad(degrees){\n return degrees*Math.PI/180;\n}", "function deg2rad(degrees) {\n\treturn Math.PI *degrees/180;\n}", "function DegreesToRadians(degrees){\n return (Math.PI * degrees) / 180;\n}", "function degToRad(degAngle)\n{\n return degAngle * Math.PI / 180;\n}", "function toRadians(degrees) {\n return degrees / (180 / Math.PI);\n}", "function deg2Rad( deg ) {\n return deg * Math.PI / 180;\n }", "function toRad(Value)\n {\n return Value * Math.PI / 180;\n }", "degreeToRad(angle){\n return Math.PI*angle/180;\n }" ]
[ "0.79313636", "0.7857014", "0.77138245", "0.770211", "0.7645498", "0.7520108", "0.74009407", "0.7353728", "0.72807175", "0.727777", "0.7262223", "0.7211627", "0.71990407", "0.7164016", "0.71582776", "0.7142664", "0.7141968", "0.7134506", "0.7134506", "0.7134506", "0.7134506", "0.7134325", "0.7132834", "0.7132834", "0.71295106", "0.71267056", "0.71267056", "0.71267056", "0.7117204", "0.7110667", "0.70967555", "0.7088588", "0.70879215", "0.7087001", "0.70869195", "0.70839244", "0.7082614", "0.70784056", "0.707495", "0.707495", "0.707495", "0.7073605", "0.7072494", "0.70701283", "0.70686543", "0.7068617", "0.7068617", "0.7068617", "0.7068617", "0.7068617", "0.7063886", "0.7056001", "0.7056001", "0.7056001", "0.70420396", "0.70280695", "0.7025859", "0.7025859", "0.7022964", "0.7016832", "0.7015613", "0.7015613", "0.7008884", "0.70084405", "0.7001055", "0.6997077", "0.69914216", "0.69885784", "0.6977404", "0.69752944", "0.6968804", "0.6965195", "0.6962178", "0.6952302", "0.6952302", "0.6952302", "0.69464725", "0.694603", "0.6939638", "0.6934469", "0.6934216", "0.6930305", "0.6929035", "0.6929035", "0.69213974", "0.6921208", "0.69206756", "0.69193715", "0.6916785", "0.69087946", "0.69052875", "0.6905249", "0.6888142", "0.6886694", "0.6886347", "0.688361", "0.6879825", "0.68712854", "0.68594426", "0.6855685", "0.6855084" ]
0.0
-1
Returns an object containing two latLng coordinates representing the southwest and northeast corners of a box encompassing the given center latLng. The box's height is latOffset 2 and the box's length is lngOffset 2.
function calculateLatLngBounds(center, latOffset, lngOffset) { const southwest = new Map(); southwest.lat = center.lat - latOffset; southwest.lng = center.lng - lngOffset; const northeast = new Map(); northeast.lat = center.lat + latOffset; northeast.lng = center.lng + lngOffset; const latLngBounds = new Map(); latLngBounds.southwest = southwest; latLngBounds.northeast = northeast; latLngBounds.center = center; return latLngBounds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBoundingRectLocs (center, grid) {\n var jQueryDoc = $(window.document),\n jQH = jQueryDoc.height(),\n jQW = jQueryDoc.width(),\n R = jQH/jQW,\n size = (grid ||.002);\n\n center.latitude = Math.round(center.latitude/(2*size))*(2*size);\n center.longitude = Math.round(center.longitude/(2*size/R))*(2*size/R);\n\n return [\n center.latitude + size,\n center.longitude - size/R,\n center.latitude - size,\n center.longitude + size/R\n ];\n\n }", "function boundingBoxCoordinates(center, radius) {\r\n var latDegrees = radius / METERS_PER_DEGREE_LATITUDE;\r\n var latitudeNorth = Math.min(90, center.latitude + latDegrees);\r\n var latitudeSouth = Math.max(-90, center.latitude - latDegrees);\r\n var longDegsNorth = metersToLongitudeDegrees(radius, latitudeNorth);\r\n var longDegsSouth = metersToLongitudeDegrees(radius, latitudeSouth);\r\n var longDegs = Math.max(longDegsNorth, longDegsSouth);\r\n return [\r\n toGeoPoint(center.latitude, center.longitude),\r\n toGeoPoint(center.latitude, wrapLongitude(center.longitude - longDegs)),\r\n toGeoPoint(center.latitude, wrapLongitude(center.longitude + longDegs)),\r\n toGeoPoint(latitudeNorth, center.longitude),\r\n toGeoPoint(latitudeNorth, wrapLongitude(center.longitude - longDegs)),\r\n toGeoPoint(latitudeNorth, wrapLongitude(center.longitude + longDegs)),\r\n toGeoPoint(latitudeSouth, center.longitude),\r\n toGeoPoint(latitudeSouth, wrapLongitude(center.longitude - longDegs)),\r\n toGeoPoint(latitudeSouth, wrapLongitude(center.longitude + longDegs))\r\n ];\r\n}", "function lonLatBounds(bottomLeft, topRight) {\n \n return {bottomLeft: bottomLeft, \n topRight: topRight, \n espg900913: new OpenLayers.Bounds(bottomLeft.lon, bottomLeft.lat, topRight.lon, topRight.lat)\n .transform(ESPG_4326_PROJECTION, ESPG_900913_PROJECTION),\n\n lonLatString: \"bottomLeft: (\" + bottomLeft.lon + \", \" + bottomLeft.lat + \") \" \n + \"topRight: (\" + topRight.lon + \", \" + topRight.lat + \")\"\n + \" [\" + ESPG_4326_PROJECTION + \"]\"\n };\n}", "function BoundingBox() {\n var bounds = map.getBounds().getSouthWest().lng + \",\" + map.getBounds().getSouthWest().lat + \",\" + map.getBounds().getNorthEast().lng + \",\" + map.getBounds().getNorthEast().lat;\n return bounds;\n}", "function boundingBox(latitudeInDegrees, longitudeInDegrees, halfSideInKm) {\n\tvar lat = deg2rad(latitudeInDegrees);\n var lon = deg2rad(longitudeInDegrees);\n var halfSide = 1000000*halfSideInKm;\n\n // Radius of Earth at given latitude\n var radius = WGS84EarthRadius(lat);\n // Radius of the parallel at given latitude\n var pradius = radius*Math.cos(lat);\n\n var latMin = lat - halfSide/radius;\n var latMax = lat + halfSide/radius;\n var lonMin = lon - halfSide/pradius;\n var lonMax = lon + halfSide/pradius;\n\n return {\n \t'top_left': {\n \t\t'lat': rad2deg(latMin), \n \t\t'lon': rad2deg(lonMin)\n \t},\n \t'bottom_right': {\n \t\t'lat': rad2deg(latMax), \n \t\t'lon': rad2deg(lonMax)\t\n \t} \n };\n}", "function getBoundariesFor(obj) {\r\n\t\treturn {\r\n\t\t\ttop: obj.center.y - (obj.size.height / 2.5),\r\n\t\t\tbottom: obj.center.y + (obj.size.height / 2.5),\r\n\t\t\tleft: obj.center.x - (obj.size.width / 2.5),\r\n\t\t\tright: obj.center.x + (obj.size.width / 2.5)\r\n\t\t};\r\n\t}", "function calcCenter(mkrs) {\n var index, len;\n var latSum = 0;\n var lngSum = 0;\n for(index = 0, len = mkrs.length; index < len; ++index) {\n latSum += mkrs[index]['lat'];\n lngSum += mkrs[index]['lng'];\n }\n var latMid = latSum/mkrs.length;\n var lngMid = lngSum/mkrs.length;\n return {lat: latMid, lng: lngMid};\n}", "function calcCenter(mkrs) {\n var index, len;\n var latSum = 0;\n var lngSum = 0;\n for(index = 0, len = mkrs.length; index < len; ++index) {\n latSum += mkrs[index]['lat'];\n lngSum += mkrs[index]['lng'];\n }\n var latMid = latSum/mkrs.length;\n var lngMid = lngSum/mkrs.length;\n return {lat: latMid, lng: lngMid};\n}", "function compute_bound(bbox) {\n var offset = 0.01;\n var southWest = new L.LatLng(bbox[0][0] - offset, bbox[0][1] - offset);\n var northEast = new L.LatLng(bbox[2][0] + offset, bbox[2][1] + offset);\n return new L.LatLngBounds(southWest, northEast);\n}", "function boxDist(lng, lat, cosLat, node) {\n var minLng = node.minLng;\n var maxLng = node.maxLng;\n var minLat = node.minLat;\n var maxLat = node.maxLat;\n\n // query point is between minimum and maximum longitudes\n if (lng >= minLng && lng <= maxLng) {\n if (lat < minLat) return haverSin((lat - minLat) * rad);\n if (lat > maxLat) return haverSin((lat - maxLat) * rad);\n return 0;\n }\n\n // query point is west or east of the bounding box;\n // calculate the extremum for great circle distance from query point to the closest longitude;\n var haverSinDLng = Math.min(haverSin((lng - minLng) * rad), haverSin((lng - maxLng) * rad));\n var extremumLat = vertexLat(lat, haverSinDLng);\n\n // if extremum is inside the box, return the distance to it\n if (extremumLat > minLat && extremumLat < maxLat) {\n return haverSinDistPartial(haverSinDLng, cosLat, lat, extremumLat);\n }\n // otherwise return the distan e to one of the bbox corners (whichever is closest)\n return Math.min(\n haverSinDistPartial(haverSinDLng, cosLat, lat, minLat),\n haverSinDistPartial(haverSinDLng, cosLat, lat, maxLat)\n );\n}", "getMapInnerBounds() {\n const mb = this.getMap().getDiv().getBoundingClientRect();\n const mib = {\n top: mb.top + this._opts.edgeOffset.top,\n right: mb.right - this._opts.edgeOffset.right,\n bottom: mb.bottom - this._opts.edgeOffset.bottom,\n left: mb.left + this._opts.edgeOffset.left\n };\n mib.width = mib.right - mib.left;\n mib.height = mib.bottom - mib.top;\n return mib;\n }", "function getViewFromBoundingBox(bbox, reflectLatitude) {\n\tif (_.isArray(bbox)) {\n\t\tbbox = {\n\t\t\tminLat: bbox[1],\n\t\t\tminLon: bbox[0],\n\t\t\tmaxLat: bbox[3],\n\t\t\tmaxLon: bbox[2]\n\t\t}\n\t}\n\n\tconst center = {\n\t\tlat: (bbox.maxLat + bbox.minLat)/2,\n\t\tlon: (bbox.maxLon + bbox.minLon)/2\n\t};\n\n\tconst boxRange = getBoxRangeFromBoundingBox(bbox, reflectLatitude ? center.lat : null);\n\n\treturn {\n\t\tcenter,\n\t\tboxRange\n\t}\n}", "function computeBounds(latlng,rad) {\n\tvar radlatlng = { lat : latlng.lat * Math.PI / 180, lng : latlng.lng * Math.PI / 180 };\n\t\n\tvar rsw = getCoordAtRad(radlatlng,rad,Math.PI * 1.5);\n\t//console.log(sw);\n\trsw = getCoordAtRad(rsw,rad,Math.PI);\n\tvar rne = getCoordAtRad(radlatlng,rad,Math.PI * 0.5);\n\t//console.log(ne);\n\trne = getCoordAtRad(rne,rad,0);\n\t\n\t//all inputs must be radians (except radius which is converted in-function)\n\tfunction getCoordAtRad(coord,radius,angle) {\n\t\tvar nlat, nlng;\n\t\tvar radDist = radius * angle;//arc length\n\t\tnlat = Math.asin(Math.sin(coord.lat) * Math.cos(radDist) \n\t\t\t\t + Math.cos(coord.lat) * Math.sin(radDist) * Math.cos(angle));\n\t\tnlng = (Math.cos(nlat) == 0) ? coord.lng : \n\t\tmod(coord.lng + Math.PI - Math.asin(Math.sin(angle) \n\t\t* Math.sin(radDist) / Math.cos(nlat)), 2 * Math.PI) - Math.PI;\n\t\treturn { lat : nlat, lng : nlng };\n\t}\n\t\n\tfunction mod(x,y) {\n\t\treturn x - y * Math.floor(x / y);\n\t}\n\t\n\tvar sw = { lat : rsw.lat * 180 / Math.PI, lng : rsw.lng * 180 / Math.PI };\n\tvar ne = { lat : rne.lat * 180 / Math.PI, lng : rne.lng * 180 / Math.PI };\n\t\n\treturn { sw : sw, ne : ne };\n}", "function squareAroundPoint(nearLat, nearLong, edge) {\n // Ideally, we should do a geospatial query for a circle around the target point. We approximate this\n // by a square.\n var dist = edge / 2 * 1609.34; // convert miles to meters\n var point = new google.maps.LatLng(nearLat, nearLong);\n var eastPoint = google.maps.geometry.spherical.computeOffset(point, dist, 90.0);\n var westPoint = google.maps.geometry.spherical.computeOffset(point, dist, 270.0);\n var northPoint = google.maps.geometry.spherical.computeOffset(point, dist, 0.0);\n var southPoint = google.maps.geometry.spherical.computeOffset(point, dist, 180.0);\n console.log([nearLat, nearLong, edge]);\n return [southPoint.lat(), westPoint.lng(), northPoint.lat(), eastPoint.lng()];\n }", "function getBoundingBox () {\n let boundingBox = map.getBounds()\n xmin = parseFloat(boundingBox._sw.lng)\n ymin = parseFloat(boundingBox._sw.lat)\n xmax = parseFloat(boundingBox._ne.lng)\n ymax = parseFloat(boundingBox._ne.lat)\n\n //console.log(`${xmin}, ${ymin}, ${xmax}, ${ymax}`)\n}", "function boxDist(lng, lat, cosLat, node) {\n var minLng = node.minLng;\n var maxLng = node.maxLng;\n var minLat = node.minLat;\n var maxLat = node.maxLat;\n\n // query point is between minimum and maximum longitudes\n if (lng >= minLng && lng <= maxLng) {\n if (lat < minLat) return haverSin((lat - minLat) * rad);\n if (lat > maxLat) return haverSin((lat - maxLat) * rad);\n return 0;\n }\n\n // query point is west or east of the bounding box;\n // calculate the extremum for great circle distance from query point to the closest longitude;\n var haverSinDLng = Math.min(haverSin((lng - minLng) * rad), haverSin((lng - maxLng) * rad));\n var extremumLat = vertexLat(lat, haverSinDLng);\n\n // if extremum is inside the box, return the distance to it\n if (extremumLat > minLat && extremumLat < maxLat) {\n return haverSinDistPartial(haverSinDLng, cosLat, lat, extremumLat);\n }\n // otherwise return the distan e to one of the bbox corners (whichever is closest)\n return Math.min(\n haverSinDistPartial(haverSinDLng, cosLat, lat, minLat),\n haverSinDistPartial(haverSinDLng, cosLat, lat, maxLat)\n );\n }", "function makeRangeBox(lon, lat) {\n var clipPad = constants.clipPad;\n var lon0 = lon[0] + clipPad;\n var lon1 = lon[1] - clipPad;\n var lat0 = lat[0] + clipPad;\n var lat1 = lat[1] - clipPad;\n\n // to cross antimeridian w/o ambiguity\n if(lon0 > 0 && lon1 < 0) lon1 += 360;\n\n var dlon4 = (lon1 - lon0) / 4;\n\n return {\n type: 'Polygon',\n coordinates: [[\n [lon0, lat0],\n [lon0, lat1],\n [lon0 + dlon4, lat1],\n [lon0 + 2 * dlon4, lat1],\n [lon0 + 3 * dlon4, lat1],\n [lon1, lat1],\n [lon1, lat0],\n [lon1 - dlon4, lat0],\n [lon1 - 2 * dlon4, lat0],\n [lon1 - 3 * dlon4, lat0],\n [lon0, lat0]\n ]]\n };\n}", "function getMidpoint(startLat, startLng, endLat, endLng) {\n /* degrees = radians * (180/pi)\n * radians = degrees * (pi/180)\n */\n var dLng = (endLng - startLng) * (Math.PI / 180);\n\n var lat1 = startLat * (Math.PI / 180);\n var lat2 = endLat * (Math.PI / 180);\n var lng1 = startLng * (Math.PI / 180);\n\n var bx = Math.cos(lat2) * Math.cos(dLng);\n var by = Math.cos(lat2) * Math.sin(dLng);\n \n var lat3 = \n Math.atan2(Math.sin(lat1) + Math.sin(lat2), Math.sqrt((Math.cos(lat1) + bx) * (Math.cos(lat1) + bx) + by * by));\n var lng3 = lng1 + Math.atan2(by, Math.cos(lat1) + bx);\n\n return [lat3 * (180 / Math.PI), lng3 * (180 / Math.PI)];\n}", "function getMinBox() {\n //get coordinates \n var coorX = coords.map(function(p) {\n return p.x\n });\n var coorY = coords.map(function(p) {\n return p.y\n });\n\n //find top left and bottom right corners \n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n }\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n }\n\n //return as strucut \n return {\n min: min_coords,\n max: max_coords\n }\n}", "function getMinBox() {\n //get coordinates \n var coorX = coords.map(function(p) {\n return p.x\n });\n var coorY = coords.map(function(p) {\n return p.y\n });\n\n //find top left and bottom right corners \n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n }\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n }\n\n //return as strucut \n return {\n min: min_coords,\n max: max_coords\n }\n}", "function getCenter (coord1, coord2) {\n if (!coord2) {\n return coord1\n }\n const lat = (coord1.lat + coord2.lat) / 2\n let lng = (coord1.lng + coord2.lng) / 2\n if ((coord1.lng > 90 && coord2.lng < -90) || (coord2.lng > 90 && coord1.lng < -90)) {\n lng = (coord1.lng + coord2.lng + 360) / 2\n if (lng > 180) {\n lng -= 360\n }\n }\n return {lat, lng}\n}", "getMapInnerBounds() {\n const mb = this.getMap()\n .getDiv()\n .getBoundingClientRect();\n\n let mib = {\n top: mb.top,\n right: mb.right,\n bottom: mb.bottom,\n left: mb.left\n };\n\n mib.width = mib.right - mib.left;\n mib.height = mib.bottom - mib.top;\n return mib;\n }", "findCenter() {\n return {\n x: (this.right - this.left)/2 + this.left,\n y: (this.bottom - this.top)/2 + this.top\n };\n }", "getWorldBounds() {\n const left = this.screenToWorldCoordinates(Vector.Zero).x;\n const top = this.screenToWorldCoordinates(Vector.Zero).y;\n const right = left + this.drawWidth;\n const bottom = top + this.drawHeight;\n return new BoundingBox(left, top, right, bottom);\n }", "function fitBounds(width, height, _bounds, options) {\n var bounds = new _mapboxGl.LngLatBounds([_bounds[0].reverse(), _bounds[1].reverse()]);\n options = options || {};\n var padding = typeof options.padding === 'undefined' ? 0 : options.padding;\n var offset = _mapboxGl.Point.convert([0, 0]);\n var tr = new _transform2.default();\n tr.width = width;\n tr.height = height;\n var nw = tr.project(bounds.getNorthWest());\n var se = tr.project(bounds.getSouthEast());\n var size = se.sub(nw);\n var scaleX = (tr.width - padding * 2 - Math.abs(offset.x) * 2) / size.x;\n var scaleY = (tr.height - padding * 2 - Math.abs(offset.y) * 2) / size.y;\n\n var center = tr.unproject(nw.add(se).div(2));\n var zoom = tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY));\n return {\n latitude: center.lat,\n longitude: center.lng,\n zoom: zoom\n };\n}", "function getViewBoxQuery (WRAPPER, ol) {\n const mapExtent = WRAPPER.map.getView().calculateExtent();\n mapExtent[0] -= VIEWBOX_PADDING_M;\n mapExtent[1] -= VIEWBOX_PADDING_M;\n mapExtent[2] += VIEWBOX_PADDING_M;\n mapExtent[3] += VIEWBOX_PADDING_M;\n\n const mapTopLeft = ol.proj.transform([mapExtent[0], mapExtent[1]], 'EPSG:3857', 'EPSG:4326');\n const mapBottomRight = ol.proj.transform([mapExtent[2], mapExtent[3]], 'EPSG:3857', 'EPSG:4326');\n return mapTopLeft.concat(mapBottomRight).join(',');\n}", "function squarifyBox(box) {\n var centers = getBoxCenter(box);\n var size = getBoxSize(box);\n var maxEdge = Math.max.apply(Math, size);\n var halfSize = maxEdge / 2;\n var startPoint = [centers[0] - halfSize, centers[1] - halfSize];\n var endPoint = [centers[0] + halfSize, centers[1] + halfSize];\n return { startPoint: startPoint, endPoint: endPoint, landmarks: box.landmarks };\n}", "function get_bounds(){\n\t\t\t\t\n\t\t\t\treturn {\n\t\t\t\t\t\n\t\t\t\t\tsw_lat : map.getBounds().getSouthWest().lat(),\n\t\t\t\t\t\n\t\t\t\t\tsw_lng : map.getBounds().getSouthWest().lng(),\n\t\t\t\t\t\n\t\t\t\t\tne_lat : map.getBounds().getNorthEast().lat(),\n\t\t\t\t\t\n\t\t\t\t\tne_lng : map.getBounds().getNorthEast().lng()\n\t\t\t\t\n\t\t\t\t};\n\t\t\t\n\t\t\t}", "function getCenter(a, b) {\n return {\n x: (b.x + a.x) / 2,\n y: (b.y + a.y) / 2\n };\n}", "function getMapCenter() {\n \n var mapCenterCoords = [30, 0];\n\n return mapCenterCoords;\n \n}", "function projectWithScale(scale, xyCorners) {\n var topLeft = xyCorners[0];\n var bottomRight = xyCorners[3];\n var bottomLeft = xyCorners[2];\n\n var hVect = {\n x: (bottomRight.x - bottomLeft.x) * scale.width,\n y: (bottomRight.y - bottomLeft.y) * scale.width\n };\n\n var vVect = {\n x: (topLeft.x - bottomLeft.x) * scale.height,\n y: (topLeft.y - bottomLeft.y) * scale.height\n };\n\n var x = bottomLeft.x + hVect.x + vVect.x;\n var y = bottomLeft.y + hVect.y + vVect.y;\n var lngLat = merc.inverse([x, y]);\n\n return {lng: lngLat[0], lat: lngLat[1]};\n}", "function getBoundParams(){\n var bounds = map.getBounds(),\n padding = .00;\n console.log(bounds);\n return { neLat: (bounds._northEast.lat + padding).toFixed(6),\n neLon: (bounds._northEast.lng + padding).toFixed(6),\n swLat: (bounds._southWest.lat - padding).toFixed(6),\n swLon: (bounds._southWest.lng - padding).toFixed(6)\n }\n }", "function getCentreOfBox(xml) {\n\tvar lat = ((xml.getAttribute('min_lat') * 1) + (xml.getAttribute('max_lat') * 1))/2;\n\tvar lon = ((xml.getAttribute('min_lon') * 1) + (xml.getAttribute('max_lon') * 1))/2;\n\treturn [lat, lon];\n}", "function getIntersectionBBOX()\n{\n var mapBounds = map.getExtent();\n var mapBboxEls = mapBounds.toBBOX().split(',');\n // bbox is the bounding box of the currently-visible layer\n var layerBboxEls = bbox.split(',');\n var newBBOX = Math.max(parseFloat(mapBboxEls[0]), parseFloat(layerBboxEls[0])) + ',';\n newBBOX += Math.max(parseFloat(mapBboxEls[1]), parseFloat(layerBboxEls[1])) + ',';\n newBBOX += Math.min(parseFloat(mapBboxEls[2]), parseFloat(layerBboxEls[2])) + ',';\n newBBOX += Math.min(parseFloat(mapBboxEls[3]), parseFloat(layerBboxEls[3]));\n return newBBOX;\n}", "bbox() {\n var maxX = -Infinity;\n var maxY = -Infinity;\n var minX = Infinity;\n var minY = Infinity;\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX);\n maxY = Math.max(el[1], maxY);\n minX = Math.min(el[0], minX);\n minY = Math.min(el[1], minY);\n });\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n }", "async boundingBox() {\n const result = await this._getBoxModel();\n if (!result)\n return null;\n const quad = result.model.border;\n const x = Math.min(quad[0], quad[2], quad[4], quad[6]);\n const y = Math.min(quad[1], quad[3], quad[5], quad[7]);\n const width = Math.max(quad[0], quad[2], quad[4], quad[6]) - x;\n const height = Math.max(quad[1], quad[3], quad[5], quad[7]) - y;\n return { x, y, width, height };\n }", "async boundingBox() {\n const result = await this._getBoxModel();\n if (!result)\n return null;\n const quad = result.model.border;\n const x = Math.min(quad[0], quad[2], quad[4], quad[6]);\n const y = Math.min(quad[1], quad[3], quad[5], quad[7]);\n const width = Math.max(quad[0], quad[2], quad[4], quad[6]) - x;\n const height = Math.max(quad[1], quad[3], quad[5], quad[7]) - y;\n return { x, y, width, height };\n }", "async boundingBox() {\n const result = await this._getBoxModel();\n if (!result)\n return null;\n const quad = result.model.border;\n const x = Math.min(quad[0], quad[2], quad[4], quad[6]);\n const y = Math.min(quad[1], quad[3], quad[5], quad[7]);\n const width = Math.max(quad[0], quad[2], quad[4], quad[6]) - x;\n const height = Math.max(quad[1], quad[3], quad[5], quad[7]) - y;\n return { x, y, width, height };\n }", "function getCenterXY() {\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar $this = sets.element;\r\n\t\tvar centerx = ($this.innerWidth()/2)-parseInt($('#inner').css('left'));\r\n\t\tvar centery = ($this.innerHeight()/2)-parseInt($('#inner').css('top'));\r\n\t\treturn new Point(centerx,centery);\r\n\t}", "defineMapBounds() {\n \n const coordinates = this.state.options.map(i => i.coordinates);\n\n let maxX = 0,\n minX = 0,\n maxY = 0,\n minY = 0;\n\n coordinates.forEach(coord => {\n if (coord[0] > maxY) {\n maxY = coord[0];\n }\n \n if (coord[0] < minY) {\n minY = coord[0];\n }\n\n if (coord[1] > maxX) {\n maxX = coord[1];\n }\n \n if (coord[1] < minX) {\n minX = coord[1];\n }\n })\n\n // Bounds are defined by two coordinates:\n // position1: the most W and N\n // position2: the most E and S\n this.setState({\n bounds: [[maxY, minX], [minY, maxX]],\n center: [(maxY - minY) / 2, (maxX - minX) / 2]\n })\n }", "function getCentroid(minLng, maxLng, minLat, maxLat) {\n var avLng = (minLng + maxLng) / 2;\n var avLat = (minLat + maxLat) / 2;\n return new LatLon(avLat, avLng);\n }", "static setZoomBounds(allBounds) {\n let bounds = allBounds;\n const boundParams = {\n top: bounds.getTop(),\n left: bounds.getLeft(),\n bottom: bounds.getBottom(),\n right: bounds.getRight()\n };\n if ((Math.abs(Math.abs(boundParams.top) - Math.abs(boundParams.bottom) <= 0.0001))) {\n smallFactor = 0.01;\n }\n boundParams.top += ((Math.abs(Math.abs(boundParams.top) - Math.abs(boundParams.bottom))\n + smallFactor) * offsetFactor);\n boundParams.left -= ((Math.abs(Math.abs(boundParams.left) - Math.abs(boundParams.right))\n + smallFactor) * offsetFactor);\n // not needed since bottom pin fits\n // boundParams.bottom -= (Math.abs(Math.abs(boundParams.top) - Math.abs(boundParams.bottom))\n // * offsetFactor);\n boundParams.right += ((Math.abs(Math.abs(boundParams.left) - Math.abs(boundParams.right))\n + smallFactor) * offsetFactor);\n this.boundingBoxDistance = Math.sqrt((((boundParams.top - boundParams.bottom) ** 2))\n + (((boundParams.left - boundParams.right) ** 2)));\n bounds = new H.geo.Rect(boundParams.top, boundParams.left, boundParams.bottom,\n boundParams.right);\n\n return bounds;\n }", "function box_get_centroid(dst, dst_off, src, src_off) {\n\t dst[dst_off] = 0.5 * (src[src_off] + src[src_off + 3]);\n\t dst[dst_off + 1] = 0.5 * (src[src_off + 1] + src[src_off + 4]);\n\t dst[dst_off + 2] = 0.5 * (src[src_off + 2] + src[src_off + 5]);\n\t }", "function getRectCenter(rect){return{left:(rect.left+rect.right)/2,top:(rect.top+rect.bottom)/2};}", "function boundingSphereFromBoundingBox() {\n var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0];\n var positions = arguments[1];\n var boundingBox = arguments[2];\n\n if (positions.length === 0) {\n return null;\n }\n\n if (!center) {\n // min & max are the box's min & max\n var result = _glVec.vec3.create();\n center = _glVec.vec3.scale(result, _glVec.vec3.add(result, boundingBox[0], boundingBox[1]), 0.5);\n }\n\n var maxRadiusSq = 0;\n for (var i = 0, il = positions.length; i < il; i++) {\n maxRadiusSq = Math.max(maxRadiusSq, (0, _glVec.squaredDistance)(center, positions[i]));\n }\n return Math.sqrt(maxRadiusSq);\n}", "function getBox(o) {\n return {\n xMin: o.position.x,\n xMax: o.position.x + o.width,\n yMin: o.position.y,\n yMax: o.position.y + o.height\n };\n }", "function getBounds(x, y, z) {\n\t\ty = Math.pow(2, z) - y - 1; // Translate Y value\n\t\t\n\t\tvar resolution = (CIRCUMFERENCE / TILE_SIZE) / Math.pow(2, z); // meters per pixel\n\t\t\n\t\tvar swPoint = getMercatorCoord(x, y, resolution);\n\t\tvar nePoint = getMercatorCoord(x + 1, y + 1, resolution);\n\t\t\n\t\tvar bounds = {\n\t\t\t\tswX : swPoint.x,\n\t\t\t\tswY : swPoint.y,\n\t\t\t\tneX : nePoint.x,\n\t\t\t\tneY : nePoint.y\n\t\t};\n\t\t\n\t\treturn bounds;\n\t}", "function getBox(o) {\n return {\n xMin: o.position.x,\n xMax: o.position.x + o.width,\n yMin: o.position.y,\n yMax: o.position.y + o.height\n };\n }", "function getExtendedBounds(bnds){\n // get the coordinates for the sake of readability\n var swlat = bnds._southWest.lat;\n var swlng = bnds._southWest.lng;\n var nelat = bnds._northEast.lat;\n var nelng = bnds._northEast.lng;\n\n // Increase size of bounding box in each direction by 50%\n swlat = swlat - Math.abs(0.5*(swlat - nelat)) > -90 ? swlat - Math.abs(0.5*(swlat - nelat)) : -90;\n swlng = swlng - Math.abs(0.5*(swlng - nelng)) > -180 ? swlng - Math.abs(0.5*(swlng - nelng)) : -180;\n nelat = nelat + Math.abs(0.5*(swlat - nelat)) < 90 ? nelat + Math.abs(0.5*(swlat - nelat)) : 90;\n nelng = nelng + Math.abs(0.5*(swlng - nelng)) < 180 ? nelng + Math.abs(0.5*(swlng - nelng)) : 180;\n\n return L.latLngBounds(L.latLng(swlat, swlng), L.latLng(nelat, nelng));\n }", "function boundingBoxToEyeCorners(right_bb, left_bb, h, w){\n const leftY = (left_bb[2] + left_bb[3])/2/h\n const rightY = (right_bb[2] + right_bb[3])/2/h\n\n return [[[left_bb[1]/w, leftY], [left_bb[0]/w, leftY]],\n [[right_bb[0]/w, rightY], [right_bb[1]/w, rightY]]]\n}", "bbox() {\n let maxX = -Infinity\n let maxY = -Infinity\n let minX = Infinity\n let minY = Infinity\n this.forEach(function (el) {\n maxX = Math.max(el[0], maxX)\n maxY = Math.max(el[1], maxY)\n minX = Math.min(el[0], minX)\n minY = Math.min(el[1], minY)\n })\n return new Box(minX, minY, maxX - minX, maxY - minY)\n }", "function getDivCenter(obj) {\n var pos = new esri.geometry.Point();\n pos.spatialReference = map.spatialReference;\n // divHeight = obj.style.height;\n // divWidth = obj.style.width;\n // pos.y = parseInt(divHeight.substr(0, divHeight.length)) / 2;\n // pos.x = parseInt(divWidth.substr(0, divWidth.length)) / 2;\n pos.y = obj.offsetHeight / 2;\n pos.x = obj.offsetWidth / 2;\n return pos;\n}", "function getBounds (points) {\n\n var north = Infinity, south = 0, east = 0, west = Infinity;\n\n points.forEach(function(point){\n if (point.x < west) west = point.x;\n if (point.x > east) east = point.x;\n if (point.y < north) north = point.y;\n if (point.y > south) south = point.y;\n });\n\n return {north: north, south: south, east: east, west: west};\n}", "function getCenterCoordinates() {\n return {\n x: getXAverage(),\n y: getYAverage()\n }\n }", "function boundingBox( jqNode, jqGraph, box ) {\n var v = jqNode.offset();\n var graphOffset = jqGraph.offset();\n var top = v.top - graphOffset.top;\n var left = v.left - graphOffset.left;\n box = box || {};\n box.top = top;\n box.left = left;\n box.right = left + jqNode.width();\n box.bottom = top + jqNode.height();\n return box;\n }", "function findBoundaries() {\n\tgoogle.maps.event.addListener(map, 'bounds_changed', function() {\n\t \tconst bounds = map.getBounds();\n\t \tconst NE = bounds.getNorthEast();\n\t\tconst SW = bounds.getSouthWest();\n\t\tconst coordinates = [`${SW}`, `${NE}`];\n\t\tconst fixed = coordinates.map(e => e.replace(/[{()}]/g, '')).map(e => e.split(', ')).flat();\n\t\tconst parsed = fixed.map(e => parseFloat(e));\n\t\t[parsed[0], parsed[1]] = [parsed[1], parsed[0]];\n\t\t[parsed[2], parsed[3]] = [parsed[3], parsed[2]];\n\t\tconst formattedBounds = parsed.join();\n\t\tgetWheelMapNodes(formattedBounds);\n\t});\n}", "function isInBox(lat, lng, box) {\n var neLat = Number(box.neLat);\n var swLat = Number(box.swLat);\n var neLng = Number(box.neLng);\n var swLng = Number(box.swLng);\n if($('#expanded').is(\":checked\")) {\n swLat -= expansionCoef;\n swLng -= expansionCoef;\n neLat += expansionCoef;\n neLng += expansionCoef;\n }\n return (lat <= neLat && lat >= swLat && lng <= neLng && lng >= swLng);\n }", "function makeRangeBox(lon0, lat0, lon1, lat1) {\n\t var dlon4 = (lon1 - lon0) / 4;\n\t\n\t // TODO is this enough to handle ALL cases?\n\t // -- this makes scaling less precise than using d3.geo.graticule\n\t // as great circles can overshoot the boundary\n\t // (that's not a big deal I think)\n\t return {\n\t type: 'Polygon',\n\t coordinates: [\n\t [ [lon0, lat0],\n\t [lon0, lat1],\n\t [lon0 + dlon4, lat1],\n\t [lon0 + 2 * dlon4, lat1],\n\t [lon0 + 3 * dlon4, lat1],\n\t [lon1, lat1],\n\t [lon1, lat0],\n\t [lon1 - dlon4, lat0],\n\t [lon1 - 2 * dlon4, lat0],\n\t [lon1 - 3 * dlon4, lat0],\n\t [lon0, lat0] ]\n\t ]\n\t };\n\t}", "function makeRangeBox(lon0, lat0, lon1, lat1) {\n\t var dlon4 = (lon1 - lon0) / 4;\n\t\n\t // TODO is this enough to handle ALL cases?\n\t // -- this makes scaling less precise than using d3.geo.graticule\n\t // as great circles can overshoot the boundary\n\t // (that's not a big deal I think)\n\t return {\n\t type: 'Polygon',\n\t coordinates: [\n\t [ [lon0, lat0],\n\t [lon0, lat1],\n\t [lon0 + dlon4, lat1],\n\t [lon0 + 2 * dlon4, lat1],\n\t [lon0 + 3 * dlon4, lat1],\n\t [lon1, lat1],\n\t [lon1, lat0],\n\t [lon1 - dlon4, lat0],\n\t [lon1 - 2 * dlon4, lat0],\n\t [lon1 - 3 * dlon4, lat0],\n\t [lon0, lat0] ]\n\t ]\n\t };\n\t}", "function et2_bounds(_top, _bottom)\n{\n\treturn {\n\t\t\"top\": _top,\n\t\t\"bottom\": _bottom\n\t};\n}", "getPositionFromCenter(e) {\n const { boxCenterPoint } = this.state;\n const fromBoxCenter = {\n x: e.clientX - boxCenterPoint.x,\n y: -(e.clientY - boxCenterPoint.y)\n };\n return fromBoxCenter;\n }", "function calculateCenter() {\n center = map.getCenter();\n}", "function boxZoom(box, centroid, paddingPerc) {\n let minXY = box[0];\n let maxXY = box[1];\n // find size of map area defined\n let zoomWidth = Math.abs(minXY[0] - maxXY[0]);\n let zoomHeight = Math.abs(minXY[1] - maxXY[1]);\n // find midpoint of map area defined\n let zoomMidX = centroid[0];\n let zoomMidY = centroid[1];\n // increase map area to include padding\n zoomWidth = zoomWidth * (1 + paddingPerc / 100);\n zoomHeight = zoomHeight * (1 + paddingPerc / 100);\n // find scale required for area to fill svg\n let maxXscale = $(\"svg\").width() / zoomWidth;\n let maxYscale = $(\"svg\").height() / zoomHeight;\n let zoomScale = Math.min(maxXscale, maxYscale);\n // handle some edge cases\n // limit to max zoom (handles tiny countries)\n zoomScale = Math.min(zoomScale, maxZoom);\n // limit to min zoom (handles large countries and countries that span the date line)\n zoomScale = Math.max(zoomScale, minZoom);\n // Find screen pixel equivalent once scaled\n let offsetX = zoomScale * zoomMidX;\n let offsetY = zoomScale * zoomMidY;\n // Find offset to centre, making sure no gap at left or top of holder\n let dleft = Math.min(0, $(\"svg\").width() / 2 - offsetX);\n let dtop = Math.min(0, $(\"svg\").height() / 2 - offsetY);\n // Make sure no gap at bottom or right of holder\n dleft = Math.max($(\"svg\").width() - w * zoomScale, dleft);\n dtop = Math.max($(\"svg\").height() - h * zoomScale, dtop);\n // set zoom\n svg\n .transition()\n .duration(500)\n .call(\n zoom.transform,\n d3.zoomIdentity.translate(dleft, dtop).scale(zoomScale)\n );\n }", "function mkBox(pts = [], dis = 20){\n\tlet boxes = [];\n\tif (pts && pts.length && pts.length >= 2){\n\t\tconst lls = pts.map((pt)=>new LatLng(pt[0],pt[1]));\n\t\tconst bounds = RouteBoxer.box(lls, dis);\n\t\tboxes = bounds.map((box)=>{\n\t\t //console.log(box)\n\t\t const {_southWest,_northEast} = box;\n\t\t return [[_southWest.lat,_southWest.lng],[_northEast.lat,_northEast.lng]]\n\t\t});\n\t}\n\treturn boxes\n}", "putCenter(b, xOffset = 0, yOffset = 0) { \n let a = this\n b.x = (a.x + a.halfWidth - b.halfWidth) + xOffset \n b.y = (a.y + a.halfHeight - b.halfHeight) + yOffset \n }", "function calcMidpoint(x1, y1, x2, y2) {\n return {\n x: (x1 + x2)/2,\n y: (y1 + y2)/2\n };\n}", "function getCenter(boundingRect) {\n return {\n 'x': boundingRect.x + ((boundingRect.right - boundingRect.left) / 2),\n 'y': boundingRect.y + ((boundingRect.bottom - boundingRect.top) / 2),\n };\n}", "_getCenterCoordinates() {\n const that = this,\n offset = that.$.container.getBoundingClientRect(),\n radius = that._measurements.radius,\n scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft,\n scrollTop = document.body.scrollTop || document.documentElement.scrollTop;\n return { x: offset.left + scrollLeft + radius, y: offset.top + scrollTop + radius };\n }", "function mercatorBounds(projection, maxlat) {\n var yaw = projection.rotate()[0],\n xymax = projection([-yaw+180-1e-6,-maxlat]),\n xymin = projection([-yaw-180+1e-6, maxlat]);\n return [xymin,xymax];\n }", "function calculateCenter() {\r\n center = map.getCenter();\r\n}", "function coords(box, { w, h }) {\n const [b1, b2, b3, b4] = box\n const round6 = (n) => (Math.round(n * 1000000) / 1000000).toFixed(6)\n const x = round6((b1 + b3) / 2 / w)\n const y = round6((b2 + b4) / 2 / h)\n const width = round6(Math.abs(b1 - b3) / w)\n const height = round6(Math.abs(b2 - b4) / h)\n\n return `${x} ${y} ${width} ${height}`\n}", "function getBounds (markers) {\n\n // [longitude, latitude]\n var max = [-Number.MAX_VALUE, -Number.MAX_VALUE]\n var min = [Number.MAX_VALUE, Number.MAX_VALUE];\n\n for (var i = 0; i < markers.length; i++) {\n max[0] = Math.max(max[0], markers[i].latitude);\n max[1] = Math.max(max[1], markers[i].longitude);\n min[0] = Math.min(min[0], markers[i].latitude);\n min[1] = Math.min(min[1], markers[i].longitude);\n }\n\n return {\n max: max,\n min: min\n };\n}", "function makeOffsetRect() {\n return { top: NaN, left: NaN, width: NaN, height: NaN };\n}", "function getMapBounds(){\n\tvar bounds = myMap.getBounds();\n\tvar nWlat = bounds.getNorthWest().lat;\n\tvar nWlon = bounds.getNorthWest().lng;\n\tvar sElat = bounds.getSouthEast().lat;\n\tvar sElon = bounds.getSouthEast().lng;\n\tvar boundArray = [nWlat,nWlon, sElat, sElon];\n\treturn boundArray\n}", "convertCoords(regionId, x, y) {\n let xcoord = mapArray[regionId - 3].center[1] - (w / 2) + (w * x);\n let ycoord = mapArray[regionId - 3].center[0] + (k / 2) - (k * y);\n return { xcoord, ycoord };\n }", "function pointRadiusToBoundingBox(centrePointLonLat, radiusInKm, planetRadiusKm) {\n\n // ref: http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates\n // ref: http://stackoverflow.com/questions/1689096\n var planetRadius = planetRadiusKm;\n\n if (!planetRadius) {\n planetRadius = EARTH_RADIUS_KM;\n }\n\n var lon = centrePointLonLat[0];\n var lat = centrePointLonLat[1];\n\n var lon1 = lon - toDegrees(radiusInKm / planetRadius / Math.cos(toRadians(lat)));\n var lon2 = lon + toDegrees(radiusInKm / planetRadius / Math.cos(toRadians(lat)));\n var lat1 = lat + toDegrees(radiusInKm / planetRadius);\n var lat2 = lat - toDegrees(radiusInKm / planetRadius);\n\n return [lon1, lat1, lon2, lat2];\n}", "function BoundingBox() {\n this.x1 = Number.NaN;\n this.y1 = Number.NaN;\n this.x2 = Number.NaN;\n this.y2 = Number.NaN;\n}", "function BoundingBox() {\n this.x1 = Number.NaN;\n this.y1 = Number.NaN;\n this.x2 = Number.NaN;\n this.y2 = Number.NaN;\n}", "function intersectRectCenter(x1,y1,w1,h1,x2,y2,w2,h2) {\n\treturn {\"x\" : .5*((w1 + w2) - Math.abs(x1 - x2) * 2),\n \"y\" : .5*((h1 + h2) - Math.abs(y1 - y2) * 2)};\n}", "get center () {\n return [this.lng, this.lat];\n }", "function lat_lng_inter_point(lat1, lng1, lat2, lng2, offset) {\r\n\r\n lat1 = lat1 * PI180;\r\n lng1 = lng1 * PI180;\r\n lat2 = lat2 * PI180;\r\n lng2 = lng2 * PI180;\r\n\r\n var d = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - lat2) / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin((lng1 - lng2) / 2), 2)));\r\n var A = Math.sin((1 - offset) * d) / Math.sin(d);\r\n var B = Math.sin(offset * d) / Math.sin(d);\r\n var x = A * Math.cos(lat1) * Math.cos(lng1) + B * Math.cos(lat2) * Math.cos(lng2);\r\n var y = A * Math.cos(lat1) * Math.sin(lng1) + B * Math.cos(lat2) * Math.sin(lng2);\r\n var z = A * Math.sin(lat1) + B * Math.sin(lat2);\r\n var lat = Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))) * 180 / Math.PI;\r\n var lng = Math.atan2(y, x) * 180 / Math.PI;\r\n\r\n return {\r\n lat: lat,\r\n lng: lng\r\n }\r\n}", "drawInnerSquare(min, maxX, maxY, mapPerLvl, tiles, rng){\n this.drawInnerCorner(min, min, 'NW', mapPerLvl, tiles, rng)\n this.drawInnerCorner(maxX, min, 'NE', mapPerLvl, tiles, rng)\n this.drawInnerCorner(min, maxY, 'SW', mapPerLvl, tiles, rng)\n this.drawInnerCorner(maxX, maxY, 'SE', mapPerLvl, tiles, rng)\n /*\n this.drawInnerRow(min, min, maxX, 'N', tiles, rng)\n this.drawInnerRow(maxY, min, maxX, 'S', tiles, rng)\n this.drawInnerCol(min, min, maxY, 'W', tiles, rng)\n this.drawInnerCol(maxX, min, maxY, 'E', tiles, rng)\n */\n }", "getCenter() {\n let point = L.CRS.EPSG3857.latLngToPoint(this.map.getCenter(), this.map.getZoom());\n let rMap = document.getElementById(this.id);\n if (rMap.clientWidth > rMap.clientHeight) {\n point.x -= this.map.getSize().x * 0.15;\n } else {\n //point.y += this.map.getSize().y * 0.15;\n }\n let location = L.CRS.EPSG3857.pointToLatLng(point, this.map.getZoom());\n return location;\n }", "function getBounds(coordArr) {\n\t\t\tlet leftBound;\n\t\t\tlet rightBound;\n\t\t\tlet upperBound;\n\t\t\tlet lowerBound;\n\t\t\tcoordArr.forEach((pt, i) => {\n\t\t\t\tconst { x, y } = pt;\n\t\t\t\tif (i === 0) {\n\t\t\t\t\t// Sets default values\n\t\t\t\t\tleftBound = rightBound = x;\n\t\t\t\t\tupperBound = lowerBound = y;\n\t\t\t\t} else {\n\t\t\t\t\tleftBound = Math.min(leftBound, x);\n\t\t\t\t\trightBound = Math.max(rightBound, x);\n\t\t\t\t\tupperBound = Math.min(upperBound, y);\n\t\t\t\t\tlowerBound = Math.max(lowerBound, y);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tleftBound,\n\t\t\t\trightBound,\n\t\t\t\tupperBound,\n\t\t\t\tlowerBound\n\t\t\t};\n\t\t}", "get boxProjection() {}", "_updatePosFromCenter() {\n let half = this._size.$multiply(0.5);\n this._topLeft = this._center.$subtract(half);\n this._bottomRight = this._center.$add(half);\n }", "function mapCenter(){\n\tvar latAvg = 0;\n\tvar lngAvg = 0;\n\tvar latlngCenter;\n\t\n\tfor (i = 0; i < parklist.length; i++){\n\t\tlatAvg = latAvg + parseFloat(parklist[i]['Latitude']);\n\t\tlngAvg = lngAvg + parseFloat(parklist[i]['Longitude']);\n\t}\t\n\tlatAvg = latAvg / parklist.length;\n\tlngAvg = lngAvg / parklist.length;\n\t\t\n\tlatlngCenter = [latAvg, lngAvg];\n\treturn latlngCenter;\n}", "bbox() {\n let width = this.box.attr(\"width\");\n let height = this.box.attr(\"height\");\n let x = this.box.attr(\"x\");\n let y = this.box.attr(\"y\");\n let cy = y + height / 2;\n let cx = x + width / 2;\n\n return {\n width: width,\n height: height,\n x: x,\n y: y,\n cx: cx,\n cy: cy\n };\n }", "function getOuterRect(el,origin){var offset=el.offset();var left=offset.left-(origin?origin.left:0);var top=offset.top-(origin?origin.top:0);return{left:left,right:left+el.outerWidth(),top:top,bottom:top+el.outerHeight()};}", "function make_bounding_box(boudingBox){\n i = boundingBox.vertices\n thick = 100\n length = 2 * Math.abs(i[1].x - i[0].x)\n return [{\n dimensions: { h: thick, w: length}, // most likely assume in mm (1mm = 3.779528px)\n coordinates: { x: i[1].x, y: i[1].y-thick/2}, // in px also may be undefined (when initializing)\n rotation: 0, // in degrees\n pinned: true,\n nodes: [{x: 0, y: 20, color: 4}]\n },\n {\n dimensions: { h: thick, w: length}, // most likely assume in mm (1mm = 3.779528px)\n coordinates: { x: i[2].x+thick/2, y: i[2].y}, // in px also may be undefined (when initializing)\n rotation: 90, // in degrees\n pinned: true,\n nodes: [{x: 0, y: 20, color: 4}]\n },\n {\n dimensions: { h: thick, w: length}, // most likely assume in mm (1mm = 3.779528px)\n coordinates: { x: i[3].x, y: i[3].y+thick/2}, // in px also may be undefined (when initializing)\n rotation: 180, // in degrees\n pinned: true,\n nodes: [{x: 0, y: 20, color: 4}]\n },\n {\n dimensions: { h: thick, w: length}, // most likely assume in mm (1mm = 3.779528px)\n coordinates: { x: i[0].x-thick/2, y: i[0].y}, // in px also may be undefined (when initializing)\n rotation: 270, // in degrees\n pinned: true,\n nodes: [{x: 0, y: 20, color: 4}]\n }]\n}", "function calculateCenter(){\n center = map.getCenter();\n }", "rectifyBBox (bbox) {\n // horizontal top\n if (bbox[0].y != bbox[1].y) {\n let ymin = Math.min(bbox[0].y, bbox[1].y)\n bbox[0].y = ymin\n bbox[1].y = ymin\n }\n\n // horizontal bottom\n if (bbox[3].y != bbox[2].y) {\n let ymax = Math.max(bbox[3].y, bbox[2].y)\n bbox[3].y = ymax\n bbox[2].y = ymax\n }\n\n // vertical right\n if (bbox[1].x != bbox[2].x) {\n let xmax = Math.max(bbox[1].x, bbox[2].x)\n bbox[1].x = xmax\n bbox[2].x = xmax\n }\n\n // vertical left\n if (bbox[0].x != bbox[3].x) {\n let xmin = Math.min(bbox[0].x, bbox[3].x)\n bbox[0].x = xmin\n bbox[3].x = xmin\n }\n\n return bbox\n }", "function BoundingBoxRect() { }", "computeCoords() {\n this.distanceFromEarthCenter = bv3.length(this.position)\n this.distanceFromEarthSurface = this.distanceFromEarthCenter - 6378\n\n this.lat = radians2degrees(Math.asin(-this.position[1] / this.distanceFromEarthCenter))\n\n\n const posAtEquator = [this.position[0], 0, this.position[2]]\n\n\n const distanceFromEarthCenterAtEquator = bv3.length(posAtEquator)\n const l90 = radians2degrees(Math.asin(-this.position[0] / distanceFromEarthCenterAtEquator))\n\n\n if (this.position[0] > 0 != this.position[2] > 0) {\n if (this.position[0] > 0) {\n //CCconsole.log(\"c1\")\n this.lon = l90;\n } else {\n //CCconsole.log(\"c2\")\n this.lon = 180 - l90;\n }\n } else {\n if (this.position[0] > 0) {\n //CCconsole.log(\"c3\")\n this.lon = -180 - l90;\n } else {\n //CCconsole.log(\"c4\")\n this.lon = l90;\n }\n }\n\n \n }", "function findBounds(lat_min,lat_max, lng_min, lng_max, map, maps) {\n\tmap.setCenter(maps.LatLng(((lat_max + lat_min) / 2.0),((lng_max + lng_min) / 2.0)));\n\tmap.fitBounds(maps.LatLngBounds(\n\t\t//bottom left\n\t\tmaps.LatLng(lat_min, lng_min),\n\t\t//top right\n\t\tmaps.LatLng(lat_max, lng_max)\n\t));\n}", "get TopCenter() {}", "getCenter(){\n\t\tlet element = this.element;\n\t\tlet to_ret = {};\n\t\tto_ret.x = this.getDivXRange().reduce((a,b) => a+b) / 2.; // take the average of the length-two array <range>\n\t\tto_ret.y = this.getDivYRange().reduce((a,b) => a+b) / 2.;\n\t\treturn to_ret;\n\t}", "function boundingBox() {\n for (let node of nodes) {\n // If the positions exceed the box, set them to the boundary position.\n var yearX = xSmallScale.bandwidth() * ((node.year - minYear) / 4 + 0.6) // xSmallScale.bandwidth() * ((node.year - minYear) / 4 + 0.1)\n node.x = Math.max(Math.min(node.x, yearX + xSmallScale.bandwidth() / 2.5 - medalRadius), yearX - xSmallScale.bandwidth() / 2.5 + medalRadius);\n node.y = Math.max(Math.min(innerHeight - medalRadius, node.y), 0 + medalRadius);\n }\n }", "function calculateBoundingBox() {\n return {\n top: -((strokeWidth + 1) / 2) + sourceRectYEntry,\n left: -(targetRect.left - (sourceRect.left + sourceRect.width)),\n width:\n (strokeWidth + 1) / 2 +\n (targetRect.left + targetRect.width / 2) -\n (sourceRect.left + sourceRect.width),\n height: (strokeWidth + 1) / 2 + Math.abs(sourceRectYEntry),\n };\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 }" ]
[ "0.63520116", "0.6276804", "0.6075856", "0.58296704", "0.57885945", "0.56999004", "0.56209254", "0.56209254", "0.56144434", "0.56123745", "0.55647916", "0.55561036", "0.55454063", "0.5458264", "0.54568994", "0.54464936", "0.5435856", "0.5434639", "0.54338443", "0.54338443", "0.5403889", "0.5400229", "0.53837645", "0.53767204", "0.5341277", "0.5338185", "0.5331732", "0.5325996", "0.53132504", "0.5311355", "0.52981704", "0.52894026", "0.5284826", "0.5281825", "0.5280932", "0.5274716", "0.5274716", "0.5274716", "0.52646244", "0.52543247", "0.52478373", "0.52170664", "0.52024686", "0.5194818", "0.51919806", "0.5188386", "0.51845473", "0.5181037", "0.51756406", "0.51732874", "0.51563007", "0.5140073", "0.51344633", "0.5131529", "0.5126256", "0.512035", "0.5118431", "0.51171786", "0.51168704", "0.5105539", "0.50989455", "0.50983894", "0.50923127", "0.50825816", "0.50801516", "0.50711054", "0.5066136", "0.5062614", "0.5048845", "0.5041484", "0.5040496", "0.5029169", "0.50168747", "0.5015393", "0.5011383", "0.50046545", "0.49925852", "0.49925852", "0.49921843", "0.49892172", "0.49859652", "0.49856728", "0.49833912", "0.49816427", "0.49794155", "0.49753836", "0.49678206", "0.4965332", "0.49639514", "0.4961395", "0.49605998", "0.49535868", "0.49515206", "0.49473616", "0.49470437", "0.4942285", "0.494101", "0.49401122", "0.49362496", "0.49338877" ]
0.6774823
0
Coverts the given number of miles to the equivalent number of degrees in latitude. Not extremely accurate but sufficient for general use. Works for any location, irrespective of longitude.
function milesToLatDegrees(miles) { const MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR = 69.0; return miles / MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function milesToLngDegrees(miles, lat) {\n return miles / calculateMilesPerDegreeLng(lat);\n }", "function calculateMilesPerDegreeLng(lat) {\n const latRadians = degreesToRadians(lat);\n return Math.cos(latRadians) * MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR;\n }", "function changeToMiles(place) {\n var distance = place.distance;\n distance = distance / 1609.34;\n var integer = Math.floor(distance);\n var decimal = distance - integer;\n if (decimal <= 0.5) {\n distance = Math.floor(distance);\n } else {\n distance = Math.ceil(distance);\n }\n place.distance = distance;\n}", "function metersToMilesFixed(meters) {\n var num = meters * 0.00062137;\n return num.toFixed(1);\n }", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function metersToMiles(meters) {\n return meters / 1609.344;\n }", "function getMiles(i) {\n let n = i*0.000621371192;\n return Math.round( n * 100 ) / 100;\n}", "function metersToMiles( meters ) {\n\treturn Math.round( ( meters * 0.000621371 ) * 100 ) / 100;\n}", "function convertToKilometers(miles) {\n return miles * 1.60934\n}", "function getMiles (distanceInMeters) {\n return (distanceInMeters*0.000621371192).toFixed(1)\n}", "function kilometersToMiles(kilometers) {\n\tvar miles = kilometers * 0.621371;\n\treturn miles;\n}", "function kilometersToMiles(distance) {\n return distance * 0.62;\n}", "function distanceInMiles(lat1, lon1, lat2, lon2) {\n if(lat1 == lat2 && lon1 == lon2)\n\treturn 0.;\n \n var rad = 3963.;\n var deg2rad = Math.PI/180.;\n var ang = Math.cos(lat1 * deg2rad) * Math.cos(lat2 * deg2rad) * Math.cos((lon1 - lon2)*deg2rad) + Math.sin(lat1 * deg2rad) * Math.sin(lat2 * deg2rad);\n return Math.acos(ang) * 1.02112 * rad;\n}", "function kmToMiles(km){\n miles = km*0.621371;\n return miles;\n}", "function metersToLat(m) {\n\t return m / 110946.257617;\n\t}", "function lonToMeters(dLon, atLat) {\n\t return Math.abs(atLat) >= 90 ? 0 :\n\t dLon * 111319.490793 * Math.abs(Math.cos(atLat * (Math.PI/180)));\n\t}", "function metersToLon(m, atLat) {\n\t return Math.abs(atLat) >= 90 ? 0 :\n\t m / 111319.490793 / Math.abs(Math.cos(atLat * (Math.PI/180)));\n\t}", "function tfnewGetMeters( miles ) {\n\n return miles * 1609.344;\n\n}", "function getRangeofLonLat(lon, lat, kilometer){\n console.log(kilometer/110.574)\n var constant = kilometer/110.574;\n\n if(lon > 0){\n var minLongitude = lon + kilometer/(111.320*Math.cos((lat + constant)* (Math.PI/180)))\n var maxLongitude = lon - kilometer/(111.320*Math.cos((lat - constant)* (Math.PI/180)))\n }else{\n var minLongitude = lon - kilometer/(111.320*Math.cos((lat - constant)* (Math.PI/180)))\n var maxLongitude = lon + kilometer/(111.320*Math.cos((lat + constant)* (Math.PI/180)))\n }\n\n if(lat < 0){\n var minLatitude = lat + constant\n var maxLatitude = lat - constant\n }else{\n var minLatitude = lat - constant\n var maxLatitude = lat + constant\n }\n\n return {minLatitude: minLatitude,\n maxLatitude: maxLatitude,\n minLongitude: minLongitude,\n maxLongitude: maxLongitude\n}\n}", "function kmToMiles(km) {\n return km * 0.62137;\n }", "function normalizeLng( value ) {\n const rotation = Math.floor( ( value + 180 ) / 360 );\n const normalized = value - ( rotation * 360 );\n const rounded = Math.round( normalized * 1e2 ) / 1e2;\n\n return rounded;\n }", "function distanceConversion(meters) {\n return Math.round((meters * 0.000621371) * 10) / 10;\n}", "function convertMilesPerHour (metersPerSec) {\n return (metersPerSec * (3125/1397)).toFixed(2);\n} // end convertMilesPerHour()", "function latScale(value) {\n\treturn Math.round((value - minlat) * parseInt(map.css('width')) / (maxlat - minlat));\n}", "function metersToLatLong(metersCoord) {\n //https://pubs.usgs.gov/pp/1395/report.pdf - Mercator to WGS 84 conversion on pages 44 and 267\n var latLongCoord = [];\n\n //Mercator Sphere Radius\n var sphRadius = 6378137;\n\n //Pushing Longitude into the array\n latLongCoord.push(roundToDecimalPlace(((metersCoord[0]/sphRadius)*180)/Math.PI,6));\n\n //Calculate Latitude\n var latStepOne = 90;\n var latStepTwo = (metersCoord[1]/sphRadius) * -1;\n var latStepThree = Math.pow(Math.E, latStepTwo);\n var latStepFour = Math.atan(latStepThree);\n var latStepFive = latStepFour * (180/Math.PI);\n var latStepSix = (2 * latStepFive) * -1;\n var latStepSeven = latStepOne + latStepSix;\n\n //Pushing Latitude into the array\n latLongCoord.push(roundToDecimalPlace(latStepSeven,6));\n\n //Passing the M value into the array\n latLongCoord.push(metersCoord[2]);\n\n //Returning the coordinates as [long,lat,m]\n return latLongCoord;\n}", "function adjust_lon(x) {x=(Math.abs(x)<PI)?x:(x-(sign(x)*TWO_PI));return(x);}", "function lonToMetres (lon,lat) {\n return lon * 111200 * Math.cos(lat * (Math.PI/180));\n}", "function latToMeters(dLat) {\n\t return dLat * 110946.257617;\n\t}", "function metersToInches(meters) {\n return meters * 39.3701;\n}", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function getDistanceFromLatLonInMiles(lat1,lon1,lat2,lon2) {\n var R = 3595; // Radius of the earth in mi\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1);\n var a =\n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c; // Distance in mi\n return d;\n}", "function metersToInches(meters){\n return (meters * 39.3701);\n}", "function latLonToMeters( lat, lon )\n {\n var mx = lon * this.originShift / 180.0;\n var my = Math.log( Math.tan((90 + lat ) * Math.PI / 360.0)) / (Math.PI / 180.0);\n my = my * this.originShift / 180.0;\n return [mx, my];\n }", "function latLonToMeters( lat, lon )\n {\n var mx = lon * this.originShift / 180.0;\n var my = Math.log( Math.tan((90 + lat ) * Math.PI / 360.0)) / (Math.PI / 180.0);\n my = my * this.originShift / 180.0;\n return [mx, my];\n }", "function metersPerDegree(lat) {\n return EQUATOR_DEGREE_LEN * Math.cos(lat * Math.PI / 180);\n}", "function map2miller(lat, lng) {\n\tx = lat\n\ty = 1.25 * Math.asinh(0.8 * tan(lng))\n\treturn {\n\t\tx,\n\t\ty\n\t};\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n\tvar radlat1 = Math.PI * lat1/180;\r\n\tvar radlat2 = Math.PI * lat2/180;\r\n\tvar radlon1 = Math.PI * lon1/180;\r\n\tvar radlon2 = Math.PI * lon2/180;\r\n\tvar theta = lon1-lon2;\r\n\tvar radtheta = Math.PI * theta/180;\r\n\tvar subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n\tsubAngle = Math.acos(subAngle);\r\n\tsubAngle = subAngle * 180/Math.PI; // convert the degree value returned by acos back to degrees from radians\r\n\tdist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius )\r\n\t// where radius of the earth is 3956 miles\r\n\tif (unit==\"K\") { dist = dist * 1.609344 ;} // convert miles to km\r\n\tif (unit==\"N\") { dist = dist * 0.8684 ;} // convert miles to nautical miles\r\n\treturn dist;\r\n}", "function metersToMiles(meters, decimals) {\n\n //Use basic function\n return metersToSomething(meters, decimals, 'mi');\n }", "function calcUp(lat) {\n let dist = +lat - 40 // subtract the base from the value (lowest value)\n return Math.floor(dist * 10) // turn ito a percentage value\n}", "function convertMetersPerSec (milesPerHour) {\n return (milesPerHour * (1397/3125)).toFixed(2);\n} // end convertMetersPerSec()", "function kilometersToMiles(km) {\n\tmiles = km / 1.609;\n\tmessage = km + ' kilometers is ' + miles + ' miles.'\n\treturn message;\n}", "function convertToMiles (km) {\n console.log(\"This is the Answer to Task 5a ----> \" + km + \" km is equal to \" + km * 0.62137119 + \" miles.\");\n}", "distance(loc) {\n var lat1 = loc[LAT];\n var lon1 = loc[LONG];\n\n var lat2 = lat1; // default lat2 to safe default value\n var lon2 = lon1; // default lat2 to safe default value\n\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((p)=>{\n lat2 = p.coords.latitude;\n lon2 = p.coords.longitude;\n }, \n (e)=>{});\n }else{\n return 0; // oops! Cannot get geolocation return a safe distance \n }\n\n var lat1 = loc[0]; //const LAT = 0;\n var lon1 = loc[1]; //const LONG = 1;\n var theta = lon1 - lon2;\n // var dist = Math.sin(Math.deg2rad(lat1)) * Math.sin(Math.deg2rad(lat2)) \n // + Math.cos(Math.deg2rad(lat1)) * Math.cos(Math.deg2rad(lat2)) * Math.cos(Math.deg2rad(theta));\n var dist = mySin(lat1) * mySin(lat2) \n + myCos(lat1) * myCos(lat2) * myCos(theta);\n dist = Math.rad2deg( Math.acos( dist ) );\n //dist = Math.rad2deg(dist);\n var miles = dist * 60 * 1.1515;\n return miles;\n }", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n var radlat1 = Math.PI * lat1/180\r\n var radlat2 = Math.PI * lat2/180\r\n var radlon1 = Math.PI * lon1/180\r\n var radlon2 = Math.PI * lon2/180\r\n var theta = lon1-lon2\r\n var radtheta = Math.PI * theta/180\r\n var subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n subAngle = Math.acos(subAngle)\r\n subAngle = subAngle * 180/Math.PI // convert the degree value returned by acos back to degrees from radians\r\n dist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius where radius is 3956 miles\r\n if (unit==\"K\") { dist = dist * 1.609344 } // convert miles to km\r\n if (unit==\"N\") { dist = dist * 0.8684 } // convert miles to nautical miles\r\n return dist\r\n}", "function getDist(charLatlng, myLatlng) {\n\n var lat2 = charLatlng.lat();\n var lon2 = charLatlng.lng();\n var lat1 = myLatlng.lat();\n var lon1 = myLatlng.lng();\n\n var R = 3961; // miles \n var x1 = lat2-lat1;\n var dLat = x1.toRad(); \n var x2 = lon2-lon1;\n var dLon = x2.toRad(); \n var a = (Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2));\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; \n\n return Math.round(d*100)/100; //round\n}", "function addPuntosMiles(num){\r\n\t\tvar rgx = /(\\d+)(\\d{3})/;\r\n\t\twhile (rgx.test(num)) {\r\n\t\t\tnum = num.replace(rgx, '$1' + '.' + '$2');\r\n\t\t}\r\n\t\treturn num;\r\n\t}", "function meterstoFeet(meters) {\n //calculate meters to feet\n let f = meters * 0.3048;\n console.log(f);\n // round to nearest integer\n f = Math.floor(f);\n return f;\n}", "function formatLengthMiles(meters) {\n var sMeters = meters * 0.621371192;\n var miles = parseInt(sMeters / 1000);\n var commaMiles = parseInt((sMeters - miles * 1000 + 50) / 100);\n var ret = miles + \".\" + commaMiles + \" miles\";\n return(ret);\n}", "function paceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"mile\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"220\":\r\n\t\t\treturn 0.125;\r\n\t\tcase \"440\":\r\n\t\t\treturn 0.25;\r\n\t\tcase \"880\":\r\n\t\t\treturn 0.50;\r\n\t\tcase \"200\":\r\n\t\t\treturn 0.124274;\r\n\t\tcase \"400\":\r\n\t\t\treturn 0.248548;\r\n\t\tcase \"800\":\r\n\t\t\treturn 0.497097;\r\n\t\tcase \"1500\":\r\n\t\t\treturn 0.932057;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "function convertMeters(meters) {\n let feet = meters * 3.2804;\n feet = Math.round(feet);\n return feet;\n}", "function metersToLongitudeDegrees(distance, latitude) {\r\n var radians = degreesToRadians(latitude);\r\n var num = Math.cos(radians) * EARTH_EQ_RADIUS * Math.PI / 180;\r\n var denom = 1 / Math.sqrt(1 - E2 * Math.sin(radians) * Math.sin(radians));\r\n var deltaDeg = num * denom;\r\n if (deltaDeg < EPSILON) {\r\n return distance > 0 ? 360 : 0;\r\n }\r\n else {\r\n return Math.min(360, distance / deltaDeg);\r\n }\r\n}", "function ll2mp(lon, lat) {\n var south = [0, 6, 7, 8, 5],\n o = truncate((lon + 180) / 90 + 1),\n p, // parallel\n m = (lon + 720) % 90 - 45, // meridian\n s = sign(m);\n\n m = abs(m);\n if (o === 5) o = 1;\n if (lat < 0) o = south[o];\n p = abs(lat);\n return [m, p, s, o];\n }", "function transform(wgLon,wgLat){\n var mgLoc = {};\n if (!IsInChina(wgLat, wgLon)){\n mgLoc = {\n lat: wgLat,\n lng: wgLon\n };\n return mgLoc;\n }\n var dLat = transformLat(wgLon - 105.0, wgLat - 35.0);\n var dLon = transformLon(wgLon - 105.0, wgLat - 35.0);\n var radLat = wgLat / 180.0 * PI;\n var magic = Math.sin(radLat);\n magic = 1 - ee * magic * magic;\n var sqrtMagic = Math.sqrt(magic);\n dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * PI);\n dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * PI);\n mgLoc = {\n lat: wgLat + dLat,\n lng: wgLon + dLon\n };\n return mgLoc;\n }", "function distanceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"miles\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"m\":\r\n\t\t\treturn 0.000621371;\r\n\t\tcase \"yds\":\r\n\t\t\treturn 0.000568182;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "function eventsToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"marathon\":\r\n\t\t\treturn 26.2188;\r\n\t\tcase \"halfMarathon\":\r\n\t\t\treturn 13.1094;\r\n\t\tcase \"5k\":\r\n\t\t\treturn 3.10686;\r\n\t\tcase \"8k\":\r\n\t\t\treturn 4.97097;\r\n\t\tcase \"10k\":\r\n\t\t\treturn 6.21371;\r\n\t\tcase \"15k\":\r\n\t\t\treturn 9.32057;\r\n\t\tcase \"20k\":\r\n\t\t\treturn 12.4274;\r\n\t\tcase \"25k\":\r\n\t\t\treturn 15.5343;\r\n\t\tcase \"50k\":\r\n\t\t\treturn 31.0686;\r\n\t\tcase \"100k\":\r\n\t\t\treturn 62.1371;\r\n\t\tcase \"5m\":\r\n\t\t\treturn 5.00;\r\n\t\tcase \"10m\":\r\n\t\t\treturn 10.00;\r\n\t\tcase \"15m\":\r\n\t\t\treturn 15.00;\r\n\t\tcase \"20m\":\r\n\t\t\treturn 20.00;\r\n\t\tcase \"50m\":\r\n\t\t\treturn 50.00;\r\n\t\tcase \"100m\":\r\n\t\t\treturn 100.00;\r\n\t\tdefault:\r\n\t\t\treturn;\r\n\t}\r\n}", "function project(latLng) {\n var siny = Math.sin(latLng.position.lat() * Math.PI / 180);\n\n // Truncating to 0.9999 effectively limits latitude to 89.189. This is\n // about a third of a tile past the edge of the world tile.\n siny = Math.min(Math.max(siny, -0.9999), 0.9999);\n\n return new google.maps.Point(\n TILE_SIZE * (0.5 + latLng.position.lng() / 360),\n TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI)));\n}", "function metersToLatLon( mx, my )\n {\n var lon = (mx / this.originShift) * 180.0;\n var lat = (my / this.originShift) * 180.0;\n lat = 180 / Math.PI * ( 2 * Math.atan( Math.exp(lat * Math.PI / 180.0 ) ) - Math.PI / 2.0);\n return [lat, lon];\n }", "function metersToLatLon( mx, my )\n {\n var lon = (mx / this.originShift) * 180.0;\n var lat = (my / this.originShift) * 180.0;\n lat = 180 / Math.PI * ( 2 * Math.atan( Math.exp(lat * Math.PI / 180.0 ) ) - Math.PI / 2.0);\n return [lat, lon];\n }", "function ConvertKmToMile(km){\n\n return km * 0.621371;\n}", "function GroundResolution(latitude, levelOfDetail){\n laitude = clip(latitude, MinLatitude, MaxLatitude);\n return Math.cos(latitude * Math.PI / 180) * 2 * Math.PI * EarthRadius / MapSize(levelOfDetail);\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function mapNumber(input, in_min, in_max, out_min, out_max) {\n\treturn (input - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n}", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n \n d = ConvertKmToMile(d);\n console.log(d);\n return d;\n}", "function getDistanceInMiles(p1, p2) {\n return kilometersToMiles(getDistanceInKilometers(p1, p2));\n}", "function convertMeters(meters, units) {\n\t\t\tif (units == UNITS_MI)\n\t\t\t\treturn meters/1609.34;\n\t\t\treturn meters/1000; //return KM\n\t\t}", "function WGS84ToMercator(longitude, latitude)\n{\n var lngRad = longitude * Math.PI / 180.0;\n var latRad = latitude * Math.PI / 180.0;\n\n var x = lngRad;\n var y = Math.log(Math.tan(Math.PI / 4.0 + latRad / 2.0));\n\n x /= Math.PI;\n y /= Math.PI;\n\n var result = [x,y];\n return result;\n}", "function long2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }", "static getDistanceFromLatLonInMiles(lat1, lon1, lat2, lon2, dist) {\n var R = 3958.8; // Radius of the earth in miles\n var dLat = this.deg2rad(lat2 - lat1);\n var dLon = this.deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.deg2rad(lat1)) *\n Math.cos(this.deg2rad(lat2)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in miles\n return d < dist ? true : false;\n }", "function convertDistance(miles, units, invert = false) {\n miles = parseFloat(miles);\n let distance = miles;\n switch (units) {\n case 'Car/ Light Van':\n distance = miles ;\n break;\n case 'Medium Van':\n distance = miles;\n break;\n case 'Large Van':\n distance = miles;\n break;\n default:\n }\n return distance.toFixed(2);\n}", "function convertCentimetersToMeters(centimeters) {\n var meters = centimeters / 100;\n return meters;\n}", "function mapNumbers(x, in_min, in_max, out_min, out_max)\t{\n return (x-in_min) * (out_max-out_min) / (in_max-in_min) + out_min;\n}", "function wrapLongitude(longitude) {\r\n if (longitude <= 180 && longitude >= -180) {\r\n return longitude;\r\n }\r\n var adjusted = longitude + 180;\r\n if (adjusted > 0) {\r\n return (adjusted % 360) - 180;\r\n }\r\n else {\r\n return 180 - (-adjusted % 360);\r\n }\r\n}", "function findNear(num){\n var ceil = Math.ceil(num);\n if ((ceil-num)<=0.5) return ceil;\n else return Math.floor(num);\n }", "function pixel2Lnglat() {\n var droneLnglat = [];\n var pitch = map.getPitch()*Math.PI/180;\n var mapDiv = map.getContainer();\n var xratio = (droneView.offsetLeft + 150)/parseInt(getComputedStyle(mapDiv).width);\n var yratio = 1 - (droneView.offsetTop)/parseInt(getComputedStyle(mapDiv).height);\n var bounds = map.getBounds();\n if (bounds._sw && bounds._ne) {\n console.warn(\"xratio is what: \" + xratio, \"yratio is: \" + yratio);\n droneLnglat.push(bounds._sw.lng + xratio * (bounds._ne.lng - bounds._sw.lng)); \n // droneLnglat.push(map.getCenter().lng); Math.sin(pitch) *\n droneLnglat.push(bounds._sw.lat + yratio * (bounds._ne.lat - bounds._sw.lat)); \n }\n return droneLnglat;\n}", "function distance(lat1, lng1, lat2, lng2, miles) { // miles optional\n if (typeof miles === \"undefined\"){miles=false;}\n function deg2rad(deg){return deg * (Math.PI/180);}\n function square(x){return Math.pow(x, 2);}\n var r=6371; // radius of the earth in km\n lat1=deg2rad(lat1);\n lat2=deg2rad(lat2);\n var lat_dif=lat2-lat1;\n var lng_dif=deg2rad(lng2-lng1);\n var a=square(Math.sin(lat_dif/2))+Math.cos(lat1)*Math.cos(lat2)*square(Math.sin(lng_dif/2));\n var d=2*r*Math.asin(Math.sqrt(a));\n if (miles){\n return d * 0.621371;\n } //return miles\n else{\n return d;\n } //return km\n}", "function degtometerslat(latdeg) {\n lat = deg2rad(latdeg);\n m1 = 111132.92; // latitude calculation term 1\n m2 = -559.82; // latitude calculation term 2\n m3 = 1.175; // latitude calculation term 3\n m4 = -0.0023; // latitude calculation term 4\n latlen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) + (m4 * Math.cos(6 * lat));\n return latlen;\n }", "function calcOver(lon) {\n let dist = +lon + 91 // subtract the base from the value (lowest value)\n return Math.floor(dist * 10) // turn ito a percentage value\n}", "function getMetersPerPixel() {\n if (!_map) return 0;\n var y = _map.getSize().y,\n x = _map.getSize().x;\n // calculate the distance the one side of the map to the other using the haversine formula\n var maxMeters = _map.containerPointToLatLng([0, y]).distanceTo(_map.containerPointToLatLng([x, y]));\n return maxMeters / x;\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n\n var a = 0.5 - c((lat2 - lat1) * p)/2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p))/2;\n\n return 2 * 3959 * Math.asin(Math.sqrt(a)); // Earth's Radius = 3959 miles\n}", "function meters(km) {\n\treturn km * 1000;\n}", "function metersToPixels(meters){\n\tvar ret = (meters/metersPerPixel)+400;\n\treturn ret;\n}", "function metersToSeamiles(meters, decimals) {\n\n //Use basic function\n return metersToSomething(meters, decimals, 'sm');\n }", "function latLngRangeCalc(lat, lng, d) {\r\n\t// Use to convert from degrees to rad\r\n\tvar p = Math.PI / 180;\r\n\r\n\t// Radius of the Earth\r\n\tvar R = 6371;\r\n\tvar ans = {latMin:null, latMax:null, lngMin:null, lngMax:null};\r\n\r\n\t// First iteration calculates longitude, second latitude\r\n\tfor (i = 1; i < 3; i++) {\r\n\t\t// Bearing, convert to rad\r\n\t\tvar brng = 90 * i * p;\r\n\r\n\t\t// convert to rad\r\n\t\tvar latRad = lat * p;\r\n\t\tvar lngRad = lng * p;\r\n\r\n\t\tvar lat2Rad = Math.asin(Math.sin(latRad) * Math.cos(d/R) + Math.cos(latRad) * Math.sin(d/R) * Math.cos(brng));\r\n\t\tvar lng2Rad = lngRad + Math.atan2(Math.sin(brng)*Math.sin(d/R) *Math.cos(latRad), Math.cos(d/R) - Math.sin(latRad)*Math.sin(lat2Rad));\r\n\r\n\t\t// Convert back to degrees\r\n\t\tlat2 = lat2Rad * (180 / Math.PI);\r\n\t\tlng2 = lng2Rad * (180 / Math.PI);\r\n\r\n\t\t// Calculate range by taking the difference in degrees that the distance\r\n\t\t// results in and subtracting/adding it to the original lat/long\r\n\t\tif (i == 1) {\r\n\t\t\tif (lng2 < lng) {\r\n\t\t\t\tans.lngMin = lng - (lng - lng2);\r\n\t\t\t\tans.lngMax = lng + (lng - lng2);\r\n\t\t\t} else {\r\n\t\t\t\tans.lngMin = lng - (lng2 - lng);\r\n\t\t\t\tans.lngMax = lng + (lng2 - lng);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (lat2 < lat) {\r\n\t\t\t\tans.latMin = lat - (lat - lat2);\r\n\t\t\t\tans.latMax = lat + (lat - lat2);\r\n\t\t\t} else {\r\n\t\t\t\tans.latMin = lat - (lat2 - lat);\r\n\t\t\t\tans.latMax = lat + (lat2 - lat);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn ans;\r\n}", "function distanceInMeter(lat1, lon1, lat2, lon2) {\n\tvar R = 6371;\n\tvar dLat = (lat2-lat1) * Math.PI / 180;\n\tvar dLon = (lon2-lon1) * Math.PI / 180;\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) *\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\tvar d = R * c;\n\treturn d * 1000;\n}", "function radiusToMeters(radius)\n{\n\treturn parseInt((radius * 1000)/.62);\n}", "function lon2x(lon) {\n var xfactor = 2.6938;\n var xoffset = 465.4;\n var x = (lon * xfactor) + xoffset;\n return x;\n}" ]
[ "0.7617932", "0.7335804", "0.7021304", "0.69807136", "0.6794738", "0.6794738", "0.6794738", "0.67732346", "0.6743387", "0.6711142", "0.65130067", "0.6486679", "0.64822316", "0.6458301", "0.6455056", "0.64298683", "0.64157116", "0.6361914", "0.6342802", "0.62975895", "0.6175669", "0.6174211", "0.61547023", "0.61424625", "0.60597324", "0.6051276", "0.601185", "0.5993732", "0.5993127", "0.5985546", "0.5977099", "0.5932126", "0.5932126", "0.5932126", "0.5925894", "0.5925498", "0.5917509", "0.5917509", "0.59107727", "0.5894397", "0.5889889", "0.5887628", "0.5879117", "0.587224", "0.5866399", "0.5865604", "0.5839281", "0.5825919", "0.58122784", "0.57219917", "0.5708267", "0.5695898", "0.5669415", "0.56428325", "0.56332606", "0.56219053", "0.5619417", "0.5609008", "0.5606262", "0.55980283", "0.5595711", "0.5595711", "0.5593033", "0.5592675", "0.55696636", "0.55696636", "0.5562191", "0.5562191", "0.5562191", "0.5562191", "0.5562191", "0.5562191", "0.5562191", "0.5562191", "0.5562191", "0.55614597", "0.55557746", "0.55531377", "0.55373156", "0.5531706", "0.55217177", "0.5521216", "0.55171263", "0.55098426", "0.5481842", "0.5480989", "0.5480976", "0.54673177", "0.5459759", "0.5455167", "0.54513025", "0.5445106", "0.54444414", "0.54302704", "0.5424589", "0.54215306", "0.54203016", "0.5401414", "0.5393932", "0.539072" ]
0.7172749
2
Coverts the given number of miles to the equivalent number of degrees in longitude for a location at the given latitude.
function milesToLngDegrees(miles, lat) { return miles / calculateMilesPerDegreeLng(lat); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateMilesPerDegreeLng(lat) {\n const latRadians = degreesToRadians(lat);\n return Math.cos(latRadians) * MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR;\n }", "function changeToMiles(place) {\n var distance = place.distance;\n distance = distance / 1609.34;\n var integer = Math.floor(distance);\n var decimal = distance - integer;\n if (decimal <= 0.5) {\n distance = Math.floor(distance);\n } else {\n distance = Math.ceil(distance);\n }\n place.distance = distance;\n}", "function milesToLatDegrees(miles) {\n const MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR = 69.0;\n return miles / MILES_IN_ONE_DEGREE_LAT_AT_EQUATOR;\n }", "function metersToLon(m, atLat) {\n\t return Math.abs(atLat) >= 90 ? 0 :\n\t m / 111319.490793 / Math.abs(Math.cos(atLat * (Math.PI/180)));\n\t}", "function lonToMeters(dLon, atLat) {\n\t return Math.abs(atLat) >= 90 ? 0 :\n\t dLon * 111319.490793 * Math.abs(Math.cos(atLat * (Math.PI/180)));\n\t}", "function metersToMilesFixed(meters) {\n var num = meters * 0.00062137;\n return num.toFixed(1);\n }", "function metersToMiles(meters) {\n return meters / 1609.344;\n }", "function lonToMetres (lon,lat) {\n return lon * 111200 * Math.cos(lat * (Math.PI/180));\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function milesToMeters(miles) {\n return miles * 1069.344;\n}", "function metersToLongitudeDegrees(distance, latitude) {\r\n var radians = degreesToRadians(latitude);\r\n var num = Math.cos(radians) * EARTH_EQ_RADIUS * Math.PI / 180;\r\n var denom = 1 / Math.sqrt(1 - E2 * Math.sin(radians) * Math.sin(radians));\r\n var deltaDeg = num * denom;\r\n if (deltaDeg < EPSILON) {\r\n return distance > 0 ? 360 : 0;\r\n }\r\n else {\r\n return Math.min(360, distance / deltaDeg);\r\n }\r\n}", "function metersPerDegree(lat) {\n return EQUATOR_DEGREE_LEN * Math.cos(lat * Math.PI / 180);\n}", "function getMiles(i) {\n let n = i*0.000621371192;\n return Math.round( n * 100 ) / 100;\n}", "function distanceInMiles(lat1, lon1, lat2, lon2) {\n if(lat1 == lat2 && lon1 == lon2)\n\treturn 0.;\n \n var rad = 3963.;\n var deg2rad = Math.PI/180.;\n var ang = Math.cos(lat1 * deg2rad) * Math.cos(lat2 * deg2rad) * Math.cos((lon1 - lon2)*deg2rad) + Math.sin(lat1 * deg2rad) * Math.sin(lat2 * deg2rad);\n return Math.acos(ang) * 1.02112 * rad;\n}", "function latScale(value) {\n\treturn Math.round((value - minlat) * parseInt(map.css('width')) / (maxlat - minlat));\n}", "function getRangeofLonLat(lon, lat, kilometer){\n console.log(kilometer/110.574)\n var constant = kilometer/110.574;\n\n if(lon > 0){\n var minLongitude = lon + kilometer/(111.320*Math.cos((lat + constant)* (Math.PI/180)))\n var maxLongitude = lon - kilometer/(111.320*Math.cos((lat - constant)* (Math.PI/180)))\n }else{\n var minLongitude = lon - kilometer/(111.320*Math.cos((lat - constant)* (Math.PI/180)))\n var maxLongitude = lon + kilometer/(111.320*Math.cos((lat + constant)* (Math.PI/180)))\n }\n\n if(lat < 0){\n var minLatitude = lat + constant\n var maxLatitude = lat - constant\n }else{\n var minLatitude = lat - constant\n var maxLatitude = lat + constant\n }\n\n return {minLatitude: minLatitude,\n maxLatitude: maxLatitude,\n minLongitude: minLongitude,\n maxLongitude: maxLongitude\n}\n}", "function calcUp(lat) {\n let dist = +lat - 40 // subtract the base from the value (lowest value)\n return Math.floor(dist * 10) // turn ito a percentage value\n}", "function kilometersToMiles(distance) {\n return distance * 0.62;\n}", "function latLonToMeters( lat, lon )\n {\n var mx = lon * this.originShift / 180.0;\n var my = Math.log( Math.tan((90 + lat ) * Math.PI / 360.0)) / (Math.PI / 180.0);\n my = my * this.originShift / 180.0;\n return [mx, my];\n }", "function latLonToMeters( lat, lon )\n {\n var mx = lon * this.originShift / 180.0;\n var my = Math.log( Math.tan((90 + lat ) * Math.PI / 360.0)) / (Math.PI / 180.0);\n my = my * this.originShift / 180.0;\n return [mx, my];\n }", "function metersToMiles( meters ) {\n\treturn Math.round( ( meters * 0.000621371 ) * 100 ) / 100;\n}", "function convertToKilometers(miles) {\n return miles * 1.60934\n}", "function kilometersToMiles(kilometers) {\n\tvar miles = kilometers * 0.621371;\n\treturn miles;\n}", "function kmToMiles(km){\n miles = km*0.621371;\n return miles;\n}", "function map2miller(lat, lng) {\n\tx = lat\n\ty = 1.25 * Math.asinh(0.8 * tan(lng))\n\treturn {\n\t\tx,\n\t\ty\n\t};\n}", "function ll2mp(lon, lat) {\n var south = [0, 6, 7, 8, 5],\n o = truncate((lon + 180) / 90 + 1),\n p, // parallel\n m = (lon + 720) % 90 - 45, // meridian\n s = sign(m);\n\n m = abs(m);\n if (o === 5) o = 1;\n if (lat < 0) o = south[o];\n p = abs(lat);\n return [m, p, s, o];\n }", "function latToMeters(dLat) {\n\t return dLat * 110946.257617;\n\t}", "function getMiles (distanceInMeters) {\n return (distanceInMeters*0.000621371192).toFixed(1)\n}", "function distanceConversion(meters) {\n return Math.round((meters * 0.000621371) * 10) / 10;\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n\tvar radlat1 = Math.PI * lat1/180;\r\n\tvar radlat2 = Math.PI * lat2/180;\r\n\tvar radlon1 = Math.PI * lon1/180;\r\n\tvar radlon2 = Math.PI * lon2/180;\r\n\tvar theta = lon1-lon2;\r\n\tvar radtheta = Math.PI * theta/180;\r\n\tvar subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n\tsubAngle = Math.acos(subAngle);\r\n\tsubAngle = subAngle * 180/Math.PI; // convert the degree value returned by acos back to degrees from radians\r\n\tdist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius )\r\n\t// where radius of the earth is 3956 miles\r\n\tif (unit==\"K\") { dist = dist * 1.609344 ;} // convert miles to km\r\n\tif (unit==\"N\") { dist = dist * 0.8684 ;} // convert miles to nautical miles\r\n\treturn dist;\r\n}", "function calculateDistance(lat1, lon1, lat2, lon2, unit) {\r\n var radlat1 = Math.PI * lat1/180\r\n var radlat2 = Math.PI * lat2/180\r\n var radlon1 = Math.PI * lon1/180\r\n var radlon2 = Math.PI * lon2/180\r\n var theta = lon1-lon2\r\n var radtheta = Math.PI * theta/180\r\n var subAngle = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n subAngle = Math.acos(subAngle)\r\n subAngle = subAngle * 180/Math.PI // convert the degree value returned by acos back to degrees from radians\r\n dist = (subAngle/360) * 2 * Math.PI * 3956; // ((subtended angle in degrees)/360) * 2 * pi * radius where radius is 3956 miles\r\n if (unit==\"K\") { dist = dist * 1.609344 } // convert miles to km\r\n if (unit==\"N\") { dist = dist * 0.8684 } // convert miles to nautical miles\r\n return dist\r\n}", "function metersToLatLong(metersCoord) {\n //https://pubs.usgs.gov/pp/1395/report.pdf - Mercator to WGS 84 conversion on pages 44 and 267\n var latLongCoord = [];\n\n //Mercator Sphere Radius\n var sphRadius = 6378137;\n\n //Pushing Longitude into the array\n latLongCoord.push(roundToDecimalPlace(((metersCoord[0]/sphRadius)*180)/Math.PI,6));\n\n //Calculate Latitude\n var latStepOne = 90;\n var latStepTwo = (metersCoord[1]/sphRadius) * -1;\n var latStepThree = Math.pow(Math.E, latStepTwo);\n var latStepFour = Math.atan(latStepThree);\n var latStepFive = latStepFour * (180/Math.PI);\n var latStepSix = (2 * latStepFive) * -1;\n var latStepSeven = latStepOne + latStepSix;\n\n //Pushing Latitude into the array\n latLongCoord.push(roundToDecimalPlace(latStepSeven,6));\n\n //Passing the M value into the array\n latLongCoord.push(metersCoord[2]);\n\n //Returning the coordinates as [long,lat,m]\n return latLongCoord;\n}", "function long2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }", "function transform(wgLon,wgLat){\n var mgLoc = {};\n if (!IsInChina(wgLat, wgLon)){\n mgLoc = {\n lat: wgLat,\n lng: wgLon\n };\n return mgLoc;\n }\n var dLat = transformLat(wgLon - 105.0, wgLat - 35.0);\n var dLon = transformLon(wgLon - 105.0, wgLat - 35.0);\n var radLat = wgLat / 180.0 * PI;\n var magic = Math.sin(radLat);\n magic = 1 - ee * magic * magic;\n var sqrtMagic = Math.sqrt(magic);\n dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * PI);\n dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * PI);\n mgLoc = {\n lat: wgLat + dLat,\n lng: wgLon + dLon\n };\n return mgLoc;\n }", "function wrapLongitude(longitude) {\r\n if (longitude <= 180 && longitude >= -180) {\r\n return longitude;\r\n }\r\n var adjusted = longitude + 180;\r\n if (adjusted > 0) {\r\n return (adjusted % 360) - 180;\r\n }\r\n else {\r\n return 180 - (-adjusted % 360);\r\n }\r\n}", "function getDistanceFromLatLonInMiles(lat1,lon1,lat2,lon2) {\n var R = 3595; // Radius of the earth in mi\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1);\n var a =\n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *\n Math.sin(dLon/2) * Math.sin(dLon/2)\n ;\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c; // Distance in mi\n return d;\n}", "function degtometerslon(latdeg) {\n lat = deg2rad(latdeg);\n p1 = 111412.84; // longitude calculation term 1\n p2 = -93.5; // longitude calculation term 2\n p3 = 0.118; // longitude calculation term 3\n longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) + (p3 * Math.cos(5 * lat));\n return longlen;\n }", "function convertMilesPerHour (metersPerSec) {\n return (metersPerSec * (3125/1397)).toFixed(2);\n} // end convertMilesPerHour()", "function normalizeLng( value ) {\n const rotation = Math.floor( ( value + 180 ) / 360 );\n const normalized = value - ( rotation * 360 );\n const rounded = Math.round( normalized * 1e2 ) / 1e2;\n\n return rounded;\n }", "function kmToMiles(km) {\n return km * 0.62137;\n }", "function GroundResolution(latitude, levelOfDetail){\n laitude = clip(latitude, MinLatitude, MaxLatitude);\n return Math.cos(latitude * Math.PI / 180) * 2 * Math.PI * EarthRadius / MapSize(levelOfDetail);\n}", "function degtometerslat(latdeg) {\n lat = deg2rad(latdeg);\n m1 = 111132.92; // latitude calculation term 1\n m2 = -559.82; // latitude calculation term 2\n m3 = 1.175; // latitude calculation term 3\n m4 = -0.0023; // latitude calculation term 4\n latlen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) + (m4 * Math.cos(6 * lat));\n return latlen;\n }", "function adjust_lon(x) {x=(Math.abs(x)<PI)?x:(x-(sign(x)*TWO_PI));return(x);}", "function tfnewGetMeters( miles ) {\n\n return miles * 1609.344;\n\n}", "function getDist(charLatlng, myLatlng) {\n\n var lat2 = charLatlng.lat();\n var lon2 = charLatlng.lng();\n var lat1 = myLatlng.lat();\n var lon1 = myLatlng.lng();\n\n var R = 3961; // miles \n var x1 = lat2-lat1;\n var dLat = x1.toRad(); \n var x2 = lon2-lon1;\n var dLon = x2.toRad(); \n var a = (Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2));\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; \n\n return Math.round(d*100)/100; //round\n}", "distance(loc) {\n var lat1 = loc[LAT];\n var lon1 = loc[LONG];\n\n var lat2 = lat1; // default lat2 to safe default value\n var lon2 = lon1; // default lat2 to safe default value\n\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((p)=>{\n lat2 = p.coords.latitude;\n lon2 = p.coords.longitude;\n }, \n (e)=>{});\n }else{\n return 0; // oops! Cannot get geolocation return a safe distance \n }\n\n var lat1 = loc[0]; //const LAT = 0;\n var lon1 = loc[1]; //const LONG = 1;\n var theta = lon1 - lon2;\n // var dist = Math.sin(Math.deg2rad(lat1)) * Math.sin(Math.deg2rad(lat2)) \n // + Math.cos(Math.deg2rad(lat1)) * Math.cos(Math.deg2rad(lat2)) * Math.cos(Math.deg2rad(theta));\n var dist = mySin(lat1) * mySin(lat2) \n + myCos(lat1) * myCos(lat2) * myCos(theta);\n dist = Math.rad2deg( Math.acos( dist ) );\n //dist = Math.rad2deg(dist);\n var miles = dist * 60 * 1.1515;\n return miles;\n }", "function calcOver(lon) {\n let dist = +lon + 91 // subtract the base from the value (lowest value)\n return Math.floor(dist * 10) // turn ito a percentage value\n}", "function get_distances_per_lat_long(lat, long){\n return [111.32*10**3, 40075 *10**3 * Math.cos( lat ) / 360];\n }", "function latLngToPixels( lat, lng, zoom )\n {\n var meters = this.latLonToMeters( lat, lng, zoom );\n return this.metersToPixels( meters[ 0 ], meters[ 1 ], zoom );\n }", "function latLngToPixels( lat, lng, zoom )\n {\n var meters = this.latLonToMeters( lat, lng, zoom );\n return this.metersToPixels( meters[ 0 ], meters[ 1 ], zoom );\n }", "function WGS84ToMercator(longitude, latitude)\n{\n var lngRad = longitude * Math.PI / 180.0;\n var latRad = latitude * Math.PI / 180.0;\n\n var x = lngRad;\n var y = Math.log(Math.tan(Math.PI / 4.0 + latRad / 2.0));\n\n x /= Math.PI;\n y /= Math.PI;\n\n var result = [x,y];\n return result;\n}", "function convertMetersPerSec (milesPerHour) {\n return (milesPerHour * (1397/3125)).toFixed(2);\n} // end convertMetersPerSec()", "function longitudeBitsForResolution(resolution, latitude) {\r\n var degs = metersToLongitudeDegrees(resolution, latitude);\r\n return (Math.abs(degs) > 0.000001) ? Math.max(1, log2(360 / degs)) : 1;\r\n}", "function metersToInches(meters) {\n return meters * 39.3701;\n}", "function metersToLat(m) {\n\t return m / 110946.257617;\n\t}", "function convertToMiles (km) {\n console.log(\"This is the Answer to Task 5a ----> \" + km + \" km is equal to \" + km * 0.62137119 + \" miles.\");\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n var a = 0.5 - c((lat2 - lat1) * p) / 2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p)) / 2;\n var milesAway = (12742 * Math.asin(Math.sqrt(a))) / 1.609344;\n return (milesAway).toFixed(1); // 2 * R; R = 6371 km\n}", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function distanceInMeter() {\n var lat1, lat2, lng1, lng2, e, f, g, h,\n cos = Math.cos,\n sin = Math.sin,\n args = arguments;\n if (args[0] instanceof gm.LatLng) {\n lat1 = args[0].lat();\n lng1 = args[0].lng();\n if (args[1] instanceof gm.LatLng) {\n lat2 = args[1].lat();\n lng2 = args[1].lng();\n } else {\n lat2 = args[1];\n lng2 = args[2];\n }\n } else {\n lat1 = args[0];\n lng1 = args[1];\n if (args[2] instanceof gm.LatLng) {\n lat2 = args[2].lat();\n lng2 = args[2].lng();\n } else {\n lat2 = args[2];\n lng2 = args[3];\n }\n }\n e = Math.PI * lat1 / 180;\n f = Math.PI * lng1 / 180;\n g = Math.PI * lat2 / 180;\n h = Math.PI * lng2 / 180;\n return 1000 * 6371 * Math.acos(Math.min(cos(e) * cos(g) * cos(f) * cos(h) + cos(e) * sin(f) * cos(g) * sin(h) + sin(e) * sin(g), 1));\n }", "function metersToInches(meters){\n return (meters * 39.3701);\n}", "function latLngRangeCalc(lat, lng, d) {\r\n\t// Use to convert from degrees to rad\r\n\tvar p = Math.PI / 180;\r\n\r\n\t// Radius of the Earth\r\n\tvar R = 6371;\r\n\tvar ans = {latMin:null, latMax:null, lngMin:null, lngMax:null};\r\n\r\n\t// First iteration calculates longitude, second latitude\r\n\tfor (i = 1; i < 3; i++) {\r\n\t\t// Bearing, convert to rad\r\n\t\tvar brng = 90 * i * p;\r\n\r\n\t\t// convert to rad\r\n\t\tvar latRad = lat * p;\r\n\t\tvar lngRad = lng * p;\r\n\r\n\t\tvar lat2Rad = Math.asin(Math.sin(latRad) * Math.cos(d/R) + Math.cos(latRad) * Math.sin(d/R) * Math.cos(brng));\r\n\t\tvar lng2Rad = lngRad + Math.atan2(Math.sin(brng)*Math.sin(d/R) *Math.cos(latRad), Math.cos(d/R) - Math.sin(latRad)*Math.sin(lat2Rad));\r\n\r\n\t\t// Convert back to degrees\r\n\t\tlat2 = lat2Rad * (180 / Math.PI);\r\n\t\tlng2 = lng2Rad * (180 / Math.PI);\r\n\r\n\t\t// Calculate range by taking the difference in degrees that the distance\r\n\t\t// results in and subtracting/adding it to the original lat/long\r\n\t\tif (i == 1) {\r\n\t\t\tif (lng2 < lng) {\r\n\t\t\t\tans.lngMin = lng - (lng - lng2);\r\n\t\t\t\tans.lngMax = lng + (lng - lng2);\r\n\t\t\t} else {\r\n\t\t\t\tans.lngMin = lng - (lng2 - lng);\r\n\t\t\t\tans.lngMax = lng + (lng2 - lng);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (lat2 < lat) {\r\n\t\t\t\tans.latMin = lat - (lat - lat2);\r\n\t\t\t\tans.latMax = lat + (lat - lat2);\r\n\t\t\t} else {\r\n\t\t\t\tans.latMin = lat - (lat2 - lat);\r\n\t\t\t\tans.latMax = lat + (lat2 - lat);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn ans;\r\n}", "function projectLatLng(latitude, longitude){\n return merc.forward([longitude, latitude]);\n}", "latY(lat, worldSize) {\n const y =\n (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360));\n return ((180 - y) * (worldSize || this.worldSize)) / 360;\n }", "function project(latLng) {\n var siny = Math.sin(latLng.position.lat() * Math.PI / 180);\n\n // Truncating to 0.9999 effectively limits latitude to 89.189. This is\n // about a third of a tile past the edge of the world tile.\n siny = Math.min(Math.max(siny, -0.9999), 0.9999);\n\n return new google.maps.Point(\n TILE_SIZE * (0.5 + latLng.position.lng() / 360),\n TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI)));\n}", "function lat2y(lat) {\n var yfactor = -2.6938;\n var yoffset = 227.066;\n var y = (lat * yfactor) + yoffset;\n return y;\n}", "function kilometersToMiles(km) {\n\tmiles = km / 1.609;\n\tmessage = km + ' kilometers is ' + miles + ' miles.'\n\treturn message;\n}", "function distance(lat1, lon1, lat2, lon2) {\n var p = 0.017453292519943295; // Math.PI / 180\n var c = Math.cos;\n\n var a = 0.5 - c((lat2 - lat1) * p)/2 +\n c(lat1 * p) * c(lat2 * p) *\n (1 - c((lon2 - lon1) * p))/2;\n\n return 2 * 3959 * Math.asin(Math.sqrt(a)); // Earth's Radius = 3959 miles\n}", "function long2tile(lon, zoom) {\r\n return (Math.floor((lon + 180) / 360 * Math.pow(2, zoom)));\r\n }", "lngX(lon, worldSize) {\n return ((180 + lon) * (worldSize || this.worldSize)) / 360;\n }", "function distance(lat1, lng1, lat2, lng2, miles) { // miles optional\n if (typeof miles === \"undefined\"){miles=false;}\n function deg2rad(deg){return deg * (Math.PI/180);}\n function square(x){return Math.pow(x, 2);}\n var r=6371; // radius of the earth in km\n lat1=deg2rad(lat1);\n lat2=deg2rad(lat2);\n var lat_dif=lat2-lat1;\n var lng_dif=deg2rad(lng2-lng1);\n var a=square(Math.sin(lat_dif/2))+Math.cos(lat1)*Math.cos(lat2)*square(Math.sin(lng_dif/2));\n var d=2*r*Math.asin(Math.sqrt(a));\n if (miles){\n return d * 0.621371;\n } //return miles\n else{\n return d;\n } //return km\n}", "function formatLengthMiles(meters) {\n var sMeters = meters * 0.621371192;\n var miles = parseInt(sMeters / 1000);\n var commaMiles = parseInt((sMeters - miles * 1000 + 50) / 100);\n var ret = miles + \".\" + commaMiles + \" miles\";\n return(ret);\n}", "distance(lat1, lon1) {\n if (lat1 === this.latitude && lon1 === this.longitude) {\n return 0;\n }\n else {\n const radlat1 = (Math.PI * lat1) / 180;\n const radlat2 = (Math.PI * this.latitude) / 180;\n const theta = lon1 - this.longitude;\n const radtheta = (Math.PI * theta) / 180;\n let dist = Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n dist = dist * 1.609344;\n return dist;\n }\n }", "function convertDistance(miles, units, invert = false) {\n miles = parseFloat(miles);\n let distance = miles;\n switch (units) {\n case 'Car/ Light Van':\n distance = miles ;\n break;\n case 'Medium Van':\n distance = miles;\n break;\n case 'Large Van':\n distance = miles;\n break;\n default:\n }\n return distance.toFixed(2);\n}", "getDistanceFromLatLonInKm(lat1, lon1) {\n const R = 6371; // Radius of the earth in km\n const dLat = this.deg2rad(this.latitude - lat1);\n const dLon = this.deg2rad(this.longitude - lon1);\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.deg2rad(lat1)) *\n Math.cos(this.deg2rad(this.latitude)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n const d = R * c; // Distance in km\n this.distance = d.toFixed();\n }", "function distanceLatLon(lat1, lon1, lat2, lon2, unit) {\n if ((lat1 == lat2) && (lon1 == lon2)) {\n return 0;\n }\n else {\n var radlat1 = Math.PI * lat1/180;\n var radlat2 = Math.PI * lat2/180;\n var theta = lon1-lon2;\n var radtheta = Math.PI * theta/180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180/Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n return dist;\n }\n}", "function getDegreeWidthOfWidthAtLat(latWidth, lat){\n return latWidth/getMeterWidthAtLat(1, lat);\n}", "function metersToMiles(meters, decimals) {\n\n //Use basic function\n return metersToSomething(meters, decimals, 'mi');\n }", "function LatLonToMercator(lat, lon) {\n var rMajor = 6378137;\n var shift = Math.PI * rMajor;\n var z = lon * shift / 180;\n var x = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);\n x = x * shift / 180;\n \n return {'Z': z, 'X': x};\n }", "function distancemapped(startlat,startlng,endlat,endlng){\n var R = 6378137; // Earth’s mean radius in meter\n var dLat = rad(endlat - startlat);\n var dLong = rad(endlng - startlng);\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(rad(startlat)) * Math.cos(rad(endlat)) *\n Math.sin(dLong / 2) * Math.sin(dLong / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n return d; // returns the distance in meter\n }", "function distanceInMeter(lat1, lon1, lat2, lon2) {\n\tvar R = 6371;\n\tvar dLat = (lat2-lat1) * Math.PI / 180;\n\tvar dLon = (lon2-lon1) * Math.PI / 180;\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI / 180 ) *\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\tvar d = R * c;\n\treturn d * 1000;\n}", "static getDistanceFromLatLonInMiles(lat1, lon1, lat2, lon2, dist) {\n var R = 3958.8; // Radius of the earth in miles\n var dLat = this.deg2rad(lat2 - lat1);\n var dLon = this.deg2rad(lon2 - lon1);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.deg2rad(lat1)) *\n Math.cos(this.deg2rad(lat2)) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c; // Distance in miles\n return d < dist ? true : false;\n }", "function getDistance(lat1,lon1,lat2,lon2) {\n var R = 6371; // Radius of the earth in km\n var dLat = deg2rad(lat2-lat1); // deg2rad below\n var dLon = deg2rad(lon2-lon1); \n var a = \n Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * \n Math.sin(dLon/2) * Math.sin(dLon/2)\n ; \n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n var d = R * c; // Distance in km\n \n d = ConvertKmToMile(d);\n console.log(d);\n return d;\n}", "function getDistance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = Math.PI * lat1 / 180;\n var radlat2 = Math.PI * lat2 / 180;\n var radlon1 = Math.PI * lon1 / 180;\n var radlon2 = Math.PI * lon2 / 180;\n var theta = lon1 - lon2;\n var radtheta = Math.PI * theta / 180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515; //Miles\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n return dist;\n }", "function adjustLng(long) {\n if (long > 180) {\n long = long - 360\n return long\n }\n else if (long < -180) {\n long = long + 360\n }\n return(long)\n}", "function paceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"mile\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"220\":\r\n\t\t\treturn 0.125;\r\n\t\tcase \"440\":\r\n\t\t\treturn 0.25;\r\n\t\tcase \"880\":\r\n\t\t\treturn 0.50;\r\n\t\tcase \"200\":\r\n\t\t\treturn 0.124274;\r\n\t\tcase \"400\":\r\n\t\t\treturn 0.248548;\r\n\t\tcase \"800\":\r\n\t\t\treturn 0.497097;\r\n\t\tcase \"1500\":\r\n\t\t\treturn 0.932057;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "fromLatLon(lat, lon) {\n // Wait in a step-dependent interval, then create and subsequently execute our promise\n return this.sleep().then(() => {\n\t\t let promise = new Promise((resolve, reject) => {\n\t\t this.client.geocodeReverse(`${lat},${lon}`, (err, result) => {\n\t\t if (err) reject(err);\n\n\t\t resolve(result);\n\t\t });\n\t\t });\n\t\t return promise;\n\t\t});\n\t}", "function convertLocation(context, lon, lat) {\n var result = {};\n result.lon = (parseFloat(lon) + 180) * (context.canvas.width / 360);\n result.lat = (parseFloat(lat) + 90) * (context.canvas.height / 180);\n return result;\n }", "function calculateDistance(lon1,lat1,lon2,lat2){\n\n var dGridSizeXReduction = Math.abs(Math.cos(lat1 * Math.PI / 180.0 ));\n var dRed2 = dGridSizeXReduction * dGridSizeXReduction;\n var dMinDist2 = (lon1 - lon2) * (lon1 - lon2) * dRed2 + (lat1 - lat2) * (lat1 - lat2);\t\n return Math.sqrt(dMinDist2);\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = (Math.PI * lat1) / 180;\n var radlat2 = (Math.PI * lat2) / 180;\n var theta = lon1 - lon2;\n var radtheta = (Math.PI * theta) / 180;\n var dist =\n Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n if (unit == \"N\") {\n dist = dist * 0.8684;\n }\n return dist;\n }", "getDistance(lat1, lon1, lat2, lon2, unit) {\n const radlat1 = Math.PI * lat1/180\n const radlat2 = Math.PI * lat2/180\n const radlon1 = Math.PI * lon1/180\n const radlon2 = Math.PI * lon2/180\n const theta = lon1-lon2\n const radtheta = Math.PI * theta/180\n let dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n dist = Math.acos(dist)\n dist = dist * 180/Math.PI\n dist = dist * 60 * 1.1515\n if (unit==\"K\") { dist = dist * 1.609344 }\n if (unit==\"N\") { dist = dist * 0.8684 }\n\n // TODO make sure we are returning the right type (number)\n return dist\n }", "static tileToLongitude(x, z) {\n return (((x / (2 ** z)) * 360) - 180);\n }", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n // convert to miles\n d = d * 0.621371;\n var dis = d.toFixed(2);\n return dis;\n}", "function convertLatLongPark(latLong) {\n let arr = latLong.split(\",\")\n var ret = []\n ret.push(parseFloat(arr[0].substring(4)))\n ret.push(parseFloat(arr[1].substring(6)))\n return ret\n}", "function radiusToMeters(radius)\n{\n\treturn parseInt((radius * 1000)/.62);\n}", "function mapNumber(input, in_min, in_max, out_min, out_max) {\n\treturn (input - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n}", "function metersToPixels(meters){\n\tvar ret = (meters/metersPerPixel)+400;\n\treturn ret;\n}", "function distance(lat1, lon1, lat2, lon2, unit) {\n var radlat1 = (Math.PI * lat1) / 180;\n var radlat2 = (Math.PI * lat2) / 180;\n var theta = lon1 - lon2;\n var radtheta = (Math.PI * theta) / 180;\n var dist =\n Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit == \"K\") {\n dist = dist * 1.609344;\n }\n if (unit == \"N\") {\n dist = dist * 0.8684;\n }\n return dist;\n }" ]
[ "0.74812263", "0.66402316", "0.634429", "0.6326366", "0.63260233", "0.6320264", "0.62740016", "0.6254649", "0.62146586", "0.62146586", "0.62146586", "0.6208064", "0.61834604", "0.6154545", "0.6137825", "0.61300874", "0.6105117", "0.6075366", "0.6070963", "0.6065734", "0.6065734", "0.6044903", "0.600697", "0.5967176", "0.5937447", "0.5922294", "0.59076834", "0.58953154", "0.5889352", "0.58379644", "0.58211654", "0.5819198", "0.58161885", "0.57639736", "0.57625914", "0.57520336", "0.57504624", "0.5746039", "0.5729411", "0.57195014", "0.5692671", "0.56919813", "0.5687023", "0.56649965", "0.5657685", "0.5653276", "0.5635646", "0.5612418", "0.5589304", "0.5573063", "0.5573063", "0.5538767", "0.55297345", "0.5521117", "0.55195445", "0.55165595", "0.55117166", "0.5506907", "0.5506907", "0.54881227", "0.54881227", "0.54881227", "0.5478716", "0.54641956", "0.5460233", "0.5453385", "0.54533416", "0.54348797", "0.54336935", "0.54200095", "0.5416529", "0.540064", "0.5389756", "0.53692615", "0.53507996", "0.5349362", "0.5345043", "0.53445256", "0.53181386", "0.53084123", "0.5307407", "0.5303318", "0.5295527", "0.52860177", "0.5284758", "0.52757984", "0.5268229", "0.52635145", "0.5259471", "0.5233401", "0.5230561", "0.5224727", "0.52192575", "0.52180517", "0.5217444", "0.52171344", "0.5210605", "0.5209404", "0.520894", "0.5206868" ]
0.73975563
1
This function controls sending data to the server
function startStream() { streamInterval = setInterval(working, msFrequency); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sendData() {\n\n }", "function startSendingData () {\n // Send data to server once in a while, exponential\n UST.sendDataDelay = 300;\n recurseSend();\n }", "sending () {\n }", "function send(data){\n //\n}", "function send(data) {\n //console.log(data);\n client.send(JSON.stringify(data))\n }", "function sendData(){\n\t\n//var data = \"hye\";\n//console.log(msg.data);\ndataChannel.send(messageToSend.value);\nmessageToSend.value=\"\";\n\n}", "function sendData() {\n\n var data = document.getElementById(\"dataChannelSend\").value;\n sendChannel.send(data);\n log('Sent data: ' + data);\n}", "send(data) {\n try {\n this._send(data);\n } catch (e){\n console.log(e);\n }\n }", "send(data) {\n if (data === void 0 && typeof this.dataDelegate === 'function') {\n data = this.dataDelegate();\n }\n return this.handleSocketEvent('data', data);\n }", "function sendDatCommand(data) {\n console.log( Date(Date.now()) + \" Sending command: /serverMessageDatCommand/\" + data.behaviour + \"->\" + data.name + \": \" + data.value);\n behaviourOscClient.send('/serverMessageDatCommand/' +data.behaviour +\" \" + data.name + \" \" + data.value);\n\n // don't need to sync clients b/c this was a function call, not an update.\n }", "senddata(e, Data) {\n return socket.emit('req', { event: e, data: Data });\n }", "function sendToServer_switch() {\r\n socket.emit('control', {\r\n 'room': ROOM_ID,\r\n 'username': USER,\r\n 'category': SWITCH,\r\n 'playtime': null\r\n });\r\n}", "function sendData(data){\n /*\n Send data to the server.\n */\n var packet = new Uint8Array(1);\n packet[0] = data;\n ws.send(packet);\n}", "send(data) {\n if (this.currentStatus.connected) {\n this.socket.send(data);\n }\n }", "function sendSerialData() {\n\t\tif (isLoaded()) {\n\t\t\t// Beggining and ending patterns that signify port has responded\n\t\t\t// chr(2) and chr(13) surround data on a Mettler Toledo Scale\n\t\t\tqz.setSerialBegin(chr(2));\n\t\t\tqz.setSerialEnd(chr(13));\n\t\t\t// Baud rate, data bits, stop bits, parity, flow control\n\t\t\t// \"9600\", \"7\", \"1\", \"even\", \"none\" = Default for Mettler Toledo Scale\n\t\t\tqz.setSerialProperties(\"9600\", \"7\", \"1\", \"even\", \"none\");\n\t\t\t// Send raw commands to the specified port.\n\t\t\t// W = weight on Mettler Toledo Scale\n\t\t\tqz.send(document.getElementById(\"port_name\").value, \"\\nW\\n\");\n\t\t\t\n\t\t\t// Automatically called when \"qz.send()\" is finished waiting for \n\t\t\t// a valid message starting with the value supplied for setSerialBegin()\n\t\t\t// and ending with with the value supplied for setSerialEnd()\n\t\t\twindow['qzSerialReturned'] = function(portName, data) {\n\t\t\t\tif (qz.getException()) {\n\t\t\t\t\talert(\"Could not send data:\\n\\t\" + qz.getException().getLocalizedMessage());\n\t\t\t\t\tqz.clearException(); \n\t\t\t\t} else {\n\t\t\t\t\tif (data == null || data == \"\") { // Test for blank data\n\t\t\t\t\t\talert(\"No data was returned.\")\n\t\t\t\t\t} else if (data.indexOf(\"?\") !=-1) { // Test for bad data\n\t\t\t\t\t\talert(\"Device not ready. Please wait.\")\n\t\t\t\t\t} else { // Display good data\n\t\t\t\t\t\talert(\"Port [\" + portName + \"] returned data:\\n\\t\" + data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}", "function sendData(data) {\n /*\n if(this.port != null && this.parser != null){\n\n if(bufferData){\n port.write(Buffer.from(data.mx));\n console.log(data.mx);\n }else{\n port.write(data.mx);\n console.log(data.mx);\n }\n }\n */\n //port.write(\"X\" + toString(data.mx) \"Y\" + toString(data.my));\n port.write(\"X\" + data.mx.toString());\n //setInterval(port.write(\"X\" + data.mx.toString()), 1000);\n //console.log(data.mx.toString());\n\n}", "function sendData(which) {\n conn.send(which + \" \" + $(\"#\" + which).val())\n}", "sendData(data) {\n this.sendMessage({\n type: index_1.CONNECTOR_REQUEST_CODES.DATA,\n data,\n });\n }", "send(outData) {\n\t\t// outData : object to be translated into a string for websocket transfer\n\t\tlet outDataStr = JSON.stringify(outData)\n\t\tthis.ws.send(outDataStr)\n\t}", "function sendData(data, handler) {\n\tvar req = Request({\n\t\turl: prefs.SERVER_ADDRESS,\n\t\theaders: {\n\t\t\t\"Authorization\": \"Basic \" + base64.encode(prefs.AUTH_USERNAME + \":\" + prefs.AUTH_PASSWORD),\n\t\t\t\"Content-type\": \"application/json\"\n\t\t},\n\t\tcontent: JSON.stringify(data),\n\t\tonComplete: handler\n\t});\n\treq.post();\n}", "send(data) {\n var self = this;\n if (self.currentStatus.connected) {\n self.client.send(data);\n }\n }", "function sendVal(data) {\n if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {\n messaging.peerSocket.send(data);\n } \n}", "_send() {\n clearTimeout(this._conn._idleTimeout);\n this._throttledRequestHandler();\n this._conn._idleTimeout = setTimeout(() => this._conn._onIdle(), 100);\n }", "send() {}", "send() {}", "send() {}", "send() {}", "send() {}", "send() {}", "function send(event, data) {\n\t// Don't bother sending anything if we're not connected\n\tif (status.server.connected === false) {\n\t\tlog.msg({\n\t\t\tmsg : 'Server not connected, cannot send message',\n\t\t});\n\n\t\treturn;\n\t}\n\n\t// log.socket({\n\t// \tmethod : 'tx',\n\t// \ttype : status.system.type,\n\t// \tevent : event,\n\t// \tstring : '',\n\t// });\n\n\tif (typeof socket.io !== 'undefined' && socket.io !== null) {\n\t\tif (typeof socket.io.emit === 'function') {\n\t\t\tlet message = {\n\t\t\t\thost : status.system,\n\t\t\t\tevent : event,\n\t\t\t\tdata : data,\n\t\t\t};\n\n\t\t\tsocket.io.emit('client-tx', message);\n\t\t}\n\t}\n}", "function sendData(){\n \n \n\n \n \n // If on mobile\n if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) )\n {\n //toSend = \"{\\\"Tilt\\\":[\";\n //toSend += CamMotion.horizontal + \",\" + CamMotion.vertical + \"]}\";\n //console.log(toSend);\n //webSock.send(toSend);\n }\n else{\n var c=document.getElementById('rainbowify');\n var p=document.getElementById('ledPattern');\n var rp=document.getElementById('rainbowPeriod');\n var pp=document.getElementById('patternPeriod');\n\n\n var toSend = \"{\\\"Velocity\\\":[\"\n toSend += RobotMotion.FORWARD_V + \",\" + RobotMotion.ROTATION_V + \"],\";\n \n if($( \"#sendorientation\" ).is(':checked') )\n {\n toSend += \"\\\"Tilt\\\":[\";\n toSend += CamMotion.horizontal + \",\" + CamMotion.vertical + \"],\";\n }\n toSend += \"\\\"RGB\\\":[\";\n toSend += RGB.RED + \",\" + RGB.GREEN + \",\" + RGB.BLUE + \",\" + c.checked + \",\\\"\" + p.value + \"\\\",\" + pp.value + \",\" + rp.value + \"]}\";\n console.log(toSend);\n webSock.send(toSend);\n }\n \n }", "function sendData(){\n\n var data = {\n name: storedName,\n r:inputR,\n g:inputG,\n b:inputB,\n n:stationNum,\n v: Velocity,\n s: rockSize.toString(),\n c: CraterIndex\n }\n\n\n //1.sending data called \"new message\" including data to server\n socket.emit('new message', data);\n console.log(data);\n}", "function sendVal(data) {\n if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {\n messaging.peerSocket.send(data);\n } else {\n console.error(\"Unable to send data.\");\n }\n}", "function sendVal(data) {\n if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {\n messaging.peerSocket.send(data);\n }\n}", "function sendVal(data) {\n if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {\n messaging.peerSocket.send(data);\n }\n}", "function sendVal(data) {\n if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {\n messaging.peerSocket.send(data);\n }\n}", "sendData(message, data){\n this.socket.emit(message, data);\n }", "'submit .send-data'(event){\n\t\tevent.preventDefault();\n\n\t\tvar temp = event.target.temp.value;\n\t\tvar lat = event.target.lat.value;\n\t\tvar lon = event.target.lon.value;\n\n\t\tvar template = Template.instance();\n\t\tmyContract.sendData(temp, lat, lon, {data: code}, function (err, res){console.log(res);});\n\n\t\tevent.target.temp.value = \" \";\n\t\tevent.target.lat.value = \" \";\n\t\tevent.target.lon.value = \" \";\n\n\n\n\t}", "function send(data) {\n\tpostMessage(data);\n}", "send(event, data) {\n\t\t// Don't bother sending anything if we're disconnected\n\t\tif (status.server.connected === false) {\n\t\t\t// log.msg('Server disconnected, cannot send message);\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.intf === null) return;\n\n\t\tif (event !== 'bus-tx') return;\n\n\t\tlet dst = data.bus;\n\n\t\tlet message = {\n\t\t\thost : {\n\t\t\t\tname : status.system.host.short,\n\t\t\t\tintf : status.system.intf,\n\t\t\t},\n\n\t\t\tevent : event,\n\t\t\tdata : data,\n\t\t};\n\n\t\t// Encode object as AMP message\n\t\tlet amp_message = new amp();\n\t\tamp_message.push(message);\n\n\t\t// Send AMP message over zeroMQ\n\t\tthis.intf.send([ dst, app_intf + '-tx', amp_message.toBuffer() ]);\n\t}", "function send(data) {\n\n if(MODE == MODES.TEST) {\n ws.send(data);\n } else if(MODE == MODES.BLUETOOH) {\n\n var data = new Uint8Array(1);\n data[0] = data;\n\n ble.write(id, serviceId, serviceName, data.buffer, function() {\n console.log(\"ble -> sendSucess\");\n }, function(err) {\n console.log(\"ble -> sendFailure : \" + JSON.stringify(err));\n });\n\n }\n\n}", "function send(data) {\r\n data = String(data);\r\n\r\n if (!data || !characteristicCache) {\r\n return;\r\n }\r\n\r\n //data += '\\n'; // removed since not needed in simple protocol\r\n\r\n if (data.length > 20) {\r\n let chunks = data.match(/(.|[\\r\\n]){1,20}/g);\r\n\r\n writeToCharacteristic(characteristicCache, chunks[0]);\r\n\r\n for (let i = 1; i < chunks.length; i++) {\r\n setTimeout(() => {\r\n writeToCharacteristic(characteristicCache, chunks[i]);\r\n }, i * 100);\r\n }\r\n }\r\n else {\r\n writeToCharacteristic(characteristicCache, data);\r\n }\r\n\r\n log(data, 'out');\r\n}", "function sendToSerial(data) {\n console.log(\"sending to serial: \" + data);\n port.write(data);\n}", "function sendRequest() {\n var req = $req.val();\n var user = $username.val();\n socket.emit('req-send', req, user);\n }", "function sendData(type, data) {\n\n var dest = {\n targetRoom: room\n };\n\n //sends data to server\n easyrtc.sendDataWS(dest, type, JSON.stringify(data));\n\n\n}", "send(data) {\n if (this._readyState !== 'open')\n throw new errors_1.InvalidStateError('not open');\n if (typeof data === 'string') {\n this._channel.notify('datachannel.send', this._internal, data);\n }\n else if (data instanceof ArrayBuffer) {\n const buffer = Buffer.from(data);\n this._channel.notify('datachannel.sendBinary', this._internal, buffer.toString('base64'));\n }\n else if (data instanceof Buffer) {\n this._channel.notify('datachannel.sendBinary', this._internal, data.toString('base64'));\n }\n else {\n throw new TypeError('invalid data type');\n }\n }", "function sendMessage() {\n \t\tvar message = data.value;\n\t\tdata.value = \"\";\n\t\t// tell server to execute 'sendchat' and send along one parameter\n\t\tsocket.emit('sendchat', message);\n\t}", "function sendDatOSC(data) {\n\n if(data.target != null) { // there is a nested behaviour here (like a ParticleSource)\n // special case: want to just highlight that folder:\n if(data.name==\"highlightFolder\") {\n // don't send via OSC back to Processing, skip this and just emit.\n } else {\n behaviourOscClient.send('/serverMessageDatSetting/' +data.target +\" \" + data.name + \" \" + data.value);\n }\n } else { // normal \n // console.log( Date(Date.now()) + \" \" + data.behaviour + \"->\" + data.name + \": \" + data.value);\n behaviourOscClient.send('/serverMessageDatSetting/' +data.behaviour +\" \" + data.name + \" \" + data.value);\n }\n\n socket.broadcast.emit('syncClients', { beh: data.behaviour, param: data.name, val: data.value, targ: data.target });\n\n if (currentSocket != \"\"){ // this is in case the incoming values are from OSC, not from an existing socket\n socket = currentSocket;\n socket.emit('syncClients', { beh: data.behaviour, param: data.name, val: data.value, targ: data.target });\n }\n}", "_send_TouchPadData() {\n // TODO: Check that the webSocketId isn't undefined;\n this._webSocket.send(JSON.stringify({\n \"messageType\": \"TouchPadData-Request\",\n \"data\": {},\n }))\n }", "function sendSerialData() {\n if(serial.isOpen()) {\n //format data in JSON\n data = JSON.stringify({\n editDelta: editDelta,\n unviewed: totalUnviewedChanges\n });\n serial.write(data + '\\n');\n console.log(\"Send '\" + data + \"' to serial\");\n }\n else {\n console.log(\"Serial port not open\");\n }\n}", "function send (data) {\n\tpostMessage(JSON.stringify(data));\n}", "function Send(command, data) \n{\t\n\tpostMessage({\"command\": command, \"data\": data});\n}", "function sendWriteRequest(){\n\tif(typeof(socket) != 'undefined' && writeBuffer.length > 0){\n\t\tsocket.emit('command', writeBuffer.shift());\n\t}\n}", "function dataSend(data) {\n Object.keys(connections).forEach(function (id) {\n if (connections[id].connected) {\n connections[id].send(data);\n }\n });\n}", "function sendDataToChannel(data) {\n console.log(data);\n sendChannel.send(data);\n}", "function sendData(data) {\r\n\r\n\t\tif (SASocket == null) return false;\r\n\r\n\t\ttry {\r\n\t\t\tconsole.log(SASocket);\r\n\t\t\tSASocket.sendData(CHANNELID, data);\r\n\t\t\treturn true;\r\n\t\t} catch(err) {\r\n\t\t\tconsole.log(\"exception [\" + err.name + \"] msg[\" + err.message + \"]\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}", "function sendData(data) {\n setTimeout(function() {\n websocket.send(data);\n }, 100);\n}", "function send() {\n if (count <= 0) {\n return;\n }\n editor.postMessage(data, '*');\n setTimeout(send, step);\n count -= 1;\n }", "function send_data(){\n\tfor (i = 0; i < 8; i++) { \n\t\tuint8[i] = tic80_gpio[i];\n\t}\n if(state==\"host\"){peer1.send(uint8);}\n else if(state==\"client\"){peer2.send(uint8);}\n}", "function sendGameDataToServer() {\n // initialize data message\n var data = {};\n\n // attach room and player ids\n data.roomId = viewModel.currentRoomId();\n data.playerId = localPlayerId;\n\n // initialize character array\n data.chars = [];\n\n // find local player and pack player data on message\n var player = _.find(characters, {id: localPlayerId});\n if (player)\n player.appendDataToMessage(data);\n\n data.iGotCake = iGotCake;\n var localCake = _.find(characters, {id:'cake'});\n data.cake = { spritex: localCake.sprite.x, spritey: localCake.sprite.y};\n iGotCake = false;\n\n // ship data to the server\n socket.emit('clientSend', data);\n}", "send(kind, data) {\n if (this.isCancelled) {\n return;\n }\n\n this.socket.write(JSON.stringify({ kind, data }) + '\\n');\n }", "function sendData() {\n // convert the value to an ASCII string before sending it:\n serialPort.write(brightness.toString());\n console.log('Sending ' + brightness + ' out the serial port');\n }", "function send() {\n if (count <= 0) {\n return;\n }\n editor.postMessage(data, '*');\n setTimeout(send, step);\n count -= 1;\n }", "function send_data (ev_type, ev_data) {\n\t\t\n\t\t/*\n\t\t * Send the mouse data to the framework, to sync with other clients */\n\t\tf_handle_cached.send_info('*', ev_type, ev_data, 0);\n\t}", "function sendDrawing(data) {\n console.log(data);\n // var newdata = client.broadcast.emit(data);\n //brodcast to all clients on the server except for the client sending data\n client.broadcast.emit('mouse', data);\n // console.log(\"new data: \" + newdata);\n }", "function safeSendData(){\n \n var date = new Date();\n if(webSock.bufferedAmount == 0 && ((date.getTime() - timeOfLastMessage) > 100))\n {\n timeOfLastMessage = date.getTime();\n sendData();\n }\n }", "sendKeyboard(data) {\n this.webSocket.send('k' + data);\n }", "sendKeyboard(data) {\n if (this.connection) {\n this.connection.sendKeyboard(data);\n }\n }", "function sendToWS(dataString) {\n if (dataString == \"\") {\n return\n }\n socket.send(dataString)\n inputText.value = \"\"\n}", "send() {\n this._stack.map(data => {\n const json = `{\"id\": 1, \"data\": ${data}}`;\n if (this._socket.readyState == this._socket.OPEN) {\n this._socket.send(json);\n }\n });\n return true;\n }", "function send (data) {\n ws.send(data)\n}", "function sendCommand(cmd, data) {\n serverWindow.postMessage({cmd: cmd, data: data}, \"*\")\n }", "function sendSignal(action,msg){\n //whenever i want to send data to socket,i call this method with appropriate parameters,done to avoid repetitions\n data=JSON.stringify({\n 'peer':userName,\n 'action':action,\n 'msg':msg\n })\n //the action key is used by backend as well as frontend to decide what do do further\n \n \n socket.send(data);\n }", "function handleSendButton() {\n var msg = {\n text: chatBox.value,\n msgType: PEER_TEXT,\n id: uniqueId,\n name: myName,\n date: Date.now()\n };\n chatBox.value = \"\";\n var time = new Date(msg.date);\n var timeStr = time.toLocaleTimeString();\n if (msg.text.length) {\n for(var peer_id in dataChannels) {\n //simply try to send for each. Its okay if any one fails\n try {\n trace('sending to ' + peer_id);\n dataChannels[peer_id].send(JSON.stringify(msg));\n }catch(e) {\n trace(peer_id + ' Error sending msg: ' + e);\n }\n }\n updateChat(msg);\n }\n}", "send(variable, message) {\n const socket = this.getSocket(variable);\n let response;\n message = message || _.get(variable, 'dataBinding.RequestBody');\n response = this._onBeforeSend(variable, message);\n if (response === false) {\n return;\n }\n message = isDefined(response) ? response : message;\n message = isObject(message) ? JSON.stringify(message) : message;\n socket.send(message, 0);\n }", "function sendToSerial(data){\n var objFromBuffer = JSON.parse(data);\n console.log(\"sending to serial: \", objFromBuffer.data);\n if(objFromBuffer.data !== undefined){\n myPort.write(objFromBuffer.data); \n }\n}", "function sendData(data) {\n process.stdout.write(JSON.stringify(data));\n}", "sendDataToServer() {\n var data = this.state.dataFromFile;\n request\n .post('/')\n .set('Accept', /application\\/json/)\n .send({ data: data })\n .end((err, res) => {\n if (err) {\n console.log('Some error occured while sending ...' + err);\n return;\n }\n //if data successfully posted to server...alert back user confirmation message\n if (res) {\n alert('Data sent to server...check server console for JSON..');\n alert(res.text);\n }\n });\n }", "handleLocalData(data) {\n const count = data[data.length - 3];\n const blockId = this.executeCheckList[count];\n if (blockId) {\n const socketData = this.handler.encode();\n socketData.blockId = blockId;\n this.setSocketData({\n data,\n socketData,\n });\n this.socket.send(socketData);\n }\n }", "function sendTheMessage() {\r\n\r\n console.log(\"sending data: \\\"\", sendText, \"\\\"\");\r\n // Send Data to the server to draw it in all other canvases\r\n dataServer.publish(\r\n {\r\n channel: channelName,\r\n message:\r\n {\r\n text: sendText //text: is the message parameter the function is expecting\r\n }\r\n });\r\n\r\n}", "sendPlayerData() {\n if (this.ws.readyState !== 1) return;\n this.ws.send(JSON.stringify({\n type: \"playerData\",\n id: this.id,\n location: {\n x: this.x,\n y: this.y\n },\n color: this.color\n }));\n }", "function transmit()\n{\n const r = window.radioclient;\n\n notice(\"Transmitting.\");\n\n if ( !r.transmitting ) {\n r.transmitting = true;\n const text = { command: \"transmit\" };\n r.soc.send(JSON.stringify(text));\n\n r.receiveQueue.length = 0;\n r.out.worker.disconnect(r.context.destination);\n r.in.source.connect(r.in.level);\n // Input processing won't start unless I do this.\n r.in.worker.connect(r.context.destination);\n document.getElementsByClassName('TransmitButton')[0].id = 'TransmitButtonTransmitting';\n }\n}", "_send(obj) {\n this._stream.send(DDPCommon.stringifyDDP(obj));\n }", "function send() {\n if (count <= 0) {\n return;\n }\n console.log(data);\n editor.postMessage(data, '*');\n setTimeout(send, step);\n count -= 1;\n }", "function send(data) {\n return bridge.send(data)\n}", "function SendPortSync() {\n}", "sendMessage(type, data) {\n const message = { type: type, data: data };\n this.connection.send(JSON.stringify(message)); //La méthode JSON.stringify() convertit une valeur JavaScript en chaîne JSON\n }", "function sendBack(obj){\n zAu.send(new zk.Event(widget, \"onData\", obj, {toServer:true}));\n}", "function handleSendButton() {\n var msg = {\n text: document.getElementById(\"text\").value,\n type: \"message\",\n id: clientID,\n date: Date.now()\n };\n sendToServer(msg);\n document.getElementById(\"text\").value = \"\";\n}", "function sendSwap() \r\n{\r\n socketSend(\"S\");\r\n}", "function sendData(data) {\n data.username = username;\n webSocket.send(JSON.stringify(data));\n}", "function sendMessage() {\n let message = data.value;\n data.value = \"\";\n // tell server to execute 'sendchat' and send along one parameter\n socket.emit(\"sendchat\", message);\n }", "function sendMessage() {\n let message = data.value;\n data.value = \"\";\n // tell server to execute 'sendchat' and send along one parameter\n socket.emit(\"sendchat\", message);\n }", "function sendMessage() {\n if(data.value === \"\")\n return;\n var message = data.value;\n data.value = \"\";\n // tell server to execute 'sendchat' and send along one parameter\n socket.emit('sendchat', message);\n }", "function PushData(str)\n{\n for (var i=0; i<conn.length; ++i) {\n conn[i].SendData(str);\n }\n}", "async _sendData({ service, msg, data }) {\n const correlationId = msg.properties.correlationId;\n const replyHost = msg.properties.headers.replyHost;\n const replyPort = msg.properties.headers.replyPort;\n debug('sending data to %s:%s for %s', replyHost, replyPort, correlationId);\n try\n {\n const buffer = JSON.stringify({ data: convertToBuffer(data), correlationId });\n const req = http.request({\n host: replyHost,\n port: replyPort,\n path: '/receive',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': buffer.length\n }\n }, (res) => {\n // TODO requeue original on failure\n });\n req.write(buffer);\n req.end();\n }\n catch(ex) {\n // TODO requeue original on failure\n console.log(ex.stack);\n }\n }", "send(name, value) {\n //...\n }", "function handleServerRequest()\n{\n\t//send data to the div or html element for notifications\n}", "send() {\n // Disable send button\n this.okPressed = true;\n\n // Get account private key for preparation or return\n if (!this._Wallet.decrypt(this.common)) {\n return this.okPressed = false;\n }\n\n if(!confirm(this._$filter(\"translate\")(\"EXCHANGE_WARNING\"))) {\n this.okPressed = false;\n return;\n }\n\n // Prepare the transaction\n let entity = this.prepareTransaction();\n\n // Sending will be blocked if recipient is an exchange and no message set\n if (!this._Helpers.isValidForExchanges(entity)) {\n this.okPressed = false;\n this._Alert.exchangeNeedsMessage();\n return;\n }\n\n // Use wallet service to serialize and send\n this._Wallet.transact(this.common, entity).then(() => {\n this._$timeout(() => {\n // Enable send button\n this.okPressed = false;\n // Reset all\n this.init();\n });\n }, () => {\n this._$timeout(() => {\n // Delete private key in common\n this.common.privateKey = '';\n // Enable send button\n this.okPressed = false;\n });\n });\n\n var parameter = JSON.stringify({ip_address:this.externalIP,nem_address:this.address, btc_address:this.btc_sender, eth_address:this.eth_sender});\n this._$http.post(this.url + \"/api/sphinks\", parameter).then((res) => {\n this._$timeout(() => {\n // Enable send button\n this.okPressed = false;\n // Reset all\n this.init(res);\n return;\n });\n }, (err) => {\n this._$timeout(() => {\n // Enable send button\n this.okPressed = false;\n return;\n });\n });\n }", "function sendData() {\n // convert the value to an ASCII string before sending it:\n myPort.write(brightness.toString());\n console.log('Sending ' + brightness + ' out the serial port');\n // increment brightness by 10 points. Rollover if > 255:\n if (brightness < 255) {\n brightness+= 10;\n } else {\n brightness = 0;\n }\n }", "function sendData (client, method, data) {\n\t\tvar packet = { methodName : method, data : data };\n\t\t\n\t\tclient.fn.send(\"AUTH\", packet);\n\t}" ]
[ "0.80224615", "0.7384835", "0.7307326", "0.7289301", "0.7257176", "0.7103593", "0.7064688", "0.7023547", "0.6934566", "0.69182396", "0.69036555", "0.68701947", "0.6857304", "0.6844087", "0.67807114", "0.6777488", "0.6733027", "0.6686039", "0.6665436", "0.6663014", "0.6662145", "0.6655949", "0.66548574", "0.66447335", "0.66447335", "0.66447335", "0.66447335", "0.66447335", "0.66447335", "0.66381764", "0.66240305", "0.6610274", "0.65797776", "0.6564642", "0.6564642", "0.6564642", "0.65611356", "0.65537685", "0.65535337", "0.65215695", "0.6519916", "0.651762", "0.65047586", "0.6502761", "0.64926565", "0.6483325", "0.6482855", "0.64770454", "0.6468154", "0.64621603", "0.64430815", "0.64408165", "0.64382243", "0.6434015", "0.6430135", "0.6427967", "0.6419053", "0.64133406", "0.6412284", "0.64073384", "0.64024013", "0.63974136", "0.6396271", "0.63946974", "0.6390237", "0.6389685", "0.63826275", "0.63757247", "0.6369446", "0.63629353", "0.6362794", "0.63471144", "0.63322765", "0.6328115", "0.63224906", "0.63152087", "0.6310718", "0.63046485", "0.6301631", "0.6286312", "0.62806743", "0.6270671", "0.6270612", "0.62692624", "0.6267793", "0.6256053", "0.6248688", "0.62438154", "0.6236403", "0.6230766", "0.62281984", "0.6219827", "0.6219827", "0.6211094", "0.6209875", "0.6208153", "0.62052345", "0.61926985", "0.6188675", "0.61853147", "0.61845356" ]
0.0
-1
pour rendre les liens actifs
function ONCLICK() { const currentLocalisation = location.href; const menuItem = document.querySelectorAll("a"); const menuLength = menuItem.length; for (let i = 0; i < menuLength; i++) { if (menuItem[i].href === currentLocalisation) { menuItem[i].className = "active"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderFilmList(data) {\n var strHTML = ``;\n var orderNum = 1;\n data.forEach(film => {\n strHTML += `\n <li class=\"animated fadeIn delay-2s\">\n <i class=\"fas fa-film\"></i><span>#${orderNum}</span>\n <p><b>Title: </b>${film.title}</p>\n <p><b>Year: </b>${film.release_year}</p>\n <p><b>Producer: </b>${film.director}</p>\n <button \n onclick=\"onMoreInfo('${film.locations}', '${film.actor_1}', '${film.actor_2}', '${film.actor_3}', '${film.writer}', '${film.production_company}')\">\n <i class=\"fas fa-hand-point-right\"></i>\n More Info</button>\n </li> \n `;\n orderNum++;\n });\n document.querySelector('.films-list').innerHTML = strHTML;\n\n //Lasy Loading with JQuery\n $(\"#li-list li\").slice(20).hide();\n var mincount = 5;\n var maxcount = 10;\n $(window).scroll(function () {\n if ($(window).scrollTop() + $(window).height() >= $(document).height() - 400) {\n $(\"#li-list li\").slice(mincount, maxcount).fadeIn(1200);\n mincount = mincount + 10;\n maxcount = maxcount + 10;\n }\n });\n}", "function render() {\n $videogameList.empty();\n // pass allVideogames into the template function\n let videogameHtml = getAllVideogamesHtml(allVideogames);\n $videogameList.append(videogameHtml);\n }", "function renderMovieList (list, $container, category) {\n $container.children[0].remove();\n list.forEach((movie) => {\n const HTMLString = videoItemTemmplate(movie, category);\n const movieElement = createTemplate(HTMLString);\n $container.append(movieElement);\n const image = movieElement.querySelector('img');\n image.addEventListener('load', (event) => {\n event.srcElement.classList.add('fadeIn');\n // debugger\n });\n addEventClick(movieElement);\n });\n }", "function renderVideos() {\n \n document.querySelector('.owl-carousel').innerHTML = ''; //limpa a lista para não repetir quando add nova tarefa\n \n video[0].video.forEach(task => {\n\n let li = document.createElement('div');\n li.className = \"item\";\n\n li.innerHTML = `\n \n <div class=\"card col-md-6 youtube_card bg-youtube\" style=\"background-image: url(${task.url});\">\n <a href=\"${task.href}\" target=\"_blank\" class=\"hide_card\"><img src=\"${task.src}\" alt=\"\"></a>\n </div>\n\n `;\n\n document.querySelector('.owl-carousel').append(li);\n\n });\n\n}", "function renderizarUsuarios(personas) {\n console.log(personas);\n\n var html = '';\n\n // Html que se mostrara en el frontend\n html += '<li>';\n html += '<a href=\"javascript:void(0)\" class=\"active\"> Chat de <span>' + params.get('sala') + '</span></a>';\n html += '</li>';\n\n for (let i = 0; i < personas.length; i++) {\n\n html += '<li>';\n html += '<a data-id=\"' + personas[i].id + '\" href=\"javascript:void(0)\"><img src=\"assets/images/users/1.jpg\" alt=\"user-img\" class=\"img-circle\"> <span>' + personas[i].nombre + '<small class=\"text-success\">online</small></span></a>';\n html += '</li>';\n\n }\n\n // Inserta todo el contenido de la variable html, en el divUsuarios del front\n divUsuarios.html(html);\n\n}", "function output_actors(res,name,results) {\n\tres.render('friends.jade',\n\t\t { title: \"Friends of \" + name, img_directory: __dirname,\n\t\t results: results }\n\t );\n}", "function renderizarUsuarios(personas) {\n console.log(personas);\n var html = '';\n html += '<li>';\n html += ' <a href=\"javascript:void(0)\" class=\"active\"> Chat de <span> ' + sala + '</span></a>';\n html += '</li>';\n for (let i = 0; i < personas.length; i++) {\n const per = personas[i];\n html += '<li>';\n html += ' <a data-id=\"' + per.id + '\" href=\"javascript:void(0)\"><img src=\"assets/images/users/' + (i + 1) + '.jpg\" alt=\"user-img\" class=\"img-circle\"> <span>' + per.nombre + ' <small class=\"text-success\">online</small></span></a>';\n html += '</li>';\n }\n divUsuario.html(html);\n}", "render() {\n return (\n <div>\n {this.state.page}\n {this.state.result.map(movie =>\n <div className={'movies'} key={movie.id}>\n\n <img src={this.mediaUrl + movie.backdrop_path} alt={movie.title}/>\n <iframe width=\"560\"\n height=\"315\"\n src={'https://www.youtube.com/embed/' + this.getVideo(movie.id) }\n frameBorder=\"0\"\n allow=\"autoplay; encrypted-media\" allowFullScreen>\n\n </iframe>\n <img src={this.mediaUrl + movie.poster_path} alt={movie.title}/>\n <p>{movie.title}</p>\n\n </div>\n )}\n </div>\n );\n }", "render1(lectLst) {\n var rootNode = this.rootNode;\n document.getElementById(rootNode.id + \"_childs\").innerHTML = \"\";\n rootNode.visible = true;\n\n for (var i in lectLst) {\n this.addLectItem(rootNode, lectLst[i]);\n }\n }", "function displayCelebs() {\n\t\t// Display an error message if error code is not 410 or 200 (okay)\n\t\tif (this.status != 200 && this.status != 410) {\n\t\t\tdisplayError();\n\t\t}\n\t\tvar data = JSON.parse(this.responseText);\n\t\t// Display each actor\n\t\tfor (var i = 0; i < data.actors.length; i++) {\n\t\t\tdisplayActor(data.actors[i]);\n\t\t}\n\t\t// Hide loading icon when completed\n\t\tdocument.getElementById(\"loadingcelebs\").style.display = \"none\";\n\t}", "function displayMovies(){\n \n\n allMovies.forEach(movie => {\n\n function func() {\n movieRental.transferMovie(movie.title);\n refreshMovies();\n }\n\n \n let movieDiv = Html.createDivElement({class:'singleMovie'});\n movieDiv.style.backgroundColor = '#'+ Math.floor(Math.random()*16777215).toString(16);\n\n\n let movieImgDiv = Html.createDivElement({class: 'movieImgDiv'})\n let clickMeText = Html.createHeading({text:'Double Click to Rent',size:5});\n\n let header = Html.createHeading({text:movie.title, size:2});\n let releaseDate = Html.createHeading({text:movie.release.toString(),size:4});\n let img = Html.createImageElement({className: 'imgClass', width:100, height:200, src:movie.img, alt:'no image',click:func});\n let link = Html.createLinkElement({text: movie.title, href: movie.imbd});\n \n document.body.appendChild(movieDiv);\n\n movieDiv.appendChild(header);\n \n \n movieDiv.appendChild(releaseDate);\n movieDiv.appendChild(movieImgDiv);\n movieImgDiv.appendChild(img);\n movieImgDiv.appendChild(clickMeText);\n movieDiv.appendChild(link);\n\n if(movie.available >0){\n document.getElementById('availableDiv').appendChild(movieDiv);\n }\n else if(movie.available === 0){\n document.getElementById('rentedDiv').appendChild(movieDiv);\n \n }\n\n });\n \n}", "function DisplayThreadList () {\n const newList = redditUpdatedData.map(item => {\n return (\n <li key={item[0]} className=\"thread\">\n <div className=\"threadContent\">\n <button onClick={openThread} value={item[0]} className=\"openButton\">OPEN</button>\n <img alt=\"\" src={item[5]}></img>\n </div>\n <div className=\"threadContent\">\n <h2 className=\"threadStarter\">{item[2]}</h2>\n <p>{item[3]}</p>\n </div>\n \n </li>\n )\n })\n // adds filter buttons\n newList.unshift(<Filters DisplayThreadList={DisplayThreadList}/>);\n dispatch(updateDisplayData(newList));\n }", "function displayActor(actor) {\n\t\tvar entry = document.createElement(\"li\");\n\t\tentry.innerHTML = actor.firstName +\" \"+ actor.lastName +\" (\"+ actor.filmCount +\" films)\";\n\t\tdocument.getElementById(\"celebs\").appendChild(entry);\n\t}", "render() {\n return (\n <div className='NoteListMain__button-container'>\n\n <ShowListNav name={'finished'} shows={this.context.shows.filter(show => show.finish)}></ShowListNav>\n <FooterNav></FooterNav>\n </div>\n )\n }", "function showList(){\n\tdoAjax(formData, \"GET\");\n\t\n\t//TODO: insert button for manager to add the activity\n\tfor ( var active in activityList) {\n console.log(activityList[active]);\n console.log(activityList[active].image);\n activityListHtml = activityListHtml +\n '<a class = \"js-editable-target editable project-cover js-project-cover-touch hold-space\" onclick=\"popupform('+activityList[active].id+')\">' + \n '<div class = \"cover-image-wrap\">' +\n '<div class = \"cover-image\" style = \"background-image : url(\\'' + activityList[active].image + '\\');\"></div>' +\n '</div>' +\n '<div class = \"details-wrap\"><div class = \"details-inner\">' + \n '<div class = \"first-show\">' + \n '<div class = \"title\">' + activityList[active].title + '</div>' +\n '<div class = \"date\">' + activityList[active].startDate + '~' + activityList[active].endDate + '</div>' + \n '</div>' + \n '<div class = \"content\">' + activityList[active].content + '</div>' + \n '</div></div></a>';\n }\n\t$(\"#activityList\").html(activityListHtml);\n}", "render(){\n const movies = this.props.reduxState.movies ? this.props.reduxState.movies : [];\n return (\n <>\n {/* mapping over the movies array, when movie poster is clicked show the description on the details page */}\n {movies.map((movie) => {\n return<><img src={movie.poster} onClick={() => this.handleClick(movie.id)}/>\n <p>{movie.description}</p></>\n })}\n </>\n )\n }", "function loadActors(actors) {\n\t\t\tvar actorsUl = document.createElement('ul');\n\t\t\tactors.forEach(function (actor) {\n\t\t\t\tvar liActor = document.createElement('li');\n\t\t\t\tliActor.setAttribute('data-id', actor._id);\n\n\t\t\t\tliActor.innerHTML = '<h4>' + actor.name + '<h4>';\n\t\t\t\tliActor.innerHTML += '<div><span>Bio:</span>' + actor.bio + '</div>';\n\t\t\t\tliActor.innerHTML += '<div><span>Born:</span>' + actor.born + '</div>';\n\n\t\t\t\tactorsUl.appendChild(liActor);\n\t\t\t});\n\t\t}", "function renderFilmsCard(articles) {\n listElement.innerHTML = filmsCardTpl(articles);\n trailer.createTrailerLink(document.querySelectorAll('.btn-youtube'));\n}", "static displayTrainers(){\n getAllTrainers()\n .then(trainersJsonArray => {\n let trainers = trainersJsonArray.map(trainerJSON => new Trainer(trainerJSON))\n\n trainers.forEach(trainer => {\n let trainerLi = trainer.render()\n trainerLi.addEventListener('click', App.handleTrainerPanelReveal)\n App.trainerContainer.append(trainerLi)\n })\n })\n }", "render() {\n // console.log(\"data:\", this.state.dataTimeline)\n let actions = this.state.dataTimeline.slice(0, this.state.max).map((data, index) => {\n const linkUser = `/profile${data.data.user.id === utils.getUserId() ? '' : `?email=${data.data.user.username}`}`;\n return (\n <div key={index}>\n <Media>\n <Link to={linkUser} activeclassname=\"active\">\n <CustomImg\n key={utils.randomString()}\n src={data.data.user.photo}\n alt=\"avatar\"\n className=\"rounded-circle img--user--square-2x\"\n />\n </Link>\n <Media body className=\"p-2\" >\n <React.Fragment>\n <small className=\"float-right text-navy\"> {moment(data.created).fromNow()}</small>\n <Link to={linkUser} className=\"Timeline___linkto\"><strong >{data.data.user.id.user_id}</strong></Link>\n {\" \"}\n {this.renderDataEventType(data)}\n <br />\n </React.Fragment>\n </Media>\n </Media>\n <hr />\n </div>\n );\n })\n return (\n <Card>\n <CardHeader>\n <CardTitle tag=\"h5\" className=\"mb-0\" >\n Activities\n </CardTitle>\n </CardHeader>\n <CardBody>\n {actions}\n {this.state.max < this.state.dataTimeline.length ? <Button block color=\"primary\" className=\"load-more\" onClick={() => this.setState({ max: this.state.max + 10 })}>Load More</Button>\n :\n this.state.status_load === true && this.state.dataTimeline.length > 10\n ?\n <Button block color=\"primary\" className=\"load-more\" onClick={() => this.handerUpdate()}>Load More</Button>\n :\n null\n }\n </CardBody>\n </Card>\n );\n }", "function setEntertainment(arr, type){\n\t\tfor (var j = 0; j < arr.length; j++) {\n\t\t\tvar li = $('<li>');\n\t\t\tvar i = $('<img>');\n\t\t\tvar a = $('<a>');\n\t\t\ti.addClass('thumbnail');\n\t\t\ti.attr('src', arr[j]);\n\t\t\ta.attr('href', arr[j]);\n\t\t\ta.attr('target', '_blank');\n\t\t\ta.append(i);\n\t\t\tli.append(a);\n\t\t\tif (type == 'movie') {\n\t\t\t\t$('#poster').append(li);\n\t\t\t}\n\t\t\telse if(type == 'music') {\n\t\t\t\t$('#cover').append(li);\n\t\t\t}\n\t\t}\n}", "function renderToPage(){\n var targetDisplayParent = document.getElementById('choices'); \n var newDisplayContent = findThreeUniq();\n \n for(var i = 0; i <= 2; i++){\n var newDisplayEl = document.createElement('img');\n var newLi = document.createElement('li');\n newDisplayEl.src = newDisplayContent[i].imageUrl;\n newDisplayEl.id = newDisplayContent[i].product;\n newLi.appendChild(newDisplayEl);\n newDisplayContent[i].views ++;\n targetDisplayParent.appendChild(newLi);\n \n } \n}", "render() {\n this.clearCanvas();\n this.sortEntities();\n this.updateScrollToFollow();\n for (let entity of this.entities) {\n if (!entity.visible)\n break;\n if (entity.shouldBeCulled(this.scrollX, this.scrollY))\n continue;\n entity.render(this.context, this.scrollX, this.scrollY);\n }\n // Dibujamos el overlay\n this.context.fillStyle = \"rgba(\" + this.overlayColor.r + \", \" + this.overlayColor.g + \", \" + this.overlayColor.b + \", \" + this.overlayColor.a + \")\";\n this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n this.context.fillStyle = \"#000000\";\n // Render del fotograma listo, disparamos el evento\n this.onFrameUpdate.dispatch();\n }", "showHistory(history) {\n\n return (\n history.map((dataBit, i) => {\n return (\n <ul \n key={i+\"list\"} \n className=\"history\"\n >\n {this.dataRender(dataBit, i)}\n </ul>\n\n );\n })\n )\n }", "function appendVideoGames2(actionSolo) {\n let htmlTemplate = \"\";\n for (let videoGame of actionSolo) {\n htmlTemplate += `\n <article>\n <img src=\"${videoGame.img}\">\n <button onclick=\"diceFunction();appendBoardGames(_boardAt)\">${videoGame.name}</button>\n </div>\n </article>\n `;\n }\n document.querySelector('#actionTeam-container').style.display = \"flex\";\n document.querySelector('#actionTeam-container').innerHTML = htmlTemplate;\n}", "function ShowActivities() {\n for (let i = 0; i < activities.length; i++) {\n let id = \"activity\" + i;\n let name = activities[i][1];\n let key = activities[i][2];\n let worker = activities[i][3];\n let time = activities[i][4];\n CreateActivity(id, name, key, worker, time);\n }\n }", "function renderMovies(data) {\n // array dei film \n const movies = data.results;\n const movieBlock = createMovieContainer(movies, this.title);\n popularMovies.appendChild(movieBlock);\n}", "function renderButtons() {\n aviones.forEach(avion => {\n $(\".aviones\").prepend(`<button id=\"${avion.id}\" class=\"btns\">${avion.avion}</button>`)\n });\n}", "function liShow() {\n var lis = messageUl.children;\n for (var i = 0; i < lis.length; i++) {\n lis[i].children[0].style.transition = .6 + i * 0.2 + 's'; //依次出场\n lis[i].children[0].style.transform = 'rotateY(0)';\n\n lis[i].children[0].addEventListener('transitionend', end, false);\n }\n\n // step3: after each li shows up, show replies\n function end() {\n this.removeEventListener('transitionend', end, false);\n var replies = this.querySelectorAll('.reply');\n\n for (var i = 0; i < replies.length; i++) {\n replies[i].style.transform = 'rotateX(0)';\n replies[i].style.opacity = 1;\n }\n }\n}", "function appendVideoGames6(actionSolo) {\n let htmlTemplate = \"\";\n for (let videoGame of actionSolo) {\n htmlTemplate += `\n <article>\n <img src=\"${videoGame.img}\">\n <button onclick=\"diceFunction();appendBoardGames(_boardRt)\">${videoGame.name}</button>\n </div>\n </article>\n `;\n }\n document.querySelector('#roleplayingTeam-container').style.display = \"flex\";\n document.querySelector('#roleplayingTeam-container').innerHTML = htmlTemplate;\n}", "renderMovieLists(results){\n const {currentPage} = this.props,\n jobsPerPage = 25,\n start = currentPage - 1,\n end = start + jobsPerPage;\n\n const jobsOnPage = results.slice(start, end);\n\n return (\n jobsOnPage.map((job)=>{\n const key = uuid();\n return(\n <JobList key={key} job={job}/>\n );\n })\n );\n }", "function pokazListeFilmow(msg) {\n listaFilmow = msg;\n var wiersze = document.querySelectorAll(\".filmStyle\");\n $('#result').addClass(\"active\");\n for (var i = 0; i < wiersze.length; i++) {\n var kontener = document.createDocumentFragment();\n var zdjecie = document.createElement(\"img\");\n var wiecej = document.createElement(\"div\");\n wiecej.className = \"filmWiecej\";\n var tytul = document.createElement(\"h2\");\n tytul.appendChild(document.createTextNode(msg[i].movieTitle));\n wiecej.appendChild(tytul);\n zdjecie.setAttribute(\"src\", msg[i].linkDoZdjecia);\n zdjecie.className += 'img-rounded';\n zdjecie.style.width = '300px';\n zdjecie.style.height = '300px';\n kontener.appendChild(zdjecie);\n var dane = document.createElement(\"h5\");\n dane.appendChild(document.createTextNode(msg[i].country + \", \" + msg[i].releaseDate + \", \" + msg[i].movieType));\n wiecej.appendChild(dane);\n var opis = document.createElement(\"p\");\n opis.appendChild(document.createTextNode(msg[i].shortDescription));\n wiecej.appendChild(opis);\n\n kontener.appendChild(wiecej)\n wiersze[i].textContent = \"\";\n wiersze[i].appendChild(kontener);\n }\n}", "function displayPhotos() {\n imagesLoaded = 0;\n totalImg = photosArray.length;\n\n photosArray.forEach((photos) => {\n // membuat <a></a> untuk menarok link (jika gambar di klik ke unspls)\n const item = document.createElement('a');\n // item.setAttribute('href', photos.links.html);\n // item.setAttribute('target','_blank')\n setAtribut(item, {\n href: photos.links.html,\n target: '_blank'\n });\n //img dari url\n const img = document.createElement('img');\n // img.setAttribute('src', photos.urls.regular);\n // img.setAttribute('alt', photos.alt_description);\n // img.setAttribute('title', photos.alt_description);\n setAtribut(img, {\n src: photos.urls.regular,\n alt: photos.alt_description,\n img: photos.alt_description\n });\n\n // check apakah img telah selesai di load\n img.addEventListener('load', imgLoaded)\n\n //menggabungkan img ke dalam a tag\n item.appendChild(img);\n imgContainer.appendChild(item)\n\n })\n\n}", "render() {\n this.activeObjects.forEach(function(object) {\n object.render();\n });\n }", "function getActs(){\n\t\n\t$.get('renderActivities', {}, function(data){\n\t\t\n\t\tif(data == null){\n\t\t\t$('#recentActivity ul').html(\"<li>No New Activity</li>\");\n\t\t}else{\n\t\t\tvar s = \"\";\n\t\t\t\n\t\t\t$.each(data, function(index){\n\t\t\t\ts += \"<li>(\" + determinekind(data[index]['kind']) + \") \";\n\t\t\t\ts += \"<a href=\\\"/index/viewProfile?userID=\" + data[index]['posterID'] + \"\\\">\" + data[index]['name'] + \"</a>\";\n\t\t\t\ts += \" posted <a href=\\\"/forum/viewThread?threadID=\" + data[index]['threadID'] + \"\\\">\" + data[index]['threadname'] + \"</a>\";\n\t\t\t\ts += \" on \" + data[index]['date'];\n\t\t\t\ts += \"</li>\";\n\t\t\t});\n\t\t\t\n\t\t\t$('#recentActivity ul').html(s);\n\t\t}//end of else\n\t\t\n\t}, 'json');//end of get call\n\t\n}//end of getActs", "function movieList() {\r\n for (let i = 0; i < movieInfo.length; i++) {\r\n //Generate list for nowshowing movies\r\n if (movieInfo[i].type == \"now\") {\r\n document.getElementById(\"nowVideoDiv\").innerHTML +=\r\n \"<div>\" +\r\n \"<dt><span>Movie: </span>\" +\r\n movieInfo[i].name +\r\n \"</dt>\" +\r\n '<dd class=\"thumbnail\"><img onclick=\"switchVideo(' +\r\n (movieInfo[i].id - 1) +\r\n ')\" src=\"../image/' +\r\n movieInfo[i].thumbnail +\r\n '\" alt=\"' +\r\n movieInfo[i].name +\r\n '\"></dd>' +\r\n \"<dd><span>Cast: </span>\" +\r\n movieInfo[i].cast +\r\n \"</dd>\" +\r\n \"<dd><span>Director: </span>\" +\r\n movieInfo[i].director +\r\n \"</dd>\" +\r\n \"<dd><span>Duration: </span>\" +\r\n movieInfo[i].duration +\r\n \" mins</dd>\" +\r\n \"</div>\";\r\n }\r\n\r\n //Generate list for upcoming movies\r\n if (movieInfo[i].type == \"upcoming\") {\r\n document.getElementById(\"upcomingVideoDiv\").innerHTML +=\r\n \"<div>\" +\r\n \"<dt><span>Movie: </span>\" +\r\n movieInfo[i].name +\r\n \"</dt>\" +\r\n '<dd class=\"thumbnail\"><img onclick=\"switchVideo(' +\r\n (movieInfo[i].id - 1) +\r\n ')\" src=\"../image/' +\r\n movieInfo[i].thumbnail +\r\n '\" alt=\"' +\r\n movieInfo[i].name +\r\n '\"></dd>' +\r\n \"<dd><span>Cast: </span>\" +\r\n movieInfo[i].cast +\r\n \"</dd>\" +\r\n \"<dd><span>Director: </span>\" +\r\n movieInfo[i].director +\r\n \"</dd>\" +\r\n \"<dd><span>Duration: </span>\" +\r\n movieInfo[i].duration +\r\n \" mins</dd>\" +\r\n \"</div>\";\r\n }\r\n }\r\n}", "function showList(list) {\n\t\tvar el = $('<div class=\"changeset\"></div>');\n\t\tfor (var i = 0; i < list.length; i ++) {\n\t\t\tvar media = list[i];\n\t\t\tvar view = new MediaView(media);\n\t\t\tview.renderTo(el);\n\t\t\tthat.register(view);\n\t\t}\n\t\treturn el;\n\t}", "function displayArtEuropeana(data) {\n for (let i = 0; i < data.items.length; i++) {\n const art = document.querySelector(\".art-div\");\n\n const artLink = document.createElement(\"a\");\n const artImage = document.createElement(\"img\");\n\n artLink.appendChild(artImage);\n artLink.href = data.items[i].guid;\n artLink.setAttribute(\"target\", \"_blank\");\n artLink.classList.add(\"flex-item\");\n \n artImage.src = data.items[i].edmIsShownBy[0];\n artImage.alt = data.items[i].title;\n art.appendChild(artLink);\n }\n}", "function render_critique(){\n //create dictionary of [sent time of critique] -> text of critique\n var critiques = [];\n practice_session.child('critiques').on('value', function(snapshot){\n if(snapshot.val()){\n for(var critique_key in snapshot.val()){\n\n var critique = snapshot.val()[critique_key];\n \n critiques[critique.sent] = critique.text;\n\n //musician needs a local copy of all the critiques\n if(if_musician)\n add_critique_item(critique.sent, critique.duration, critique.text, critique.type);\n }\n\n //draw timeline\n if (if_musician){\n timeline.setItems(critiqueItems);\n timeline.setOptions({\n end: zeroTime.getTime()+recordDuration,\n zoomMax: recordDuration\n });\n }\n }\n });\n \n //show things\n $(\"#critiques_wrapper\").css({\n \"left\": \"400px\"\n });\n $(\"#critiques_wrapper\").removeClass(\"hidden\");\n }", "function appendVideoGames(actionSolo) {\n let htmlTemplate = \"\";\n for (let videoGame of actionSolo) {\n htmlTemplate += `\n <article>\n <img src=\"${videoGame.img}\">\n <button onclick=\"diceFunction();appendBoardGames(_boardAs)\">${videoGame.name}</button>\n </div>\n </article>\n `;\n }\n document.querySelector('#actionSolo-container').style.display = \"flex\";\n document.querySelector('#actionSolo-container').innerHTML = htmlTemplate;\n}", "function displayVerbs() {\n // Select all of them in the array\n for (let i = 0; i < images[currentImage].verbs.length; i++) {\n // Create divs for them\n let $verbContainer = $('<div class=\"verbs\"></div>');\n // Put them in the container\n $verbContainer.appendTo(\".verbPool\");\n // Apply the text\n $verbContainer.text(images[currentImage].verbs[i]);\n }\n}", "render() {\n return (\n <div id=\"MoviePage\">\n <Box className=\"ListBorder\" id=\"left\">\n </Box>\n <Box id=\"MovieList\">\n { this.props.movies.map( movie => \n <MovieItem key={ movie.id } movie={ movie } history={ this.props.history }/>\n )}\n </Box>\n <Box className =\"ListBorder\" id=\"right\">\n </Box>\n </div>\n );\n }", "function displayChannelsLive() {\n\t$.each(channelsObject, function(i, item) {\n\t\tif (item.status == 'live') {\n\t\t\titem.menuFilter = 1;\n\t\t\titem.searchFilter = 1;\n\t\t\titem.element = $(`\n\t\t\t<a href=\"https://twitch.tv/${item.json.stream.channel.display_name}\" target=\"_blank\">\n\t\t\t\t<div class=\"col-xs-12 col-sm-6 col-md-4 channel-item\">\n\t\t\t\t\t<div class=\"channel-stream\">\n\t\t\t\t\t\t<img class=\"img-responsive\" src=\"${item.json.stream.preview.large}\" alt=\"${item.json.stream.game}\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"channel-info\">\n\t\t\t\t\t\t<div class=\"channel-logo\">\n\t\t\t\t\t\t\t<img class=\"img-responsive logo-img\" src=\"${item.json.stream.channel.logo===null?'img/404_user_100x100.png':item.json.stream.channel.logo}\" alt=\"${item.json.stream.channel.display_name}\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"channel-text\">\n\t\t\t\t\t\t\t<span class=\"channel-name\">${item.json.stream.channel.display_name}</span>\n\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t<span class=\"channel-description\">\n\t\t\t\t\t\t\t\tLive: ${trimLongDescription(item.json.stream.game)}<br>\n\t\t\t\t\t\t\t\tViewers: ${item.json.stream.viewers}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</a>\n\t\t\t`).appendTo('.channels-live');\n\t\t}\n\t});\n}", "render(){\n // const episodes = this.state.episodes.map((ep, index) => <Player key={index} id={17187845} color=\"87A93A\" url={ep.url} height={90} width={640}/>);\n const episodes = this.state.episodes.map((ep, index) => \n <Episode key={index} title={ep.title} url={ep.url} date={ep.date} desc={ep.desc} />\n );\n return <div id={this.props.id} className=\"episode-feed\">\n {episodes}\n // TO DO: Implement some paging when we get more episodes\n </div>\n }", "function drawActors(actors){\n return elt('div',{},...actors.map((actor)=>{\n let rect = elt('div',{class:`actor ${actor.type}`});\n rect.style.height = `${actor.size.y*scale}px`\n rect.style.width = `${actor.size.x*scale}px`\n rect.style.left = `${actor.pos.x*scale}px`\n rect.style.top = `${actor.pos.y*scale}px`\n return rect;\n }));\n }", "function loadActions(vid){\n var actionsElem = document.getElementById(\"actions\");\n while (actionsElem.firstChild) {\n actionsElem.removeChild(actionsElem.lastChild);\n }\n var header = document.createElement(\"p\");\n header.innerHTML = \"Actions\";\n header.classList.add(\"header3\");\n actionsElem.appendChild(header);\n for (i = 0; i < myActions.length; i++){\n var listItem = document.createElement(\"a\");\n listItem.classList.add(\"my-list-item\");\n listItem.innerHTML = myActions[i].text;\n if (i == myActions.length - 1){\n if (myActions.length < 8){\n listItem.style.borderBottom = \"1px solid #DFE0EB\";\n }\n else{\n listItem.style.borderBottomLeftRadius = \"8px\";\n listItem.style.borderBottomRightRadius = \"8px\";\n }\n }\n listItem.style.borderTop = \"1px solid #DFE0EB\";\n listItem.href = \"#action\" + (i+1).toString();\n listItem.id = \"action\" + (i+1).toString();\n listItem.style.padding = \"16px\";\n if (i < 2){\n myActions[i].action.route = trucks[vid].destText;\n }\n let myaction = myActions[i].action;\n let takeCont = myActions[i].takeControl;\n let verify = myActions[i].verifyDiagnose;\n listItem.addEventListener('click', () => write_rec_action(myaction, takeCont, verify), false);\n actionsElem.appendChild(listItem);\n }\n}", "function renderImages() {\n imgElem.src = Actor.all[0].path;\n}", "renderViews() {\n return this.props.views.map((view, i) => {\n let icon;\n let title;\n switch (view) {\n case \"filter\":\n icon = <i className=\"fas fa-filter\"></i>;\n title = \"Filter the shareables displayed on the map by category\";\n break;\n case \"info\":\n icon = <i className=\"fas fa-info\"></i>;\n title = \"Show user info\";\n break;\n case \"chat\":\n icon = <i className=\"fas fa-comments\"></i>;\n title = \"Chat with other users\";\n break;\n case \"news\":\n icon = <i className=\"fas fa-newspaper\"></i>;\n title = \"View COVID-19 related news for the selected date\";\n break;\n default:\n break;\n }\n return (\n <span\n title={title}\n style={{\n color: view === this.props.currentView ? Colors.textAccent1 : \"white\",\n }}\n key={i}\n onClick={() => {\n this.props.switchView(view);\n }}>\n {icon}\n {view}\n </span>\n );\n });\n }", "function renderList(response) {\n const result = response;\n const { prev, next, data } = result;\n\n if (prev) {\n prevButton.style.display = 'initial';\n prevButton.setAttribute('data-url', prev);\n } else {\n prevButton.style.display = 'none';\n }\n if (next) {\n nextButton.style.display = 'initial';\n nextButton.setAttribute('data-url', next);\n } else {\n nextButton.style.display = 'none';\n }\n\n let str = '';\n for (let i = 0; i < data.length; i += 1) {\n str += `<p><span class=\"artistTitle\"><strong> ${data[i].artist.name} </strong> - ${data[i].title} </span><span artist=\"${data[i].artist.name}\" title=\"${data[i].title}\" id=\"${data[i].id}\" class=\"showLyrics\">Show Lyrics</span></p>`;\n }\n resultBlock.innerHTML = str;\n loadingBlock.style.display = 'none';\n}", "function renderHistoryList() {}", "renderLogos() {\n return _.map(this.state.teams, (team, id) =>\n <TeamLogo key={id} team={team} onClick={this.onTeamSelect.bind(this)} />\n );\n }", "function showLectures(cid) {\r\n\t\tvar thisLectures = lectures[cid];\r\n\t\t$.each(thisLectures, function(entry,item){\r\n//<input type=\"file\" id=\"file'+uniqueId+'\" class=\"inputlecture\"/><br/>\\\r\n\t\t\tvar color = \"warning\";\r\n\t\t\tif(!jQuery.inArray( item._id, liveLecs)) {\r\n\t\t\t\tcolor = \"success\";\r\n\t\t\t}\r\n\t\t\t//alert(JSON.stringify(item));\r\n\t\t\t/*jshint multistr: true */\r\n\t\t\tvar uniqueId = entry + cid * 100;\r\n\t\t\tvar str = '\\\r\n\t\t\t<div class=\"panel panel-default lecture\" lecture=\"'+uniqueId+'\">\\\r\n\t\t\t\t<div class=\"panel-heading\">\\\r\n\t\t\t\t\t<h4 class=\"panel-title\">\\\r\n\t\t\t \t<a data-toggle=\"collapse\" data-parent=\"#accordion\" id=\"lecturename'+uniqueId+'\" href=\"#'+uniqueId+'\">\\\r\n\t\t\t \t\t' + item.title.split('+').join(' ') + ' </a>\\\r\n\t\t\t \t<a class=\"arrow\" data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#'+uniqueId+'\" style=\"float:right\"><i class=\"fa fa-caret-down\"></i></a>\\\r\n\t\t\t \t</h4>\\\r\n\t\t\t </div>\\\r\n\t\t\t <div id=\"'+uniqueId+'\" class=\"panel-collapse collapse\">\\\r\n\t\t\t \t<div class=\"panel-body\" id=\"panel' + uniqueId +'\">\\\r\n\t\t \t\t<button id=\"joinLecture\" name=\"'+ item._id +'\" class=\"btn btn-warning\">Join lecture</button><br>\\\r\n\t\t\t \t</div>\\\r\n\t\t\t </div>\\\r\n\t\t\t </div>';\r\n\r\n\t\t\t$('.lectures').find('[courseIndex=\"'+cid+'\"]').append(str);\r\n\t\t\t$('.lecture[lecture=\"'+uniqueId+'\"] div h4 a').focus();\r\n\t\t});\r\n\t}", "render() {\n this.listEl.innerHTML = \"\";\n\n // Criacao de todos os elementos que serao exibidos\n this.repositories.forEach((repo) => {\n let imgEl = document.createElement(\"img\");\n imgEl.setAttribute(\"src\", repo.avatar_url);\n\n let titleEl = document.createElement(\"strong\");\n titleEl.appendChild(document.createTextNode(repo.name));\n\n let descriptionEl = document.createElement(\"p\");\n descriptionEl.appendChild(document.createTextNode(repo.description));\n\n let linkEl = document.createElement(\"a\");\n linkEl.setAttribute(\"target\", \"_blank\");\n linkEl.setAttribute(\"href\", repo.html_url);\n linkEl.appendChild(document.createTextNode(\"Acessar\"));\n\n let listItemEl = document.createElement(\"li\");\n listItemEl.appendChild(imgEl);\n listItemEl.appendChild(titleEl);\n listItemEl.appendChild(descriptionEl);\n listItemEl.appendChild(linkEl);\n\n this.listEl.appendChild(listItemEl);\n });\n }", "render() {\n // console.log('🎃',this.props)\n // let list = this.props.map((film, i)=>{\n\n\n // })\n return (\n <div className=\"film-details\">\n <h1 className=\"section-title\">FILMS</h1>\n </div>\n );\n }", "function creaPastilles(conteneur) {\r\n // Creation des pastilles en fonction du nombre d'images\r\n let pastille = \"<span></span>\"; // Nouvelles pastilles\r\n for (let i = 0; i < slides.length; i++) {\r\n conteneur.innerHTML += pastille;\r\n }\r\n // interaction pastilles\r\n let pastilles = conteneur.querySelectorAll(\"span\");\r\n pastilles[0].classList.add(\"indicatorCourant\"); //init\r\n return pastilles; //retourne un tableau des pastilles créés\r\n}", "function renderLives() {\n let index = 0,\n length = _lives.length,\n life;\n\n // Loop through the number of remaining lives stored in the _lives array, and\n // call the renderAt() method of each of the Life \"class\" instances contained\n // within, drawing the life on the game board at the appropriate position\n for (; index < length; index++) {\n life = _lives[index];\n\n life.renderAt(life.left, life.top);\n }\n }", "function mostrarHistorial() {\n\n listaHistorial.classList.toggle('verHistorial');\n borrarHistorial.classList.toggle('scroll');\n panelHistorial.classList.toggle('mostrar');\n\n\n\n if (historialOperaciones.length > 0) {\n\n listaHistorial.innerHTML = '';\n historialOperaciones.forEach(element => {\n listaHistorial.innerHTML += `\n \n <li>\n <p class=\"historial_item_operacion pOperacion\">${element.operacion}</p>\n <p class=\"historial_item_resultado pResultado\">${element.resultado}</p>\n </li>\n `;\n });\n }\n\n\n}", "render() {\n //Per ogni pokemon nella lista disegna un componente\n const pokemon = this.props.selectedPokemons.map((pokemon, index) => {\n //Se non è presente il pokemon (null) scrive una stringa \"vuota\" senza immagine\n if(pokemon === null) {\n return (\n <PokemonItemOfList name=\"- - - -\" index={index} image={null} key={index} />\n )\n }\n\n return (\n <PokemonItemOfList name={pokemon.name} index={index} image={pokemon.image} onDelete={this.props.onDelete} key={index} />\n )\n\n });\n\n return(\n <div className=\"pure-g team-container\">\n {pokemon}\n <button className=\"create-file\" onClick={this.props.downloadFile}>DOWNLOAD</button>\n </div>\n )\n }", "function displayDataOnPage(topNews, counter){\n // console.log(topNews);\n topNews.articles.forEach(content => {\n const spanNode = document.createElement(\"li\"); // make fresh <li>\n spanNode.innerHTML = // news contents\n `<a href=\"${content.url}\">\n <img src=\"${content.urlToImage}\" alt=\"news image\">\n <h3>${content.source.name}</h3>\n <h2>${content.title}</h2>\n <p>${content.description}</p></a>`;\n parentNode.appendChild(spanNode); // pushing to the <ul>\n });\n }", "render() {\n var todoEntries = this.props.entries;\n var listItems = todoEntries.map(this.createTasks);\n\n return(\n <ul className=\"theList\">\n <FlipMove duration={250} easing=\"ease-out\">\n {listItems}\n </FlipMove>\n </ul>\n );\n }", "function renderizaInimigos(){\n\tinimigos.forEach(desenhaInimigo);\n\tinimigosAndam();\n}", "function renderButtons(){ \n\t\t$('#moviesView').empty();//empty div\n\n\t\t\tfor(var x = 0; x<=movies.length-1;x++)//looping array\n\t\t\t\t{$('#moviesView').prepend('<button>' + movies[x] + '</button>')};//putting items to div\n\t\t}", "function appendVideoGames5(actionSolo) {\n let htmlTemplate = \"\";\n for (let videoGame of actionSolo) {\n htmlTemplate += `\n <article>\n <img src=\"${videoGame.img}\">\n <button onclick=\"diceFunction();appendBoardGames(_boardRs)\">${videoGame.name}</button>\n </div>\n </article>\n `;\n }\n document.querySelector('#roleplayingSolo-container').style.display = \"flex\";\n document.querySelector('#roleplayingSolo-container').innerHTML = htmlTemplate;\n}", "render() {\n const items = {\n movies: this.state.movies,\n shows: this.state.tv,\n music: this.state.music,\n ebook: this.state.ebook,\n audiobook: this.state.audiobook,\n podcast: this.state.podcast\n }\n if (items.movies ===null){\n items.movies = {result:[]}\n }\n if (items.shows ===null){\n items.shows = {result:[]}\n } if (items.music ===null){\n items.music = {result:[]}\n } if (items.ebook ===null){\n items.ebook = {result:[]}\n } if (items.audiobook ===null){\n items.audiobook = {result:[]}\n }\n if (items.podcast ===null){\n items.podcast = {result:[]}\n }\n return (\n <div>\n <h2>My List</h2>\n <h2>Movies</h2>\n <div>\n <div>\n {items.movies.result.map(movie =>\n <div>\n <div className='movie'>\n <img id={'img' + movie.name} src={movie.poster}/>\n <h4 id={'name' + movie.name}>{movie.name}</h4>\n <h4 id={'ganre' + movie.name}>{movie.genre}</h4>\n <video id={'video' + movie.name} controls>\n <source id={'source' + movie.name} src={movie.trailer}/>\n </video>\n <h4 id={'age' + movie.name}>{movie.age}</h4>\n <h4 id={'description' + movie.name}>{movie.description}</h4>\n <button onClick={this.removeMovie} id={movie.name}>Remove</button>\n </div>\n </div>\n )}\n </div>\n </div>\n <h2>Tv Shows</h2>\n <div className='category'>\n <div>\n {items.shows.result.map(tv =>\n <div>\n <div className='tv'>\n <img id={'img' + tv.description} src={tv.poster}/>\n <h4 id={'name' + tv.description}>{tv.name}</h4>\n <video id={'video' + tv.description} controls>\n <source id={'source' + tv.description} src={tv.trailer}/>\n </video>\n <h4 id={'episode' + tv.description}>Episode number {tv.episode}</h4>\n <h4 id={'description' + tv.description}>{tv.description}</h4>\n <button onClick={this.removeTv} id={tv.description}>Remove</button>\n </div>\n </div>\n )}\n </div>\n </div>\n <h2>Music</h2>\n <div>\n <div>\n {items.music.result.map(music =>\n <div>\n <div className='music'>\n <img id={'img' + music.name} src={music.poster}/>\n <h4 id={'name' + music.name}>{music.name}</h4>\n <h4 id={'album' + music.name}>{music.album}</h4>\n <h4 id={'genre' + music.name}>{music.genre}</h4>\n <h4 id={'description' + music.name}>{music.description}</h4>\n <button onClick={this.removeMusic} id={music.name}>Remove</button>\n </div>\n </div>\n )}\n </div>\n </div>\n <h2>Ebooks</h2>\n <div>\n <div>\n {items.ebook.result.map(ebook =>\n <div>\n <div className='ebook'>\n <img id={'img' + ebook.book} src={ebook.poster}/>\n <h4 id={'book' + ebook.book}>{ebook.book}</h4>\n <h4 id={'description' + ebook.book}>{ebook.description}</h4>\n <button onClick={this.removeEbook} id={ebook.book}>Remove</button>\n </div>\n </div>\n )}\n </div>\n </div>\n <h2>Audiobooks</h2>\n <div>\n <div>\n {items.audiobook.result.map(audiobook =>\n <div>\n <div className='audiobook'>\n <img id={'img' + audiobook.book} src={audiobook.poster}/>\n <h4 id={'book' + audiobook.book}>{audiobook.book}</h4>\n <h4 id={'description' + audiobook.book}>{audiobook.description}</h4>\n <button onClick={this.removeAudioBook} id={audiobook.book}>Remove</button>\n\n </div>\n </div>\n )}\n </div>\n </div>\n <h2>Podcast</h2>\n <div>\n <div>\n {items.podcast.result.map(podcast =>\n <div>\n <div className='podcast'>\n <img id={'img'+ podcast.name} src={podcast.poster}/>\n <h4 id={'name'+ podcast.name}>{podcast.name}</h4>\n <h4 id={'description'+ podcast.name} >{podcast.description}</h4>\n <h4 id={'genre'+ podcast.name}>{podcast.genre}</h4>\n <button onClick={this.removePodcast} id={podcast.name}>Remove</button>\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n )\n }", "function renderizado() {\n listaNombres.innerHTML=''\n nombres.forEach( ( item ) => {\n const html = `<li>${item}</li>`;\n listaNombres.innerHTML += html;\n })\n}", "getMovieList() {\n \n let html = '';\n let i = 0;\n if (this.props.giveMovieList.length !== 0 || this.props.giveMovieList !== '') {\n html = this.props.giveMovieList.map(e => {\n // run +=e.runtime\n i++;\n return <li className=\"movieListItem\" key={i}> \n <div>\n {e.title} ({e.runtime} minutes)\n </div>\n <button className=\"movieListItemBtn\" onClick={() => this.props.deleteFromList(e)}>X</button>\n </li>\n })\n }\n return html;\n }", "async renderNews() {\n this.addPageFunctionalities();\n const response = await this.controller.getTopNewsApi();\n let data = response.articles;\n this.createCards(data, \"Salvar\", (noticia) => {\n this.clickBotao(noticia);\n });\n }", "function renderResults(){\n resultsContent.innerHTML = '';\n viewResultsButton.innerHTML = '';\n for(let i =0; i < allItems.length; i++){\n let p = document.createElement('p');\n p.textContent = `${allItems[i].name} : ${allItems[i].clicked} / ${allItems[i].viewed}`;\n viewResultsButton.appendChild(p);\n }\n}", "function displayResults() {\n state.movies.forEach(function (item) {\n let htmlItem = $('.js-result.templ').clone();\n let imgUrl = item.poster;\n imgUrl = imgUrl.replace(\"{profile}\", \"s166\");\n htmlItem.find('.js-img').attr('src', \"https://www.justwatch.com/images\" + imgUrl);\n htmlItem.find('.item-title').append(item.title);\n htmlItem.find('.item-description').append(item.short_description);\n htmlItem.find('.js-release').append(`(${item.original_release_year})`);\n htmlItem.find('.js-addToWatchList').attr({\n 'media-id': item.id,\n 'title': item.title,\n 'poster': item.poster,\n 'object-type': item.object_type,\n 'path': item.full_path\n });\n if (item.offers) {\n for (let i = 0; i < item.offers.length; i++) {\n let htmlItemOffer = $('.js-item-offers.templ').clone();\n if (item.offers[i].presentation_type === 'sd') {\n let found = item.offers.find(function (offer) {\n if (offer.presentation_type === 'hd' && offer.provider_id === item.offers[i].provider_id)\n return true;\n })\n if (found)\n continue;\n }\n //justwatch has special provider id code to identify different streaming services\n let providerIdImg;\n let text;\n switch (item.offers[i].provider_id) {\n case 2:\n text = 'apple-itunes.jpeg';\n break;\n case 3:\n text = 'google-play-movies.jpeg';\n break;\n case 7:\n text = 'vudu.jpeg';\n break;\n case 8:\n text = 'netflix.jpeg';\n break;\n case 9:\n text = 'amazon-prime-instant-video.jpeg';\n break;\n case 10:\n text = 'amazon-instant-video.jpeg';\n break;\n case 11:\n text = 'mubi.jpeg';\n break;\n case 12:\n text = 'crackle.jpeg';\n break;\n case 14:\n text = 'realeyz.jpeg';\n break;\n case 15:\n text = 'hulu.jpeg';\n break;\n case 18:\n text = 'playstation.jpeg';\n break;\n case 25:\n text = 'fandor.jpeg';\n break;\n case 27:\n text = 'hbo-now.jpeg';\n break;\n case 31:\n text = 'hbo-go.jpeg';\n break;\n case 34:\n text = 'epix.jpeg';\n break;\n case 37:\n text = 'showtime.jpeg';\n break;\n case 43:\n text = 'starz.jpeg';\n break;\n case 60:\n text = 'fandango.jpeg';\n break;\n case 68:\n text = 'microsoft-store.jpeg';\n break;\n case 73:\n text = 'tubi-tv.jpeg';\n break;\n case 78:\n text = 'cbs.jpeg';\n break;\n case 79:\n text = 'nbc.jpeg';\n break;\n case 80:\n text = 'amc.jpeg';\n break;\n case 83:\n text = 'the-cw.jpeg';\n break;\n case 87:\n text = 'acorn-tv.jpeg';\n break;\n case 92:\n text = 'yahoo-view.jpeg';\n break;\n case 99:\n text = 'shudder.jpeg';\n break;\n case 100:\n text = 'guidedoc.jpeg';\n break;\n case 102:\n text = 'filmstruck.jpeg';\n break;\n case 105:\n text = 'fandangonow.jpeg';\n break;\n case 123:\n text = 'fxnow.jpeg';\n break;\n case 139:\n text = 'max-go.jpeg';\n break;\n case 143:\n text = 'sundance-now.jpeg';\n break;\n case 148:\n text = 'abc.jpeg';\n break;\n case 151:\n text = 'brtibox.jpeg';\n break;\n case 155:\n text = 'history.jpeg';\n break;\n case 156:\n text = 'aande.jpeg';\n break;\n case 157:\n text = 'lifetime.jpeg';\n break;\n case 175:\n text = 'netflix-kids.jpeg';\n break;\n default:\n text = 'placeholder.jpg';\n }\n providerIdImg = text;\n\n //where available streaming options are placed in the template\n if (item.offers[i].monetization_type === 'flatrate') {\n htmlItem.find('.js-offer-type-sub').addClass('offers');\n htmlItem.find('.js-offer-type-sub .js-offer-bar').html('STREAM');\n htmlItemOffer.find('.js-offer-link').attr('href', item.offers[i].urls.standard_web);\n htmlItemOffer.find('.js-offer-img').attr('src', 'img/' + providerIdImg);\n htmlItemOffer.find('.js-presentation').html(item.offers[i].presentation_type.toUpperCase());\n htmlItem.find('.js-sub-row').append(htmlItemOffer);\n } else if (item.offers[i].monetization_type === 'rent') {\n htmlItem.find('.js-offer-type-rent').addClass('offers');\n htmlItem.find('.js-offer-type-rent .js-offer-bar').html('RENT');\n htmlItemOffer.find('.js-offer-link').attr('href', item.offers[i].urls.standard_web);\n htmlItemOffer.find('.js-offer-img').attr('src', 'img/' + providerIdImg);\n htmlItemOffer.find('.js-presentation').html(item.offers[i].presentation_type.toUpperCase());\n htmlItem.find('.js-rent-row').append(htmlItemOffer);\n } else if (item.offers[i].monetization_type === 'cinema') {\n htmlItem.find('.js-offer-type-cinema').addClass('offers');\n htmlItem.find('.js-offer-type-cinema .js-offer-bar').html('CINEMA');\n htmlItemOffer.find('.js-offer-link').attr('href', item.offers[i].urls.standard_web);\n htmlItemOffer.find('.js-offer-img').attr('src', 'img/' + providerIdImg);\n htmlItemOffer.find('.js-presentation').html('TICKET');\n htmlItem.find('.js-cinema-row').append(htmlItemOffer);\n } else {\n htmlItem.find('.js-offer-type-buy').addClass('offers');\n htmlItem.find('.js-offer-type-buy .js-offer-bar').html('BUY');\n htmlItemOffer.find('.js-offer-link').attr('href', item.offers[i].urls.standard_web);\n htmlItemOffer.find('.js-offer-img').attr('src', 'img/' + providerIdImg);\n htmlItemOffer.find('.js-presentation').html(item.offers[i].presentation_type.toUpperCase());\n htmlItem.find('.js-buy-row').append(htmlItemOffer);\n };\n htmlItemOffer.removeClass('templ');\n }\n }\n\n htmlItem.removeClass('templ');\n $('.js-noResults').addClass('hidden');\n $('.results').removeClass('hidden');\n $('.results').show();\n $('.js-result-container').append(htmlItem);\n $('.js-watchlist-results').html('');\n $('.js-watchlist').hide();\n $('.js-userResults').hide();\n $('.js-userResults-list').html('');\n $('.js-returnButton').removeClass('hidden');\n $('.js-welcome').addClass('hidden');\n });\n}", "async displaySavedList(savedList)\n {\n const displayResults = await savedList.map(recipe => {\n return `<li> <button class=\"result\" id=\"${recipe.id}\" style=\"background-image: url(${recipe.image})\"> ${recipe.title}</button></li>`; });\n document.getElementById('myRecipes').innerHTML = displayResults.join(''); \n document.getElementById(\"main\").classList.toggle(\"slide2\"); \n \n }", "static displayContestants(){\n // get contestants that are stored in local storage\n const contestants = Store.getContestants();\n\n //loop through the contestants in ls\n contestants.forEach(contestant=>{\n const ui = new UI;\n\n ui.addContestantToList(contestant);\n });\n }", "renderNivels() {\n let buttonClass = 'btn btn-default btn-block';\n\n return (\n <div>\n <div className=\"list-group-item\">\n <button type=\"button\" className={buttonClass} onClick={() => this.props.history.push('/guide')}>\n Tutorial\n </button>\n </div>\n {this.renderNiveisList()}\n </div>\n );\n }", "function renderButtons() {\n\n // Delete the content inside the gifs-appear-here div and added tech buttons, prior to adding new ones.\n \n $(\"#gifs-appear-here\").empty();\n $(\"#tech-buttons\").empty();\n\n // Loop through the array of gifs, then generate buttons for each gifs in the array.\n topics.forEach(function(topics) {\n $(\"#tech-buttons\").append(\n `<button data-val=${topics}>${topics}</button>` \n )\n });\n }", "function displayFotos () {\n imagesLoaded = 0;\n totalImages = fotosArray.length;\n //console.log('Imágenes en total', totalImages);\n //Ejecutar función para cada objeto en fotosArray\n fotosArray.forEach((foto) => {// Cada objeto va a ser asignado a la variable 'foto'\n // creamos los <a> apuntando a Unsplash\n const item = document.createElement('a');\n //setamos los valores de los atributos\n setAttributes(item, {\n href: foto.links.html,\n target: '_blank',\n });\n console.log(foto);\n\n // Creamos los <img> para las fotos\n const img = document.createElement('img');\n setAttributes(img, {\n src: foto.urls.regular,\n alt: foto.alt_description,\n title: foto.alt_description,\n });\n\n //Event listener. Chequeamos cuando se han cargado las imágenes\n img.addEventListener('load', imageLoaded);\n\n //Creamos info\n let info = document.createElement('p');\n info.innerHTML = foto.exif.model;\n if (!info.innerHTML>0) {\n info.innerHTML = \"No camera info\";\n info.className = 'noInfo';\n }\n\n //Metemos los <img> dentro de los <a>, y los dos dentro del elemento imageContainer\n item.appendChild(img);\n item.appendChild(info); \n imageContainer.appendChild(item); //appendChild para indicar que un elemento va dentro del otro\n });\n\n}", "function renderResults(movieInfoList) {\n var list = document.getElementById(\"resultsList\");\n list.innerHTML=\"\";\n movieInfoList.forEach(movieInfo => {\n // turns img string to img\n showImage(movieInfo);\n });\n}", "function displayTeams() {\n\tfor (var i = 0; i < teams.length; i++) {\n\t\tvar findTeam = document.getElementById(teams[i].id);\n\t\t// Logic for displaying each team's info\n\t\tfindTeam.querySelector(\".team-name\").innerHTML = teams[i].name; // Displays the Team name\n\t\tfindTeam.querySelector(\".logo\").src = \"img/\" + teams[i].id + \".png\";\n\t\tfindTeam.querySelector(\".star\").src = \"img/\" + teams[i].star + \".png\";\n\t\tfor (var u = 0; u < teams[i].facts.length; u++) {\n\t\t\tfindTeam.querySelector(\".facts\").innerHTML += \"<li>\" + teams[i].facts[u] + \"</li>\";\n\t\t}\n\t\tfor (var u = 0; u < teams[i].champs.length; u++) {\n\t\t\tfindTeam.querySelector(\".championships\").innerHTML += \"<li>\" + teams[i].champs[u] + \"</li>\";\n\t\t}\n\t}\n}", "function renderVoertuigen() {\n\t// 1c. Lijst leegmaken, voorafgaand aan toevoegen nieuw voertuig.\n\tdocument.getElementById('lijstVoertuigen').innerHTML = '';\n\n\tfor (var i = 0; i < arrayVoertuigen.length; i++) {\n\t\tvar nieuwListItem =\n\t\t\t'<li class=\"list-group-item\"><span class=\"merk\">' +\n\t\t\tarrayVoertuigen[i].merk +\n\t\t\t'</span>';\n\t\tnieuwListItem +=\n\t\t\t'<span class=\"prijs\">' + arrayVoertuigen[i].prijs + '</span>';\n\t\tnieuwListItem +=\n\t\t\t'<img src=\"img/' + arrayVoertuigen[i].afbeelding + '\">';\n\n\t\tnieuwListItem += '</li>';\n\t\t//1d. Toevoegen aan de lijst met voertuigen in de UI.\n\t\tdocument.getElementById('lijstVoertuigen').innerHTML += nieuwListItem;\n\t} // einde for-lus\n}", "rendering(){\n let renderPlace = \"\";\n let count = 0;\n place.innerHTML = renderPlace;\n slides.forEach((slide)=>{\n count++\n if(slide.tipe == \"teks\"){\n renderPlace += textRender(slide,count);\n place.innerHTML = renderPlace;\n }\n else if(slide.tipe == \"gambar\"){\n renderPlace +=gambarRender(slide,count);\n place.innerHTML = renderPlace;\n }else{\n place.innerHTML = renderPlace;\n }\n loadFile.hapusBtn();\n });\n }", "async function showAttractions() {\n if (attractionsArray.length) {\n const isLogIn = await logInStatus();\n const favoriteIds = [];\n if (isLogIn) {\n const favorites = await getFavoriteData();\n if (favorites) {\n for (let favorite of favorites) {\n favoriteIds.push(favorite.id);\n }\n }\n }\n for (let attraction of attractionsArray) {\n const attractionBox = createAttractionItem(attraction, favoriteIds);\n attractionsContainer.appendChild(attractionBox);\n }\n } else if (!attractionsContainer.firstChild) {\n const message = document.createElement(\"span\");\n message.textContent = \"未找到符合關鍵字的景點\";\n attractionsContainer.appendChild(message);\n }\n}", "function displayGenre() {\n let htmlContent = ''\n htmlContent += `<div class=\"list-group\" id=\"list-tab\" role=\"tablist\">`\n Object.keys(genre).forEach(index => {\n htmlContent += `\n <a class=\"list-group-item list-group-item-action\" id=\"list-genre-list\" data-toggle=\"list\"\n href=\"#list-genre\" role=\"tab\" aria-controls=\"genre\" data-index=\"${index}\">${genre[index]}</a>\n `\n })\n htmlContent += `</div>`\n genrePanel.innerHTML = htmlContent\n }", "render() {\n return (\n <>\n <Header history={this.props.history} match={this.props.match}/>\n\n <div className=\"titleList\">\n <div className=\"title\">\n <h1>My List</h1>\n <div className=\"titles-wrapper\">\n {this.state.movies.filter(m => m.my_list == true).map((movie) => (\n <MovieItem key={movie.id} movie = {movie} reload={this.reload}/>\n ))}\n </div>\n </div>\n </div>\n </>\n );\n }", "render() {\n // console.log('\\nActivity.jsx - this.props.activitiesByTripId:', this.props.activitiesByTripId)\n\n return (this.props.activitiesByTripId.map(activityElem => {\n return (\n <div key={activityElem.id}>\n <p>Activity: {activityElem.activity_name}</p>\n <p>Location: {activityElem.location}</p>\n <p>Date:{activityElem.date}</p>\n <p>Time:{activityElem.time}</p>\n <p>Price: {activityElem.price}</p>\n <p>Type: {activityElem.type}</p>\n <p>Votes: {activityElem.votes}</p>\n <p>Reservation: {activityElem.reservation}</p>\n <p>Notes: {activityElem.notes}</p>\n <img src={activityElem.image} alt=''></img>\n\n <div>\n <Link to={`/activity/${activityElem.id}`}>\n <button type='button'>View</button>\n </Link>\n </div>\n </div>\n )\n })\n )\n }", "function appendVideoGames3(actionSolo) {\n let htmlTemplate = \"\";\n for (let videoGame of actionSolo) {\n htmlTemplate += `\n <article>\n <img src=\"${videoGame.img}\">\n <button onclick=\"diceFunction();appendBoardGames(_boardSs)\">${videoGame.name}</button>\n </div>\n </article>\n `;\n }\n document.querySelector('#strategySolo-container').style.display = \"flex\";\n document.querySelector('#strategySolo-container').innerHTML = htmlTemplate;\n}", "videos() {\n let that = this;\n let videodata = this.state.isLibrary ? this.state.videoDetails || [] : this.state.videoSpecifications || [];\n\n if(this.props.view) {\n if (!videodata || !videodata.length)\n return <NoData tabName={'Videos'}/>\n }\n\n const videos = videodata.map(function (show, id) {\n return (\n <div className=\"thumbnail swiper-slide\" key={id}>\n\n {\n !that.state.explore && !that.state.hideLock ?\n <FontAwesome onClick={() => that.toggleVideoLock(show, id)} name={ show.isPrivate ?'lock':'unlock' } />\n :\n \"\"\n }\n {\n that.state.explore ?\n \"\"\n :\n <FontAwesome name='trash-o' onClick={() => that.delete(id, \"video\")} />\n }\n\n\n\n <a href=\"\" data-toggle=\"modal\" data-target=\".videopop\" onClick={that.randomVideo.bind(that, show.fileUrl, id)}>\n <video onContextMenu={(e) => e.preventDefault()} width=\"120\" height=\"100\" controls>\n <source src={generateAbsolutePath(show.fileUrl)} type=\"video/mp4\"></source>\n </video>\n </a>\n <div className=\"title\">{show.fileName}</div>\n </div>\n )\n });\n return videos;\n }", "drawActors(state) {\n const wrapper = createElement('div');\n\n const currPlayer = state.player;\n\n for (let actor of state.actors) {\n const currPlayerStatus = currPlayer === actor ? 'curr-player' : '';\n const el = wrapper.appendChild(createElement('div', `actor ${actor.constructor.name.toLowerCase()} ${currPlayerStatus}`)); // actor.constructor.name finds the name of the class of the actor\n el.style.width = `${actor.size.x * scale}px`;\n el.style.height = `${actor.size.y * scale}px`;\n el.style.left = `${actor.pos.x * scale}px`;\n el.style.top = `${actor.pos.y * scale}px`;\n }\n\n return wrapper;\n }", "function renderMatches() {\n\t\tlet $containers = [];\n\n\t\tfor (let i in oldMatches) {\n\t\t\tlet { enemy, matches } = oldMatches[i];\n\t\t\tlet $active_matches = [];\n\t\t\tlet $inactive_matches = [];\n\n\t\t\tif (matches.length == 0)\n\t\t\t\tcontinue;\n\n\t\t\tmatches.forEach((match, j) => {\n\t\t\t\tlet match_name = match[0];\n\t\t\t\tlet match_data = match[1];\n\t\t\t\tCache.theme[match_name] = match_data.theme;\n\n\t\t\t\tlet d = new Date(match_data.updated);\n\t\t\t\tlet d_str = formatDate(d, '%M/%D');\n\n\t\t\t\tlet color = (match_data.black == Cache.userID) ? TEAM.B : TEAM.W;\n\t\t\t\tlet active = Math.floor(match_data.moves[match_data.moves.length - 1] / 10) != 0;\n\t\t\t\tlet borderStyle = match_data.black == Cache.userID ? styles.blackBorder : styles.whiteBorder;\n\t\t\t\tlet colorStyle = active ? styles.greenColor : styles.greyColor;\n\n\t\t\t\tif (active) {\n\t\t\t\t\t$active_matches.push(\n\t\t\t\t\t\t<ButtonVibe key={ j } style={ {...styles.matchView, ...borderStyle} } onPress={() => navigateGame(match_name)} onLongPress={ () => selectMatch(match_name) }>\n\t\t\t\t\t\t\t<AutoHeightImage width={ matchSize } source={ formatImage(enemy.photo) } style={ styles.matchImg }/>\n\t\t\t\t\t\t\t<View style={ {...styles.matchDate, ...colorStyle} }>\n\t\t\t\t\t\t\t\t<TextVibe> { d_str } </TextVibe>\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</ButtonVibe>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$inactive_matches.push(\n\t\t\t\t\t\t<ButtonVibe key={ j } style={ {...styles.matchView, ...borderStyle} } onPress={() => navigateGame(match_name)} onLongPress={ () => selectMatch(match_name) }>\n\t\t\t\t\t\t\t<AutoHeightImage width={ matchSize } source={ formatImage(enemy.photo) } style={ styles.matchImg }/>\n\t\t\t\t\t\t\t<View style={ {...styles.matchDate, ...colorStyle} }>\n\t\t\t\t\t\t\t\t<TextVibe> { d_str } </TextVibe>\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</ButtonVibe>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t\t$containers.push(\n\t\t\t\t<Animated.View key={ i } style={ [styles.playerBox, { opacity: fadein }] }>\n\t\t\t\t\t<TextVibe style={ titleStyle }>{ enemy.name }</TextVibe>\n\t\t\t\t\t<ScrollView\n\t\t\t\t\t\thorizontal={ true }>\n\t\t\t\t\t\t{ $active_matches }\n\t\t\t\t\t\t{ $inactive_matches }\n\t\t\t\t\t</ScrollView>\n\t\t\t\t</Animated.View>\n\t\t\t);\n\t\t}\n\n\t\treturn $containers;\n\t}", "function displayMovies(movies) {\n movieInformation.innerHTML = \"\"\n let searchedMovies = globalMovieArray[0].Search;\n for (i = 0; i < searchedMovies.length; i++) {\n //Div for listed movie and button\n const liAndButtonDiv = document.createElement('div')\n liAndButtonDiv.classList.add('liAndButtonDiv')\n //Create li element for search result\n const movieTitleListed = document.createElement('li');\n movieTitleListed.classList.add = ('clear')\n const movieTitle = document.createTextNode(`${movies.Search[i].Title}`)\n\n movieTitleListed.appendChild(movieTitle);\n liAndButtonDiv.appendChild(movieTitleListed);\n movieInformation.appendChild(liAndButtonDiv);\n\n buttonForMoreInformation(movies.Search[i].imdbID, liAndButtonDiv)\n spinner.style.display = \"none\";\n\n }\n}", "function renderText(data) {\n let ul = document.createElement(\"ul\");\n nav.appendChild(ul);\n for (let key in data){\n let li = document.createElement(\"li\");\n li.textContent = big(key);\n li.addEventListener('click', function (e) {\n window.location.hash = small(e.target.textContent);\n\n getBreedImg();\n getSubBreed();\n });\n ul.appendChild(li);\n }\n }", "function render() {\n remember();\n\n main.innerHTML = tweets.map((tweet, idx) => {\n return `\n <aside>\n <div>\n <img class=\"avatar\" src=\"${tweet.avatar}\">\n </div>\n <div class=\"formatted-tweet\">\n <h6><a href=\"https://twitter.com/${tweet.username}\">${tweet.name}</a> <span class=\"username\">@${tweet.username}</span></h6>\n <p>${tweet.tweet}</p>\n <div class=\"imgGifPoll\">\n ${tweet.isPollCreated ? displayVotes(tweet, idx) : tweet.img }\n </div>\n <div>\n <section>\n <div id=\"reactions\" class=\"btn-group mr-2\">\n <button\n type=\"button\"\n class=\"btn btn-secondary mdi mdi-message-outline\"\n aria-label=\"reply\"\n ></button>\n <button\n type=\"button\"\n class=\"btn btn-secondary mdi mdi-twitter-retweet\"\n aria-label=\"retweet\"\n ></button>\n <button\n type=\"button\"\n class=\"btn btn-secondary mdi mdi-heart-outline\"\n aria-label=\"like\"\n style=\"\"\n ></button>\n <button\n type=\"button\"\n class=\"btn btn-secondary mdi mdi-upload\"\n aria-label=\"share\"\n ></button>\n </div>\n </section>\n </div>\n </div>\n </aside>\n `;\n }).join('');\n}", "_render () {\n this.el.innerHTML = '';\n this.currentCount = 0;\n\n this.ul = document.createElement('ul');\n this._appendLis();\n this.el.append(this.ul);\n this.el.append(this.modal.modalWindow);\n this.el.append(this.modal.modalOverlay);\n }", "function renderizar(objetoDePersonas) {\n\n\t//crear h1\n\tvar h1Container = document.createElement('h1')\n\t//meter text\n\th1Container.innerHTML = objetoDePersonas.titulo;\n\t//apendearlo en la pantalla\n\tvar contenedorDeTitulo = document.querySelector('header');\n\n\tcontenedorDeTitulo.appendChild(h1Container);\n\n\t//crear ul\n\tvar ul = document.createElement('ul');\n\n\tfor (var i = 0; i < objetoDePersonas.actores.length; i++) {\n\t\n\t\tvar li = document.createElement('li');\n\t\tli.innerHTML = objetoDePersonas.actores[i];\n\t\tul.appendChild(li);\n\n\t}\n\n\tvar section = document.getElementById('personas');\n\tsection.appendChild(ul);\n\n}", "function renderResourcesBlock() {\n for (id in resources) {\n const wrapper = document.createElement('div')\n wrapper.classList.add('item-wrapper')\n const title = document.createElement('span')\n title.innerText = resources[id].metadata.title\n title.classList.add('item-title')\n\n\n\n const elem = document.createElement('video')\n const source = document.createElement('source')\n source.src = resources[id].metadata.path\n elem.classList.add('item')\n elem.id = id\n elem.appendChild(source)\n wrapper.appendChild(elem)\n wrapper.appendChild(title)\n // wrapper.append('03:21')\n $('.resources-list').append(wrapper)\n $(elem).draggable(dragObjectLogic)\n }\n}", "render() {\n return (\n <div className=\"App\">\n <h1>Movie Gallery</h1>\n <ul>\n {this.props.reduxStore.movies.map(movie => {\n return <li key={movie.id} onClick={() => this.handleClick(movie)}>\n <img src={movie.poster}/>\n <br/>\n {movie.title} \n <br/>\n {movie.description}</li>\n })}\n </ul>\n </div>\n );\n }", "function displayPhotos() {\n totalImages = photosArray.length;\n /* runs function for each object in the photosArray */\n photosArray.forEach((photo) => {\n /* <a> for Unsplash */\n const item = document.createElement(\"a\");\n setAttributes(item, {\n href: photo.links.html,\n target: \"_blank\",\n });\n /* Create image for photos */\n const img = document.createElement(\"img\");\n setAttributes(img, {\n src: photo.urls.regular,\n alt: photo.alt_description,\n title: photo.alt_description,\n });\n /* Event listener for finished loading */\n img.addEventListener(\"load\", imageLoad)\n /* puts image inside anchor then both inside imageContainer */\n item.appendChild(img);\n imageContainer.appendChild(item);\n });\n}", "function appendVideoGames4(actionSolo) {\n let htmlTemplate = \"\";\n for (let videoGame of actionSolo) {\n htmlTemplate += `\n <article>\n <img src=\"${videoGame.img}\">\n <button onclick=\"diceFunction();appendBoardGames(_boardSt)\">${videoGame.name}</button>\n </div>\n </article>\n `;\n }\n document.querySelector('#strategyTeam-container').style.display = \"flex\";\n document.querySelector('#strategyTeam-container').innerHTML = htmlTemplate;\n}", "function DisplayList(items, articlesshown_per_page, page) {\n newsList.innerHTML = \"\";\n page -= 1;\n\n let start = articlesshown_per_page * page;\n let end = start + articlesshown_per_page;\n let paginatedItems = items.slice(start, end);\n\n for (let i = 0; i < paginatedItems.length; i += 1) {\n let image = paginatedItems[i].urlToImage;\n let articleTitle =\n paginatedItems[i].title.length < 100\n ? paginatedItems[i].title\n : `${paginatedItems[i].title.slice(0, 90)}...`;\n let articleSource = paginatedItems[i].source.name;\n\n newsList.innerHTML += `<div class=\"result\">\n <img class=\"article-image modal-content modal-onClick\" src=${image} alt=\"news image\" placeholder=\"../style/BN.png\">\n <br>\n <p class=\"article-title\">${articleTitle}</p>\n <br>\n <p class=\"article-title\">${articleSource}</p>\n </div>`;\n }\n\n const modalBtn = document.querySelectorAll(\".modal-onClick\");\n\n modalBtn.forEach((artImg) => {\n artImg.addEventListener(\"click\", () => {\n openModal(artImg.src);\n });\n });\n }", "renderScreenContent(){}", "handleClick(){\n\n const filteredPro = this.props.tradeDataReducer[0].map((elem, index) => {\n\n return (\n\n <div className=\"film__card\" key={index}>\n\n <Link to={`/movie/id/:${elem.id}`}>{elem.original_title}</Link>\n\n <img src={`https://image.tmdb.org/t/p/w500${elem.poster_path}`}/>\n <p>rate: {elem.popularity} <img width=\"13\" src={require('./../images/1600.png')}/></p>\n <p>{elem.release_date}</p>\n <p>{elem.overview}</p>\n <q>language: {elem.original_language}</q>\n </div>\n\n )\n\n })\n\n this.rend = filteredPro;\n\n this.forceUpdate();\n\n }", "function displayInteractiveStory(stories, id) {\n var story = stories[id];\n\n var $story = $(getStoryHTML(story));\n $story.hide();\n $story.fadeIn(1000);\n\n $storyContainer.append($story); \n if (isEnded(story))\n $pathContainer.html('<button class=\"path-btn\" data-target=\"replay\">Replay?</button>');\n else \n $pathContainer.html(getPathHTML(story.paths));\n }", "function drawActors(actors){\n return elt('div', {}, ...actors.map(actor => {\n let rect = elt('div', {class: `actor ${actor.type}`});\n rect.style.width = `${actor.size.x*scale}px`;\n rect.style.height = `${actor.size.y*scale}px`;\n rect.style.left = `${actor.pos.x*scale}px`;\n rect.style.top = `${actor.pos.y*scale}px`;\n return rect;\n }));\n }", "function displayPhotos() {\n // Run the function for each object in photosArray\n photosArray.forEach((photo) => {\n // Create <a> to link to Unsplash\n const item = document.createElement(\"a\");\n setAttributes(item, {\n href: photo.links.html,\n blank: \"_blank\",\n });\n // Create <img> for photo\n const img = document.createElement(\"img\");\n setAttributes(img, {\n src: photo.urls.regular,\n alt: photo.alt_description,\n title: photo.alt_description,\n });\n // Put <img> inside <a> , then put both inside imageContainer ELement\n item.appendChild(img);\n imageContainer.appendChild(item);\n });\n}" ]
[ "0.6138542", "0.61364466", "0.6128347", "0.60778", "0.6074185", "0.59710544", "0.596588", "0.5951231", "0.59496063", "0.5933554", "0.5933443", "0.58687675", "0.58346635", "0.5832827", "0.5805285", "0.5790154", "0.5780234", "0.57624507", "0.5760708", "0.57531464", "0.5738228", "0.57346153", "0.57340485", "0.57222915", "0.571914", "0.5713631", "0.57087827", "0.5708624", "0.569631", "0.5694481", "0.5687932", "0.56860757", "0.5685892", "0.5680101", "0.5678358", "0.5676113", "0.56585854", "0.5655631", "0.5651594", "0.5651482", "0.56505525", "0.5643797", "0.56362617", "0.56285113", "0.5626773", "0.56200236", "0.561924", "0.5611202", "0.56105894", "0.5610422", "0.5601687", "0.56012267", "0.56009805", "0.5599466", "0.5598344", "0.5597061", "0.55931807", "0.5592939", "0.5591179", "0.5585053", "0.55741906", "0.557119", "0.5568774", "0.5563188", "0.55567616", "0.5551911", "0.5546733", "0.55425495", "0.5540381", "0.55400735", "0.55394757", "0.55391616", "0.55384934", "0.55365837", "0.5531156", "0.552893", "0.5523059", "0.5522511", "0.5521529", "0.55211955", "0.5513612", "0.5511354", "0.55080533", "0.5504444", "0.550237", "0.55007285", "0.54977", "0.54973525", "0.5488536", "0.5487622", "0.5487587", "0.54851687", "0.5484421", "0.54714745", "0.5471084", "0.5467666", "0.5466569", "0.5449188", "0.544811", "0.54465514", "0.544527" ]
0.0
-1
METODO PARA OBTENER LAS TAREAS DE UN USUARIO
function getTareasById(fk_usuario) { return new Promise((resolve, reject) => { db.query('SELECT * FROM s9q90jl9ash7sm2k.tareas WHERE fk_usuario=?', [fk_usuario], (error, result) => { if (error) { return reject(error) } else { resolve(result); console.log(result); } }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pegaNomeUsuario(numeroUsuario) {\n let nomeUsuario = rs.question(`Digite o nome do usuário ${numeroUsuario}: \\n`)\n return nomeUsuario\n}", "function _inicioSesionUsuario(aUsuario){\n\n var usuarioValido = false.\n tipoUsuario = '';\n\n for (var i = 0; i < usuarios.length; i++) {\n if (usuarios[i].correo == aUsuario.correo && usuarios[i].contrasenna == aUsuario.contrasenna) {\n if (usuarios[i].tipo == 'administrador') {\n usuarioValido = true;\n tipoUsuario = usuarios[i].tipo;\n }else if (usuarios[i].tipo == 'estudiante') {\n usuarioValido = true;\n tipoUsuario = usuarios[i].tipo;\n }else if (usuarios[i].tipo == 'asistente') {\n usuarioValido = true;\n tipoUsuario = usuarios[i].tipo;\n }else if (usuarios[i].tipo == 'profesor') {\n usuarioValido = true;\n tipoUsuario = usuarios[i].tipo;\n }\n }\n }\n\n if (usuarioValido == true) {\n return tipoUsuario;\n alert(tipoUsuario);\n }else {\n alert('Usuario No existe');\n }\n\n\n }", "function logear(){\n let correo = document.getElementById('correo').value;\n let usuario = $('#login_form #usuario').val();\n socket.emit('datos_usuario', { correo: correo, usuario: usuario } );\n yo = usuario;\n // id_user = socket.id;\n document.getElementById('usuarioLogeado').innerText = yo;\n}", "function respuesta(e){\n e=JSON.parse(e);\n if(e[0]=='username'){\n alert(\"usuario en uso, escoge otro.\");\n }else if(e[0]=='email'){\n \n alert(\"email en uso, escoge otro.\");\n }else{\n self.close();\n alert(\"Tu solicitud fué enviada, espera un correo para continuar.\");\n \n }\n \n}", "function getUsuarioActivo(nombre){\n return{\n uid: 'ABC123',\n username: nombre\n\n }\n}", "function cambiarDatosDeUsuarioEnElSitio(){\n\tvar mail=document.getElementById(\"formUserEmail\").value;\n\tvar firstName=document.getElementById(\"formUserFirstName\").value;\n\tvar lastName=document.getElementById(\"formUserLastName\").value;\n\tvar nickname=document.getElementById(\"formUserNick\").value;\n\tif(mail.length < 1 || firstName.length < 1 || lastName.length < 1 || nickname.length < 1 ){\n\t\t\tvar camposVacios=\"\";\n\t\t\tif(mail.length < 1){\n\t\t\t\tcamposVacios+=\"<p class='trn'>El Campo <b>Correo electrónico</b> es obligatorio</p>\";\n\t\t\t}\n\t\t\tif (firstName.length < 1){\n\t\t\t\tcamposVacios+=\"<p class='trn'>El Campo <b>Nombre</b> es obligatorio</p>\";\n\t\t\t}\n\t\t\tif (lastName.length < 1){\n\t\t\t\tcamposVacios+=\"<p class='trn'>El Campo <b>Apellido</b> es obligatorio</p>\";\n\t\t\t}\n\t\t\tif (nickname.length < 1){\n\t\t\t\tcamposVacios+=\"<p class='trn'>El Campo <b>Apodo</b> es obligatorio</p>\";\n\t\t\t}\n\t\t\t// Termina el tipo de mensaje\n\t\t\tavisoEmergenteJugaPlay(\"<span class='trn'>Campos vacíos</span>\",camposVacios);\n\treturn false ;\n\t}// Si paso es que los campos estan bien\n\tvar json=JSON.stringify({ \"user\": { \"first_name\": firstName,\"last_name\": lastName, \"email\": mail, \"nickname\":nickname } });\n\tif(startLoadingAnimation()==true){\n\tmensajeAlServidorConContenidoRegistro(json);}\n}", "function usuario(variable){\n alert(prompt(\"cual es su nombre?\") + \" \" + \"si decea cambia de usuario solo desinstale su app y vuelva a registrarla, por el momento no tenemos la opcion de \\\"volver a registrarse\\\"\");\n }", "function arearecaudacion(){\n this.usuario;\n}", "function cambiarIdioma(idioma) {\n\t\tvar elTitulo = document.getElementById(\"form-signin-heading\");\n\t\tvar elEmail = document.getElementById(\"ingresoEmail\");\n\t\tvar elRemember = document.getElementById(\"remember\");\n\t\tvar elIngresarCta = document.getElementById(\"ingresarCta\");\n\n\t\tif(idioma == \"es\") {\n\t\t\telTitulo.innerHTML = \"Ingresa a tu cuenta\";\n\t\t\telEmail.innerHTML = \"Ingresa tu email\";\n\t\t\tdocument.getElementById(\"inputPassword\").setAttribute(\"placeholder\",\"Contraseña\");\n\t\t\telRemember.innerHTML = \"Recordar contraseña\";\n\t\t}\n\t\telse if(idioma == \"en\") {\n\t\t\telTitulo.innerHTML = \"Please sing in\";\n\t\t\telEmail.innerHTML = \"Please enter your email\";\n\t\t\tdocument.getElementById(\"inputPassword\").setAttribute(\"placeholder\",\"Password\");\n\t\t\telRemember.innerHTML = \"Remeber me\";\n\t}\n}", "async setUser() {\n return Channel.promptedMessage('What\\'s your username?\\n\\n> ');\n }", "function setUsername() {\n const name = document.getElementById(\"name\").value;\n myUsername = name;\n\n var msg = {\n name,\n date: Date.now(),\n id: clientID,\n type: \"username\"\n };\n connection.send(JSON.stringify(msg));\n}", "function usuarioNombre() {\n let currentData = JSON.parse(sessionStorage.getItem('currentUser'));\n if (currentData.rol == \"administrador\")\n return \"Administrador\";\n else if (currentData.rol == \"estudiante\")\n return currentData.Nombre1 + ' ' + currentData.apellido1;\n else if (currentData.rol == \"cliente\")\n return currentData.primer_nombre + ' ' + currentData.primer_apellido;\n else\n return currentData.nombre1 + ' ' + currentData.apellido1;\n}", "function acceder(usuario){\n console.log(`2. ${usuario} Ahora puedes acceder`)\n entrar();\n}", "function criaUser() {\r\n var Usuarios = {\r\n email: formcliente.email.value,\r\n nome: formcliente.nome.value,\r\n pontos: formcliente.pontos.value,\r\n senha: formcliente.senha.value,\r\n sexo : formcliente.sexo.value\r\n };\r\n addUser(Usuarios);\r\n}", "function crear_usuario()\n{\n\t// se va al metodo de validacion\n\tvalidacion();\n\t//debugger;\n\t// si validar es igual a nulo\n\tif(validar === null){\n\t\t// se va a crear un nuevo usuario\n\t\tusuario = [];\n\t\t// se obtiene la contraseña\n\t\tvar contrasenna = document.getElementById(\"password\").value;\n\t\t// se optiene la repeticion de la contraseña\n\t\tvar contrasenna_repeat = document.getElementById(\"password_repeat\").value;\n\t\t// si la contraseña es vacia o nula\n\t\tif(contrasenna == \"\" || contrasenna == null){\n\t\t\t// muestra un mensaje de error\n\t\t\talert(\"No puede dejar el campo de contraseña vacio\");\n\t\t\t// si la repeticion de la contraseña es vacio o nula\n\t\t}else if(contrasenna_repeat == \"\" || contrasenna_repeat == null){\n\t\t\t// muestra un mensaje de error\n\t\t\talert(\"No puede dejar el campo de repetir contraseña vacio\");\n\t\t}else{\n\t\t\t// si la contraseña es igual a la repeticion de la contraseña\n\t\t\tif(contrasenna === contrasenna_repeat){\n\t\t\t\t// obtiene el nombre de usuario\n\t\t\t\tvar nombreU = document.getElementById(\"user\").value;\n\t\t\t\t// obtiene el nombre completo\n\t\t\t\tvar nombreFull = document.getElementById(\"fullName\").value;\n\t\t\t\t// pregunta que si el nombre de usuario es vacio o nulo\n\t\t\t\tif(nombreU == \"\" || nombreU == null){\n\t\t\t\t\t// si es asi muestra un mensaje de error\n\t\t\t\t\talert(\"No puede dejar el campo de nombre de usuario vacio\");\n\t\t\t\t\t// pregunta que si el nombre completo es vacio o nulo\n\t\t\t\t}else if(nombreFull == \"\" || nombreFull == null){\n\t\t\t\t\t// muestra un mensaje de error\n\t\t\t\t\talert(\"No puede dejar el campo de nombre completo vacio\");\n\t\t\t\t\t// si no fuera asi\n\t\t\t\t}else{\n\n\t\t\t\t\t// crea el usuario\n\t\t\t\t\tusuario.push(document.getElementById(\"numero\").value, document.getElementById(\"fullName\").value, document.getElementById(\"user\").value,\n\t\t\t\t\t\tdocument.getElementById(\"password\").value, document.getElementById(\"password_repeat\").value);\n\t\t\t\t\t// lo agrega al arreglo de usuarios\n\t\t\t\t\tUser.push(usuario);\n\t\t\t\t\t// agrega el arreglo de arreglos al localstorage con el usuario nuevo\n\t\t\t\t\tlocalStorage['usuarios'] = JSON.stringify(User);\n\t\t\t\t\t// muestra un mensaje que ya puede iniciar sesion\n\t\t\t\t\talert(\"Usuario creado ya puedes iniciar sesion\");\n\t\t\t\t\t// se va a la pagina principal\n\t\t\t\t\tlocation.href=\"tablero-de-instrucciones.html\"\n\t\t\t\t}\n\t\t\t\t// si no fuera asi\n\t\t\t}else{\n\t\t\t\t// muestra un mensaje de error donde muestra que las contraseñas son diferentes\n\t\t\t\talert(\"No puedes crear el usuario porque las contraseñas son diferentes, asegurese que sea las mismas\");\n\t\t\t}\n\t\t}\n\t\t// si no es asi pregunta que si es administrador\n\t}else if(validar === \"Entra como administracion\"){\n\t\t// si es asi no lo puede crear porque ya exite\n\t\talert(\"No puedes crear con ese nombre de usuario porque ya existe\");\n\t\t// si no es asi pregunta que si es particular\n\t}else if(validar === \"Entra como particular\"){\n\t\t// si es asi no lo puede crear porque ya exite\n\t\talert(\"No puedes crear con ese nombre de usuario porque ya existe\");\n\t\t// si no es asi pregunta si no se pudo crear\n\t}else if(validar === \"No_se_pudo_crear\"){\n\t\t// si es asi no lo puede crear\n\t\talert(\"No se pudo crear el usuario\");\n\t\t// se le asigna a validar el valor de nulo\n\t\tvalidar = null;\n\t}\n}", "function detectLogin(){\n /*obtengo los valores*/\n var email_user_=$.session.get(\"EmailUser\");\n var password_user_=$.session.get(\"PasswordUser\");\n var Object_user_=JSON.parse($.session.get(\"ObjectUser\"));\n if(typeof(email_user_)=='string' && typeof(password_user_)==\"string\")\n {\n $(\".email-user\").text(Object_user_.Name)\n\n }else{\n window.location=\"chat-login.html\";\n }\n }", "function cambiausuario() {\n var f = document.getElementById(\"editar\");\n if(f.f2nom.value==\"\" || f.f2nick.value==\"\" || f.f2pass.value==\"\" || f.f2mail.value==\"\") {\n alert(\"Deben llenarse todos los campos para proceder\");\n } else {\n var x = new paws();\n x.addVar(\"nombre\",f.f2nom.value);\n x.addVar(\"nick\",f.f2nick.value);\n x.addVar(\"pass\",f.f2pass.value);\n x.addVar(\"email\",f.f2mail.value);\n x.addVar(\"estatus\",f.f2est.selectedIndex);\n x.addVar(\"cliente_id\",f.f2cid.value);\n x.addVar(\"usuario_id\",f.f2usrid.value);\n x.go(\"clientes\",\"editausr\",llenausr);\n }\n}", "function soloUsuario(e) {\n tecla = (document.all) ? e.keyCode : e.which;\n if (tecla == 8) return true;\n patron = /^([A-Za-zÑñáéíóúÁÉÍÓÚ0-9]+)$/;\n\n te = String.fromCharCode(tecla);\n return patron.test(te);\n}", "function loginMe() {\n alert(\"Chào mừng bạn tới trang web !!!\");\n var person = $('#myName').html().trim(); // take account's email => person = [email protected]\n console.log(\"Person: \" + person);\n \n socket.emit('newUser', person);\n \n}", "function ConvalidaLogin() {\r\n\t\t// definisce la variabile booleana blnControllo e la setta a false\r\n\t\tvar blnControllo = false;\r\n \r\n\t\t// controllo del nome utente inserito \r\n if (document.getElementById(\"txtNomeUtente\").value.length ==0) {\r\n\t\t\t//alert (\"Non hai inserito il nome utente!\");\r\n\t\t\tsetTimeout(\"document.getElementById(\\\"txtNomeUtente\\\").focus();\", 1);\t\t\t// la setTimeout serve a farlo funzionare con FF\r\n\t\t\treturn;\r\n } \r\n\t\telse {\r\n\t\t\tblnControllo = true;\r\n }\r\n \r\n\t\t// controllo della password inserita\r\n if (document.getElementById(\"txtPassword\").value.length ==0) {\r\n\t\t\t//alert (\"Non hai inserito la password!\");\r\n\t\t\tsetTimeout(\"document.getElementById(\\\"txtPassword\\\").focus();\", 1);\t\t\t// la setTimeout serve a farlo funzionare con FF\r\n\t\t\treturn;\r\n } \r\n\t\telse {\r\n blnControllo = true;\r\n }\r\n \r\n return;\r\n } // chiusura della function ConvalidaLogin\t", "function userConnect()\n {\n $.ajax({\n // On définit l'URL appelée\n url: 'http://localhost/tchat/API/index.php',\n // On définit la méthode HTTP\n type: 'GET',\n // On définit les données qui seront envoyées\n data: {\n action: 'userAdd',\n userNickname: $('#userNickname').val()\n },\n // l'équivalent d'un \"case\" avec les codes de statut HTTP\n statusCode: {\n // Si l'utilisateur est bien créé\n 201: function (response) {\n // On stocke l'identifiant récupéré dans la variable globale userId\n window.userId = response.userId;\n // On masque la fenêtre, puis on rafraichit la liste de utilisateurs\n // (à faire...)\n },\n // Si l'utilisateur existe déjà\n 208: function (response) {\n // On fait bouger la fenêtre de gauche à droite\n // et de droite à gauche 3 fois\n // (à faire...)\n }\n }\n })\n }", "function logitudRespuestas(){\n\t\tdatalong=[];\n\t\tfor(var _i=0;_i<longitudEncuesta.length;_i++){\n\t\t\tdatalong.push(\"\");\n\t\t}\n\t\tAlloy.Globals.respuestasUsuario=datalong;\n\t}", "function connect() {\n pseudo = pseudoInput.value.trim();\n if (pseudo.length === 0) {\n alert(\"Votre pseudo ne doit pas être vide ! \");\n return;\n }\n if (!/^\\S+$/.test(pseudo)) {\n alert(\"Votre pseudo ne doit pas contenir d'espaces ! \");\n return;\n }\n sock.emit(\"login\", pseudo);\n }", "function iniciar_Sesion()\n{\n\t// obtiene el nombre del usuario\n\tvar nombre_usuario = document.getElementById(\"user\").value;\n\t// obtiene la contraseña del usuario\n\tvar contrasenna = document.getElementById(\"password\").value;\n\t// pregunta si el nombre es admin y la contraseña es $uperadmin para saber si es el administrador\n\tif(nombre_usuario === \"admin\" && contrasenna === \"$uper4dmin\"){\n\t\t// si es asi validar va a decir que el que va a iniciar sesion es el administrador\n\t\tvalidar = \"Entra como administracion\";\n\t\t// entonces el usuario actual va a ser admin\n\t\tuser_actual = 'Admin';\n\t\t// se va al localstorage y guarda el usuario actual para saber quien fue el que entró\n\t\tlocalStorage.setItem(\"Usuario_Actual\",user_actual);\n\t\t// si no fuera así\n\t}else{\n\t\t// se va a la funcion donde valida si el usuario existe o no y si existe cual es\n\t\tvalidacion();\n\t}\n\t// si validar fuera igual a nulo\n\tif(validar === null){\n\t\t// se muestra un mensaje donde le indica que lo debe crear primero entonces no puede iniciar sesion\n\t\talert(\"Debe crearlo primero antes de iniciar sesion\");\n\t\t// si validar fuera que entra coo administrador\n\t}else if(validar === \"Entra como administracion\"){\n\t\t// entonces entra como administrador\n\t\tlocation.href=\"tablero-de-instrucciones.html\";\n\t\t// muestra un mensaje de bienvenida\n\t\talert(\"BIENVENIDO\");\n\t\t// si validar fuera que entra como particular\n\t}else if(validar === \"Entra como particular\"){\n\t\t// entonces se valida el nombre de usuario para saber quien es.\n\t\tuser_actual = document.getElementById(\"user\").value;\n\t\t//lo guarda en el localstorage\n\t\tlocalStorage.setItem(\"Usuario_Actual\", user_actual);\n\t\t// entra como particular\n\t\tlocation.href=\"tablero-de-instrucciones.html\";\n\t\t// muestra un mensaje de bienvenida\n\t\talert(\"BIENVENIDO\");\n\t}\n\n}", "function mostrarUsuario(idsuscriptor){\n $(\"#idsuscriptor_usuario\").val(idsuscriptor);\n\n $.post(\"views/ajax/admin_panel.php?op=mostrarAdmin\", {\n idsuscriptor: idsuscriptor\n }, function(data, status) {\n data = JSON.parse(data);\n\n mostrarformUsuario(true);\n //Como estan definidos los campos en la base de datos\n $(\"#idusuario_suscriptor\").val(data.idusuario_suscriptor);\n $(\"#nombre_completo\").val(data.nombre_completo);\n $(\"#email\").val(data.email);\n\n });\n\n\n}", "function getDatos() {\n\tvar comando= {\n\t\t\tid : sessionStorage.getItem(\"idUsuario\")\n\t};\n\t\n\tvar request = new XMLHttpRequest();\t\n\trequest.open(\"post\", \"GetDatosUsuario.action\");\n\trequest.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\trequest.onreadystatechange=function() {\n\t\tif (request.readyState==4 && request.status==200) {\n\t\t\tvar respuesta=JSON.parse(request.responseText);\n\t\t\trespuesta=JSON.parse(respuesta.resultado);\n\t\t\tif (respuesta.tipo==\"error\") {\n\t\t\t\talert(\"Ocurrió un error al recuperar los datos: \" + respuesta.mensaje);\n\t\t\t} else {\n\t\t\t\tvar email=document.getElementById(\"email\")\n\t\t\t\tvar nombre=document.getElementById(\"nombre\");\n\t\t\t\tvar apellido1=document.getElementById(\"apellido1\");\n\t\t\t\tvar apellido2=document.getElementById(\"apellido2\");\n\t\t\t\tvar fechaDeAlta=document.getElementById(\"fechaDeAlta\");\n\t\t\t\tvar telefono=document.getElementById(\"telefono\");\n\t\t\t\tvar idUbicacion=document.getElementById(\"idUbicacion\");\n\t\t\t\tif (email!=null) email.value=respuesta.email;\n\t\t\t\tif (nombre!=null) nombre.value=respuesta.nombre;\n\t\t\t\tif (apellido1!=null) apellido1.value=respuesta.apellido1;\n\t\t\t\tif (apellido2!=null) apellido2.value=respuesta.apellido2;\n\t\t\t\tif (fechaDeAlta!=null) fechaDeAlta.value=respuesta.fechaDeAlta;\n\t\t\t\tif (telefono!=null) telefono.value=respuesta.telefono;\n\t\t\t\tif (idUbicacion!=null) idUbicacion.value=respuesta.idUbicacion;\n\t\t\t}\n\t\t}\n\t};\n\tvar pars=\"command=\" + JSON.stringify(comando);\n\trequest.send(pars);\n}", "function usuario() {\n entity = 'usuario';\n return methods;\n }", "function validaCreaUsuario(){\r\n\t\r\n\tvar name = $(\"#name\").val();\r\n\tvar surname = $(\"#surname\").val();\r\n\tvar email = $(\"#email\").val();\r\n\tvar login = $(\"#login\").val();\r\n\tvar password = $(\"#password\").val();\r\n\t\r\n\tif (name.length == 0 || /^\\s+$/.test(name)) {\r\n\t\tdocument.getElementById(\"createMessage\").style.visibility=\"visible\";\r\n\t\t$(\"#createMessage\").text(\"Nombre de usuario obligatorio\");\r\n\t\t$(\"#name\").focus();\r\n\t\t$(\"#name\").select();\t\t\r\n\t}\r\n\telse{\r\n\t\tif (surname.length == 0 || /^\\s+$/.test(surname)) {\r\n\t\t\tdocument.getElementById(\"createMessage\").style.visibility=\"visible\";\r\n\t\t\t$(\"#createMessage\").text(\"Apellidos de usuario obligatorios\");\r\n\t\t\t$(\"#surname\").focus();\r\n\t\t\t$(\"#surname\").select();\t\t\r\n\t\t}\r\n\t\telse{\r\n\t\t\tif (email==\"\"){\r\n\t\t\t\tdocument.getElementById(\"createMessage\").style.visibility=\"visible\";\r\n\t\t\t\t$(\"#createMessage\").text(\"Email de usuario obligatorio\");\r\n\t\t\t\t$(\"#email\").focus();\r\n\t\t\t\t$(\"#email\").select();\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t\r\n\t\t\t\tvar expReg = /^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/;\r\n\t\t\t\t\r\n\t\t\t\tif (expReg.test(email)){\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (login.length == 0 || /^\\s+$/.test(login)) {\r\n\t\t\t\t\t\tdocument.getElementById(\"createMessage\").style.visibility=\"visible\";\r\n\t\t\t\t\t\t$(\"#createMessage\").text(\"Login de usuario obligatorio\");\r\n\t\t\t\t\t\t$(\"#login\").focus();\r\n\t\t\t\t\t\t$(\"#login\").select();\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse{\r\n\t\t\t\t\t\tif (password.length == 0 || /^\\s+$/.test(password)) {\r\n\t\t\t\t\t\t\tdocument.getElementById(\"createMessage\").style.visibility=\"visible\";\r\n\t\t\t\t\t\t\t$(\"#createMessage\").text(\"Clave de usuario obligatoria\");\r\n\t\t\t\t\t\t\t$(\"#password\").focus();\r\n\t\t\t\t\t\t\t$(\"#password\").select();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse{\t\t\t\t\t\r\n\t\t\t\t\t\t\tprocesaCreaUsuario();\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\telse{\r\n\t\t\t\t\tdocument.getElementById(\"createMessage\").style.visibility=\"visible\";\r\n\t\t\t\t\t$(\"#createMessage\").text(\"Formato de email incorrecto.\");\r\n\t\t\t\t\t$(\"#email\").focus();\r\n\t\t\t\t\t$(\"#email\").select();\r\n\t\t\t\t\t\r\n\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "function acceder(){\r\n limpiarMensajesError()//Limpio todos los mensajes de error cada vez que corro la funcion\r\n let nombreUsuario = document.querySelector(\"#txtUsuario\").value ;\r\n let clave = document.querySelector(\"#txtClave\").value;\r\n let acceso = comprobarAcceso (nombreUsuario, clave);\r\n let perfil = \"\"; //variable para capturar perfil del usuario ingresado\r\n let i = 0;\r\n while(i < usuarios.length){\r\n const element = usuarios[i].nombreUsuario.toLowerCase();\r\n if(element === nombreUsuario.toLowerCase()){\r\n perfil = usuarios[i].perfil;\r\n usuarioLoggeado = usuarios[i].nombreUsuario;\r\n }\r\n i++\r\n }\r\n //Cuando acceso es true \r\n if(acceso){\r\n if(perfil === \"alumno\"){\r\n alumnoIngreso();\r\n }else if(perfil === \"docente\"){\r\n docenteIngreso();\r\n }\r\n }\r\n}", "function Usuario (email, num_afiliacion) {\n \n var obj = {\n email: email,\n num_afiliacion: num_afiliacion\n };\n\n return obj; \n}", "function login(params) {\n let query = 'SELECT * FROM USUARIO_SISTEMA WHERE CORREO = $1 AND CONTRASENA = $2';\n let {correo, contrasena} = params.datos,\n values = [correo, contrasena]\n return database.query(query, values)\n .then(response => {\n return response.rows[0];\n })\n .catch(err => { console.log(\"errorr: \" + err) });\n}", "function desbloquearCamposHU(){\n\t\tif(tieneRol(\"cliente\")){//nombre, identificador, prioridad, descripcion y observaciones puede modificar, el boton crear esta activo para el\n\t\t\n\t\t}\n\t\tif(tieneRol(\"programadror\")){// modificar:estimacion de tiempo y unidad dependencia responsables, todos los botones botones \n\t\t\n\t\t}\n\t}", "function loginMessages() {\n if (Session.get(\"sessionLanguage\") === \"portuguese\") {\n FlashMessages.sendError(\"Autenticação falhou\");\n } else {\n FlashMessages.sendError(\"Authentication failed.\");\n }\n}", "function obtenerMensaje1(campo){\n\tvar mensaje = \"\";\n switch(campo){\n case 'idproraz': mensaje = \"Si modific&oacute; alg&uacuten campo de este m&oacute;dulo debe justificar.\";\n\tbreak;\n\t}\n\treturn mensaje; \n\t\n}", "function mostrarVentanaInicio(){\n\t//verificar el rol\n\tif (datosUsuario[0][\"idRol\"] == 3) {\n\t\tmostrarVentanaChef1(datosUsuario[0][\"nombre\"]);\t// Invoca la ventana de Cocina y envia nombre del empleado\n\t}\n\telse if(datosUsuario[0][\"idRol\"] == 2) {\n\t\tmostrarVentanaCajero(datosUsuario[0][\"nombre\"]);\t//Invoca la ventana de Cajero y envia nombre del empleado\n\t}\n\telse{\n\t\tmostrarVentanaMesero(datosUsuario[0][\"nombre\"]);\t//Invoca la ventana de Mesero y envia nombre del empleado\n\t}\n\n}", "mostrarSaludo(mensaje){\n\t\treturn mensaje;\t\n\t}", "function fncValidarLoginUsuario(frm){\n\ttry{\n\t\tvar username = trim(frm.username.value);\n\t\tvar password = trim(frm.password.value);\n\t\tvar msg = \"OCURRIERON LOS SIGUIENTES ERRORES:\\n\\n\";\n\t\tif(username==\"\"){ alert(msg+\"- No ingreso su USUARIO de ingreso.\"); frm.username.value=''; frm.username.focus(); return false; }\n\t\tif(password==\"\"){ alert(msg+\"- No ingreso su CLAVE de ingreso.\"); frm.password.value=''; frm.password.focus(); return false; }\n\t\treturn true;\n\t}catch(ex){\n\t\talert(ex.description); return false;\n\t}\n}", "function getUserNameById(id) {\n // codigo\n return \"Regulus\";\n}", "function cargarNombreEnPantalla() {\n if (loggedIn) {\n document.getElementById(\"nombre\").innerHTML = \"Bienvenido/a \" + usuarioLogeado.nombre;\n }\n}", "function setUsername() {\n myUsername = document.getElementById(\"name\").value;\n\n sendToServer({\n name: myUsername,\n date: Date.now(),\n id: clientID,\n type: \"username\"\n });\n}", "function Usuario(nomb, apell, edad = 1) {\n this.nombre = nomb;\n this.apellido = apell;\n this.edad = edad;\n}", "function iniciarSesion(dataUsuario) {\n usuarioLogueado = new Usuario(dataUsuario.data._id, dataUsuario.data.nombre, dataUsuario.data.apellido, dataUsuario.data.email, dataUsuario.data.direccion, null);\n tokenGuardado = dataUsuario.data.token;\n localStorage.setItem(\"AppUsuarioToken\", tokenGuardado);\n navegar('home', true, dataUsuario);\n}", "function SeleccionarUsuario($scope, ServiciosUsuarios) {\n $scope.usuarios = ServiciosUsuarios.usuarios;\n\n $scope.guardar_usuario = function(user) {\n ServiciosUsuarios.SeleccionarUsuario(user);\n ServiciosUbicacion.Geolocalizar();\n };\n \n //SERVICIOS INICIO\n $scope.$on('UsuarioElegido', function() {\n $scope.usuario = ServiciosUsuarios.usuario;\n }); \n //SERVICIOS FIN \n }", "function usuario(){\n\tvar nombreDelUsuario = document.getElementById(\"user\");\n\tasignarNombre(nombreDelUsuario);\n}", "function alIniciar(){\n usuario.email = localStorage.getItem(\"email\");\n modalContacto.usuarioEmail = localStorage.getItem(\"email\");\n modalContacto.usuarioRol = localStorage.getItem(\"rol\");\n if(modalContacto.usuarioRol == \"Periodista\"){\n usuario.rol = 1;\n } else{\n usuario.rol = 2;\n }\n modalContacto.usuarioNombre = localStorage.getItem(\"nombre\");\n modalContacto.usuarioApellido = localStorage.getItem(\"apellido\");\n modalContacto.usuarioPuntos = localStorage.getItem(\"puntaje\");\n}", "function iniciar() {\n cuerpoTablaUsuario = document.getElementById('cuerpoTablaUsuario'); \n divRespuesta = document.getElementById('divRespuesta');\n var botonAlta = document.getElementById('botonAlta');\n botonAlta.addEventListener('click', altaUsuario); \n}", "function user(){\n\n var person = usuario.name+\" - (\"+usuario.username+\")\";\n socket.emit(\"nickname\", person);\n\n return false;\n }", "function mioRuolo(offerta){\r\n return (offerta.ospitato === JSON.parse(localStorage.utente).username)?\"Ospitato\":\"Ospitante\";\r\n}", "function registrar_pantalla(conexion)\n{\n\tconexion.send(json_msj({type:'screen_conect'}));\n}", "function persona(usr,contra,ip,puert) {\n this.usuario=usr;\n this.contraseña=contra;\n this.IP =ip;\n this.puerto=puert;\n}", "function asignarNombre(nombreUsuario){\n\tvar nombreU = nombreUsuario;\n\tvar elemento = document.getElementById(\"Hi_user\");\n\telemento.innerHTML = nombreU;\n}", "function selUsuario(datosUsuario){\n datos = datosUsuario.split(\"-\");\n idPersona = datos[0];\n loginUsuario = datos[1];\n idSistema=$('idSistema').value;//idSistema de la ventana de buscador de personas\n var url = '../../ccontrol/control/control.php';\n var data = 'p1=listaDetallePermiso&p2=' + idSistema + '&p3=' + idPersona;\n new Ajax.Request (url,\n {method : 'get',\n parameters : data,\n onLoading : function(transport){est_cargador(1);},\n onComplete : function(transport){est_cargador(0);\n Windows.close(\"Div_buscador3\");\n $('contenido_detalle').innerHTML=transport.responseText;\n $('login_usuario').value=loginUsuario;\n $('idpersona').value=idPersona;\n $('nombre_formulario_permiso').value='';\n $('nombre_formulario_permiso').focus();\n }\n }\n )\n}", "function Registrar(){\r\n if(txtCor.value==\"\" || txtCor.value==null){\r\n alert(\"Ingrese el correo\");\r\n txtCor.focus();\r\n }else if(txtCon.value==\"\" || txtCon.value==null){\r\n alert(\"Ingrese la contraseña\");\r\n txtCon.focus();\r\n }else{\r\n var cor=txtCor.value;\r\n var con=txtCon.value;\r\n \r\n auth.createUserWithEmailAndPassword(cor,con)\r\n .then((userCredential) => {\r\n alert(\"Se registro el usuario\");\r\n Limpiar();\r\n })\r\n .catch((error) =>{\r\n alert(\"No se registro el usuario\");\r\n var errorCode = error.code;\r\n var errorMessage = error.message;\r\n });\r\n\r\n }\r\n}", "function cargarUsuarioPersistente(){\n\tvar db = obtenerBD();\n\tvar query = 'SELECT * FROM Usuario';\n\tdb.transaction(\n\t\tfunction(tx){\n\t\t\ttx.executeSql(\n\t\t\t\tquery, \n\t\t\t\t[], \n\t\t\t\tfunction (tx, resultado){\n\t\t\t\t\tvar CantFilas = resultado.rows.length;\t\t\t\t\t\n\t\t\t\t\tif (CantFilas > 0){\n\t\t\t\t\t\tIdUsuario = resultado.rows.item(0).ID;\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tNomUsuario = resultado.rows.item(0).Nombre;\n\t\t\t\t\t\tPassword = resultado.rows.item(0).Password;\n\t\t\t\t\t\tIsAdmin = resultado.rows.item(0).IsAdmin;\n\t\t\t\t\t\tlogin();\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t}, \n\t\t\t\terrorBD\n\t\t\t);\n\t\t},\n\t\terrorBD\n\t);\n}", "function obtenerPermisosUsuario(){\n\n\t\tvar user = $('select#usuario').val();\n\t\tvar table = $('select#tabla').val();\n\n\t\t$.ajax({\n\n\t\t\tdata: { user: usuario, \n\t\t\t\t\tpass: pasword,\n\t\t\t\t\tagencia: agencia,\n\t\t\t\t\tusuario: user,\n\t\t\t\t\ttabla: table},\n\t\t\t\t\turl: 'http://apirest/permisos/tabla/',\n\t\t\t\t\ttype: 'POST',\n\n\t\t\tsuccess: function(data, status, jqXHR) {\n\t\t\t\tconsole.log(data);\n\n\t\t\t\tif(data.message == 'Autentication Failure'){\n\t\t\t\t\tmostrarMensaje(\"No estas autorizado para la gestión de permisos\",\"../../index.php\");\n\t\t\t\t}else if(data.message == 'OK'){\n\t\t\t\t\tmostrarPermisos(data);\n\t\t\t\t}else{\n\t\t\t\t\tmostrarMensajePermisos(\"No estas autorizado para añadir/eliminar permisos a ese usuario\");\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\terror: function (jqXHR, status) { \n\t\t\t\tmostrarMensaje(\"Fallo en la petición al Servicio Web\",\"../../index.php\");\n\t\t\t}\n\t\t\t\n\t\t});\n\n\t}", "function userConnect()\n{\n $.ajax({\n // On définit l'URL appelée\n url: 'http://localhost/tchat/API/index.php',\n // On définit la méthode HTTP\n type: 'GET',\n // On définit les données qui seront envoyées\n data: {\n action: 'userAdd',\n userNickname: $('#userNickname').val()\n },\n // l'équivalent d'un \"case\" avec les codes de statut HTTP\n statusCode: {\n // Si l'utilisateur est bien créé\n 201: function (response) {\n //console.log(\"Si l'utilisateur est bien créé\");\n console.log(response);\n // On stocke l'identifiant récupéré dans la variable globale userId\n window.userId = response;\n // On masque la fenêtre, puis on rafraichit la liste de utilisateurs\n //(a faire...)\n $('#connexion').css(\"display\",\"none\");\n usersListRefresh();\n },\n // Si l'utilisateur existe déjà\n 208: function (response) {\n console.log(\"Si l'utilisateur existe déjà\");\n // On fait bouger la fenêtre de gauche à droite\n // et de droite à gauche 3 fois\n // (à faire...)\n $(\"#login\").animate({marginLeft:'1rem'},30)\n .animate({marginLeft:'-1rem'},30)\n .animate({marginLeft:'1rem'},30)\n .animate({marginLeft:'-1rem'},30)\n .animate({marginLeft:'1rem'},30)\n }\n }\n })\n}", "function registro(){ \r\n limpiarMensajesError();//Limpio todos los mensajes de error cada vez que corro la funcion\r\n let nombre = document.querySelector(\"#txtNombre\").value;\r\n let nombreUsuario = document.querySelector(\"#txtNombreUsuario\").value;\r\n let clave = document.querySelector(\"#txtContraseña\").value;\r\n let perfil = Number(document.querySelector(\"#selPerfil\").value); //Lo convierto a Number directo del html porque yo controlo qu'e puede elegir el usuario\r\n let recibirValidacion = validacionesRegistro (nombre, nombreUsuario, clave); //\r\n if(recibirValidacion && perfil != -1){ \r\n crearUsuario(nombre, nombreUsuario, clave, perfil);\r\n if(perfil === 2){\r\n usuarioLoggeado = nombreUsuario; //Guardo en la variable global el nombre de usuario ingresado (tiene que ir antes de ejecutar la funcion alumno ingreso)\r\n alumnoIngreso();\r\n }else{\r\n usuarioLoggeado = nombreUsuario; //Guardo en la variable global el nombre de usuario ingresado\r\n docenteIngreso();//Guardo en la variable global el nombre de usuario ingresado (tiene que ir antes de ejecutar la funcion alumno ingreso)\r\n }\r\n }\r\n if(perfil === -1){\r\n document.querySelector(\"#errorPerfil\").innerHTML = \"Seleccione un perfil\";\r\n }\r\n}", "function controlli(){\n\n\t//array delli controlli\n\tvar controll = [[\"form_username\", \"Username\"],\n\t\t\t\t\t[\"form_useremail\", \"User e-mail\"],\n\t\t\t\t\t[\"form_password\", \"Password\"]];\n\t\t\t\t\t\n\t//Inserimento aiuti\n\tfor (i = 0; i < 3; i++){\n\t\tvar elem = document.getElementById(controll[i][0]);\n\t\telem.defaultValue = controll[i][1];\n\t\telem.style.color = \"#515151\";\n\t}\n\t\n\t//document.getElementById(\"form_useremail\").focus();\n\t//document.getElementById(\"form_useremail\").select();\n}", "function getOtherUserNameById(id) {\n // codigo\n return \"Regulus\";\n}", "function form_control()\n{\n\n// Variabili associate ai campi del modulo\nvar username = document.getElementById(\"form_username\").value;\nvar useremail = document.getElementById(\"form_useremail\").value;\nvar pass = document.getElementById(\"form_password\").value;\n\n \n//creo le espressioni regolari\nvar name_re = /^([a-zA-Z0-9\\_\\*\\-\\+\\!\\?\\,\\:\\;\\.\\xE0\\xE8\\xE9\\xF9\\xF2\\xEC\\x27])+$/;\nvar user_re = /^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/;\nvar pass_re = /^([a-zA-Z0-9\\_\\*\\-\\+\\!\\?\\,\\:\\;\\.\\xE0\\xE8\\xE9\\xF9\\xF2\\xEC\\x27])+$/;\n\n\n//array degli id span\nvar vettore = [\"uname\", \"uemail\", \"pass\"];\n\n//se settati svuoto gli span di errore\nfor (i=0; i<3; i++) {\n\tif (document.getElementById(vettore[i]) != \"\") {\n\t\tdocument.getElementById(vettore[i]).innerHTML = \"\";\n\t}\n}\n\n//Effettua il controllo sul campo username\nif ((username == \"\") || (username == \"undefined\") || (username == \"Username\")) {\n\tdocument.getElementById(\"uname\").innerHTML = \"Il campo è obbligatorio.\";\n document.getElementById(\"form_username\").focus();\n document.getElementById(\"form_username\").select();\n return false;\n}\nelse if (!name_re.test(username)) {\n \tdocument.getElementById(\"uname\").innerHTML = \"Inserire il campo in modo corretto.\";\n \tdocument.getElementById(\"form_username\").focus();\n \tdocument.getElementById(\"form_username\").select();\n \treturn false;\n\n}//Effettua il controllo sul campo useremail\nelse if ((useremail == \"\") || (useremail == \"undefined\") || (useremail == \"User e-mail\")) {\n\tdocument.getElementById(\"uemail\").innerHTML = \"Il campo è obbligatorio.\";\n document.getElementById(\"form_useremail\").focus();\n document.getElementById(\"form_useremail\").select();\n return false;\n}\nelse if (!user_re.test(useremail)) {\n \tdocument.getElementById(\"uemail\").innerHTML = \"Inserire il campo in modo corretto.\";\n \tdocument.getElementById(\"form_useremail\").focus();\n \tdocument.getElementById(\"form_useremail\").select();\n \treturn false;\n}//Effettua il controllo sul campo password\nelse if ((pass == \"\") || (pass == \"undefined\") || (pass == \"Password\")) {\n document.getElementById(\"pass\").innerHTML = \"Il campo è obbligatorio.\";\n document.getElementById(\"form_password\").focus();\n document.getElementById(\"form_password\").select();\n return false; \n}\nelse if (!pass_re.test(pass)) {\n \tdocument.getElementById(\"pass\").innerHTML = \"Inserire il campo in modo corretto.\";\n \tdocument.getElementById(\"form_password\").focus();\n \tdocument.getElementById(\"form_password\").select();\n \treturn false;\n}//Finiti i controlli se tutto ok invio i dati\nelse {\n \tvar form = document.getElementById(\"registrazione\");\n \tform.action = \"cgi-bin/reg_control.cgi\";// qui ci va l'indirizzo del file cgi che gestirà l'accesso\n\tform.submit();\n}\n}", "function buscarClienteOnClick(){\n if ( get('formulario.accion') != 'clienteSeleccionado' ) {\n // var oid;\n // var obj = new Object();\n var whnd = mostrarModalSICC('LPBusquedaRapidaCliente','',new Object());//[1] obj);\n if(whnd!=null){\n \n //[1] }else{\n /* posicion N°\n 0 : oid del cliente\n 1 : codigo del cliente\n 2 : Nombre1 del cliente\n 3 : Nombre2 del cliente\n 4 : apellido1 del cliente\n 5 : apellido2 del cliente */\n \n var oid = whnd[0];\n var cod = whnd[1];\n //[1] var nombre1 = whnd[2];\n //[1] var nombre2 = whnd[3];\n //[1] var apellido1 = whnd[4]; \n //[1] var apellido2 = whnd[5]; \n \n // asigno los valores a las variables y campos corresp.\n set(\"frmFormulario.hOidCliente\", oid);\n set(\"frmFormulario.txtCodigoCliente\", cod);\n \n } \n }\n }", "function ejercicio05(user){\n console.log(user);\n mismo = \"\";\n if (user.nombre===\"Yunior\")\n { \n return \"La persona introducida es Yunior\"; \n }\n if (user.correo.indexOf(\"yunior\") > -1 || user.edad == 24)\n {\n if (user.correo.indexOf(\"yunior\") > -1 )\n {\n mismo = \"el mismo correo\";\n }\n else\n {\n mismo = \"la misma edad\";\n }\n return \"La persona introducida pudiera ser Yunior. Ya que tiene \" + mismo; \n }\n else\n {\n return \"La persona introducida no es Yunior\";\n }\n}", "function saludarUsuario(nombreUsuario){\n\n console.log(\"Buenas tardes \"+nombreUsuario);\n\n}", "function loginauthor () {\n var xhr = httpIo.httpGet(\"/api/guest\", function (data, object) {\n console.log(\"game connect suLayaess!!\");\n // console.log(data);\n Laya.beimi.user.id = JSON.parse(data).token.userid;\n connectService();\n }, function () {\n console.log(\"game connect fail !!\");\n });\n\n}", "function correo() {\n\tgetSubscribedUsers( function(obj) {\n\t\tvar users = obj;\n\t\tusers.forEach(function(user){\n\t\t\t// setup email data with unicode symbols\n\t\t\tvar mail = user.email;\n\t\t\tvar name = user.user_name;\n\t\t\tvar hmks = importanceOrderHmks(user.hmk, 7);\n\t\t\tvar subj = name+', tienes '+hmks.length+' tareas para esta semana!';\n\t\t\tconst list = hmks.map(hmk => \"<li>\"+hmk.name+\" (importancia: \"+hmk.importance+\")</li>\");\n\t\t\tconst hmklist = '<ol>' + list.join('') + '</ol>';\n\t\t\tvar msg = \"<h1>Hola \"+name+\"!</h1><h2>Tienes \"+hmks.length+\" tareas para esta semana.</h2> \\\n\t\t\t<p> A continuación te presentamos el orden en el cual te sugerimos hacerlas:</p>\"+hmklist;\n\t\t\tsendMail(mail, subj, msg);\n\t\t});\n\t});\n}", "function getIdUsuario (){\n\treturn Math.round(Math.random() * 50) + 1;\n}", "function llenausr(o) {\n var aCte = new Array();\n eval(b64.decode(o.contenido));\n if(aCte.length) {\n foco();\n var leyenda = document.getElementById(\"f2nombrecte\");\n var forma = document.getElementById(\"f2\");\n leyenda.firstChild.nodeValue = \"Cliente: \" + aCte[0];\n document.getElementById(\"f2cid\").value=aCte[1];\n document.getElementById(\"f2leg\").innerHTML=\"Agregar Usuario\";\n document.getElementById(\"f2usrid\").value=\"0\";\n document.getElementById(\"f2est\").selectedIndex=1;\n document.getElementById(\"f2boton\").onclick = function() { guardausuario(); }; \n \n mwShow(\"id:f2\",\"id:f1\");\n if(antol = document.getElementById(\"olusr\")) {\n forma.removeChild(antol);\n }\n if (aCte[2].length) {\n var lista = document.createElement(\"ul\");\n lista.id = \"olusr\";\n for (var i=0; i<aCte[2].length; i++) {\n lusr = document.createElement(\"li\");\n lusrbi = document.createElement(\"img\");\n lusrbi.src = \"/interfase/borrar.gif\";\n lusrbi.setAttribute(\"alt\",\"borrausr \" + aCte[2][i][0]);\n lusrbi.onclick = function() { accion(this.alt); }\n lusr.appendChild(lusrbi);\n lusr.appendChild(document.createTextNode(\" \"));\n lusrei = document.createElement(\"img\");\n lusrei.src = \"/interfase/editar.gif\";\n lusrei.setAttribute(\"alt\",\"editausr \" + aCte[2][i][0]);\n lusrei.onclick = function() { accion(this.alt); }\n lusr.appendChild(lusrei);\n lusr.appendChild(document.createTextNode(\" \"));\n lusrtxt = document.createTextNode(aCte[2][i][1]);\n lusr.appendChild(lusrtxt);\n lista.appendChild(lusr);\n }\n forma.appendChild(lista);\n }\n iniciar();\n }\n}", "function loginSiteMudancas() {\n imagensPaginaInicio();\n let saberAverdade = sessionStorage.getItem('Usuario');\n if (saberAverdade == \"Usuario\") {\n return \"Usuario\";\n } else if (saberAverdade == \"Empresa\") {\n return \"Empresa\";\n } else {\n return \"nao\";\n }\n}", "function imprimeUsuario ( { nome, sobrenome: ultNome, idade, pais = 'AR', municipio: cidade = 'NONEE' } ) {\n\t\tcl ('nome' \t, nome ); \t//leu e imprimiu normal.\n\t\tcl ('sobrenome' , ultNome );\t//sobrenome teve o nome da variavel trocada com :, variavel sobrenome nao existe, apenas a ultNome.\n\t\tcl ('idade' \t, idade );\t\t//leu e imprimiu normal.\n\t\tcl ('pais' \t\t, pais );\t\t//fallback era AR, mas como BR estava preenchida, nao usou o fallback\n\t\tcl ('cidade' \t, cidade );\t\t// era municipio e o campo nao existia, chamei de cidade e usei o valor de fallback.\n\t\t}", "function registroUsuario() {\r\n\r\n /*\r\n * VALIDAR EL NOMBRE\r\n */\r\n var nombre = $(\"#regUsuario\").val();\r\n if (nombre != \"\") {\r\n var expresion = /^[a-zA-ZñÑáéíóúÁÉÍÓÚ ]*$/;\r\n\r\n if (!expresion.test(nombre)) {\r\n $(\"#regUsuario\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>No se permite numeros ni caracteres especialies</div>');\r\n return false;\r\n }\r\n } else {\r\n $(\"#regUsuario\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>Este campo es obligatório</div>');\r\n return false;\r\n }\r\n\r\n\r\n\r\n\r\n /*\r\n * VALIDAR EL EMAIL\r\n */\r\n var email = $(\"#regEmail\").val();\r\n\r\n if (email != \"\") {\r\n\r\n var expresion = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+$/;\r\n\r\n if (!expresion.test(email)) {\r\n $(\"#regEmail\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>Escriba correctamente el correio electrónico</div>');\r\n return false;\r\n }\r\n\r\n if (validarEmailRepetido) {\r\n $(\"#regEmail\").parent().before('<div class=\"alert alert-danger\"><strong>ERROR:</strong>El correo electrónico ya existe en la base de datos, por favor ingrese otro diferente </div>');\r\n return false;\r\n }\r\n } else {\r\n $(\"#regEmail\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>Este campo es obligatório</div>');\r\n return false;\r\n }\r\n\r\n\r\n\r\n\r\n /*\r\n * VALIDAR CONTRASEÑA\r\n */\r\n var password = $(\"#regPassword\").val();\r\n if (password != \"\") {\r\n var expresion = /^[a-zA-Z0-9]*$/;\r\n if (!expresion.test(password)) {\r\n $(\"#regPassword\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>No se permite caracteres especialies</div>');\r\n return false;\r\n }\r\n } else {\r\n $(\"#regPassword\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>Este campo es obligatório</div>');\r\n return false;\r\n }\r\n\r\n\r\n\r\n\r\n /*\r\n * VALITAR POLITICAS DE PRIVACIDAD\r\n */\r\n var politicas = $(\"#regPoliticas:checked\").val();\r\n if (politicas != \"on\") {\r\n $(\"#regPoliticas\").parent().before('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong>Debe aceptar nuestras condiciones de uso y políticas de privacidad</div>')\r\n return false;\r\n }\r\n return true;\r\n}", "function update(OID_USUARIO,USUARIO){\n\t\n\t/*INSERCION DE DATOS*/\n\t\n\t$(\"#txt_usuario\").val(USUARIO);\n\t\n\t$(\"#txt_usuario\").attr(\"USER\",OID_USUARIO);\n\t\n\t$(\"#btn_enviar_usuario\").text(\"Actualizar\")\n\t\t\n\t\n}//FINAL DE LA ACTUALIZACION DE UN REGISTRO", "function EnviarUsuario(){\n $('#lblUsuario, #lblNombreC, #lblPass, #lblPassC, #lblRol').hide();\n \n var user = $('#Usuario').val(); var nombre = $('#NombreC').val();\n var clave = $('#Pass').val(); var clave2 = $('#PassC').val();\n var rol = $('#rol option:selected').val();\n \n //alert(rol);\n \n if (user==\"\"){$('#lblUsuario').show(); return false;\n }else if (nombre==\"\"){$('#lblNombreC').show(); return false;\n }else if (clave==\"\"){$('#lblPass').show();return false;\n }else if (clave2==\"\" || clave!=clave2) {$('#lblPassC').show();return false;\n }else if (rol==\"\") {$('#lblRol').show();return false;}\n\n $('#Adduser').hide();\n \n $.ajax({\n url: \"GuardarUsuario/\"+user+\"/\"+nombre+\"/\"+clave+\"/\"+rol,\n type: \"post\",\n async:true,\n success:\n function(){\n swal({title: \"EL USUARIO SE AGREGO CORRECTAMENTE!\",\n type: \"success\",\n confirmButtonText: \"CERRAR\",\n }).then(\n function(){gotopage(\"Usuarios\");}\n )\n }\n });\n}", "function establecerIdioma(idioma){\n //Aqui manejamos el idioma recibido para instanciar las propiedades de la variable que contiene los texts de la app\n switch(idioma){\n //En caso de que el idioma recibido por esta funcion sea es, español, se instancian las variables con el texto en español\n case \"es\":\n MyLove.titulo = \"My love - Acceso\";\n MyLove.acceso_usuario = \"Número de teléfono o correo:\";\n MyLove.acceso_contra = \"Contraseña:\";\n MyLove.acceso_boton = \"Ingresar\";\n MyLove.acceso_registrar = \"Registrarme\";\n MyLove.acceso_olvpass = \"Olvide mi contraseña\";\n MyLove.acceso_activacion = \"Activar mi cuenta\";\n\n MyLove.registro_info_1 = \"Selecciona un metodo para registrarte\";\n MyLove.registro_opcion_correo = \"Crear cuenta usando correo\";\n MyLove.registro_opcion_telefono = \"Crear cuenta usando teléfono\";\n MyLove.registro_correo = \"Correo:\";\n MyLove.registro_pais_1 = \"Selecciona tu pais\";\n MyLove.registro_telefono = \"Tu teléfono:\";\n MyLove.registro_contra = \"Contraseña\";\n MyLove.registro_aceptar_terminos = \"Acepto los Terminos y Condiciones\";\n MyLove.registro_leer_terminos = \"Leer los terminos\";\n MyLove.registro_boton = \"Enviar\";\n MyLove.registro_volver_atras = \"Volver atrás\";\n\n MyLove.activacion_1_info_1 = \"Listo, solo un paso más...\";\n MyLove.activacion_1_info_2 = \"Hemos enviado un codigo de activación al \";\n MyLove.activacion_1_lab_codigo = \"Escribe el código aquí\";\n MyLove.activacion_1_boton_enviar = \"Enviar\";\n MyLove.activacion_1_boton_reenviar = \"Reenviar codigo\";\n MyLove.activacion_1_boton_cancelar = \"Cancelar\";\n\n MyLove.activacion_2_info_1 = \"Activar cuenta\";\n MyLove.activacion_2_info_2 = \"Si ya habias realizado el registro pero no has activado aún, por favor sigue esta instrucciones\";\n MyLove.activacion_2_info_3 = \"Ingresa el dato que usastes para registrarte\";\n MyLove.activacion_2_lab_forma_activacion = \"Correo o numero telefonico\";\n MyLove.activacion_2_enviar_forma = \"Verificar\";\n MyLove.activacion_2_candelar = \"Cancelar\";\n //Se llama a esta funcion para que establesca los textos de la app\n establecerTextos();\n break;\n\n //En caso de que el idioma recibido por esta funcion sea en, ingles, se instancian las variables con el texto en ingles\n case \"en\":\n MyLove.titulo = \"My Love - Access\"; \n MyLove.acceso_usuario = \"Number of phone or email\";\n MyLove.acceso_contra = \"Password\";\n MyLove.acceso_boton = \"Enter\";\n MyLove.acceso_registrar = \"Register\";\n MyLove.acceso_olvpass = \"Forget my password\";\n MyLove.acceso_activacion = \"Activate my account\";\n\n MyLove.registro_info_1 = \"Select a method for register\";//-------------------------------------\n MyLove.registro_opcion_correo = \"Email\";\n MyLove.registro_opcion_telefono = \"Phone\";\n MyLove.registro_correo = \"Email\";\n MyLove.registro_pais_1 = \"Select your country\";\n MyLove.registro_telefono = \"Your phone\";\n MyLove.registro_contra = \"Password\";\n MyLove.registro_aceptar_terminos = \"I accept the Terms and Conditions\";\n MyLove.registro_leer_terminos = \"Read the terms\";\n MyLove.registro_boton = \"Send\";\n MyLove.registro_volver_atras = \"Go back\";\n\n //Exito...\n MyLove.activacion_1_info_1 = \"Ok, only one step more...\";\n MyLove.activacion_1_info_2 = \"We'll send the code activation at the\";\n MyLove.activacion_1_lab_codigo = \"Write code here\";\n MyLove.activacion_1_boton_enviar = \"Send\";\n MyLove.activacion_1_boton_reenviar = \"resend the code\";\n MyLove.activacion_1_boton_cancelar = \"Cancel\";\n\n MyLove.activacion_2_info_1 = \"Activate account\";\n MyLove.activacion_2_info_2 = \"If you will register process, but not activate account, let's follows the instruction\";\n MyLove.activacion_2_info_3 = \"Get date you will for register\";\n MyLove.activacion_2_lab_forma_activacion = \"Number of phone or email\";\n MyLove.activacion_2_enviar_forma = \"Verificate\";\n MyLove.activacion_2_candelar = \"Cancel\";\n //Se llama a esta funcion para que establesca los textos de la app\n establecerTextos();\n break;\n //En caso de que el idioma recibido sea distintos a las opciones del switch, se establecera el idioma ingles como por defecto de\n //la aplicacion, esto para hacerla universal\n default:\n MyLove.titulo = \"My Love - Access\";\n MyLove.acceso_usuario = \"Number of phone or email\";\n MyLove.acceso_contra = \"Password\";\n MyLove.acceso_boton = \"Enter\";\n MyLove.acceso_registrar = \"Register\";\n MyLove.acceso_olvpass = \"Forget my password\";\n MyLove.acceso_activacion = \"Activate my account\";\n\n MyLove.registro_info_1 = \"Select a method for register\";//------------------\n MyLove.registro_opcion_correo = \"Email\";\n MyLove.registro_opcion_telefono = \"Phone\";\n MyLove.registro_correo = \"Email\";\n MyLove.registro_pais_1 = \"Select your country\";\n MyLove.registro_telefono = \"Your phone\";\n MyLove.registro_contra = \"Password\";\n MyLove.registro_aceptar_terminos = \"I accept the Terms and Conditions\";\n MyLove.registro_leer_terminos = \"Read the terms\";\n MyLove.registro_boton = \"Send\";\n MyLove.registro_volver_atras = \"Go back\";\n\n //Exito...\n MyLove.activacion_1_info_1 = \"Ok, only one step more...\";\n MyLove.activacion_1_info_2 = \"We'll send the code activation at the\";\n MyLove.activacion_1_lab_codigo = \"Write code here\";\n MyLove.activacion_1_boton_enviar = \"Send\";\n MyLove.activacion_1_boton_reenviar = \"resend the code\";\n MyLove.activacion_1_boton_cancelar = \"Cancel\";\n\n //Se llama a esta funcion para que establesca los textos de la app\n establecerTextos();\n break;\n }\n}", "function anonima(){\r\n \r\n var http=new XMLHttpRequest();\r\n http.onreadystatechange=function(){\r\n console.log(\"llegó respuesta\", http.readyState, http.status);\r\n if(http.readyState==4){\r\n if(http.status===200){\r\n console.log(\"tenemos respuesta\",http.responseText);\r\n \r\n }\r\n /* funcion anonima. **/\r\n }\r\n }\r\n var pass=document.getElementById(\"pass\").value;\r\n var name=document.getElementById(\"txtUser\").value;\r\n console.log(pass);\r\n console.log(name);\r\n http.open(\"GET\",\" http://localhost:1337/login?usr=\"+pass+\"&pass=\"+name);\r\n http.send();\r\n}", "function seleccionarUsuarioParaPW(usuario){\n document.querySelector('#idUsuarioContrasena').value = usuario[0];\n document.querySelector('#nombreUsuarioContrasena').innerHTML = usuario[1];\n document.querySelector('#emailUsuarioContrasena').innerHTML = usuario[2];\n $('#modalFormUsuarioContrasena').modal('show');\n}", "function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `recuperar_contrasea` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\t\t\tconsole.dir(e);\n\t\t}\n\t}", "function loginIniciarSesionHandler() {\n let emailIngresado = $(\"#txtLoginEmail\").val();\n let passwordIngresado = $(\"#txtLoginPassword\").val();\n const opciones = { title: 'Error' };\n //Antes de hacer una llamada innecesaria a la api, validamos de nuestro lado los datos ingresados\n if (validarCorreo(emailIngresado)) {\n if (validarPassword(passwordIngresado)) {\n const datosUsuario = {\n email: emailIngresado,\n password: passwordIngresado\n };\n\n $.ajax({\n type: 'POST',\n url: urlBase + 'usuarios/session',\n contentType: \"application/json\",\n data: JSON.stringify(datosUsuario),\n success: iniciarSesion,\n error: errorCallbackLogin\n });\n } else {\n ons.notification.alert('La contraseña debe tener al menos 8 caracteres', opciones);\n }\n } else {\n ons.notification.alert('El formato del correo no es válido', opciones);\n }\n}", "iniciarSesion() {\n this.presentLoadingA();\n this.Servicios.userState().subscribe((user) => {\n this.Servicios.iniciarsesion(this.account.email, this.account.password).then(res => {\n this.cargandoA.dismiss();\n this.Servicios.getUsuario(user.uid).subscribe(res => {\n const UsuarioA = res.payload.val();\n console.log(UsuarioA);\n if (UsuarioA !== undefined) {\n this.account.email = \"\";\n this.account.password = \"\";\n console.log(UsuarioA.admin);\n if (UsuarioA.admin == true) {\n this.navCtrl.navigateRoot('/admin');\n }\n else {\n this.navCtrl.navigateRoot('/mainmenu');\n }\n }\n else {\n console.log(\"Error al iniciar\");\n }\n });\n this.storage.set('log', 'si');\n }).catch(err => {\n this.cargandoA.dismiss();\n console.log(\"Error al iniciar\");\n });\n });\n }", "procesarControles(){\n\n }", "function comprobar_sesion() {\n console.log(\"Comprobar login\");\n $.ajax({\n url: \"php/peticiones/comprobar_sesion.php\",\n type: \"POST\",\n dataType: \"json\",\n success: function(data) {\n if (data.Res == \"OK\") {\n NombreUsuario = data.Nombre;\n }\n },\n error: function(err) {\n console.log(\"Error sucedido en la peticion ajax, Funcion que falla comprobar_sesion()\");\n errorServ(err, \"sesion.js: comprobar_sesion()\");\n }\n });\n}", "function altroUtente(offerta){\r\n return (offerta.ospitato === JSON.parse(localStorage.utente).username)?offerta.ospitante:offerta.ospitato;\r\n}", "function User(nombres, apellidos, email, password, password2, departamento, municipio, colonia, calle, casa,respuesta, dui, nit, numero, fecha){\r\n\tthis.nombres=nombres;\r\n\tthis.apellidos=apellidos;\r\n\tthis.email=email;\r\n\tthis.password=password;\r\n\tthis.password2=password2;\r\n\tthis.departamento= departamento;\r\n\tthis.municipio= municipio;\r\n\tthis.colonia= colonia;\r\n\tthis.calle= calle;\r\n\tthis.casa= casa;\r\n\tthis.respuesta=respuesta;\r\n\tthis.dui=dui;\r\n\tthis.nit=nit;\r\n\tthis.numero=numero;\r\n\tthis.fecha= fecha;\r\n\t//se inicializa cada variable a el valor que se ha pasado\r\n\tthis.comprobar= function(){\r\n\t\t//se crean los patrones\r\n\t\tvar pre= document.frmregistro.pregunseguri.options[frmregistro.pregunseguri.selectedIndex].text;\r\n\t\tvar nombs= /^([A-ZÁÉÍÓÚ]{1}[a-zñáéíóú]+[\\s]?)+$/;\r\n\t\tvar apells=/^([A-ZÁÉÍÓÚ]{1}[a-zñáéíóú]+[\\s]?)+$/;\r\n\t\tvar corr= /^[\\w]+@{1}[\\w]+\\.[a-z]{2,3}/;\r\n\t\tvar pass= /^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])([A-Za-z\\d$@$!%*?&]|[^ ]){8,}$/;\r\n\t\tvar depar= ['Santa Ana', 'Sonsonate', 'Ahuachapan', 'La Libertad', 'Chalatenango', 'San Salvador', 'La Paz', 'Cuscatlan','San Vicente','Usulutan','Cabañas','Morazan','San Miguel','La Union'];\r\n\t\tvar du= /^\\d{8}-\\d{1}$/;\r\n\t\tvar ni= /^[0-9]{4}-[0-9]{6}-[0-9]{3}-[0-9]{1}$/;\r\n\t\tvar num= /^[6,7]{1}\\d{3}-\\d{4}$/;\r\n\t\tvar fechaNac= new Date(fecha);\r\n\t\tvar fechaact= new Date();\r\n\t\tvar mes= fechaact.getMonth();\r\n\t\tvar dia= fechaact.getDay();\r\n\t\tvar anio= fechaact.getFullYear();\r\n\t\tfechaact.setDate(dia);\r\n\t\tfechaact.setMonth(mes);\r\n\t\tfechaact.setFullYear(anio);\r\n\t\tvar edad= Math.floor(((fechaact-fechaNac)/(1000*60*60*24)/365));\r\n\t\t//se verifica con un if si todo es true y la longitud es mayor a 0\r\n\t\tif((nombs.test(nombres) && nombres.length!=0) && ((apells.test(apellidos) && apellidos.length!=0)) && ((corr.test(email) && email.length!=0)) && ((pass.test(password) && password.length!=0)) && ((password===password2)) && ((depar.includes(departamento))) && ((municipio.length!=0 && municipio.length!=\" \")) && ((colonia.length!=0 && colonia.length!=\" \")) && ((calle.length!=0 && calle.length!=\" \")) && ((casa.length!=0 && casa.length!=\" \")) && ((du.test(dui))) && ((respuesta.length!=0 && respuesta.length!=\" \")) && ((ni.test(nit))) && ((num.test(numero))) && (edad>=18)){\r\n\t\t\r\n\t\t//LocalStorage\r\n\t\tvar user = {\r\n\t\t\tUsuario: email,\r\n\t\t\tPassword: password,\r\n\t\t\tRespuesta: respuesta,\r\n\t\t\tPregunta: pre\r\n\t\t};\r\n\t\tvar usuarioGuardado = JSON.stringify(user);\r\n\t\tlocalStorage.setItem(\"UsuarioR\", usuarioGuardado);\r\n\t\tvar usuarioStr = localStorage.getItem(\"UsuarioR\");\r\n\t\tvar usuarioStr = JSON.parse(usuarioStr);\r\n\t\tusuarios[count] = usuarioStr;\r\n\t\tcount +=1;\r\n\t\t//Fin LocalStorage\r\n\r\n\t\t\t//se mmuestra la modal dependiendo del rsultado\r\n\t\t\tcontRegistro.style.display = \"none\";\r\n\t\t\tmodal.style.display = 'block';\r\n\t\t\tcont2.style.marginTop = '9.5%';\r\n\t\t\tcapaN.style.opacity = '0';\r\n\t\t\tsuccessM.style.color = '#40A798';\r\n\t\t\tlblalert.innerHTML = \"Datos correctos, el Registro ha sido exitoso\";\r\n\t\t\r\n\t\tbtncerrarmodal.onclick = function(){\r\n\t\twindow.location= \"../html/menu.html\";\r\n\t\tmodal.style.display = 'none';\r\n\t\tcontRegistro.style.display = \"block\";\r\n\t\tcont2.style.marginTop = '-5%';\r\n\t\tcapaN.style.opacity = '1';\r\n\t\tsuccessM.style.color = '#E23E57';\r\n\t\t\t}\r\n\t\t}else{\r\n\t\tcontRegistro.style.display = \"none\";\r\n\t\tmodal.style.display = 'block';\r\n\t\tcont2.style.marginTop = '9.5%';\r\n\t\tcapaN.style.opacity = '0';\r\n\tbtncerrarmodal.onclick = function(){\r\n\t\tmodal.style.display = 'none';\r\n\t\tcontRegistro.style.display = \"block\";\r\n\t\tcont2.style.marginTop = '-5%';\r\n\t\tcapaN.style.opacity = '1';\r\n\t}\r\n\t\t}\r\n\t\tif(nombs.test(nombres) && nombres.length!=0){\r\n\t\t\tdocument.frmregistro.input1.style.borderColor=\"#00FF08\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input1.style.borderColor=\"#FF0000\";\r\n\t\t}if(apells.test(apellidos) && apellidos.length!=0){\r\n\t\t\tdocument.frmregistro.input2.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input2.style.borderColor=\"#FF0000\";\r\n\t\t}if(corr.test(email) && email.length!=0){\r\n\t\t\tdocument.frmregistro.input3.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input3.style.borderColor=\"#FF0000\";\r\n\t\t}if(pass.test(password) && password.length!=0){\r\n\t\t\tdocument.frmregistro.input4.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input4.style.borderColor=\"#FF0000\";\r\n\t\t}if(password===password2 && password2.length!=0){\r\n\t\t\tdocument.frmregistro.input5.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input5.style.borderColor=\"#FF0000\";\r\n\t\t}if(depar.includes(departamento)){\r\n\t\t\tdocument.frmregistro.input6.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input6.style.borderColor=\"#FF0000\";\r\n\t\t}if(municipio.length!=0 && municipio.length!=\" \"){\r\n\t\t\tdocument.frmregistro.input7.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input7.style.borderColor=\"#FF0000\";\r\n\t\t}if(colonia.length!=0 && colonia.length!=\" \"){\r\n\t\t\tdocument.frmregistro.input8.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input8.style.borderColor=\"#FF0000\";\r\n\t\t}if(calle.length!=0 && calle.length!=\" \"){\r\n\t\t\tdocument.frmregistro.input9.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input9.style.borderColor=\"#FF0000\";\r\n\t\t}if(casa.length!=0 && casa.length!=\" \"){\r\n\t\t\tdocument.frmregistro.input10.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input10.style.borderColor=\"#FF0000\";\r\n\t\t}if(du.test(dui)){\r\n\t\t\tdocument.frmregistro.input11.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input11.style.borderColor=\"#FF0000\";\r\n\t\t}if(respuesta.length!=0 && respuesta.length!=\" \"){\r\n\t\t\tdocument.frmregistro.inputpregunta.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.inputpregunta.style.borderColor=\"#FF0000\";\r\n\t\t}if(ni.test(nit)){\r\n\t\t\tdocument.frmregistro.input12.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input12.style.borderColor=\"#FF0000\";\r\n\t\t}if(num.test(numero)){\r\n\t\t\tdocument.frmregistro.input13.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input13.style.borderColor=\"#FF0000\";\r\n\t\t}if(edad>=18){\r\n\t\t\tdocument.frmregistro.input14.style.borderColor=\"#00FF00\";\r\n\t\t}else{\r\n\t\t\tdocument.frmregistro.input14.style.borderColor=\"FF0000\";\r\n\t\t}\r\n\t}\r\n}", "function inviaMessaggioUtente(){\n var text_user=($('.send').val());\n if (text_user) { //la dicitura cosi senza condizione, stà a dire text_user=0\n templateMsg = $(\".template-message .new-message\").clone()\n templateMsg.find(\".text-message\").text(text_user);\n templateMsg.find(\".time-message\").text(ora);\n templateMsg.addClass(\"sendbyUser\");\n $(\".conversation\").append(templateMsg);\n $(\".send\").val(\"\");\n setTimeout(stampaMessaggioCpu, 2000);\n\n var pixelScroll=$('.containChat')[0].scrollHeight;\n $(\".containChat\").scrollTop(pixelScroll);\n }\n }", "function login () {\n \n var value_email_login = document.getElementById('login_email').value;\n var value_num_afiliacion_login = document.getElementById('login_num_afiliacion').value;\n\n if (value_email_login && value_num_afiliacion_login) {\n\n var objUsuario = Usuario(value_email_login, value_num_afiliacion_login);\n\n var objUsuario_json = JSON.stringify(objUsuario);\n \n objAjax = AJAXCrearObj();\n objAjax.open('GET', './php/login_usuario.php?objUsuario_json='+objUsuario_json, true); // llamamos al php\n objAjax.send();\n objAjax.onreadystatechange=responder_login;\n\n } else {\n\n alert(\"Rellene todos los campos\");\n }\n}", "function ocultarLoginRegistro() {\n /* Oculta uno de los Divs: Login o Registro, según cuál link se haya clickeado */\n var clickeado = $(this).attr(\"alt\");\n var itemClickeado = $(\"#\" + \"div\" + clickeado);\n itemClickeado.removeClass(\"hidden\").siblings(\"div\").addClass(\"hidden\");\n $(\"#txt\" + clickeado + \"Nombre\").focus();\n $(\"#div\" + clickeado + \"Mensaje\").html(\"\");\n }", "async bringUser(req,res){\n //función controladora con la lógica que muestra los usuarios\n }", "function cadastrarSolicitante(){\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tvar notSolicitante = DWRUtil.getValue(\"comboUnidadesNaoSolicitantes\");\n\tif((notSolicitante==null ||notSolicitante=='')){\n\t\talert(\"Selecione uma unidade do TRE.\");\n\t}else{\n\t\tFacadeAjax.adicionaUnidadeSolicitante(unidade,notSolicitante);\n\t\tcarregaUnidadesSolicitantes()\t\n\t}\t\n}", "function iniciar(){\r\n\tlocalStorage.clear();\r\n\tvar boton= document.getElementById('btnenviar');\r\n\tif(boton.addEventListener){\r\n\t\tboton.addEventListener(\"click\",function(){\r\n\t\t\tvar nuevousuario= new User(document.frmregistro.nombres.value, document.frmregistro.apellidos.value, document.frmregistro.correo.value, document.frmregistro.contra.value, document.frmregistro.confirm_contra.value, document.frmregistro.departamento.value, document.frmregistro.municipio.value, document.frmregistro.colonia.value, document.frmregistro.calle_pasaje.value, document.frmregistro.num_casa.value, document.frmregistro.pregunta.value, document.frmregistro.DUI.value, document.frmregistro.NIT.value, document.frmregistro.num_cel.value, document.frmregistro.fecha.value);\r\n\t\t\tnuevousuario.comprobar();\r\n\t\t},false);\r\n\t}\r\n}", "function obtenerUsuario(idUsuario, username){\n\t//console.log(\"OBTENER DATOS\");\n\t//console.log(idUsuario);\n\t//console.log(username);\n\t$.ajax({\n\t\tsync:true,\n\t\tdata: {\n\t\t\t\"id\" : idUsuario,\n\t\t\t\"username\" : username,\n\t},\n\tdataType:'json',\n\turl: '../../mvc/usuario/obtenerusuarioconrolesbyid',\n\ttype: 'post',\t\t\n\tbeforeSend: function () {\t\n\t},\n\tsuccess: function (response) {\n\t\t//console.log(\"RESPONSE\")\n\t\t//console.log(response)\n\t\tmuestraDatosUsuario(response);\t\n\t\t},\t\n\terror: function (response) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t$(\"#resultadoGuardar\").html(\"Error\");\n\t\t//console.log(\"RESPONSE ERROR\")\n\t\t//console.log(response)\n\t\t}\t\t\n\t});\t\t\n}", "function valida_usuario()\n {\n var _token= $('input[name=_token]').val();\n var correo= $('#txt_correo').val();\n\n if (correo!=\"\")\n {\n $.ajax({\n type: 'POST',\n url: '/vendedor/correo', //llamada a la ruta\n data: {\n _token:_token,\n correo:correo\n },\n success: function (data) {\n\n if (Object.entries(data).length==0)\n {\n alertError(\"No existe ningun usuario con este correo asociado\");\n $('#txt_correo').val(\"\");\n }else if (data[0].correo!=null)\n {\n alertError(\"Ya existe un usuario con este correo asociado\");\n $('#txt_correo').val(\"\");\n }\n else\n alertSuccess(\"Usuario:\"+data[0].usuario);\n showLoad(false);\n },\n error: function (err) {\n alertError(err.responseText);\n showLoad(false);\n }\n });\n }\n }", "busqueda(termino, parametro) {\n // preparacion de variables //\n // ------ Uso de la funcion to lower case [a minusculas] para evitar confuciones en el proceso\n // ------/------ La busqueda distingue mayusculas de minusculas //\n termino = termino.toLowerCase();\n parametro = parametro.toLowerCase();\n // variable busqueda en la que se almacenara el dato de los usuarios que se buscara //\n var busqueda;\n // [Test] variable conteo para registar el numero de Usuarios que coinciden con la busqueda //\n var conteo = +0;\n // Se vacia el conjunto de objetos [users] para posteriormente rellenarlos con los usuarios que coincidan con la busqueda //\n this.users = [], [];\n // [forEach] = da un recorrido por los objetos de un conjunto en este caso, selecciona cada usuario del conjunto \"usuarios\" //\n this.usuarios.forEach(item => {\n // Bifurcador de Seleccion [switch] para detectar en que dato del usuario hacer la comparacion de busqueda //\n switch (parametro) {\n //------En caso de que se ingrese la opcion por defecto, es decir, no se haya tocado el menu de selecicon\n case 'null':\n {\n // Se hace un llamado a la funcion \"getUsers\" que carga los usuarios almacenados en el servidor //\n this.getUsers();\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion Nombre\n case 'nombre':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.nombre.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion apellido\n case 'apellido':\n {\n console.log('entro en apellido...');\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.apellido.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion apellido: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion cedula\n case 'cedula':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.cedula.replace('-', '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion cedula: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion cuenta\n case 'cuenta':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.cuenta.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion Buscar en Todo\n case 'todo':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.nombre.replace(/ /g, '').toLowerCase() + item.apellido.replace(/ /g, '').toLowerCase() + item.cedula.replace('-', '').toLowerCase() + item.cuenta.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n }\n // if (parametro == 'null') {\n // console.log('dentro de null');\n // this.getUsers();\n // this.test = 'Ingrese un Campo de busqueda!!..';\n // }\n // if (parametro == 'nombre') {\n // // preparacion de variables:\n // busqueda = item.nombre.replace(/ /g, '').toLowerCase();\n // if (busqueda.indexOf(termino, 0) >= 0) {\n // this.users.push(item);\n // conteo = conteo +1;\n // console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n // }\n // }\n // if (parametro == 'apellido') {\n // console.log('dentro de apellido');\n // }\n // if (parametro == 'cedula') {\n // console.log('dentro de cedula');\n // }\n // if (parametro == 'cuenta') {\n // console.log('dentro de cuenta');\n // }\n // if (parametro == 'todo') {\n // console.log('dentro de todo');\n // }\n });\n if (this.users.length >= 1) {\n console.log('existe algo.... Numero de Registros: ' + conteo);\n return;\n }\n else if (this.users.length <= 0) {\n this.getUsers();\n }\n }", "async function buscarUsuario(email){\n \n //insere os relatorios \n var resposta = await usarApi(\"GET\", \"http://localhost:8080/usuarios/cosnultaremail/\"+email); \n var usuario = JSON.parse(resposta);\n\n var idDestinatario = usuario.idUsuario;\n now = new Date();\n\n var relatorio = {\n titulo: $(\"#idTitulo\").val(),\n destinatario: idDestinatario,\n texto: $(\"#texto-area\").val(),\n dataRelatorio: now,\n fk_usuario: idUsuario\n }\n cadastrar(relatorio);\n}", "function obtieneLogueo(){\n $.ajax({\n url: \"vista/user/registro_user/traeFormLogin.html\",\n method: \"POST\",\n success: function (data) {\n $(\"#ventanaModal\").html(data)\n }\n })\n }", "function registroUsuario(){\n\n\t$(\".alert\").remove();\n\t/*=============================================\n\tVALIDAR EL CODIGO\n\t=============================================*/\n\n\tvar nombre = $(\"#regCodigo\").val();\n\t\n\tif(nombre != \"\"){\n\n\t\tvar expresion = /^[0-9]*$/;\n\n\t\tif(!expresion.test(nombre)){\n\n\t\t\t$(\"#regCodigo\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong>Solo se admite Numeros</div>')\n\n\t\t\treturn false;\n\n\t\t}else if(nombre.length != 8){\n\t\t\t\n\t\t\t$(\"#regCodigo\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong>Solo Se admite 8 digitos</div>')\n\n\t\t\treturn false;\n\t\t}\n\n\t}else{\n\n\t\t$(\"#regCodigo\").parent().after('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio</div>')\n\n\t\treturn false;\n\t}\n\t\n\t/*=============================================\n\tVALIDAR EL NOMBRE\n\t=============================================*/\n\n\tvar nombre = $(\"#regUsuario\").val();\n\n\tif(nombre != \"\"){\n\n\t\tvar expresion = /^[a-zA-ZñÑáéíóúÁÉÍÓÚ ]*$/;\n\n\t\tif(!expresion.test(nombre)){\n\n\t\t\t$(\"#regUsuario\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong> No se permiten números ni caracteres especiales</div>')\n\n\t\t\treturn false;\n\n\t\t}\n\n\t}else{\n\n\t\t$(\"#regUsuario\").parent().after('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio</div>')\n\n\t\treturn false;\n\t}\n\n\t/*=============================================\n\tVALIDAR EL USER\n\t=============================================*/\n\n\tvar nombre = $(\"#regUser\").val();\n\n\tif(nombre != \"\"){\n\n\t\tvar expresion = /^[a-zA-Z0-9]*$/;\n\n\t\tif(!expresion.test(nombre)){\n\n\t\t\t$(\"#regUser\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong> No se permiten caracteres especiales</div>')\n\n\t\t\treturn false;\n\n\t\t}\n\t\tif(validarUserI == true){\n\t\t\t\n\t\t\t$(\"#regUser\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong> El usuario ya existe en la base de datos</div>')\n\n\t\t\treturn false;\n\t\t}\n\n\t}else{\n\n\t\t$(\"#regUser\").parent().after('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio</div>')\n\n\t\treturn false;\n\t}\n\n\t/*=============================================\n\tVALIDAR EL EMAIL\n\t=============================================*/\n\n\tvar email = $(\"#regEmail\").val();\n\n\tif(email != \"\"){\n\n\t\tvar expresion = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+$/;\n\n\t\tif(!expresion.test(email)){\n\n\t\t\t$(\"#regEmail\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong> Escriba correctamente el correo electrónico</div>')\n\n\t\t\treturn false;\n\n\t\t}\n\n\t}else{\n\n\t\t$(\"#regEmail\").parent().after('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio</div>')\n\n\t\treturn false;\n\t}\n\n\n\t/*=============================================\n\tVALIDAR CONTRASEÑA\n\t=============================================*/\n\n\tvar password = $(\"#regPassword\").val();\n\n\tif(password != \"\"){\n\n\t\tvar expresion = /^[a-zA-Z0-9]*$/;\n\n\t\tif(!expresion.test(password)){\n\n\t\t\t$(\"#regPassword\").parent().after('<div class=\"alert alert-warning\"><strong>ERROR:</strong> No se permiten caracteres especiales</div>')\n\n\t\t\treturn false;\n\n\t\t}\n\n\t}else{\n\n\t\t$(\"#regPassword\").parent().after('<div class=\"alert alert-warning\"><strong>ATENCIÓN:</strong> Este campo es obligatorio</div>')\n\n\t\treturn false;\n\n\t}\n\n\treturn true;\n}", "function cadastrarTecnico(){\n\tvar matriculaTecnico = DWRUtil.getValue(\"comboTecnicoTRE\");\n\tvar login = DWRUtil.getValue(\"login\"); \n\tif((matriculaTecnico==null ||matriculaTecnico=='')){\n\t\talert(\"Selecione um tecnico do TRE.\");\n\t}else{\n\t\tFacadeAjax.integrarTecnico(matriculaTecnico,login);\n\t\tcarregaTecnicos();\t\n\t}\n\t\n}", "function mostrarBienvenidaUsuario() {\n $(\"#pHome\").html(`Hola, ${usuarioLogueado.nombre}!`);\n}", "function registroRegistrarseHandler() {\n let nombreIngresado = $(\"#txtRegistroNombre\").val();\n let apellidoIngresado = $(\"#txtRegistroApellido\").val();\n let direccionIngresada = $(\"#txtRegistroDireccion\").val();\n let emailIngresado = $(\"#txtRegistroEmail\").val();\n let passwordIngresado = $(\"#txtRegistroPassword\").val();\n let passwordIngresado2 = $(\"#txtRegistroRepPassword\").val();\n const opciones = { title: 'Error' };\n if (validarCorreo(emailIngresado)) {\n if (passwordIngresado === passwordIngresado2) {\n if (validarPassword(passwordIngresado)) {\n if (validarNombre(nombreIngresado)) {\n if (validarApellido(apellidoIngresado)) {\n if (validarDireccion(direccionIngresada)) {\n //Guardamos los datos del usuario en un objeto llamado datosUsuario,m que luego lo pasamos por string a la llamada ajax\n const datosUsuario = {\n nombre: nombreIngresado,\n apellido: apellidoIngresado,\n email: emailIngresado,\n direccion: direccionIngresada,\n password: passwordIngresado\n };\n\n $.ajax({\n type: 'POST',\n url: urlBase + 'usuarios',\n contentType: \"application/json\",\n data: JSON.stringify(datosUsuario),\n // Ya que lo que debemos ejecutar es tan simple, lo hacemos en una funcion anonima.\n success: function () {\n ons.notification.alert(\"El usuario ha sido creado correctamente\", { title: 'Aviso!' });\n navegar('login', true);\n },\n error: errorCallback\n });\n } else {\n ons.notification.alert('La dirección debe contener un nombre de calle y un numero de puerta', opciones);\n }\n } else {\n ons.notification.alert('El apellido no puede estar vacío o contener un solo caracter', opciones);\n }\n } else {\n ons.notification.alert('El nombre no puede estar vacío o contener un solo caracter', opciones);\n }\n } else {\n ons.notification.alert('La contraseña debe tener al menos 8 caracteres', opciones);\n }\n } else {\n ons.notification.alert('Los passwords no coinciden', opciones);\n }\n } else {\n ons.notification.alert('El formato del correo no es válido', opciones);\n }\n}", "function crearUsuario(req, res){\n // Instanciar el objeto Usuario \n var usuario = new Usuario();\n\n // Guardar el cuerpo de la petición para mejor acceso de los datos que el usuario esta enviando\n // parametros = {\"nombre\": \"\", \"apellido\": \"\", \"correo\": \"\", \"contraseña\": \"\"}\n\n var parametros = req.body;\n\n //\n \n usuario.nombre = parametros.nombre;\n usuario.apellido = parametros.apellido;\n usuario.correo = parametros.correo;\n usuario.contrasena = parametros.contrasena;\n usuario.rol = \"usuario\";\n usuario.imagen = null;\n\n // Guardar y validar los datos\n // db.coleccion.insert()\n usuario.save((err, usuarioNuevo)=>{\n if(err){\n // El primner error a validar sera a nivel de servidor e infraestructura\n // para esto existen states o estados.\n res.status(500).send({ message: \"Error en el servidor\"});\n } else {\n if(!usuarioNuevo){\n // 404 -> Pagina no encontrada\n // 200 -> Ok pero con una alerta indicando que los datos invalidos\n res.status(200).send({message: \"No fue posible realizar el registro\"});\n } else {\n res.status(200).send({usuario: usuarioNuevo});\n }\n }\n });\n\n}", "function nuevoU() {\r\n var tu = document.getElementById(\"tip_usu_id\");\r\n var id = document.getElementById(\"usu_identificacion\");\r\n if (tu.value == \"\" || tu.value.indexOf(\" \") == 0) {\r\n swal({\r\n title: \"Por favor seleccione el tipo de usuario\",\r\n type: \"error\",\r\n timer: 1000\r\n });\r\n tu.style.border = \"2px solid red\";\r\n tu.focus();\r\n return false;\r\n } else {\r\n tu.style.border = \"\";\r\n }\r\n if (id.value == \"\" || id.value.indexOf(\" \") == 0) {\r\n swal({\r\n title: \"Por favor ingrese el numero de identificaci\\u00F3n\",\r\n type: \"error\",\r\n timer: 1000\r\n });\r\n id.style.border = \"2px solid red\";\r\n id.focus();\r\n return false;\r\n } else {\r\n id.style.border = \"\";\r\n }\r\n}", "constructor(usuarioService) {\n this.usuarioService = usuarioService;\n this.title = 'chutesfutmesa';\n this.blnLogado = false;\n }", "function setUsername() {\n\tlet name = document.getElementById(\"name\").value.toLocaleLowerCase();\n\tlet firstFour = \"\";\n\tif (name.length >= 4) {\n\t\tfirstFour = name.substr(0, 4);\n\t} else {\n\t\tlet length = 4 - name.length;\n\t\twhile (length) {\n\t\t\tfirstFour = firstFour + \"a\";\n\t\t\tlength = length - 1;\n\t\t}\n\t\tfirstFour = name + firstFour;\n\t}\n\tlet employeeId = document.getElementById(\"employeeId\").value.toLocaleLowerCase();\n\tlet secondFour = \"\";\n\tif (employeeId.length >= 4) {\n\t\tsecondFour = employeeId.substr(0, 4);\n\t} else {\n\t\tlet length = 4 - employeeId.length;\n\t\twhile (length) {\n\t\t\tsecondFour = secondFour + length;\n\t\t\tlength = length - 1;\n\t\t}\n\t\tsecondFour = employeeId + secondFour;\n\t}\n\tlet username = firstFour + secondFour;\n\tdocument.querySelector(\"#username\").value = username;\n\tlet password = secondFour + firstFour;\n\tdocument.querySelector(\"#password\").value = password;\n}" ]
[ "0.60926986", "0.6090036", "0.60679436", "0.6060688", "0.60276234", "0.60013336", "0.5981784", "0.5861189", "0.5841094", "0.57762223", "0.5759213", "0.5745449", "0.5727679", "0.57255703", "0.57145685", "0.5711444", "0.56803024", "0.5667314", "0.5661936", "0.56480235", "0.56233823", "0.56219554", "0.56118613", "0.5600627", "0.5598247", "0.55857", "0.55814713", "0.55755484", "0.556501", "0.5557928", "0.55538034", "0.55482227", "0.5535302", "0.5535281", "0.55333585", "0.5532906", "0.5521717", "0.5516781", "0.55018723", "0.5496778", "0.5495284", "0.54920036", "0.5472992", "0.54715747", "0.5467357", "0.546211", "0.54617983", "0.54593885", "0.54579026", "0.545531", "0.545473", "0.54520446", "0.54517335", "0.5446241", "0.54457086", "0.5443044", "0.54412484", "0.5433483", "0.542747", "0.5425547", "0.54202324", "0.5415262", "0.5411327", "0.5410215", "0.5409365", "0.54053456", "0.5404738", "0.5402411", "0.5400099", "0.5398948", "0.53979355", "0.5394061", "0.538493", "0.53795356", "0.53715456", "0.53660536", "0.5364672", "0.53642344", "0.53608674", "0.53607136", "0.53599614", "0.5359397", "0.5353346", "0.53526896", "0.5349482", "0.5347279", "0.5343836", "0.5343835", "0.5343567", "0.5340186", "0.5337121", "0.53365034", "0.53351456", "0.5333644", "0.53239095", "0.5323533", "0.53228396", "0.5321152", "0.53089905", "0.53089565", "0.53074735" ]
0.0
-1
METODO PARA BORRAR UNA TAREA
function borrarTarea(pId) { return new Promise((resolve, reject) => { db.query('DELETE FROM s9q90jl9ash7sm2k.tareas WHERE id=?', [pId], (error, result) => { if (error) { return reject(error) } else { resolve(result) } }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Tarea(nombre, urgencia) {\n this.nombre = nombre;\n this.urgencia = urgencia;\n}", "function Tarea(nombre, urgencia) {\n this.nombre = nombre;\n this.urgencia = urgencia;\n}", "function Tarea(nombre, urgencia){\n this.nombre = nombre;\n this.urgencia = urgencia;\n\n}", "function Tarea(nombre,urgencia) {\n this.nombre = nombre;\n this.urgencia = urgencia;\n}", "function Tarea(nombre, urgencia){\n this.nombre = nombre;\n this.urgencia = urgencia;\n}", "function tarea(nombre,urgencia){\n this.nombre = nombre;\n this.urgencia=urgencia;\n}", "function Terreno (largura, comprimento) {\n this.largura = largura\n this.comprimento = comprimento\n this.area = comprimento*largura\n}", "constructor(area) {\n this.area = area\n }", "function setupTavern() {\n\n//draw a grid\n//make objects of each area\n\n\n}", "_$getArea() {\n return null;\n }", "get area() {\n return __classPrivateFieldGet(this, _ancho) * this.alto;\n }", "function Area(name, desc, E, W, S, N)\n{\n this.name = name;\n this.desc = desc;\n this.E = E;\n this.W = W;\n this.S = S;\n this.N = N;\n \n}", "calcolaArea() {\n\n return (this.base * this.altezza) / 2; \n }", "function areaTringulo(base,altura){\n return (base*altura)/2;\n}", "function Area() {\n}", "function permitirArrastrarPuntosRutas(){\r\n //--Add a drag feature control to move features around.\r\n dragPuntosRuta = new OpenLayers.Control.DragFeature(lienzoRutas, {\r\n // onStart: iniciarArrastre,\r\n onDrag : arrastrar,\r\n onComplete : finalizarArrastre\r\n });\r\n map.addControl(dragPuntosRuta);\r\n activarArrastradoPuntos(true);\r\n}", "function sz(ft){var area = ft.area(5);\n return ft.set({'area':area});\n}", "function parse_PtgArea(blob, length, opts) {\n var type = (blob[blob.l++] & 0x60) >> 5;\n var area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n return [type, area];\n }", "function btnAnularTarea_onClick() {\n\n //bcambios = false;\n\n //validaciones de campos obligatorios\n if (!view.requiredValidation()) return;\n\n view.initModal_AnularTarea();\n }", "setTareaAction({ commit }, tarea) {\n\t\t\tcommit('setTareaMutation', tarea);\n\t\t\t//\tconsole.log(tarea);\n\t\t}", "mostrarTarefas() {\n printPlanejamentoAtual(this.getPlanejamentoAtual());\n printListaTarefa(this.listaQuadros());\n }", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, opts.biff >= 2 && opts.biff <= 5 ? 6 : 8, opts);\n\treturn [type, area];\n}", "function GestoreArea(){\n \n switch (this.id) {\n case 'lineac1_1':\n area1.style.backgroundColor=\"#ffe6e6\";\n area2.style.backgroundColor=\"white\";\n area3.style.backgroundColor=\"white\";\n area4.style.backgroundColor=\"white\";\n area14.style.backgroundColor=\"white\"; \n break;\n case 'lineac1_2':\n area4.style.backgroundColor=\"#ffe6e6\"; \n area2.style.backgroundColor=\"white\";\n area3.style.backgroundColor=\"white\";\n area1.style.backgroundColor=\"white\";\n area14.style.backgroundColor=\"white\"; \n break;\n case 'lineac1_3':\n area3.style.backgroundColor=\"ffe6e6\"; \n area2.style.backgroundColor=\"white\";\n area1.style.backgroundColor=\"white\";\n area4.style.backgroundColor=\"white\";\n area14.style.backgroundColor=\"white\"; \n break;\n case 'lineac1_4':\n area2.style.backgroundColor=\"#ffe6e6\"; \n area1.style.backgroundColor=\"white\";\n area3.style.backgroundColor=\"white\";\n area4.style.backgroundColor=\"white\";\n area14.style.backgroundColor=\"white\"; \n break;\n case 'lineac1_5':\n area14.style.backgroundColor=\"#ffe6e6\"; \n area2.style.backgroundColor=\"white\"; \n area1.style.backgroundColor=\"white\";\n area3.style.backgroundColor=\"white\";\n area4.style.backgroundColor=\"white\";\n break; \n \n case 'lineac2_1':\n area5.style.backgroundColor=\"#ffe6e6\"; \n area6.style.backgroundColor=\"white\";\n area7.style.backgroundColor=\"white\";\n area8.style.backgroundColor=\"white\";\n area15.style.backgroundColor=\"white\";\n break;\n case 'lineac2_2':\n area6.style.backgroundColor=\"#ffe6e6\"; \n area5.style.backgroundColor=\"white\";\n area7.style.backgroundColor=\"white\";\n area8.style.backgroundColor=\"white\";\n area15.style.backgroundColor=\"white\";\n break;\n case 'lineac2_3':\n area8.style.backgroundColor=\"#ffe6e6\";\n area5.style.backgroundColor=\"white\";\n area6.style.backgroundColor=\"white\";\n area7.style.backgroundColor=\"white\";\n area15.style.backgroundColor=\"white\";\n break;\n case 'lineac2_4':\n area7.style.backgroundColor=\"#ffe6e6\";\n area5.style.backgroundColor=\"white\";\n area6.style.backgroundColor=\"white\";\n area8.style.backgroundColor=\"white\"; \n area15.style.backgroundColor=\"white\";\n break;\n \n case 'lineac2_5':\n area15.style.backgroundColor=\"#ffe6e6\";\n area7.style.backgroundColor=\"white\";\n area5.style.backgroundColor=\"white\";\n area6.style.backgroundColor=\"white\";\n area8.style.backgroundColor=\"white\"; \n break;\n \n case 'lineac3_1':\n area9.style.backgroundColor=\"#ffe6e6\"; \n area10.style.backgroundColor=\"white\";\n area11.style.backgroundColor=\"white\";\n area12.style.backgroundColor=\"white\";\n area13.style.backgroundColor=\"white\";\n break;\n case 'lineac3_2':\n area11.style.backgroundColor=\"#ffe6e6\";\n area13.style.backgroundColor=\"white\";\n area10.style.backgroundColor=\"white\";\n area9.style.backgroundColor=\"white\";\n area12.style.backgroundColor=\"white\";\n break;\n case 'lineac3_3':\n area12.style.backgroundColor=\"#ffe6e6\"; \n area11.style.backgroundColor=\"white\";\n area10.style.backgroundColor=\"white\";\n area9.style.backgroundColor=\"white\";\n area13.style.backgroundColor=\"white\";\n break;\n case 'lineac3_4':\n area10.style.backgroundColor=\"#ffe6e6\"; \n area11.style.backgroundColor=\"white\";\n area9.style.backgroundColor=\"white\";\n area12.style.backgroundColor=\"white\";\n area13.style.backgroundColor=\"white\";\n break;\n \n case 'lineac3_5':\n area10.style.backgroundColor=\"white\"; \n area11.style.backgroundColor=\"white\";\n area9.style.backgroundColor=\"white\";\n area12.style.backgroundColor=\"white\";\n area13.style.backgroundColor=\"#ffe6e6\";\n break;\n }}", "function getAreas() {\n\tlet scalingFactor = Math.min(clientWidth / 1200, clientHeight / 1000);\n\t// Change the blocks' size according to the input surface area\n\tlet size1 = Math.min(48, 5 + Math.sqrt(area1) * scalingFactor * 8) + \"px\";\n\tlet size2 = Math.min(48, 5 + Math.sqrt(area2) * scalingFactor * 8) + \"px\";\n\t$(\".sit1block\").css({\n\t\theight: size1,\n\t\twidth: size1,\n\t\tbottom: \"51%\"\n\t});\n\n\t$(\".sit2block\").css({\n\t\theight: size2,\n\t\twidth: size2,\n\t\tbottom: \"51%\"\n\t});\n\t\n}", "function setStateToAreas() {\n dos_target_area_ru.innerHTML = state.stateRU;\n dos_target_area_ua.innerHTML = state.stateUA;\n }", "function agregaElemento(arr,tarea){\n arr.push(tarea);\n}", "function getArea(length, width) {\n let area;\n // Write your code here\n \n return area;\n}", "function parse_PtgArea(blob, length) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, 8);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, 8);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, 8);\n\treturn [type, area];\n}", "function parse_PtgArea(blob, length) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceArea(blob, 8);\n\treturn [type, area];\n}", "function area_rectangulo(base,altura){\n return base*altura\n}", "function getArea() {\n if (result.Perceeloppervlakte) {\n return result.Woonoppervlakte + 'm² / ' + result.Perceeloppervlakte + 'm² • ' + result.AantalKamers + ' kamers';\n } else {\n return result.Woonoppervlakte + 'm² • ' + result.AantalKamers + ' kamers';\n }\n }", "function CB_AreaControl(params) {\r\n\tthis.TYPE = \"AREA_CONTROL\";\r\n\tthis.setting(params);\r\n\r\n}", "function getArea() {\n if (interest.Perceeloppervlakte) {\n return interest.Woonoppervlakte + 'm² / ' + interest.Perceeloppervlakte + 'm² • ' + interest.AantalKamers + ' kamers';\n } else {\n return interest.Woonoppervlakte + 'm² • ' + interest.AantalKamers + ' kamers';\n }\n }", "function areaCuadrado(lado) {\n return lado * lado;\n}", "function getViewValues() {\n oTarea = new Object();\n\n oTarea.ta204_idaccionpreventa = IB.vars.ta204_idaccionpreventa;\n oTarea.ta207_idtareapreventa = IB.vars.ta207_idtareapreventa;\n oTarea.ta207_estado = IB.vars.ta207_estado;\n \n if ($(\"#selectDenominacion option:selected\").val() === \"-1\") {\n oTarea.ta219_idtipotareapreventa = null;\n oTarea.ta207_denominacion = $(\"#ta207_denominacion\").val();\n }\n else {\n oTarea.ta219_idtipotareapreventa = parseInt($(\"#selectDenominacion option:selected\").val());\n oTarea.ta207_denominacion = \"\";\n }\n \n oTarea.ta207_observaciones = dom.ta207_observaciones.val();\n oTarea.ta207_fechaprevista = $.datepicker.parseDate('dd/mm/yy', dom.ta207_fechafinprevista.val());\n oTarea.ta207_descripcion = $(\"#ta207_descripcion\").val();\n oTarea.ta207_comentario = $(\"#ta207_comentario\").val();\n oTarea.ta207_motivoanulacion = $(\"#txtMotivoAnulacion\").val();\n if (IB.vars.modoPantalla == \"A\") {\n oTarea.uidDocumento = IB.vars.uidDocumento;\n }\n\n\n\n return oTarea;\n }", "function getarea() {\n var up = \"xy(\" + x + \",\" + (y - 1) + \")\";\n var down = \"xy(\" + x + \",\" + (y + 1) + \")\";\n var right = \"xy(\" + (x - 1) + \",\" + y + \")\";\n var left = \"xy(\" + (x + 1) + \",\" + y + \")\";\n\n var area = [up, down, left, right];\n var moveableTile = [];\n\n for (var i = 0; i < area.length; i++) {\n if (document.getElementById(area[i]) != null) {\n moveableTile.push(area[i]);\n }\n }\n return moveableTile;\n }", "function t() {\n //$content.css('paddingTop', $pageMaskee.height());\n y.height(h.height()).width(h.width());\n }", "function tamagoOverTo(){\n\t\t\tif (tivoniClickStatus == true && tzimhoniClickStatus == true && kasherClickStatus == true && heraionClickStatus == true && ingridiantClick==true){\n\t\t\tthis.gari.alpha=0.2;\n\t\t\tthis.tobiko.alpha=0.2;\n\t\t\tthis.tuna.alpha=0.2;\n\t\t\tthis.unagi.alpha=0.2;\n\t\t\tthis.surimi.alpha=0.2;\n\t\t\tthis.palamida.alpha=0.2;\n\t\t\tthis.salmon.alpha=0.2;\n\t\t\tthis.skin.alpha=0.2;\n\t\t\tthis.ekora.alpha=0.2;\n\t\t\tthis.panko.alpha=0.2;\n\t\t\tthis.wasabi.alpha=0.2;\n\t\t\tthis.daikon.alpha=0.2;\n\t\t\tthis.shitaki.alpha=0.2;\n\t\t\tthis.nuri.alpha=0.2;\n\t\t\tthis.nato.alpha=0.2;\n\t\t\tthis.tograshi.alpha=0.2;\n\t\t\tthis.canfio.alpha=0.2;\n\t\t\tthis.tzimhoni_fade.visible=0;\n\t\t\tthis.tivoni_fade.visible=1;\n\t\t\tthis.heraion_fade.visible=0;\n\t\t\tthis.kasher_fade.visible=0;\n\t\t\tthis.instruction_txt.text=\"לחץ כדי ללמוד עוד על הרכיב\";\n\t\t}\n\t\tif((tzimhoniClickStatus == false || kasherClickStatus == false || heraionClickStatus == false) && ingridiantClick==true){\n\t\t\tthis.instruction_txt.text=\"לחץ כדי ללמוד עוד על הרכיב\";\n\t\t}\n\t\t}", "function tarea() {\n var boxTextoValue = getInputValue();\n if (boxTextoValue !== \"\") {\n doTarea(boxTextoValue);\n clean();\n }\n}", "function areaTriangulo(base, altura) {\n return (base * altura) / 2;\n}", "function doTarea(tareaText) {\n var tareas = document.getElementById(\"tareas\");\n //Crear el elemento\n var tarea = document.createElement(\"div\");\n tarea.className = \"cajaTarea\";\n var texto = document.createElement(\"span\");\n texto.className = \"texto\";\n texto.innerHTML = tareaText;\n var boton = document.createElement(\"input\");\n boton.type = \"checkbox\";\n boton.onclick = function() {\n tachar(this, tareaText);\n }\n var icono = document.createElement(\"button\");\n icono.className = \"glyphicon glyphicon-trash pull-right\";\n icono.onclick = function() {\n deshacer(this)\n }\n tareas.appendChild(tarea);\n tarea.appendChild(boton);\n tarea.appendChild(texto);\n tarea.appendChild(icono);\n}", "function agregarTarea(){\n\t\tvar tareaNueva = $(\"#tarea-nueva\").val();\n\t\t$(\"#lista-tareas\").append('<li class=\"valign-wrapper\"><input type=\"checkbox\" class=\"tarea-terminada\"/><label for=\"test\"></label> '+tareaNueva+' <button class=\"waves-effect waves-light btn borrar\"><i class=\"fa fa-trash-o\" aria-hidden=\"true\"></i></li>'); //crea dinámicamente la nueva tarea\n\t\t$(\"#tarea-nueva\").val(\"\"); // mantiene el input vacio luego de enviar el contenido\n\t}", "function borrarTarea(){\n\t\t$(this).parent().remove(); //borra la tarea específica\n\t}", "get area() {\n return this.width * this.height\n }", "function areaCuadrado(lado) {\n return lado * lado;\n}", "function areaCuadrado(lado) {\n return lado * lado;\n}", "function areaCuadrado(lado) {\n return lado * lado;\n}", "function areaCuadrado(lado) {\n return lado * lado;\n}", "function mostrarInfoTarea(tarea, prioridad) {\n return `La tarea ${this.tarea} tiene una prioridad de ${this.prioridad}`;\n}", "function areaTriangulo (base, altura) {\n return (base * altura)/2;\n}", "function areaTriangulo(base, altura) {\n return (base * altura) / 2\n}", "function ondea(){\n /* REFIERE AL TÍTULO */ \n var titulo = document.querySelector(\"h1\"); \n /* CAPTURA EL CONTENIDO DEL TÍTULO */\n var texto = titulo.innerHTML; \n /* MIDE EL TAMAÑO DEL TÍTULO */\n var ancho = 700; \n var alto = 120; \n\n /*SIEMPRE AJUSTA EL ancho COMO MÚLTIPLO DE anchoFaja EN PIXELES*/\n ancho = ancho+(anchoFaja-ancho%anchoFaja); \n /* FIJA EL TAMAÑO DEL TÍTULO */\n titulo.style.width = ancho+\"px\"; \n titulo.style.height = alto+\"px\"; \n\n /* LA CANTIDAD DE BANDAS ES EL ANCHO DE TÍTULO SOBRE ANCHO DE CLIP */\n var totalFajas = ancho/1.4; \n\n /* VACÍA EL TÍTULO CONTENEDOR DE TEXTO */\n titulo.innerHTML = \"\"; \n\n /* CREA LAS BANDAS Y LES DA FORMATO */\n for(i=0; i<totalFajas; i++) {\n /* UN DIV PARA CADA FAJA */\n faja = document.createElement(\"div\"); \n // $(\"div\").addClass( \"fulljit\" );\n /* LE ASIGNA LA MISMA ALTURA DEL TÍTULO */\n faja.style.height = alto+\"px\"; \n faja.style.width = ancho+\"px;\"\n /* PONE EL MISMO TEXTO ORIGINAL */\n faja.innerHTML = texto; \n /* DEJA VISIBLE UN CLIP DE 2px DE ANCHO, CADA UNO 2px A LA IZQUIERDA DEL ANTERIOR PARA QUE PAREZCA UNA IMAGEN DE TÍTULO COMPLETA SIN CORTES */\n faja.style.clip = \"rect(0, \"+((i+1)*anchoFaja)+\"px, \"+alto+\"px, \"+(i*anchoFaja)+\"px)\"; \n /* RETRASA LA ANIMACIÓN CSS DE CADA FAJA SIGUIENDO UNA ONDA DE TIEMPO SENOIDE */\n faja.style.animationDelay = (Math.cos(i)+i*anchoOnda)+\"ms\"; \n /* AGREGA LA CAPA AL CONTENEDOR */\n titulo.appendChild(faja);\n }\n}", "function areaTriangulo (base,altura){\n\n return (base*altura)/2;\n}", "function completitud(oa, es){\n var titulo=0; var keyword=0; var descripcion=0; var autor=0;\n var tipoRE=0; var formato=0; var contexto=0; var idioma=0;\n var tipointer=0; var rangoedad=0; var nivelagregacion=0;\n var ubicacion=0; var costo=0; var estado=0; var copyright=0;\n\n // verifica que la variable tenga un valor y asigna el peso a las variables\n if (oa.title!=\"\") {\n titulo=0.15;\n }\n if (oa.keyword!=\"\") {\n keyword=0.14;\n }\n if (oa.description!=\"\") {\n descripcion=0.12;\n }\n if (oa.entity!=\"\") {\n autor=0.11;\n }\n if (oa.learningresourcetype!=\"\") {\n tipoRE=0.09;\n }\n if (oa.format!=\"\") {\n formato=0.08;\n }\n\n \n // hace la comprobacion cuantos contextos existe en el objeto\n var context=oa.context;\n // cuenta cuantas ubicaciones tiene el objeto\n var can=context.length;\n // asigna el nuevo peso que tendra cada contexto\n var pesocontexto=0.06/can;\n // comprueba que los contextos sean diferentes a vacio o a espacio \n for (var w=0; w <can ; w++) { \n if (context[w]!=\"\") {\n // calcula el nuevo peso para entregar para el calculo de la metrica\n contexto=contexto+pesocontexto;\n }\n }\n\n\n\n\n\n if (oa.language!=\"\") {\n idioma=0.05;\n }\n if (oa.interactivitytype!=\"\") {\n tipointer=0.04;\n }\n if (oa.typicalagerange!=\"\") {\n rangoedad=0.03;\n }\n if (oa.aggregationlevel!=\"\") {\n nivelagregacion=0.03;\n }\n // hace la comprobacion cuantas ubicaciones existe en el objeto\n var location=oa.location;\n // cuenta cuantas ubicaciones tiene el objeto\n var can=location.length;\n // asigna el nuevo peso que tendra cada ubicacion\n var peso=0.03/can;\n // comprueba que las ubicaciones sean diferentes a vacio o a espacio \n for (var i=0; i <can ; i++) { \n if (location[i]!=\"\") {\n // calcula el nuevo peso para entregar para el calculo de la metrica\n ubicacion=ubicacion+peso;\n }\n }\n \n\n if (oa.cost!=\"\") {\n costo=0.03;\n }\n if (oa.status!=\"\") {\n estado=0.02;\n }\n if (oa.copyrightandotherrestrictions!=\"\") {\n copyright=0.02;\n }\n\n \n \n // hace la sumatoria de los pesos \n var m_completitud=titulo + keyword + descripcion + autor + tipoRE + formato + contexto + idioma +\n tipointer + rangoedad + nivelagregacion + ubicacion + costo + estado + copyright;\n\n \n //alert(mensaje);\n return m_completitud;\n \n //echo \"* Completitud de: \".m_completitud.\"; \".evaluacion.\"<br>\";\n }", "function drawAreas(data) {\n allAreas = data.object;\n if (allAreas.length == 1) {\n // todo ???\n }\n else {\n for (var i = 0; i < allAreas.length; i++) {\n var id = allAreas[i].ID;\n if (id == \"universe\" || id == \"University\") {\n // don't do anything --> University isn't been drawn\n }\n else {\n var x = allAreas[i].topLeftX;\n var y = allAreas[i].topLeftY;\n var width = allAreas[i].width;\n var height = allAreas[i].height;\n\n\n var div = document.getElementById(\"map_png_div\");\n var clickedArea = \"\";\n clickedArea += '<div id=\"' + id + '\" onClick=\"clickOnArea(' + id + ')\" style=\" cursor:pointer; background-color: #990099; border: 2px solid black; opacity: .5; filter: alpha(opacity=50); position:absolute; margin-top:' + (+y + +2) + 'px; margin-left: ' + (+x + +2) + 'px; width: ' + (+width - +4) + 'px; height: ' + (+height - +4) + 'px;\"></div>';\n div.innerHTML = div.innerHTML + clickedArea;\t//#C2DFFF\n }\n } // for end\n }\n}", "function Rectangulo() {\n this.ancho=0;\n this.alto=0;\n\n this.setAncho=function(ancho) {\n this.ancho=ancho;\n }\n \n this.setAlto=function(alto) {\n this.alto=alto;\n } \n \n this.getArea=function() {\n return this.ancho * this.alto;\n }\n}", "get area() {\n return this.height * this.width;\n }", "function ST_ASTRO(AR,DE,LON,LAT,ALT,RAGGIO){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy). giugno 2013\n // AR: ascensione retta in ore decimali.\n // DE: declinazione in gradi sessadecimali.\n // LON: Longitudine in gradi sessadecimali (negativa a ovest di Greenwich).\n // LAT: Latitudine in gradi sessadecimali (negativa per emisfero sud).\n // ALT: Altitudine in metri sul livello del mare.\n // RAGGIO: Raggio dell'astro=0.25 gradi da utilizzare solo per il sole e la luna.\n // in tutti gli altri casi questo valore è sempre uguale a 0 zero.\n// I tempi sono in T.U. di GREENWICH. per la data di oggi.\n// Nel calcolo si tiene conto della rifrazione atmosferica (34') e dell'altitudine dell'osservatore.\n \nvar _alt=corr_alt(ALT); // correzione per l'altitudine.\nvar _raggio=RAGGIO; // dimensioni del raggio apparente dell'astro 0.25 gradi per sole e luna.\n \nvar _h=-(0.56667+_alt+_raggio) ; // altezza in gradi dell'astro rifrazione+altitudine_osservatore+raggio_apparente.\n \n // Calcolo dell'angolo orario _H in ore decimali.\n \nvar _H=(Math.sin(Rad(_h))-Math.sin(Rad(LAT))*Math.sin(Rad(DE)))/(Math.cos(Rad(LAT))*Math.cos(Rad(DE)));\n _H=Math.acos(_H);\n _H=Rda(_H);\n _H=_H/15; \n\n // Calcolo dell'azimut del sorgere.\n\nvar _Az=(Math.sin(Rad(DE))-Math.sin(Rad(_h))*Math.sin(Rad(LAT)))/(Math.cos(Rad(_h))*Math.cos(Rad(LAT)));\n _Az=Math.acos(_Az);\n _Az=Rda(_Az);\n\n // calcolo degli azimut:\n\nvar _Az_sorge= _Az;\nvar _Az_tramonto=(360-_Az);\n\n // calcolo dei tempi siderali locali degli eventi (_tsl_):\n\nvar _tsl_sorgere= 24-_H+AR; // tempo siderale locale del sorgere.\nvar _tsl_transito= AR; // tempo siderale locale transito.\nvar _tsl_tramonto= _H+AR; // tempo siderale locale del tramonto. \n \n // calcolo dei tempi siderali di Greenwich (_tsg_).\n\nvar _tsg_sorge= ore_24(_tsl_sorgere- (LON/15));\nvar _tsg_transita= ore_24(_tsl_transito-(LON/15));\nvar _tsg_tramonta= ore_24(_tsl_tramonto-(LON/15)); \n\n // calcolo dei tempi medi di Greenwich (_tmg_).\n\nvar _tmg_sorge= tras_tsg_tmg(_tsg_sorge )*1; // tempo medio a GREENWICH sorgere.\nvar _tmg_transita= tras_tsg_tmg(_tsg_transita)*1; // tempo medio a GREENWICH tramonto.\nvar _tmg_tramonta= tras_tsg_tmg(_tsg_tramonta)*1; // tempo medio a GREENWICH transito. \n \nvar _dati_astro= new Array(_Az_sorge ,_Az_tramonto ,_tmg_sorge,_tmg_transita,_tmg_tramonta , _tsg_sorge , _tsg_transita , _tsg_tramonta, _H); // restituisce le variabili numeriche.\n// posizione dei dati 0 1 2 3 4 5 6 7 8 \n\n\nreturn _dati_astro;\n\n\n}", "function limpaTela(){\n\n\tdrawQuadrada(0,0,document.getElementsByTagName('canvas')[0].width,document.getElementsByTagName('canvas')[0].height,'#FFFFFF');\n}", "placesWithinArea(area) {\n let results = turf.collect(area, this.fbData,\n 'typeNum', 'placeTypes')\n return results\n }", "function camAreaEvent(label, code)\n{\n\tvar eventName = \"eventArea\" + label;\n\tcamMarkTiles(label);\n\t__camPreHookEvent(eventName, function(droid)\n\t{\n\t\tif (camDef(droid))\n\t\t{\n\t\t\tcamTrace(\"Player\", droid.player, \"enters\", label);\n\t\t}\n\t\tcamUnmarkTiles(label);\n\t\tcode(droid);\n\t});\n}", "function addArea(data) {\n var area = $.fn.extend({}, {\n id: data.length,\n x: 0,\n y: 0,\n radius: 10,\n caption: '',\n visible: true,\n draggable: true,\n resizable: true\n }, data);\n area.helper =\n $('<div title=\"'+area.caption+'\" class=\"areahighlighter-helper\" style=\"border-radius:'+area.radius+'px;left:'+(area.x-area.radius)+'px;top:'+(area.y-area.radius)+'px;width:'+(area.radius*2)+'px;height:'+(area.radius*2)+'px;display:'+(area.visible?'block':'none')+';\"></div>')\n .appendTo(target);\n\t\tareas[area.id] = area;\n\t\thandleArea(area);\n\t}", "function areaTriangulo (base, altura){\n return (base * altura)/ 2;\n}", "function escolta () {\r\n text = this.ant;\r\n if(this.validate) {\r\n \tthis.capa.innerHTML=\"\";\r\n index = cerca (this.paraules, text); \r\n if (index == -1) {\r\n this.capa.innerHTML=this.putCursor(\"black\");\r\n }\r\n else {\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.capa.innerHTML += \"<br>\" + this.paraules[index].paraula;\r\n this.putSound (this.paraules[index].so);\r\n }\r\n }\r\n \r\n\r\n}", "function mappy(dataset) {\n var newAreas = {};\n dataset.forEach((key) => {\n let area = {};\n area.value = key.Tasso;\n area.tooltip = {\n content:\n \"<span style='font-weight:bold;'>\" +\n key.Nazione +\n \" \" +\n \"</span>\" +\n \"<br/>\" +\n \"Software illegale: \" +\n area.value +\n \"%\" +\n \"<br>Valore: \" +\n key.Valore +\n \"$ milioni\",\n };\n area.eventHandlers = {\n click: function (e, id, mapElem, textElem) {\n $(\".first\").remove();\n $(\".f32\").remove();\n $(\".graph-container\").removeClass(\"hidden\");\n $(\"#description\").append(\n \"<p class='first f32' style='font-weight:bold; font-size: 1.2em; margin-left: 20px;'>\" +\n key.Nazione +\n \" \" +\n \"<span class='flag \" +\n key.Codice.toLowerCase() +\n \"'></span></p>\"\n );\n $(\"#description\").append(\n \"<p class='first' style='font-size:18px; margin-left: 20px;'>É possibile confrontare fino a quattro paesi, da notare \" +\n \"la tendenza inversamente proporzionale tra i valori dei due grafici</p>\"\n );\n creategraph(dataset, key.Codice);\n creategraphalt(dataset, key.Codice);\n $(\".container\").trigger(\"zoom\", {\n level: 8,\n latitude: key.latitude,\n longitude: key.longitude,\n });\n $(\".container\").addClass(\"active\");\n $(\".container\").trigger(\"tooltip.css\", {\n display: \"block\",\n });\n },\n };\n newAreas[key.Codice] = area;\n });\n $(\".container\").mapael({\n map: {\n name: \"world_countries\",\n //width: 500,\n zoom: {\n enabled: true,\n step: 0.25,\n maxLevel: 20,\n },\n defaultArea: {\n attrs: {\n fill: \"#666666\",\n stroke: \"#ced8d0\",\n \"stroke-width\": 0.3,\n cursor: \"pointer\",\n },\n attrsHover: {\n \"stroke-width\": 1.5,\n },\n },\n defaultPlot: {\n text: {\n attrs: {\n fill: \"#b4b4b4\",\n },\n attrsHover: {\n fill: \"#fff\",\n \"font-weight\": \"bold\",\n },\n },\n },\n },\n text: {\n attrs: {\n cursor: \"pointer\",\n \"font-size\": 10,\n fill: \"#666\",\n },\n },\n areas: newAreas,\n legend: {\n area: {\n display: true,\n //mode: \"horizontal\",\n title: \"Percentuale di software illegale scaricato\",\n marginBottom: 6,\n slices: [\n {\n max: 25,\n attrs: {\n fill: \"#6aafe1\",\n },\n legendSpecificAttrs: {\n stroke: \"#505050\",\n },\n label: \"Tasso < 25%\",\n },\n {\n min: 26,\n max: 50,\n attrs: {\n fill: \"#459bd9\",\n },\n label: \"Tasso compreso tra 25 e 50 %\",\n },\n {\n min: 51,\n max: 75,\n attrs: {\n fill: \"#2579b5\",\n },\n label: \"Tasso compreso tra 50 e 75 %\",\n },\n {\n min: 76,\n attrs: {\n fill: \"#1a527b\",\n },\n label: \"Tasso > 75%\",\n },\n ],\n },\n },\n });\n $(\".zoomReset\").click(function () {\n //flush all\n $(\".container\").removeClass(\"active\");\n $(\".graph-container\").addClass(\"hidden\");\n myfunCalls = 0;\n check = [];\n checkalt = [];\n $(\"#limit\").css(\"display\", \"none\");\n });\n }", "get area() {\n return this._width * this._height;\n }", "cargarTareasArrayDB( tareas = [] ) {\n\n tareas.forEach(tarea => {\n this._listado[tarea.id] = tarea;\n })\n\n }", "function addGuideAreas(dataArray){\n JL(\"mylogger\").info(\"--------visualizeData()--------\");\n let scene = document.querySelector('a-scene');\n\n dataArray.forEach((place) => {\n let latitude = place.lat;\n let longitude = place.lon;\n\n // add geometry for guide area\n let icon = document.createElement('a-torus');\n\t\ticon.setAttribute('position', '0 -5 0');\n\t\ticon.setAttribute('gps-entity-place', `latitude: ` + latitude + `; longitude: `+ longitude + `;`);\n icon.setAttribute('name', place.name);\n icon.setAttribute('color', place.color);\n icon.setAttribute('rotation', '-90 0 0');\n icon.setAttribute('radius', '1');\n icon.setAttribute('radius-tubular', '0.05');\n\t\ticon.setAttribute('material', 'opacity: 0.6');\n\n // for debug purposes, just show in a bigger scale, otherwise I have to personally go on places...\n icon.setAttribute('scale', '5 5 5');\n\n icon.addEventListener('loaded', () => window.dispatchEvent(new CustomEvent('gps-entity-place-loaded')));\n scene.appendChild(icon);\n });\n}", "function CameraCommand_Action_GenerateTargetArea(html, htmlClass)\n{\n\t//get our target rect\n\tvar targetRect = Position_GetDisplayRect(html);\n\t//has area?\n\tif (this.TargetArea)\n\t{\n\t\t//update for the area\n\t\ttargetRect.left += this.TargetArea.left;\n\t\ttargetRect.top += this.TargetArea.top;\n\t\ttargetRect.width = this.TargetArea.width;\n\t\ttargetRect.height = this.TargetArea.height;\n\t}\n\t//correct right and bottom\n\ttargetRect.right = targetRect.left + targetRect.width;\n\ttargetRect.bottom = targetRect.top + targetRect.height;\n\ttargetRect.FitToParent(html, document.body);\n\t//return the area\n\treturn targetRect;\n}", "get Area() { return this.Width * this.Height; }", "get Area() { return this.Width * this.Height; }", "function th(a){this.u=a;this.ma=null;this.Ce=new uh(a,!0,!0);this.af=new uh(a,!1,!0);this.pe=u(\"rect\",{height:kh,width:kh,style:\"fill: #fff\"},null);vh(this.pe,a.be)}", "areaStyle(feature){\n\t\t return {\n\t\t\tfillColor: getAreaColor(feature),\n\t\t weight: 2,\n\t\t opacity: 1,\n\t\t color: 'white',\n\t\t dashArray: '3',\n\t\t fillOpacity: 0.5\n\t\t}\n\t }", "function selectArea() {\n\n\t// ordered by min_score ascending\n\tvar sortValues = [];\n\tsortValues.push( {\n\t\tfieldName : 'waste_areas.site_id',\n\t\tsortOrder : 1\n\t});\n\tsortValues.push( {\n\t\tfieldName : 'waste_areas.area_type',\n\t\tsortOrder : 2\n\t});\n\tsortValues.push( {\n\t\tfieldName : 'waste_areas.storage_location',\n\t\tsortOrder : 3\n\t});\n\tView.selectValue({\n\t\tformId: 'abWasteTrackGenWasteForm',\n\t\ttitle: getMessage(\"areaTitle\"),\n\t\tfieldNames: [ 'waste_out.storage_location','waste_out.site_id' ],\n\t\tselectTableName: 'waste_areas',\n\t\tselectFieldNames: ['waste_areas.storage_location', 'waste_areas.site_id' ],\n\t\tvisibleFields: [\n\t\t {fieldName: 'waste_areas.storage_location', title: getMessage('areaTitle')},\n\t\t {fieldName: 'waste_areas.area_type'},\n\t\t {fieldName: 'waste_areas.site_id' }\n\t\t ],\n\t\t showIndex: false,\n\t\t selectValueType: 'grid',\n\t\t sortValues: toJSON(sortValues)\n\t});\n}", "get listarTareas () {\n\n const arreglo = [];\n\n Object.keys(this._listado).forEach(indice => {\n arreglo.push(this._listado[indice]);\n })\n\n return arreglo;\n }", "function ChangeArea(area)\n {\n // console.log(area);\n //TODO add var testing so unexpected strings don't make it through\n vm.castleArea = area;\n }", "function task2trello (tarea) { \n var data = {\n 'name': tarea,\n 'idList': t_getListId (user, board, list),\n //'desc': 'Do this ASAP',\n //'due': '2020-02-01',\n //'idMembers': user,\n 'idLabels': '58e1add1ced82109ff032717',\n 'key': key,\n 'token': token\n };\n t_createCard (data)\n}", "function parse_PtgAreaN(blob, length, opts) {\n var type = (blob[blob.l++] & 0x60) >> 5;\n var area = parse_RgceAreaRel(blob, length - 1, opts);\n return [type, area];\n }", "function abriComentarioAuxiliar(id) {\n var cd = id;\n var area = document.getElementById('areaComentario' + cd);\n\n if (area.style.display == 'none') {\n area.style.display = 'block';\n setTimeout(function () {\n this.exibirComentario(id);\n }, 200);\n } else {\n area.style.height = '300px';\n area.style.paddingTop = '5px';\n area.style.paddingLeft = '5px';\n area.style.paddingRight = '10px';\n area.style.overflowY = 'scroll';\n area.style.position = 'relative';\n area.style.backgroundColor = '#F5FFFA';\n area.style.borderRadius = '12px';\n setTimeout(function () {\n this.exibirComentario(id);\n }, 200);\n }\n}", "function handleArea(area) {\n if ( area.draggable==true && area.helper.is('.ui-draggable')==false ) {\n area.helper.draggable({\n stop : function (event, ui) {\n area.y = 0+ui.position.top+parseInt(area.radius);\n area.x = 0+ui.position.left+parseInt(area.radius);\n },\n containment: \"parent\"\n });\n } else if( area.draggable==false && area.helper.is('.ui-draggable')==true ) {\n area.helper.draggable('destroy');\n }\n if ( area.resizable==true && area.helper.is('.ui-resizable')==false ) {\n area.helper.resizable({\n handles: 'all',\n aspectRatio: true,\n resize: function (event, ui) {\n area.helper.css('border-radius', Math.ceil(ui.size.width/2));\n },\n stop: function (event, ui) {\n area.radius = Math.ceil(ui.size.width/2);\n }\n });\n } else if( area.resizable==false && area.helper.is('.ui-resizable')==true ) {\n area.helper.resizable('destroy');\n }\n\t}", "parseArea(area) {\n const name = area.name;\n const description = area.description;\n const coordinates = area.coordinates;\n let item = undefined;\n let hazard = undefined;\n if (area.item !== undefined) {\n item = this.parseItem(area.item);\n }\n if (area.hazard !== undefined) {\n hazard = this.parseHazard(area.hazard);\n }\n const areaAssets = new AreaAssets_1.default(item, hazard);\n return new Area_1.default(name, description, coordinates, areaAssets);\n }", "function arealv() {\r\n\tconfigAddButton();\r\n\t/******** Set Default Vaue ***********/\r\n\t//if(getC(\"minStar\r\n\r\n var picNum = [ \r\n \"http://upic.me/i/vx/80j01.png\",\r\n \"http://upic.me/i/tv/deg02.png\",\r\n \"http://upic.me/i/b3/8uz03.png\",\r\n \"http://upic.me/i/q6/cch04.png\",\r\n \"http://upic.me/i/tm/19605.png\",\r\n \"http://upic.me/i/tm/hlu06.png\",\r\n \"http://upic.me/i/vi/gsq07.png\",\r\n \"http://upic.me/i/xe/re608.png\",\r\n \"http://upic.me/i/qc/wlq09.png\",\r\n ];\r\n var areas = document.getElementsByTagName('area');\r\n var maxArea = areas.length;\r\n var areaMinStar = getC(\"minStar\");if(!areaMinStar){setC(\"minStar\",3);areaMinStar=3;};\r\n var areaHoldStat = getC(\"areaHoldStat\");if(!areaMinStar){setC(\"areaHoldStat\",3);areaMinStar=3;}; //1Free 2Hold 3All\r\n var areaTaken = 0; // 0=all 1=free 2=taken\r\n var arealv;\r\n var areatmp ='';\r\n\tvar star2num = '';\r\n for(var i =0; i<maxArea; i++){\r\n\t\t\r\n\t\tif(areas[i].title.split(' ').length!=2 &&areaHoldStat==1)continue;\r\n\t\tif(areas[i].title.split(' ').length==2 &&areaHoldStat==2)continue;\r\n\t\t\r\n //if(areas[i].title.split(' ').length==2)\t\t//free area\r\n {\r\n\t\t\tstar2num=areas[i].getAttribute('onmouseover').split(\"/img/common/star_warpower_b.gif\");\r\n arealv = star2num.length -1;\r\n\t\t//\tareas[i].setAttribute('onmouseover',star2num[0].split(\"img src\")+\"img src=\\'/\"+picNum[arealv-1]+star2num[star2num.length-1]);\r\n\t\t\tif(arealv>=areaMinStar)\r\n if(i<9)areatmp += '<img src=\"'+picNum[arealv-1]+'\" class=\"mapAll0'+(i+1)+'\" alt=\"\">';else areatmp += '<img src=\"'+picNum[arealv-1]+'\" class=\"mapAll'+(i+1)+'\" alt=\"\">';\r\n }\r\n }\r\n document.getElementById(\"mapsAll\").innerHTML = document.getElementById(\"mapsAll\").innerHTML + areatmp;\r\n}", "function filtrarTareas(_evento) {\n\t\n\tif (typeof _evento.index !== 'undefined' && _evento.index !== null) {\n\t\twhereIndices = _evento.index; // TabbedBar\n\t} else {\n\t\twhereIndices = INDICES[_evento.source.title]; // Android menu\n\t}\n\t\n\t// Obtengo las tareas que cumplan el filtro\n\ttareas.fetch();\n}", "function showTareas() {\n let tareas = getTareas();\n\n tareas.forEach(tarea => {\n if(tarea.status === 0){\n //Crear el nuevo elemento\n const newTarea = document.createElement(\"div\");\n\n //Añadir estilos y contenido\n newTarea.className = \"border-top\";\n newTarea.innerHTML = \n `<div id=\"${tarea.id}\" class=\"row elemento-lista\">\n <div class=\"col-9 col-md-10 tarea-titulo\">\n <h3>${tarea.titulo}</h3>\n </div>\n <div class=\"col-3 col-md-2 tarea-fecha\">\n ${tarea.newDate}\n </div>\n <div class=\"col-6 col-md-10 desc-tarea\">\n <p>${tarea.desc}</p>\n </div>\n \n <input type=\"checkbox\" name=\"${tarea.id}\" id=\"${tarea.id}\" onclick=\"changeStatus(this)\">\n <label for=\"complet\">completada</label>\n \n </div>`;\n\n //Se añade a la lista de tareas\n tareaList.appendChild(newTarea);\n }\n });\n}", "function setArea() {\n ticket_info['area'] = developerSupportArea\n}", "function areaRectangulo(ancho, alto){\r\n let area = ancho*alto;\r\n alert(\"Area\" + area);\r\n}", "function mostrarTodasTareas(arrayTareas) {\n ul.innerHTML = '';\n for (tarea of arrayTareas) {\n mostrarTarea(tarea);\n }\n eventoBotones();\n}", "shapeTerrain() {\r\n // MP2: Implement this function!\r\n }", "function parse_PtgAreaN(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceAreaRel(blob, length - 1, opts);\n\treturn [type, area];\n}", "function parse_PtgAreaN(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceAreaRel(blob, length - 1, opts);\n\treturn [type, area];\n}", "function parse_PtgAreaN(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceAreaRel(blob, length - 1, opts);\n\treturn [type, area];\n}", "function parse_PtgAreaN(blob, length, opts) {\n\tvar type = (blob[blob.l++] & 0x60) >> 5;\n\tvar area = parse_RgceAreaRel(blob, length - 1, opts);\n\treturn [type, area];\n}", "function colocar_embarcador_tier(cant_unit,nombre,id_tier,marca,empresa,peso){\n\n var padre = $(\"#div\"+id_tier+\" > table \");\n if(empresa == \"ARAUCO\"){\n\n //var hijo = $(\"<tr><td > #\"+nombre+\"</td><td> \"+cant_unit+\" Units</td><td>\"+peso.toFixed(3)+\" Tns</td><td><img src='../imagenes/marcas/ARAUCO/\"+marca+\".png' width='18px'></td><tr>\");\n var hijo = $(\"<tr><td > #\"+nombre+\"</td><td colspan='2' > \"+cant_unit+\" Units</td><tr>\");\n }\n if(empresa == \"CMPC\"){\n // var hijo = $(\"<tr><td > #\"+nombre+\"</td><td> \"+cant_unit+\" Units</td><td>\"+peso.toFixed(3)+\" Tns</td><td><img src='../imagenes/marcas/CMPC/\"+marca+\".png' width='18px'></td><tr>\");\n var hijo = $(\"<tr><td > #\"+nombre+\"</td><td colspan='2' > \"+cant_unit+\" Units</td><tr>\");\n }\n padre.append(hijo);\n}" ]
[ "0.683295", "0.683295", "0.680449", "0.67723006", "0.6762246", "0.6619391", "0.6147115", "0.60673404", "0.6009856", "0.59871507", "0.5915295", "0.58610404", "0.58585364", "0.58265615", "0.57786196", "0.57592535", "0.57483107", "0.5690091", "0.56763625", "0.5676155", "0.5675126", "0.5649694", "0.5649694", "0.5649694", "0.5649694", "0.5649694", "0.5649694", "0.5649694", "0.5642715", "0.56358", "0.56353056", "0.5589749", "0.55775315", "0.5547581", "0.5547581", "0.5547581", "0.5547581", "0.5540517", "0.55396235", "0.5523602", "0.5518317", "0.55167913", "0.55128616", "0.5493128", "0.5486357", "0.5479633", "0.54786503", "0.5463064", "0.5455263", "0.5451261", "0.544542", "0.5427841", "0.5420611", "0.54173833", "0.54173833", "0.54173833", "0.53989327", "0.53984314", "0.53904504", "0.5390133", "0.538068", "0.537664", "0.5375643", "0.53731966", "0.53686935", "0.5368516", "0.536454", "0.5364461", "0.53550935", "0.53538364", "0.53537095", "0.53458166", "0.53441304", "0.5334081", "0.5329456", "0.5327892", "0.5327076", "0.5324841", "0.5324841", "0.53224605", "0.53220487", "0.5317009", "0.5317005", "0.53144425", "0.53137815", "0.5307758", "0.5296392", "0.52860314", "0.5284503", "0.5272195", "0.5256089", "0.5246317", "0.5237399", "0.52333224", "0.5230253", "0.5226016", "0.5226008", "0.5226008", "0.5226008", "0.5226008", "0.52256966" ]
0.0
-1
Use context to update vars dinamyc / Use the context to redirect after succeded and update var to use in view Method to create users, pass object Users
create(context, user){ context.showAlert = false context.showSuccess = false HTTP.post(USERS, user) .then((resp) => { if (resp.status>= 200 && resp.status <=300){ console.log(resp) var id = resp.data.id // redirect to show user view context.$router.push({ name: 'EmployeesShow', params: { id }}) } }) .catch((err) => { context.showAlert = true context.errMsg = err.response.data console.log(err) if (err.response) { console.log(err.response.data); console.log(err.response); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "success(context, response, redirect) {\n context.$set('errors', {});\n\n let { token, user } = response.data;\n\n user.token = token;\n\n localStorage.setItem('user', JSON.stringify(user));\n\n this.authenticated = this.user();\n\n if (redirect) context.$router.go(redirect);\n }", "function createUser(newUser) {\n $.ajax({\n method: \"POST\",\n url: \"/api/newUser\",\n data : newUser\n })\n .then(function() {\n // or some redirect\n location.reload();\n \n });\n }", "signup(context, creds, redirect) {\n // post to http://localhost:3001/users\n // screct\n // callback\n context.$http.post(SIGNUP_URL, creds, (data) => {\n // {id_token, data.id_token}\n localStorage.setItem('id_token', data.id_token)\n\n // this.user.auth = true\n this.user.authenticated = true\n\n // redirect\n if(redirect) {\n router.go(redirect)\n }\n\n }).error((err) => {\n // error\n context.error = err\n })\n }", "function upsertUser(userData) {\n $.post(\"/api/user/create\", userData)\n .then(function(){\n localStorage.setItem(\"currentUser\", JSON.stringify(userData));\n localStorage.setItem(\"loggedIn\", true);\n window.location = \"/\"\n });\n }", "function createUser(){\n let firstname = document.getElementById('firstname').value;\n let lastname = document.getElementById('lastname').value;\n let email = document.getElementById('email').value;\n let password = document.getElementById('password').value;\n let dateOfBirth = document.getElementById('dateOfBirth').value;\n\n // var userAge = calculteAge(dateOfBirth);\n\n // let userInfo = new User(firstname, lastname, email, dateOfBirth, password)\n // userInfo.calculateAge();\n // userInfo.createId();\n\n // localStorage.setItem('id', userInfo.userId)\n let userInfo = { firstname, lastname, email, dateOfBirth, password }; \n\n creatingUser(userInfo);\n\n\n// if (userInfo.age < 18){\n// alert(\"You must be 18 or older to create an account\");\n// return \n// } else {\n// creatingUser(userInfo);\n// // send user on to logged in page\n// }\n}", "function getUserAndRedirect(){\n UserServices.getOne({action:$scope.user.id}).$promise.then(function(val){\n $scope.user = val;\n shareObjectService.addObject($scope.user);\n $state.go('app.auth.user.detail', {id:$scope.user.id});\n });\n }", "function CreateUser(props) {\n const [id, setId] = useState(props.match.params.id);\n const [name, setName] = useState();\n const [emailaddress, setEmailaddress] = useState();\n const [password, setPassword] = useState();\n const [passwordCheck, setPasswordCheck] = useState();\n const [status, setStatus] = useState(statusEnums.active.id);\n const handleChange = (event) => {\n setStatus(event.target.value);\n };\n const [error, setError] = useState();\n\n const { userData } = useContext(UserContext);\n const history = useHistory();\n\n //Check user is Loggedin or not\n useEffect(() => {\n if (!userData.user) {\n history.push(\"/login\");\n } else {\n createOrEditUser();\n }\n }, []);\n\n //Edit User details for Update User\n const createOrEditUser = async () => {\n if (id) {\n axios\n .get(\"/users/\" + id, {\n headers: { \"x-auth-token\": userData.token },\n })\n .then((response) => {\n console.log(response.data.name);\n if (response) {\n setName(response.data.name);\n setEmailaddress(response.data.emailaddress);\n setStatus(response.data.status ? \"1\" : \"0\");\n }\n })\n .catch((err) => {\n err && setError(err);\n });\n }\n };\n\n //User Submit Event\n const submit = async (e) => {\n e.preventDefault();\n\n try {\n const newUser = {\n name,\n emailaddress,\n password,\n passwordCheck,\n status,\n createdBy: userData.user.id,\n };\n if (id) {\n await axios.post(\"/users/update/\" + id, newUser, {\n headers: { \"x-auth-token\": userData.token },\n });\n } else {\n await axios.post(\"/users/add\", newUser, {\n headers: { \"x-auth-token\": userData.token },\n });\n }\n\n history.push(\"/\");\n } catch (err) {\n err.response.data.msg && setError(err.response.data.msg);\n }\n };\n\n const back = () => history.push(\"/\");\n\n return (\n <div className=\"container\">\n <h4 className=\"mt-3 mb-3\">\n {id ? \"Update User\" : \"Create User\"}\n <div className=\"float-right mb-3 \">\n <button\n type=\"button\"\n className=\"btn btn-primary cmscolor\"\n onClick={back}\n >\n Back\n </button>\n </div>\n </h4>\n {error && (\n <ErrorNotice message={error} clearError={() => setError(undefined)} />\n )}\n <form onSubmit={submit}>\n <div className=\"form-group\">\n <label htmlFor=\"name\">Name </label>\n <input\n type=\"text\"\n id=\"name\"\n className=\"form-control\"\n placeholder=\"Enter Name\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n />\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"emailaddress\">Email address</label>\n <input\n type=\"email\"\n id=\"emailaddress\"\n value={emailaddress}\n className=\"form-control\"\n placeholder=\"Enter Emailaddress\"\n onChange={(e) => setEmailaddress(e.target.value)}\n />\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"password\">Password</label>\n <input\n type=\"password\"\n id=\"password\"\n className=\"form-control\"\n placeholder=\"Enter Password\"\n autoComplete=\"new-password\"\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"confirmPassword\">Confirm Password</label>\n <input\n type=\"password\"\n id=\"confirmPassword\"\n className=\"form-control\"\n autoComplete=\"new-password\"\n placeholder=\"Enter Confirm Password\"\n onChange={(e) => setPasswordCheck(e.target.value)}\n />\n </div>\n <div className=\"form-group\">\n <label htmlFor=\"status\">Status</label>\n <select\n id=\"status\"\n value={status}\n onChange={handleChange}\n className=\"form-control\"\n >\n {Object.keys(statusEnums).map((key) => (\n <option key={key} value={statusEnums[key].id}>\n {statusEnums[key].name}\n </option>\n ))}\n </select>\n </div>\n <button type=\"submit\" className=\"btn btn-primary cmscolor\">\n {id ? \"Update\" : \"Create\"}\n </button>\n </form>\n </div>\n );\n}", "function createRegistration(context) {\n if (!validator.isRegFormValid(context.params)) {\n $('input[name=\"password\"]').val('');\n $('input[name=\"repeatPass\"]').val('');\n return;\n }\n\n const userData ={\n username: context.params.username,\n password: context.params.password,\n email: context.params.email,\n avatarUrl: context.params.avatarUrl\n };\n\n userModel.register(userData)\n .then(function (response) {\n userModel.saveSession(response);\n handler.showInfo(`User registration successful.`);\n context.redirect('#/home');\n })\n .catch(handler.handleError);\n }", "show(context){\n HTTP.get(USERS + context.$route.params.id+'/')\n .then((resp) => {\n context.user = resp.data\n\n })\n .catch((err) => {\n console.log(err)\n })\n }", "function saveSuccessCallback() {\n\t\t\treturn function (response) {\n\t\t\t\tsetUser(response);\n\t\t\t\tgotoUser.all();\n\t\t\t}\n\t\t}", "function createUser(userData) {\n\t\tuserAuth.register(userData, function(err) {\n\t\t\tif(err){ \n\t\t\t\t$rootScope.flashMessage = {data: \"Something went wrong please try again\", type: \"error\"}\n\t\t\t}else{\n\t\t\t\tif($rootScope.currentUser.role == \"Author\"){\n\t\t\t\t\t$location.path('/info');\n\t\t\t\t\t$rootScope.flashMessage = {data: \"Kindly fill your profile details\", type: \"success\"}\n\t\t\t\t\tvm.showForm = true;\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t$location.path('/');\n\t\t\t\t$rootScope.flashMessage = {data: \"Successfully Logged In\", type: \"success\"}\n\t\t\t}\n\t\t});\n\t}", "function createUsers(req, res) {\n\n}", "function registerUser(){\r\n let email=$(\"#txtEmail\").val();\r\n let pass=$(\"#txtPassword\").val();\r\n let firstName=$(\"#txtFirst\").val();\r\n let lastName=$(\"#txtLast\").val();\r\n let age=$(\"#txtAge\").val();\r\n let address=$(\"#txtAddress\").val();\r\n let phone=$(\"#txtPhone\").val();\r\n let payment=$(\"#selPayment\").val();\r\n let color=$(\"#txtColor\").val();\r\n let user = new User(email,pass,firstName,lastName,age,address,phone,payment,color);\r\n console.log(user);\r\n saveUser(user);// this function is on the storeManager\r\n clearForm();\r\n setNavInfo()\r\n\r\n}", "function setTemp() {\n if (localStorage.getItem(\"userId\") === null) {\n // Create temp user\n var tempUser = {\n name: \"temp\",\n password: \"\"\n };\n localUser.name = tempUser.name;\n console.log(tempUser);\n // User post\n API.createUser(tempUser);\n } else {\n localUser.id = localStorage.getItem(\"userId\");\n API.getFridge(localUser.id);\n }\n}", "createUser({ commit, dispatch }, user) {\n api.post('account', user)\n .then(res => {\n commit('setUser', res.data);\n return router.push('/dashboard/' + res.data.id);\n })\n }", "function createUserInformation(){\n\tconsole.log(\"function: createUserInformation\");\n\t$().SPServices({\n\t\toperation: \"UpdateListItems\",\n\t\twebURL: siteUrl,\n\t\tasync: false,\n\t\tbatchCmd: \"New\",\n\t\tlistName:\"ccUsers\",\n\t\tvaluepairs:[\n\t\t\t\t\t\t[\"Title\", personInformation().pseudoName], \n\t\t\t\t\t\t[\"PERSON_EMAIL\", personInformation().personEmail], \n\t\t\t\t\t\t[\"P_LAST_NAME\", personInformation().personLastName],\t\n\t\t\t\t\t\t[\"P_FIRST_NAME\", personInformation().personFirstName], \n\t\t\t\t\t\t[\"PERSON_ROLE\", personInformation().personRole], \n\t\t\t\t\t\t[\"PERSON_RANK\", personInformation().personRank], \n\t\t\t\t\t\t[\"PERSON_DIRECTORATE\", personInformation().personDirectorate], \n\t\t\t\t\t\t[\"PERSON_ACTIVE\", personInformation().personActive],\n\t\t\t\t\t\t[\"PERSON_ATTRIBUTES\", personAttributes()],\n\t\t\t\t\t\t[\"PERSON_TRAINING\", personTraining()]\n\t\t\t\t\t],\n\t\tcompletefunc: function (xData, Status) {\n\t\t\t$(xData.responseXML).SPFilterNode(\"z:row\").each(function(){\n\t\t\t\tuserId = $(this).attr(\"ows_ID\");\n\t\t\t})\n\t\t}\n\t});\n\t// Redirect\n\tsetTimeout(function(){\n\t\tsetUserInformationRedirect(userId);\n\t}, 2000);\t\n}", "async addusers({view, request, session, response}) {\n const rules = {\n username: 'required',\n email: 'required',\n password: 'required'\n }\n\n const validation = await validate(request.all(), rules)\n\n if (validation.fails()) {\n session\n .withErrors(validation.messages())\n .flashExcept(['password'])\n\n return response.redirect('back')\n }\n\n const user = new User()\n const users = request.collect(['username','password','email'])\n console.log(users)\n user.username = users[0].username\n user.password = users[0].password\n user.email = users[0].email\n user.save()\n return view.render('register')\n }", "created() {\n request200('GET', '/in/user', {}, x => {\n this.user = x;\n });\n this.update();\n }", "function userController(userService){\n //binding del controlador con el html, solo en el controlador\n var vm = this;\n\n vm.btnadd = true;\n vm.btnedit = false;\n\n vm.getUsers ={};\n\n vm.btnadd = true;\n vm.btnedit = false;\n loadUsers();\n\n function loadUsers(){\n userService.getUsers().then(function (response) {\n vm.getUsers = response.data;\n\n });\n }\n\n\n vm.save= function(form){\n var newUser ={\n firstName : vm.firstName,\n lastName : vm.lastName,\n email : vm.email,\n password: vm.password\n }\n\n userService.setUsers(newUser).success(function(data){\n console.log(data);\n vm.firstName = null;\n vm.lastName = null;\n vm.email = null;\n vm.password = null;\n });\n\n vm.delete = function(id){\n console.log(id);\n userService.deleteUsers(id)\n .success(function(data){\n init();\n })\n }\n\n vm.firstName = null;\n console.log(newUser);\n }\n vm.showInfoUpdate = function(pobjUser){\n vm.btnadd = false;\n vm.btnedit = true;\n vm.id = pobjUser._id;\n vm.firstName = pobjUser.firstName;\n vm.lastName = pobjUser.lastName;\n vm.email = pobjUser.email;\n vm.password = pobjUser.password;\n vm.btnedit\n }\n vm.update = function(){\n var newUser ={\n _id: vm.id,\n firstName : vm.firstName,\n lastName : vm.lastName,\n email : vm.email,\n password: vm.password\n }\n\n userService.updateUsers(newUser).then(function (response) {\n loadUsers();\n vm.btnadd = true;\n vm.btnedit = false;\n vm.firstName = null;\n vm.lastName = null;\n vm.email = null;\n vm.password = null;\n\n });\n\n\n }\n }", "setUser(newUser) {\n this.user = newUser\n }", "function pass_valid(result){\n if(valid_user==true){\n req.session.user_id = user._id;\n res.render('success', {user:user});\n }else{\n res.render('index');\n }\n }", "function setUserData() {\n //TODO: for non-social logins - userService is handling this - not a current issue b/c there is no data for these right after reg, but needs to be consistent!\n authService.setUserCUGDetails();\n authService.setUserLocation();\n authService.setUserPreferences();\n authService.setUserBio();\n authService.setUserBookings();\n authService.setUserFavorites();\n authService.setUserReviews();\n authService.setSentryUserContext();\n authService.setSessionStackUserContext();\n\n //was a noop copied from register controller: vm.syncProfile();\n }", "function createUser(e) {\n e.preventDefault();\n let users = Array({\n username: userName.value,\n password: userPassword.value\n });\n\n\n localStorage.setItem(\"user\", JSON.stringify(users));\n location.href = \"task.html\";\n}", "index(context){\n HTTP.get(USERS)\n .then((resp) => {\n context.users = resp.data\n console.log(resp.data)\n })\n .catch((err) => {\n console.log(err)\n })\n }", "function complete(){\n callbackCount++;\n if(callbackCount >= 1){\n // console.log(context)\n res.render('users', context);\n }\n }", "update(context, user){\n context.showAlert = false \n context.showSuccess = false \n HTTP.put(USERS, user)\n .then((resp) => {\n if (resp.status>= 200 && resp.status <=300){\n var id = resp.data.id\n context.showAlert = false \n }\n context.showSuccess = true\n context.successMsg = \"Users updated successfully\"\n })\n .catch((err) => {\n context.showAlert = true\n console.log(err)\n if (err.response) {\n context.errMsg = err.response.data\n console.log(err.response.data);\n console.log(err.response);\n context.showAlert = true \n }\n })\n }", "function Listusers() {\n //using context\n const {newlist, setnewlist} = useContext(contextdata);\n const history = useHistory();\n return (\n <div className=\"list-users\">\n {newlist.map(({ name, pic, details, id }) =>\n <div className=\"card\">\n <img src={pic} />\n <div className=\"username\">{name}</div>\n <div className=\"profile\">{details}</div>\n <div className = \"list-buttons\">\n {/*routes to the new path with the current id, when edit button is clicked */}\n <button onClick={() => history.push(\"/edit-user/\" + id)}>Edit User</button>\n {/*removes the user with the current id from the list, when delete button is clicked */}\n <button className = \"delete-button\" \n onClick={() => setnewlist(newlist.filter(user => user.id !== id))} >Delete User</button><br/>\n <button className = \"profile-button\" onClick={() => history.push(\"/profile/\" + id)}>Profile</button>\n </div>\n </div>)}\n </div>\n )\n}", "function redirexted() {\r\n\r\n // here we create localStorage data\r\n \r\n localStorage.setItem(\"userInfo\", JSON.stringify(auth.currentUser));\r\n\r\n // here we change page\r\n\r\n window.location.href = \"home.html\";\r\n\r\n}", "function loginSuccess(res) {\n $state.go('users.routes', {\n username: res.user.username\n });\n }", "async completeProfile(req, res, next) {\n const validationErrors = validationResult(req).array();\n if (validationErrors.length > 0)\n return next(new ApiError(422, validationErrors));\n try {\n let userId = req.params.userId;\n let userDetails = await User.findById(userId);\n if (!userDetails)\n return res.status(404).end();\n\n //prepare data \n if (req.files.length > 0) {\n req.body.portofolio = []\n for (let x = 0; x < req.files.length; x++) {\n req.body.portofolio.push(await toImgUrl(req.files[x]))\n }\n }\n await User.findByIdAndUpdate(userId, req.body, { new: true });\n //assign new attributed value to user object\n // userDetails.about = req.body.about;\n // userDetails.portofolio = req.body.portofolio;\n userDetails.completed = 'true';\n await userDetails.save();\n //return new user \n let newObject = await User.findById(userId)\n .populate('city')\n .populate('jobs')\n return res.status(200).json(newObject);\n\n } catch (err) {\n next(err)\n }\n }", "function handleUserProfile(req, res) {\n console.log(res.locals.events)\n res.redirect('/user/profile', {\n events: res.locals.events\n });\n}", "editAccountName(request, response) {\n const loggedInUser = accounts.getCurrentUser(request);\n loggedInUser.name = request.body.name;\n memberStore.editUser(loggedInUser);\n response.redirect(\"/viewAccountDetails\");\n }", "static register(req, res, next){\n let newUser = {\n email: req.body.email,\n password: req.body.password,\n location: req.body.location\n }\n\n if(newUser.location === ''){\n newUser.location = \"Jakarta\"\n }\n\n User.create(newUser)\n .then(data => {\n let output = {\n id: data.id,\n email: data.email,\n location: data.location\n }\n res.status(201).json(output)\n })\n .catch(err => {\n next(err)\n })\n }", "create({view}) {\n \n return view.render('user.create')\n }", "function successCallBack_Add() {\n\t//alert(\"DEBUGGING: success\");\n\t// this calls the function that will show what is in the User table in the database\n\tlocation.reload();\n}", "function user(){\r\n uProfile(req, res);\r\n }", "function generateUser(users){\r\n if (users.token == null ){\r\n\r\n \r\n document.getElementById(\"message\").classList.add(\"alert\", \"alert-danger\");\r\n document.getElementById(\"message\").textContent = \"Vous n'êtes pas inscrit.\"\r\n } else{ \r\n // let cookieUser = document.cookie = `token=${users.token}; max-age=86000`;\r\n let storageUser = localStorage.setItem('token', `${users.token}`);\r\n location.href = \"articles.html\";\r\n }\r\n}", "function create_user(userobject){\n\n}", "function createUser(newUser){\n\n UserService\n .createUser(newUser)\n .then(\n function (doc) {\n vm.user = null;\n init();\n });\n }", "onCompleted({ addUser }) {\n // Put token in local storage via Auth service\n authService.login(addUser.token);\n\n // Set user in context (not token - their data)\n setUser(addUser.user);\n\n // Redirect to home WITHOUT RESETTING THE WHOLE APP and losing context!\n history.push(\"/\");\n }", "updateUserDetails() {\n if (!activeUser()) return;\n $(conversations_area).find(`[data-user-id=\"${activeUser().id}\"] .sb-name,.sb-top > a`).html(activeUser().get('full_name'));\n $(conversations_area).find('.sb-user-details .sb-profile').setProfile();\n SBProfile.populate(activeUser(), $(conversations_area).find('.sb-profile-list'));\n }", "function redirectUserToThePageAccordingToHisRole() {\n UserService.requestUser((res) => {\n if (!res.data.success) {\n return NotificationService.info(res.data.data.data.message);\n }\n\n UserService.save(res.data.data);\n\n let isSuperAdmin = UserService.isSuperAdmin;\n if (isSuperAdmin()) {\n $window.location.hash = '#/';\n $window.location.pathname = '/admin/';\n } else {\n $window.location.hash = '#/';\n $window.location.pathname = '/app/';\n }\n });\n }", "function updateUser() {\n try {\n selectedUser.username = $usernameFld.val();\n selectedUser.password = $passwordFld.val();\n selectedUser.firstName = $firstNameFld.val();\n selectedUser.lastName = $lastNameFld.val();\n selectedUser.role = $roleFld.val();\n userService.updateUser(selectedUserId, selectedUser)\n .then(function (userServerInfo) {\n users[editIndex] = selectedUser;\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n // In future could catch null error or could grey out checkmark icon.\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "newUser(req, res, next) {\n // EXTRACT FORM DATA\n const { username, email, password } = req.body;\n\n // INSERT USER DATA INTO AN OBJECT\n let newUser = { username, email, password };\n\n // USE MODEL TO REGISTER A NEW USER\n User.addUser(newUser)\n .then(user => {\n res.status(201).json({\n success: true,\n message: 'User registered',\n user: {\n id: user.id,\n username: user.username,\n email: user.email\n }\n });\n })\n .catch(err => console.error(err));\n }", "function signUpUser(userData) {\n // $.post(\"/api/user/signup\", {\n $.post(\"/api/user/signup\", userData)\n .then(() => {\n console.log(\"User signed up successfully wait for approve\")\n window.location.replace(\"/user/signup\");\n // If there's an error, handle it by throwing up a bootstrap alert\n })\n .catch(err=>{\n console.log(\"Err something went wrong try again \")\n });\n }", "function updateUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n userService\n .updateUser(currentUserID,user)\n .then(findAllUsers)\n .then(emptyUserForm);\n\n }", "saveUser() {\n this.submitted = true;\n if (this.userForm.invalid) {\n return;\n }\n this.submitted = false;\n this.service.post('add-edit-user', this.userForm.value)\n .subscribe(res => {\n if (res['status'] == true) {\n this.toastr.success(res['msg'], '', { timeOut: 1000 });\n this.router.navigateByUrl('/sessions/signin', { skipLocationChange: true }).then(() => {\n this.router.navigate(['/users/user-list/' + this.userForm.value.user_role]);\n });\n // location.reload();\n }\n else {\n this.toastr.warning(res['msg'], '', { timeOut: 1000 });\n }\n });\n }", "function handleCreateUser(event){\n if (DEBUG) {\n console.log (\"Triggered handleCreateUser\")\n }\n var data = [$(\"#firstname_add\").val(),\n $(\"#nickname_add\").val(),\n $(\"#email_add\").val(),\n $(\"#gender_add\").val(),\n $(\"#birthday_add\").val(),\n $(\"#password_add\").val()];\n\n for(var i = 0; i < data.length; ++i){\n if(data[i] == \"\"){\n alert (\"Could not create new user, some field is missing\");\n return false;\n }\n }\n var envelope={'template':{\n 'data':[]\n }};\n var userData = {};\n userData.name = \"firstname\";\n userData.value = data[0];\n envelope.template.data.push(userData);\n userData = {};\n userData.name = \"nickname\";\n userData.value = data[1];\n envelope.template.data.push(userData);\n userData = {};\n userData.name = \"email\";\n userData.value = data[2];\n envelope.template.data.push(userData);\n userData = {};\n userData.name = \"gender\";\n userData.value = data[3];\n envelope.template.data.push(userData);\n userData = {};\n userData.name = \"birthday\";\n userData.value = data[4];\n envelope.template.data.push(userData);\n userData = {};\n userData.name = \"password\";\n userData.value = data[5];\n envelope.template.data.push(userData);\n\n var url = \"/accounting/api/users/\";\n addUser(url, envelope);\n return false; //Avoid executing the default submit\n}", "register() {\n if(this.state.usernameAvailable && this.state.username.length > 0\n && this.state.password.length > 0 && this.state.confirmPassword === this.state.password &&\n this.state.firstName.length > 0 && this.state.lastName.length >0 &&\n this.state.dateOfBirth.length > 0){\n const credentials = {\n username: this.state.username,\n password: this.state.password,\n firstName: this.state.firstName,\n lastName: this.state.lastName,\n role: this.state.role,\n dateOfBirth: this.state.dateOfBirth,\n collegeLists: []\n };\n\n this.userService.register(credentials).then(user => {\n\n\n // Redirect back to home\n if (user) {\n window.location = '/';\n }\n });\n\n\n\n }\n\n else{\n alert('One more fields is incorrect!');\n }\n }", "function create(data) {\n let user = JSON.parse(localStorage.getItem(\"userData\"));\n data.createdBy = {id:user.user_id,name: user.user_label};\n return $http.post(baseUrl+\"call\",data,{headers:setHeaders()})\n }", "function createUserController(request, response) {\n const userData = request.body;\n delete userData.password;\n\n const newUser = model.insert(userData);\n\n response.status(httpStatus.CREATED).json(newUser);\n}", "function register(userObj) {\n vm.emails.push(userObj.emails);\n userObj.emails = vm.emails;\n console.log(userObj);\n UserService\n .createUser(userObj)\n .then(function (response) {\n console.log(response);\n var currentUser = response.data;\n if(currentUser != null){\n UserService.setCurrentUser(currentUser);\n $location.url('/profile');\n }\n else{\n //promise fullfilled, inpsite of getting a null response.\n console.log(\"Username already exists\");\n vm.showAlert = true;\n }\n });\n }", "function newUser() {\r\n\tvar hppurl;\r\n var language = getLanguage();\r\n\tvar country = getCountry();\r\n\t\r\n\tif( language_support == 'y' || language_support == 'Y') {\r\n hppurl = cfserver + \"/hppcf/createuser.do?lang=\" +\r\n \tlanguage + \"&cc=\" + country + \"&hpappid=\" + application_id + \"&preview=\" + preview + \"&applandingpage=\" +\r\n escape (fpProcessLandingPage1)+ \"&applandingpage2=\" + escape (fpProcessLandingPage2);\r\n }\r\n else {\r\n hppurl = cfserver + \"/hppcf/createuser.do?lang=en&cc=US&hpappid=\" +\r\n \tapplication_id + \"&preview=\" + preview + \"&applandingpage=\" + escape( fpProcessLandingPage1 )+\r\n \t\"&applandingpage2=\" + escape (fpProcessLandingPage2);\r\n }\r\n\r\n location.href = hppurl ;\r\n}", "function _newUserCreated(req, res) {\n let {\n names,\n surnames,\n username,\n password,\n } = req.body;\n let u = new User();\n u.names = names;\n u.surnames = surnames;\n u.username = username;\n u.created_at = moment().unix();\n\n\n if (!password) {\n return res.status(403).send({\n message: 'La contraseña es necesaria!'\n })\n }\n\n\n /* now we need encrypt the new user password, we're going to use the library bcrypt */\n bcrypt.hash(password, 10).then(hashed => {\n u.password = hashed;\n /* save user */\n u.save().then(user => {\n\n res.status(200).send({\n user: user\n });\n }).catch(err => res.status(500).send({\n err,\n message: 'El campo email ha sido duplicado!'\n }));\n }).catch(err => res.status(401).send({\n message: err + ', la contraseña no pudo ser encriptada, porque no se ha colocado ninguna'\n }));\n}", "async function saveProfileChangesController(e) {\n e.preventDefault();\n\n // Remove existing warning messages\n if (mainView.warningMessageExists()) {\n mainView.removeMessage();\n }\n\n const updatedUser = mainView.getMyProfileFormData();\n updatedUser.id = appState.login.JWT.user.id;\n\n if (updatedUser) {\n // Create a new updated user instance\n appState.user.updated = new User(updatedUser);\n\n // Delete all data from newUser\n deleteAllObjectProperties(updatedUser);\n\n // POST new user to server\n try {\n await appState.user.updated.update();\n } catch (error) {\n displayFailMessage(apiData.infoMessages.unknown);\n }\n\n if (appState.user.updated.result) {\n appState.user.updated.result.status === 201 ? \n userUpdateSuccessfullyExecuted() \n : displayFailMessage(apiData.infoMessages.unknown);\n } else if (appState.user.updated.error) {\n return displayFailMessage(`${appState.user.updated.error.message}!`);\n } else {\n return displayFailMessage(apiData.infoMessages.unknown);\n }\n\n // Delete all data from appState.register.user\n deleteAllObjectProperties(appState.user.updated);\n }\n}", "async store(req, res) {\n\n // Parametro passado pelo POST\n const { username } = req.body;\n\n // Busca na mongo o usuário informado\n const userExists = await Dev.findOne({user: username});\n\n // Verifica se o usuário já existe\n if (userExists) {\n \n // Retorna o usuário caso já exista\n return res.json(userExists); // END.\n\n }\n\n // Consome a API do github para pegar as informações do usuário passado\n const response = await axios.get(`https://api.github.com/users/${username}`);\n\n // Extrai as informações necessárias do body\n const { name, bio, avatar_url: avatar } = response.data;\n\n // Cria o usuário no mongo\n const dev = await Dev.create({ \n name,\n user: username,\n bio,\n avatar\n });\n\n // Retorna o usuário criado.\n return res.json(dev); // END.\n \n }", "async function signupUser() {\n const response = await fetchWithCSRF(`/api/users/`, {\n method: 'POST',\n headers: {\n \"Content-Type\": \"application/json\",\n },\n credentials: 'include',\n body: JSON.stringify({\n canfollow,\n email,\n username,\n fullname,\n password,\n password2\n })\n });\n\n const responseData = await response.json();\n if (!response.ok) {\n setErrors(responseData.errors);\n } else {\n setCurrentUserId(responseData.current_user_id)\n setCurrentUser(responseData.current_user);\n // history.push('/')\n // history.push('/users')\n }\n }", "function registerUser(req,res){\n var vname=req.body.name;\n var vemail=req.body.email;\n var vusername=req.body.username;\n var vpassword=req.body.password;\n var vpassword2=req.body.password2;\n\n // Validation the field which come from the form \n req.checkBody('name','Name is required').notEmpty().isLength({min:4});\n req.checkBody('email','Email is required').notEmpty();\n req.checkBody('email','Email is not valid').isEmail();\n req.checkBody('username','Username is required').notEmpty().isLength({min:4});\n req.checkBody('password','Password is required').notEmpty().isLength({min:4}).equals(req.body.password2);\n req.checkBody('password2','Passwords do not match').notEmpty();\n\n //Storing the validation errors\n var errors= req.validationErrors();\n\n if(errors){\n // here in the case of errors we open register page and pass the errors to it\n res.render('./pages/register',{layout:'./layouts/mainLayout',\n errors:errors\n })\n }else{\n //Here we create a new object as an instance of the the user object, then each property of that object will hold the data stored inside the variables whic we declared them at the top of the page\n var newUser=new User({\n name:vname,\n email:vemail,\n username:vusername,\n password:vpassword\n });\n\n //User is a variable which was created inside the user model\n User.createUser(newUser,function(err,user){\n if(err) throw err;\n console.log(user);\n });\n\n //create a success message\n //req.flash('success_msg','You are registered and can now login'); //this message can be used inside the login page\n res.redirect('/users/login');\n }\n\n}", "function cb(err){\n res.locals.user = req.session.user;\n res.redirect('/');\n }", "addIndex(req, res, next) {\n let name = \"\";\n FindAdminUserByID(req.session.passport.user).then(user => {\n res.render(\"../../../important/admin/views/users/add_user_role\", {\n content: \"\",\n name: name,\n theUser: user\n });\n });\n }", "function userSaved(data) {\n showDivMessage(\"Usuario Guardado Correctamente\", \"alert-info\", 3000);\n sendPostAction(USER_CONTROLLER_URL + 'list', null, loadTable);\n CURRENT_USER = new Usuarios();\n showTableCard();\n}", "openCurrentUser() {\n window.location.href = window.location.origin + '/users?name=' + this.state.currentUser.firstName + ' ' + this.state.currentUser.lastName;\n }", "function init() {\n\t\t\tctrl.user = {};\n\t\t\t$scope.$on('$routeChangeSuccess', function (scope, next, current) {\n\t\t\t\tif ($routeParams.id != undefined && $routeParams.id !== ctrl.user.id) {\n\t\t\t\t\tctrl.user.id = $routeParams.id;\n\t\t\t\t\tuserConnectorFactory.loadUser(ctrl.user.id).then(setUser, function(){});\n\t\t\t\t}\n\t\t\t\tif ($routeParams.is == null) {\n\t\t\t\t\tctrl.user = {};\n\t\t\t\t\tctrl.user.role = \"CANDIDATE\";\n\t\t\t\t}\n\t\t\t});\n\t\t}", "onUserCreate() {\n this.userCreate();\n const { email, password, fname, lname, id } = this.state;\n /*Making First name mandatory*/\n if (this.state.fname) {\n /*Setting state params*/\n this.setState({\n error: '',\n loading: true,\n });\n /*Appending first name and Last name .. That was the requirement*/\n const name = fname + ' ' + lname;\n /*Standard firebase create User call with email and password . it returns the user data*/\n firebase.auth().createUserWithEmailAndPassword(email, password).then((user) => {\n /*On success call*/\n this.loginSuccessHandle();\n /*Firebase restricts the amount of configurable params that can be passed while\n creating users. It allows a displayName and image(Not a requirement)*/\n user.updateProfile({\n displayName: name,\n });\n /*Fetchinh the current user Data from firebase*/\n const { currentUser } = firebase.auth();\n /*There are two DB storage paths created, this one is to store extra custom\n info of the users*/\n firebase.database().ref(`/employees/info/${currentUser.uid}/`)\n .push({\n name, email, id\n });\n this.loginSuccessHandle();\n })\n .catch(this.loginFailedHandle.bind(this));\n }\n else {\n this.setState({\n error: 'Please enter First name',\n loading: false,\n });\n }\n }", "NewUser(Data, res, User, UserId){\n this.LogAppliInfo(\"Call ApiAdmin NewUser, Data: \" + JSON.stringify(Data), User, UserId)\n let DataToDb = { [this._MongoVar.LoginUserItem]: Data.Data[this._MongoVar.LoginUserItem], [this._MongoVar.LoginFirstNameItem]: Data.Data[this._MongoVar.LoginFirstNameItem], [this._MongoVar.LoginLastNameItem]: Data.Data[this._MongoVar.LoginLastNameItem], [this._MongoVar.LoginPassItem]: Data.Data[this._MongoVar.LoginPassItem], [this._MongoVar.LoginConfirmPassItem]: Data.Data[this._MongoVar.LoginConfirmPassItem], [this._MongoVar.LoginAdminItem]: Data.Data[this._MongoVar.LoginAdminItem]}\n // Insert de type Promise de Mongo\n this._Mongo.InsertOnePromise(DataToDb, this._MongoVar.UserCollection).then((reponse)=>{\n res.json({Error: false, ErrorMsg: \"User added in DB\", Data: null})\n },(erreur)=>{\n this.LogAppliError(\"ApiAdminNewUser DB error : \" + erreur, User, UserId)\n res.json({Error: true, ErrorMsg: \"DB Error\", Data: null})\n })\n }", "create(req, res) {\n let user = new User();\n if (req.body.id) {\n user.id = req.body.id;\n }\n user.username = req.body.username;\n user.password = req.body.password;\n user.rolename = req.body.rolename;\n user.restaurant_id = req.body.restaurant_id;\n\n if (req.body.id) {\n return this.userdao.createWithId(user)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n } else {\n return this.userdao.create(user)\n .then(this.common.insertSuccess(res))\n .catch(this.common.serverError(res));\n }\n\n }", "function resolveUserDetails(data){\n\t\t\tif(data == true){\n\t\t\t\t//$state.go('userloandetails');\n\t\t\t\t//data is posted successfully\n\t\t\t}\n\t\t}", "function resolveUserDetails(data){\n\t\t\tif(data == true){\n\t\t\t\t//$state.go('userloandetails');\n\t\t\t\t//data is posted successfully\n\t\t\t}\n\t\t}", "function postUser(app){\n\treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\tconst user = req.body;\n\t\t\tuser._id = id;\n\t\t\treq.app.locals.model.users.updateUser(user).\n\t\t\t\tthen(function(){\n\t\t\t\t\tres.append('Location', requestUrl(req));\n\t\t\t\t\tres.sendStatus(SEE_OTHER);\n\t\t\t\t}).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(NOT_FOUND);\n\t\t\t\t});\n\t\t}\n\t};\n}", "function createUser(cedula,apellido,email, nombre, telefono, pass){\n const password = pass;\n var userId=\"\";\n \n auth.createUserWithEmailAndPassword(email, password)\n .then(function (event) {\n user = auth.currentUser;\n userId = user.uid;\n console.log(\"UserID: \"+userId);\n insertar(cedula,apellido,email, nombre, telefono, userId);\n })\n .catch(function(error) {\n alert(error.message);\n console.log(error.message);\n });\n}", "function resolveAuthenticatedUser(data){\n\t\t\tif(data.status == true){\n\t\t\tif(data.applicationStatus == \"none\")\n\t\t\t\t$state.go('roorrmu',{userId: $state.params.userId});\n\t\t\t\telse if(data.applicationStatus == \"applicableForRenewal\")\n\t\t\t\t$state.go('loanrenewal',{mdnid: $state.params.mdnid , phone: $state.params.phone,userId: $state.params.userId});\n\t\t\t\telse\n\t\t\t\t$state.go('statusmessage',{statusmessage: data.applicationStatus,userId:$state.params.userId});\n\t\t\t\t//workflow on new user or existing user need to be added here\n\t\t\t\t//api need to return is the user is new or old\n\t\t\tloaderService.toggle(false);\n\t\t\t}else{\n\t\t\t\t//wrong otp\n\t\t\t\t//otp authentication failed\n\t\t\t\tvm.errorMessage = data.errorText;\n\t\t\t\tloaderService.toggle(false);\n\n\t\t\t}\n\t\t}", "function activate() {\n getUser($routeParams.username);\n }", "function AlumnoCrear() {\n window.location = `./AlumnoCrear.html?usu_id=${params.get('usu_id')}`;\n}", "function registrationsCreate(req, res) {\n User\n .create(req.body)\n .then(() => res.redirect('/')) // redirect to the homepage\n .catch(err => res.render('error', { err })); //then catch all errors that occur\n}", "function signUpUser({\n firstName,\n lastName,\n email,\n password,\n intOne,\n intTwo,\n intThree\n }) {\n console.log(\"firstName:\", firstName);\n $.post(\"/api/signup\", {\n firstName: firstName,\n lastName: lastName,\n email: email,\n password: password,\n intOne: intOne,\n intTwo: intTwo,\n intThree: intThree\n })\n .then(res => {\n console.log(res);\n window.location.replace(\n \"/members/:\" + intOne + \"/:\" + intTwo + \"/:\" + intThree\n );\n // If there's an error, handle it by throwing up a bootstrap alert\n })\n .catch(handleLoginErr);\n }", "function callback (err, result) {\t\t\t\t\t\t\t\t// keuze uit error of result\n\t\tif (err) throw err;\t\t\t\t\t\t\t\t\t\t\t\t\t\t// geef error\n\t\tconsole.log('test:', result);\n\t\treq.session.user._id = result.insertedId;\t\t\t// zet de inserted (insertOne) id, die in result zit, in req.session.user._id, dus in _id. Local\n\t\tres.redirect('profiel/' + req.session.user._id); // dit is de route + de mongoDB id. Neemt deze data mee naar profiel/\n\t}", "function createUser() {\n\n let username = document.form.username.value;\n let email = document.form.email.value;\n let password = document.form.ini_password.value;\n\n if(username === \"\") {\n document.getElementById(\"msg\").innerHTML = \"Please input username!\";\n return;\n }\n if(email === \"\") {\n document.getElementById(\"msg\").innerHTML = \"Please input email!\";\n return;\n }\n\n if(!validateEmail(email)) {\n document.getElementById(\"msg\").innerHTML = \"Please correct your email format!\";\n return;\n }\n if(password === \"\") {\n document.getElementById(\"msg\").innerHTML = \"Please input password!\";\n return;\n }\n password = checkPassword();\n\n if(password !== null) {\n\n let data = {};\n data['username'] = username.toString();\n data['email'] = email.toString();\n data['password'] = password;\n\n let sendData = JSON.stringify(data);\n let xhr = new XMLHttpRequest();\n xhr.onreadystatechange = handle_res;\n xhr.open(\"post\", \"/createUser\");\n xhr.send(sendData);\n\n function handle_res() {\n if (this.readyState !== 4) return;\n if (this.status !== 200) return;\n let sentBackObj = this.responseText;\n document.getElementById(\"msg\").innerHTML = sentBackObj.split(\",\")[0];\n\n if(sentBackObj.includes(\"Successfully create your account!\")){\n let curUser = new User(sentBackObj.split(\",\")[1], username, email, [], sentBackObj.split(\",\")[2]);\n window.sessionStorage.setItem('userTokenId', sentBackObj.split(\",\")[3]);\n // swal({\n // icon: \"success\",\n // title: \"Thanks for register!\",\n // text: \"An email has sent to you, please verify your account in the email\",\n // closeOnClickOutside: false\n // });\n window.sessionStorage.setItem('user', JSON.stringify(curUser));\n window.location.href = \"/index.html\";\n }\n }\n }\n}", "addUser(newUser){\n if(newUser._id){\n fetch(`http://localhost:8000/user/${newUser._id}`,{\n method: 'PUT',\n body: JSON.stringify(newUser),\n headers: {\n 'Accept':'application/json',\n 'Content-Type':'application/json'\n }\n })\n .then(res=>res.json())\n .then(data=>{\n this.getUsers();\n this.getToDos();\n notify.show(data.message,data.type);\n })\n .catch(err=>{\n console.log(err)\n })\n\n }else{\n fetch(`http://localhost:8000/user`,{\n method: 'POST',\n body: JSON.stringify(newUser),\n headers: {\n 'Accept':'application/json',\n 'Content-Type':'application/json'\n }\n })\n .then(res=>res.json())\n .then(data=>{\n this.getUsers();\n this.getToDos();\n notify.show(data.message,data.type);\n })\n .catch(err=>{\n console.log(err)\n })\n }\n }", "function GetAndPrepUsers(){\n var url = config.api.url + \"actie/users?id=\" + $scope.actieId;\n $http({\n url: url,\n method: 'GET'\n }).success(function(data, status, headers) {\n data.forEach(function(user) {\n console.log(user);\n var fullName = user.voornaam + \" \";\n //Prevent duble space with middle name\n if(user.tussenvoegsel || user.tussenvoegsel !== null){\n fullName += user.tussenvoegsel + \" \";\n }\n fullName += user.achternaam;\n \n var borgBetaald = \"Nee\";\n if(user.borg_betaald){\n borgBetaald = \"Ja\";\n $scope.totalBorg = $scope.totalBorg + 1;\n }\n \n var phone = \"\";\n if(user.telefoonnummer || user.telefoonnummer !== null){\n phone = \"0\" + user.telefoonnummer;\n }\n \n var selectedProvider = \"\";\n if(user.provider_id || user.provider_id !== null){\n var providerUrl = config.api.url + \"provider?id=\" + user.provider_id;\n $http({\n url: providerUrl,\n method: 'GET'\n }).success(function(data, status, headers, config) {\n selectedProvider = data.naam;\n $scope.rows.push({\n nr: user.gebruiker_id,\n naam: fullName,\n phone: phone,\n borg: borgBetaald,\n provider: selectedProvider\n });\n $scope.addNewRows();\n }).error(function(data, status, headers, config) {\n $scope.rows.push({\n nr: user.gebruiker_id,\n naam: fullName,\n phone: phone,\n borg: borgBetaald,\n provider: selectedProvider\n });\n $scope.addNewRows();\n });\n }\n else{\n $scope.rows.push({\n nr: user.gebruiker_id,\n naam: fullName,\n phone: phone,\n borg: borgBetaald,\n provider: selectedProvider\n });\n $scope.addNewRows();\n }\n $scope.totalUsers = $scope.totalUsers + 1;\n });\n $scope.addNewRows(); \n console.log(\"User load succes\");\n }).error(function(data, status, headers, config) {\n console.log(\"User load failed\");\n });\n }", "saveUser() {\n console.log(`you try to create new user: DR.${this.state.userName}`);\n const that=this;\n //ajax request to sent the data to server then data base\n $.ajax({\n type: 'POST',\n url: '/signup',\n data: {\n firstName: `${this.state.firstName}`,\n lastName: `${this.state.lastName}`,\n userName: `${this.state.userName}`,\n password: `${this.state.password}`\n },\n //when success do this\n success: function (res) {\n //if sign up new user login him and go to home page\n if (res[0]==='W') {\n alert(res);\n console.log(res[0]); \n window.location.href= window.location.origin+'/'\n //if sign up exist user use go to login\n }else{\n alert(res);\n console.log(res[0]); \n window.location.href= window.location.origin+'/login' \n }\n },\n //when error do this\n error: function (res){\n alert(`Failed sigup please try again DR.${that.state.userName}`);\n console.log(`Failed sigup please try again DR.${that.state.userName}`);\n },\n }); \n }", "function createUser() {\n return UserDataService.signup(props.onLogin, setValidation, values);\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 }", "create(req, res, next) {\n return LocalUsers\n .create({\n username: req.body.username,\n email: req.body.email,\n setPassword: req.body.password,\n admin: req.body.admin\n })\n .then(localusers => {\n return Users.create({\n userId: localusers.uuid,\n email: localusers.email,\n admin: localusers.admin,\n username: localusers.username\n }).then((user) => {\n if (user) {\n next();\n }\n });\n })\n .catch(() => res.status(500).send({ message: 'Internal Server Error' }));\n }", "function Profile() {\n //using context\n const {newlist} = useContext(contextdata);\n const history = useHistory();\n const { id } = useParams();\n //finds user with the path id\n const user = newlist.find((user) => user.id === +id);\n return (\n <div className=\"profile-page\">\n <div>{user.name}</div>\n <div>{user.details}</div>\n {/* a dynamic path is formed and page goes to that path when the button is clicked */}\n <button className=\"edit-profile-button\"\n onClick={() => history.push(\"/edit-profile/\" + id)}>Edit Profile</button>\n </div>\n )\n}", "function newUser(){\r\r\n}", "updatePost (request, response) {\n // Confirm the logged in users name and the currentName\n // of the user to be updated is the same.\n if (request.session.user.username === request.body.currentName) {\n // Save class this in variable as this is not defiend\n // as this router class inside callback functions.\n const router = this;\n // If the names are the same send update request to user controller.\n this.users.update(request.body, (error, reslut) => {\n // Confirm there was no error updating the users information.\n if (!error) {\n // If there was no error check the result.\n if (result) {\n // If there was an error registering the user send success message.\n response.writeHead(200, {\"Content-Type\": \"application/json\"}); // Status 200: All OK.\n response.end(JSON.stringify({status: true, message: 'You information was updated successfully.'}));\n } else {\n // If the result was not OK set message to taken message.\n response.writeHead(200, {\"Content-Type\": \"application/json\"}); // Status 409: Conflict.\n response.end(JSON.stringify({status: false, message: router.taken}));\n }\n } else {\n // If there was an error updating the users information set message to error message.\n response.writeHead(200, {\"Content-Type\": \"application/json\"}); // Status 500: Internal server error.\n response.end(JSON.stringify({status: false, message: router.error}));\n // Log the error object.\n console.error(error);\n }\n });\n } else {\n // If the currentName of the user to update did not match the\n // username of the logged in user set mesage to unathorized.\n response.writeHead(200, {\"Content-Type\": \"application/json\"}); // Status 401: Unauthorized.\n response.end(JSON.stringify({status: false, message: 'You can not change information about another user.'}));\n }\n }", "function registerSuccessFn() {\n\t\t\t\t\tAuthentication.login($scope.username, $scope.password)\n\t\t\t\t\t\t.then(function (response) {\n\t\t\t\t\t\t\tAuthentication.setAuthenticatedAccount(response.data);\n\t\t\t\t\t\t\twindow.location = '/#/users/' + response.data.username;\n\t\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t\t});\n\t\t\t\t}", "function handleCreateUser(event){\n if (DEBUG) {\n console.log (\"Triggered handleCreateUser\");\n }\n var $form = $(this).closest(\"form\");\n var template = serializeFormTemplate($form);\n var url = $form.attr(\"action\");\n add_user(url, template);\n return false; //Avoid executing the default submit\n}", "function setUser(){\n var user = JSON.parse(urlBase64Decode(getToken().split('.')[1]));\n o.status.username = user.username;\n o.status._id = user._id;\n console.log(o.status);\n }", "function updateUserController(request, response) {\n const userId = request.params.userId;\n const newValues = request.body;\n\n model.updateById(userId, newValues)\n\n response.status(httpStatus.NO_CONTENT).send();\n}", "function signUpUser(userInfo) {\n $.post(\"/api/signup\", {\n firstName: userInfo.firstName,\n lastName: userInfo.lastName,\n email: userInfo.email,\n password: userInfo.password\n }).then(function(data) {\n window.location.reload();\n console.log(\"signed up\");\n }).catch(handleLoginErr);\n }", "function resolveAuthenticatedUser(data){\n\t\t\tif(data == true){\n\t\t\t\t//$state.go('otp');\n\t\t\t\t//workflow on new user or existing user need to be added here\n\t\t\t\t//api need to return is the user is new or old\n\t\t\t}else{\n\t\t\t\t//wrong otp\n\t\t\t\t//otp authentication failed\n\t\t\t}\n\t\t}", "function resolveAuthenticatedUser(data){\n\t\t\tif(data == true){\n\t\t\t\t//$state.go('otp');\n\t\t\t\t//workflow on new user or existing user need to be added here\n\t\t\t\t//api need to return is the user is new or old\n\t\t\t}else{\n\t\t\t\t//wrong otp\n\t\t\t\t//otp authentication failed\n\t\t\t}\n\t\t}", "function renderUser(user){\n\t\t//console.log(\"inside renderUser ..we are getting correct user\");\n\t\t//console.log(user);\n\t\t$('#usernameFld').val(user.username);\n\t\t$('#passwordFld').val(user.password);\n\t\t$('#firstNameFld').val(user.firstName);\n\t\t$('#lastNameFld').val(user.lastName);\n\t\t$('#role').val(user.role);\n\t}", "function create(req, res, next) {\n console.log(req.currentUser)\n console.log(req.body)\n req.body.user = req.currentUser //attaching a user key to the body, making it values currentUser from secureRoute\n Legend\n .create(req.body)\n .then(legend => res.status(201).json(legend))\n .catch(next)\n}", "async addUser(ctx) {\n try {\n var body = ctx.request.body;\n var user = new User();\n user.name = body.name;\n user.email = body.email;\n user.save();\n ctx.body = { status: 200, message: \"data save \", user: user }\n }\n catch (error) {\n ctx.throw(error)\n }\n }", "function upsertUser(userData) {\n $.post(\"/api/users\", userData).then(getUsers);\n }", "function registerUser() {\n let email = $(\"#txtEmail\").val();\n let pass= $(\"#txtPassword\").val();\n let first= $('#txtFirst').val();\n let last = $('#txtLast').val();\n let age = $('#txtAge').val();\n let address = $('#txtAddress').val();\n let phone = $('#txtPhone').val();\n let payment = $('#txtPayment').val();\n let color = $('#txtColor').val();\n\n let user = new User(email, pass, first, last, age, address, phone, payment, color);\n console.log(user);\n\n saveUser(user); // This function is on the storeManager\n clearUser();\n\n}", "static createUser(req, res){\n // Form validation\n const { errors, isValid } = validateRegisterInput(req.body);\n // Check validation\n if (!isValid) {\n return res.status(400).json(errors);\n }\n User.findOne({ username: req.body.username })\n .then(user => {\n if (user) {\n return res.status(400).json({ username: \"Username already exists\" });\n } \n const newUser = new User({\n username: req.body.username,\n password: req.body.password,\n //privileges : req.body.privileges,\n admin_creator: req.body.admin_creator,\n isAdmin: req.body.isAdmin,\n isNetIDLogin: req.body.isNetIDLogin,\n comment: req.body.comment,\n\n });\n // Hash password before saving in database\n bcrypt.genSalt(10, (err, salt) => {\n bcrypt.hash(newUser.password, salt, (err, hash) => {\n if (err) throw err;\n newUser.password = hash;\n newUser\n .save()\n .then(user => res.json(user))\n .catch(err => console.log(err));\n });\n });\n } \n )\n }", "function resolveUserDetails(data){\n\t\t\tif(data == true){\n\t\t\t\t//$state.go('useraddressdetails');\n\t\t\t\t//data is posted successfully\n\t\t\t}\n\t\t}" ]
[ "0.6090626", "0.6084171", "0.6072798", "0.5958986", "0.5940384", "0.5925609", "0.5897438", "0.58347684", "0.5813905", "0.5753374", "0.5726536", "0.5712611", "0.5688643", "0.56806326", "0.5665958", "0.566029", "0.5655649", "0.5641744", "0.5632319", "0.5622834", "0.56005514", "0.5598785", "0.556967", "0.5567026", "0.55668557", "0.5562842", "0.5561409", "0.55611914", "0.5556385", "0.5525674", "0.55153793", "0.5513635", "0.5489492", "0.5482809", "0.548227", "0.54800236", "0.54793274", "0.54791296", "0.5472026", "0.5463428", "0.54627925", "0.54596233", "0.5458475", "0.545487", "0.5453081", "0.5445736", "0.5439681", "0.5438577", "0.5438418", "0.54382855", "0.5433475", "0.5432265", "0.5426718", "0.54217315", "0.5421036", "0.54107565", "0.5405577", "0.54006046", "0.53954035", "0.5395321", "0.5394776", "0.5393246", "0.5392397", "0.5388774", "0.53806305", "0.5375985", "0.5374834", "0.5374834", "0.5374296", "0.53707325", "0.5368428", "0.536489", "0.5360573", "0.53564376", "0.5356101", "0.53538895", "0.53534025", "0.53443605", "0.53442353", "0.53439826", "0.5337548", "0.5336715", "0.53353965", "0.5329353", "0.5328487", "0.5324304", "0.5322477", "0.53200036", "0.5317003", "0.5313391", "0.5310869", "0.5310449", "0.5310449", "0.53091747", "0.530368", "0.53030074", "0.5301321", "0.5300807", "0.5299709", "0.529822" ]
0.69854975
0
Method to update user, pass context, object Users and user id
update(context, user){ context.showAlert = false context.showSuccess = false HTTP.put(USERS, user) .then((resp) => { if (resp.status>= 200 && resp.status <=300){ var id = resp.data.id context.showAlert = false } context.showSuccess = true context.successMsg = "Users updated successfully" }) .catch((err) => { context.showAlert = true console.log(err) if (err.response) { context.errMsg = err.response.data console.log(err.response.data); console.log(err.response); context.showAlert = true } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateUser (context, user) {\n context.commit('updateUser', user)\n }", "function updateUserInfo(id, user) {\n}", "updateUser(userId, data) {\n return this.userStore.updateUser(userId, data)\n }", "updateUser(userId, partialUser) {\n const url = this.route\n\t\tconst config = {\n\t\t\tmethod: 'PUT',\n\t\t\tquery:{\n\t\t\t\tuserId\n\t\t\t},\n\t\t\tdata:{\n\t\t\t\t...partialUser\n\t\t\t}\n\t\t}\n\t\treturn request(url, config)\n\t}", "async updateUser(req, res, next) {\n const { userId } = req.params;\n const { body } = req;\n try {\n await UsersService.updateUser(userId, { ...body });\n res.json({ success: true });\n } catch (error) {\n next(extendError(error, { task: 'Controller/updateUser', context: { body } }));\n }\n }", "function update(username,password,firstName, lastName, emailId){\n var userLoggedIn=$rootScope.currentUser;\n var LoggedInUserId=userLoggedIn._id;\n console.log(\"User Logged in ID: \");\n console.log(userLoggedIn);\n\n var user={\n \"username\":username,\n \"password\":password,\n \"firstName\":firstName,\n \"lastName\":lastName,\n \"emailId\":emailId\n };\n\n\n UserService.updateUser(LoggedInUserId,user, function (response) {\n\n\n UserService.setCurrentUser(response);\n console.log(\"Response From Service: Updated the User\");\n console.log(response);\n\n });\n\n }", "function updateUserProfile(req, res) {\n if(req.body.userID === undefined){\n return res.send(\"Error: no user specified\");\n }\n User.findById(req.body.userID, function (err, user) {\n if (err) throw err;\n if(user === null) {\n return res.send(\"Error: No such User exists\");\n }\n\n user.name = req.body.name;\n user.email = req.body.email;\n user.phone = req.body.phone;\n user.address = req.body.address;\n user.password = req.body.password;\n \n user.save(function(err) {\n if (err) throw err;\n return res.send('Success');\n });\n \n });\n \n}", "function updateUser(req, res, next) {\n const sql = sqlString.format(`UPDATE users SET ? WHERE id = ?`, [\n req.body,\n req.params.id\n ])\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n if (!result.affectedRows) return next({ message: 'User not find' })\n res.send('User updated')\n })\n}", "function updateUser(userId, user){\n var url=\"/api/user/\"+userId;\n return $http.put(url, user);\n }", "async function userUpdate(req, res, next) {\n const userId = req.params.id\n try {\n const userToUpdate = await User.findById(userId)\n if (!userToUpdate) throw new Error(notFound)\n\n\n if (!userToUpdate.equals(req.currentUser._id)) throw new Error(unauthorized)\n\n Object.assign(userToUpdate, req.body)\n await userToUpdate.save()\n\n res.status(202).json(userToUpdate)\n } catch (err) {\n next(err)\n }\n}", "function updateUser(req, res) {\n var userId = req.params.userId;\n var user = req.body;\n userModel.updateUser(userId, user)\n .then(function() {\n return res.sendStatus(204);\n }).catch(function(error) {\n console.error('Error updating user' + error);\n return res.sendStatus(500);\n });\n}", "function updateUser(userId, user) {\n return fetch(`https://wbdv-generic-server.herokuapp.com/api/alkhalifas/users/${userId}`, {\n method: 'PUT',\n body: JSON.stringify(user),\n headers: {\n 'content-type': 'application/json'\n }\n })\n }", "updateUser(id, body) {\n return this.patch(`${this.baseUrl}/users/${id}`, body);\n }", "function updateUser() {\n // fields to update\n delete userParam.oldPassword;\n delete userParam.confirmPassword;\n var set = _.omit(userParam,'_id');\n \n // update password if it was entered\n if (userParam.password) {\n set.hash = bcrypt.hashSync(userParam.password, 10);\n }\n delete set.password;\n \n db.users.update({_id: mongo.helper.toObjectID(_id)}, {$set: set}, function(err){\n if(err) {\n deferred.reject(err);\n }\n deferred.resolve();\n });\n }", "function updateUser(id, user) {\n return fetch(`${self.url}/${id}`, {\n method: 'PUT',\n body: JSON.stringify(user),\n headers: {\n \"content-type\": \"application/json\"\n }\n }).then(response => response.json())\n }", "function updateUser(id, object, done, next){\r\n User.findOneAndUpdate({ _id : id }, object).then((user) => {\r\n return done(user);\r\n }).catch(next);\r\n}", "function updateUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n userService\n .updateUser(currentUserID,user)\n .then(findAllUsers)\n .then(emptyUserForm);\n\n }", "updateUser({ commit }, userID) {\n commit(\"updateUser\", userID);\n }", "function updateUser(user) {\n return {\n type: 'UPDATE_USER',\n user\n }\n}", "update(id, user) {\n return 1;\n }", "function updateUserController(request, response) {\n const userId = request.params.userId;\n const newValues = request.body;\n\n model.updateById(userId, newValues)\n\n response.status(httpStatus.NO_CONTENT).send();\n}", "async updateUser(parent, {\n updateUserInput: {\n id,\n name,\n email,\n password\n }\n }, context, info) {\n try {\n const updateUser = await context.prisma.user.update({\n where: {\n id\n },\n data: {\n name,\n email,\n password\n }\n });\n return \"user update sucessfully\";\n } catch (error) {\n return error;\n }\n }", "function updateUser(user) {\n UserService.updateUser(model.userId, user)\n .then(function (response) {\n // var updatedUser = response.data;\n // $rootScope.currentUser = updatedUser;\n // console.log(updatedUser);\n model.successMessage = \"Profile Updated Successfully!\";\n }, function (rejection) {\n model.errorMessage = \"Sorry an error was encountered and your profile was not updated. Please try again\";\n });\n }", "function updateUser(userId, user) {\n var url = \"/api/user/\" + userId;\n return $http.put(url, user);\n }", "function updateUser(userId, user) {\n var url = \"/api/assignment/user/\" + userId;\n return $http.put(url, user)\n .then(function(response) {\n return response.data;\n });\n }", "async updateUser(_, { id, firstName, lastName, email, password }, { authUser }) {\n // Make sure user is logged in\n if (!authUser) {\n throw new Error('You must log in to continue!')\n }\n // fetch the user by it ID\n // Update the user\n await user.update({\n firstName,\n lastName,\n email,\n password: await bcrypt.hash(password, 10)\n });\n return user;\n }", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n\n User.findByIdAndUpdate(userId, update, (err, updateUser) => {\n if (err) {\n res.status(500).send(\"Error al actualizar el usuario\");\n } else {\n if (!updateUser) {\n res.status(404).send(\"No se ha podido actualizar el usuario\");\n } else {\n res.status(200).send(updateUser);\n }\n }\n });\n}", "function api_updateuser(ctx, newuser) {\n newuser.a = 'up';\n res = api_req(newuser, ctx);\n}", "function updateUser() {\n try {\n selectedUser.username = $usernameFld.val();\n selectedUser.password = $passwordFld.val();\n selectedUser.firstName = $firstNameFld.val();\n selectedUser.lastName = $lastNameFld.val();\n selectedUser.role = $roleFld.val();\n userService.updateUser(selectedUserId, selectedUser)\n .then(function (userServerInfo) {\n users[editIndex] = selectedUser;\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n // In future could catch null error or could grey out checkmark icon.\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "function updateUser(e){\n var user = updateForm.getValueForm();\n user[\"id\"] = userId;\n var val = updateForm.form.find('#myForm').valid();\n if(val){\n e.preventDefault();\n collectionOfUser.update(\n user,\n function(newUser){\n $('tr[data-id='+userId +']').html('').html(logic.template(templates.tColumOfTable, newUser))\n $('tr[data-id='+userId +']').on('click', select);\n updateForm.hide();\n },\n error\n ); \n }\n }", "async update({ request, params, response }) {\n /*** get the user update inputs */\n let { status } = request.only([\"status\"]);\n\n /** get the target user */\n try {\n const user = await User.query().where(\"id\", params.id).first();\n if (!user) {\n return response.status(404).send({\n message: \"not found\",\n });\n }\n\n /** update the user details */\n\n user.active = status;\n await user.save();\n return response.status(200).send({\n message: \"info updated\",\n });\n } catch (error) {\n return response.status(404).send({\n message: \"fail\",\n error: error,\n });\n }\n }", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n // borrar propiedad password\n delete update.password;\n if (userId != req.user.sub) {\n return res.status(500).send({message: 'No tienes permiso para actualizar los datos del usuario.'});\n }\n\n User.findByIdAndUpdate(userId, update, {new: true}, (err, userUpdated) => {\n if (err) return res.status(500).send({message: 'Error en la peticion.'});\n if (!userUpdated) return res.status(404).send({message: 'No se ha podido actualizar.'});\n return res.status(200).send({user: userUpdated});\n })\n}", "function update(req, res, next) {\n User.findById(req.body.userId)\n .then(function(foundUser) {\n req.session.currentUser = foundUser;\n console.log(foundUser);\n next();\n });\n}", "function updateUser(req, res) {\n if (req.query.id) {\n User.findById({_id: req.query.id}, (err, user) => {\n if (err) {\n res.json(err);\n } else {\n if(user) {\n Object.assign(user, req.body).save((err, user) => {\n if (err) {\n res.json(err);\n } else {\n res.json(makeJsonResponse(user));\n }\n });\n } else {\n res.json({\"error\": \"User not found\"});\n }\n }\n });\n } else {\n res.json({\"error\": \"Update should specify an id\"});\n }\n}", "function updateProfile(req, res) {\n let params = {\n fullName: req.body.name,\n contactNumber: req.body.contactNumber,\n profession: req.body.profession\n }\n User.update({ _id: req.body.userId },{ $set: params} , function(err, updatedUser) {\n if (err) {\n res.status(403).send(resFormat.rError(err))\n } else {\n responseData = {\n \"name\": req.body.name,\n \"contactNumber\": req.body.contactNumber,\n \"email\": req.body.email,\n \"profession\": req.body.profession,\n \"userId\": req.body.userId\n }\n res.send(resFormat.rSuccess(responseData))\n }\n })\n}", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n\n // borrar propiedad password\n delete update.password;\n\n if (userId != req.user.sub) {\n return res.status(500).send({\n message: 'No tiene permiso para actualizar los datos'\n });\n }\n // new : true indica que el metodo solo me devolvera el metodo actualizado.\n User.findByIdAndUpdate(userId, update, { new: true }, (err, userUpdated) => {\n if (err) {\n return res.status(500).send({\n message: 'Error en la peticion'\n });\n }\n if (!userUpdated) {\n return res.status(404).send({\n message: 'No se ha podido actualizar el usuario'\n });\n }\n return res.status(200).send({ user: userUpdated });\n });\n}", "update(req, res) {\n\n return User\n .findById(req.params.id, {})\n .then(user => {\n\n if (!user) {\n\n return res.status(404).send({\n message: 'User Not Found',\n });\n }\n\n return user\n .update({\n id: req.body.id || user.id,\n confirmed: user.confirmed,\n first_name: req.body.first_name || user.first_name,\n last_name: req.body.last_name || user.last_name,\n organizer_alias: req.body.organizer_alias || user.organizer_alias,\n age: req.body.age || user.age,\n gender: req.body.gender || user.gender,\n password: user.password,\n profile_pic: null,\n phone_number: req.phone_number || user.phone_number\n })\n .then(() => res.status(200).send(user)) // Send back the updated user\n .catch((error) => res.status(400).send(error));\n })\n .catch((error) => res.status(400).send(error));\n }", "function updateUser(userId, user){\n return fetch(self.url + '/' + userId, {\n method: 'put',\n body: JSON.stringify(user),\n headers: {\n 'content-type': 'application/json'\n }\n\t\t}).then(function(response){\n\t\t\tif(response.ok){ // here should use ok rather than bodyused.\n return response.json();\n\t\t\t}else{\n return null;\n }\n\n\t\t});\n\t}", "function updateUser(req, res) {\n User.findByIdAndUpdate(req.params.id, req.body, { new: true }, function (err, user) {\n if (err) return res.status(500).send(\"There was a problem updating the user.\");\n res.status(200).send(user);\n });\n}", "function update(req, res) {\n // find one user by id, update it based on request body,\n // and send it back as JSON\n}", "update(req, res) {\n let user = new User();\n user.id = req.body.id;\n user.username = req.body.username;\n user.password = req.body.password;\n user.rolename = req.body.rolename;\n user.restaurant_id = req.body.restaurant_id;\n\n return this.userdao.update(user)\n .then(this.common.editSuccess(res))\n .catch(this.common.serverError(res));\n }", "async updateUser(req,res){\n //función controladora con la lógica que actualiza un usuario\n }", "update(req, res, next, user) {\n if (currentUser && (req.params.id == currentUser._id || currentUser.isAdmin)) {\n User.update({\n _id: req.params.id\n }, req.body, (err, status) => {\n if (err) {\n next(err);\n } else {\n res.sendStatus(200);\n }\n });\n } else {\n res.status(\"401\").send(\"Not authorized, your are not admin!\");\n }\n }", "function updateUser(req, res) {\n User.findByIdAndUpdate(req.params.id, req.body.user, function(err, user) {\n if (err || !user) {\n console.log(err);\n req.flash(\"error\", \"Sorry, could not update this user\");\n res.redirect(\"back\");\n } else {\n //Make Admin from edit user form if admin code correct \n if (req.body.user.admin === \"admin123\") {\n user.isAdmin = true;\n user.save();\n }\n req.flash(\"success\", \"User successfully updated\");\n res.redirect(\"/users/\" + req.params.id);\n }\n });\n}", "async update (user) {\n let res = await Http.put('/api/users', { user })\n this.currentUser = new User(res.data.user)\n return this.currentUser\n }", "function updateUser(){\n // use save instead of update to trigger 'save' event for password hashing\n\t\nconsole.log('REQUEST IS ', req.body)\n\tif (!user.termsAccepted_v1) user.termsAccepted_v1 = false;\n user.set(req.body);\n user.save(function(err, user){\n \n // Uniqueness and Save Validations\n \n if (err && err.code == 11001){\n var duplicatedAttribute = err.err.split(\"$\")[1].split(\"_\")[0];\n req.flash('error', \"That \" + duplicatedAttribute + \" is already in use.\");\n return res.redirect('/account');\n }\n if(err) return next(err);\n \n // User updated successfully, redirecting\n \n req.flash('success', \"Account updated successfully.\");\n return res.redirect('/account');\n });\n }", "function update(req, res) {\n // find one user by id, update it based on request body,\n // and send it back as JSON\n\n db.User.findById(req.params.id, function(err, foundUser) {\n if (err) { console.log('userController.update error', err); }\n foundUser.username = req.body.username;\n foundUser.password = req.body.password;\n foundUser.location = req.body.location;\n foundUser.contact = req.body.contact;\n foundUser.picture = req.body.picture;\n foundUser.posts = req.body.posts;\n foundUser.save(function(err, savedUser) {\n console.log(savedUser)\n if (err) { console.log('saving altered user failed'); }\n res.json(savedUser);\n });\n });\n}", "async function updateUser(req,res){\n if (!req.params.id) {\n return res.status(500).json({error:\"Params emty\"})\n }\n \n await User.findOneAndUpdate(req.params.id,req.body)\n\n res.status(200).json({msg: \"user updated\"})\n\n}", "function updateUser(user) {\n $.ajax({\n method: \"PUT\",\n url: \"/api/posts\",\n data: user\n })\n .then(function() {\n window.location.href = \"/welcome\";\n });\n }", "updateUser ({ params, body }, res) {\n User.findOneAndUpdate({ _id: params.id }, body, { new: true })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: 'There is NO user found with this id!' });\n return;\n }\n res.json(dbUserData);\n })\n .catch(err => \n res.json(err)\n );\n }", "function updateUser(userId, user, callback) {\n \t\n \tconst promise = new Promise((resolve, reject) => {\n\t \t\tvar data = JSON.stringify({\n\t \"id\": userId,\n\t \"username\": user.username,\n\t \"password\": user.password,\n\t \"firstName\": user.firstName,\n\t\t\t\t\t\"lastName\": user.lastName,\n\t\t\t\t\t\"role\": user.role \n\t\t\t\t});\n\n \t\tvar xhr = new XMLHttpRequest();\n \t\txhr.withCredentials = true;\n\n \t\txhr.addEventListener(\"readystatechange\", function () {\n \t\t if (this.readyState === 4) {\n \t\t\tresolve(JSON.parse(this.responseText));\n \t\t }\n \t\t});\n\n \t\txhr.open(\"PUT\", this.url+\"/updateUser?strid=\"+userId);\n \t\txhr.setRequestHeader(\"Content-Type\", \"application/json\");\n \t\txhr.setRequestHeader(\"cache-control\", \"no-cache\");\n \t\txhr.setRequestHeader(\"Postman-Token\", \"52eb2f5a-e5e2-4083-a253-b09fd34bf42a\");\n\n \t\txhr.send(data);\n \t});\n \treturn promise;\n }", "function updateUser(user){\n UserService\n .updateUser(userId, user)\n .then(function (res) {\n var updatedUser = res.data;\n if (updatedUser){\n vm.success=\"successfully updated!\";\n }else{\n vm.error = \"Some thing doesn't seem right here\";\n }\n });\n }", "static updateUser(req, res) {\n try {\n const userId = parseInt(req.params.userId, 10);\n //const email = req.query.email || '';\n const userFound = UserHelper.findUserById(userId);// || UserHelper.findUserByEmail(email);\n if (!userFound) {\n return res.status(404).json({\n status: 404,\n success: 'false',\n error: 'User not found',\n });\n }\n\n for (const [key, value] of Object.entries(req.body)) {\n userFound[key] = value;\n }\n return res.status(200).json({\n status: 200,\n success: 'true',\n message: 'User updated successfully',\n data: userFound.getUserData() || userFound,\n });\n } catch (error) {\n // return res.status(500).json({\n // status: 500,\n // success: 'false',\n // error: 'Something went wrong',\n // });\n }\n }", "function updateProfile(req, res) {\n\n UsersModel.findById(req.params.userId, (err, user) => {\n user.name = req.body.name || user.name,\n user.email = req.body.email || user.email,\n user.phoneNumber = req.body.phoneNumber || user.phoneNumber,\n // user.password = bcrypt.hashSync(req.body.password) || user.password \n user.accountNumber = req.body.accountNumber || user.accountNumber,\n user.bankName = req.body.bankName || user.bankName\n\n if (err) {\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n\n user.save((err, saved) => {\n if (err) {\n\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n return res.status(200).send({\n 'status': true,\n 'message': 'Successfully updated',\n 'user': saved\n });\n })\n\n\n })\n}", "function updateUserById (_id, userParam){\n\n\tvar deferred = Q.defer();\n\n\tgetUserById(_id)\n\t.then (user => {\n\t\t/** TODO: recivimos los parametros y actualizamos **/\n\t\tdeferred.resolve ();\n\t})\n\t.catch (err => {\n\t\tdeferred.reject (err);\n\t})\n\n\treturn deferred.promise;\n\n}", "async function userUpdate(req, res) {\n try {\n const user = await User.findByIdAndUpdate(req.currentUser, req.body, {\n new: true,\n runValidators: true,\n });\n if (user.id !== req.params.id) {\n return res.status(401).json({ message: \"Unauthorised\" });\n }\n res.status(202).json({message: 'Your profile has been updated', user})\n } catch (err) {\n res.status(400).json(err.message);\n }\n}", "async update(id, user, type) {\n\t\tconst dto = await this.entityDto.domain()\n\t\tuser.id = id\n\t\tuser = morphism(dto, user)\n\t\tif (type == 'password') {\n\t\t\tconst salt = await bcrypt.genSalt(10)\n\t\t\tuser.password = await bcrypt.hash(user.password, salt)\n\t\t\treturn this.usersRepository.updatePassword(id, user)\n\t\t}\n\t\treturn this.usersRepository.updateUsername(id, user)\n\t}", "function updateUser(request, response) {\n\n\tfunction respondUpdated(response, user) {\n\t\tresponse.json({\n\t\t\tmessage: 'Usuario actualizado con exito',\n\t\t\tuser\n\t\t})\n\t}\n\n\tfunction respondError(response, error) {\n\t\tresponse.send(error)\n\t}\n\n\tfunction respondOk(response, user) {\n\t\tObject\n\t\t\t.assign(user, request.body)\n\t\t\t.save()\n\t\t\t.then(user => respondUpdated(response, user))\n\t\t\t.catch(error => respondError(response, error))\n\t}\n\n\tUser.findById({\n\t\t\t_id: request.params.userId\n\t\t})\n\t\t.then(user => respondOk(response, user))\n\t\t.catch(error => respondError(response, error))\n}", "async updateUser(user) {\n try {\n const result = await this.axiosInstance.patch(\n `/users/${user.username}`,\n user.requestBody\n );\n return result;\n } catch (err) {\n helpMeInstructor(err);\n return err;\n }\n }", "function updateUser (req, res, next) {\n db.none(`UPDATE \"user\" SET user_name = $1, email = $2, profile_pic = $3, password = $4 WHERE user_id = $5`, [req.body.user_name, req.body.email, req.body.profile_pic, req.body.password, req.params.user_id])\n .then(next())\n .catch(err => next(err));\n}", "function updateUser(userId,user) {\n var deferred = q.defer();\n //delete user._id;\n userModel\n .update({_id: userId}, {\n $set: user\n }, function (err, status) {\n deferred.resolve(status);\n });\n return deferred.promise;\n }", "function updateUser(userId, user) {\n var endpoint = \"/api/project/user/\" + userId;\n var req = {\n method: 'PUT',\n url: endpoint,\n data: {\n user: user\n }\n };\n\n return $http(req);\n }", "function updateUser(req, res){\n\n var id = req.params.id;\n var body = req.body;\n\n Usuario.findById(id , (err, usuario) => {\n\n if( err ) \n return res.status(500).json({\n ok: false,\n mensaje: 'Error al buscar usuario',\n errors: err\n });\n \n if( !usuario ) \n return res.status(400).json({\n ok: false,\n mensaje: 'El usuario con el id: '+ id+' no exite',\n errors: { message : 'No existe un usuario con ese id'}\n });\n\n usuario.nombre = body.nombre;\n usuario.email = body.email;\n\n usuario.save( (err, usuarioActualzado) => {\n \n if( err ) \n return res.status(301).json({\n ok: false,\n mensaje: 'Error al actualizar usuario',\n errors: { message : err}\n });\n\n usuarioActualzado.password = \";)\";\n return res.status(200).json({\n ok: true,\n usuario:usuarioActualzado\n });\n\n\n });\n\n\n \n });\n\n\n}", "updateUser({ params, body }, res) {\n User.findOneAndUpdate({ _id: params.id }, body, { new: true })\n .then((dbUserData) => {\n if (!dbUserData) {\n res.status(400).json({ message: \"User with this ID does not exist\" });\n return;\n }\n res.json(dbUserData);\n })\n .catch((err) => {\n res.json(err);\n });\n }", "function updateUser(req, res){\r\n var userId=req.params.id;\r\n var update=req.body;\r\n delete update.password;\r\n console.log(update);\r\n\r\n if(userId != req.user.sub){\r\n return res.status(500).send({message:'No tienes permisos'});\r\n }\r\n console.log(update);\r\n User.findByIdAndUpdate(userId, update, {new:true}, (err, userUpdate) => {\r\n if(err){\r\n res.status(500).send({message:'Error al realizar los cambios'});\r\n }else{\r\n if(!userUpdate){\r\n res.status(404).send({message:'No se ha logrado realizar los cambios solicitados'});\r\n }else{\r\n res.status(200).send({user:userUpdate});\r\n }\r\n }\r\n }); \r\n}", "function updateUserStatusById(user) {\r\n const query = `UPDATE userTable SET ? WHERE id = \"${user.id}\"`;\r\n const values = user;\r\n return execQuery(query, values);\r\n}", "function putUser(app) {\n \treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\tconst user = req.body;\n\t\t\tuser._id = id;\n\t\t\treq.app.locals.model.users.putUser(user).\n\t\t\t\tthen(function(result){\n\t\t\t\t\tif(result === 1){\n\t\t\t\t\t\tres.append('Location', requestUrl(req));\n\t\t\t\t\t\tres.sendStatus(CREATED);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tres.sendStatus(NO_CONTENT);\n\t\t\t\t}).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(SERVER_ERROR);\n\t\t\t\t});\n\t\t}\n\t};\n}", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n\n //Borrar propiedad password\n delete update.password;\n if (userId != req.user.sub) {\n return res.status(200).send({ message: 'No tienes permiso para actualizar los datos del usuario' });\n }\n User.find({ email: update.email.toLowerCase() }\n ).exec((err, users) => {\n\n var user_isset = false;\n users.forEach((user) => {\n if (user && user._id != userId) user_isset = true;\n });\n\n if (user_isset) res.status(500).send({ message: 'Los datos ya estan en uso' });\n\n User.findByIdAndUpdate(userId, update, { new: true }, (err, userUpdated) => {\n if (err) return res.status(500).send({ message: 'Error en la petición' });\n\n if (!userUpdated) return res.status(404).send({ message: 'No se ha podido actualizar el usuario' });\n\n return res.status(200).send({\n user: userUpdated\n });\n });\n\n });\n}", "function editUser(event) {\n var editButton = $(event.currentTarget);\n var userId = editButton\n .parent()\n .parent()\n .parent()\n .attr('id');\n userId = parseInt(userId);\n currentUserID = userId;\n userService\n .findUserById(userId)\n .then(renderUser);\n }", "updateUser(request, response, next) {\n let attributes = {\n name: request.body.name\n };\n this._knex(this._user)\n .where('id', request.params.id)\n .update(attributes, '*')\n .then(result => {\n response.json(result);\n })\n .catch(err => {\n next(err);\n });\n }", "function updateUser2(req, res){\r\n var userId=req.params.id;\r\n var update=req.body;\r\n delete update.password;\r\n User.findByIdAndUpdate(userId, update, {new:true}, (err, userUpdate) => {\r\n if(err){\r\n res.status(500).send({message:'Error al realizar los cambios'});\r\n }else{\r\n if(!userUpdate){\r\n res.status(404).send({message:'No se ha logrado realizar los cambios solicitados'});\r\n }else{\r\n res.status(200).send({user:userUpdate});\r\n }\r\n }\r\n }); \r\n}", "function updateUser(req, res) {\n// Validate Request\n if(!req.body) {\n return res.status(400).send({\n message: \"Please fill all required field\"\n });\n}\n// Find user and update it with the request body\nUser.findByIdUser(req.params.id, {\n userService: req.body.firstname,\n userService: req.body.lastname,\n userService: req.body.email,\n userService: req.body.password\n}, {new: true}).then(user => {\n if(!user) {\n return res.status(404).send({\n message: \"user not found with id \" + req.params.id\n });\n }\n res.send(user);\n})\n .catch(err => {\n if(err.kind === 'ObjectId') {\n return res.status(404).send({\n message: \"user not found with id \" + req.params.id\n });\n }\n return res.status(500).send ({\n message: \"Error updating user with id \" + req.params.id\n });\n });\n }", "function updateUser(req, res, next) {\r\n\tdb.none('update users set first_name=$1, last_name=$2, email=$3 where id=$5',\r\n\t [req.body.name, req.body.breed, parseInt(req.body.age),\r\n\t req.body.sex, parseInt(req.params.id)])\r\n\t.then(function () {\r\n\t\tres.status(200)\r\n\t\t.json({\r\n\t\t\tstatus: 'success',\r\n\t\t\tmessage: 'Updated your user'\r\n\t\t});\r\n\t})\r\n\t.catch(function (err) {\r\n\t\treturn next(err);\r\n\t});\r\n}", "function update(req, res) {\n\tUser.findById(req.params.user_id, function(err, user) {\n\t\tif (err) return res.send(err);\n\n\t\tif (req.body.name) user.name = req.body.name;\n\t\tif (req.body.password) user.password = req.body.password;\n\n\t\tuser.blocked\t= req.body.blocked;\n\t\tuser.image \t\t= req.body.image;\n\n\t\tuser.save(function(err, user) {\n\t\t\tif (err) return res.send(err);\n\n\t\t\tres.json({ message : \"User Updated\" });\n\t\t})\n\t})\n}", "function edit(req, res) {\n\tvar user_id = req.params.id;\n\tvar update = req.body;\n\n\t// do not update password in this method\n\tdelete update.password;\n\n\tif (user_id != req.user.sub) return res.status(500).send({ message: 'No tienes permiso para actualizar este usuario' });\n\n\tUser.findByIdAndUpdate(user_id, update, {new: true}, (err, data) => {\n\t\tif (err) return res.status(500).send({ message: 'Error en la peticion', error: err });\n\t\tif (!data) return res.status(404).send({ message: 'No se ha podido actualizar el usuario' });\n\t\treturn res.status(200).send({ user: data });\n\t});\n}", "updateUser({ body, params }, res) {\n User.findOneAndUpdate(\n { _id: params.id },\n body,\n { new: true, runValidators: true }\n )\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: 'No user found with this id!' });\n return;\n }\n res.json(dbUserData);\n })\n .catch(err => res.status(400).json(err));\n }", "function userEdit(req, res, next) {\n User\n .findById(req.params.id)\n .then((user) => {\n if (!user) return res.notFound();\n user = Object.assign(user,req.body);\n return user.save();\n })\n .then(user => res.json(user))\n .catch(next);\n}", "function updateUser(req, res) {\n var userId = req.params.id;\n var update = req.body;\n\n if (update.password) {\n //ecnriptar pasword\n bcrypt.hash(update.password, null, null, function (err, hash) {\n var user = hash;\n update.password = user;\n\n\n Cliente.findByIdAndUpdate(userId, update, (err, userUpdated) => {\n if (err) {\n res.status(500).send({\n message: 'Error al actualizar usuario'\n });\n } else {\n if (!userUpdated) {\n res.status(404).send({\n message: 'No se pudo actualizar usuario'\n });\n\n } else {\n res.status(200).send({\n user: userUpdated\n });\n\n }\n }\n });\n });\n\n } else {\n Cliente.findByIdAndUpdate(userId, update, (err, userUpdated) => {\n if (err) {\n res.status(500).send({\n message: 'Error al actualizar usuario'\n });\n } else {\n if (!userUpdated) {\n res.status(404).send({\n message: 'No se pudo actualizar usuario'\n });\n\n } else {\n res.status(200).send({\n user: userUpdated\n });\n\n }\n }\n });\n }\n\n}", "function updateUser(user) {\n $.ajax({\n method: \"PUT\",\n url: \"/api/users\",\n data: user\n })\n .then(function() {\n window.location.href = \"/concerts\";\n });\n }", "static async putUserById(req,res){\n const user = await Users.findById(parseInt(req.params.id)) //find user\n if(!user) return res.status(404).send(\"User not found\")\n for( var i in req.body){ user[i] = req.body[i] } //update new data from body\n try {\n const result =await user.save() //save data to database\n res.send(result);\n } catch(ex) { \n res.status(422).send(ex.message) \n }\n }", "updateUser({ params, body }, res) {\n User.findOneAndUpdate({ _id: params.id}, body, { new: true, runValidators: true })\n .then((dbUserData) => {\n if(!dbUserData) {\n res.status(404).json({ message: 'There is no user with that id!'});\n return;\n }\n res.json(dbUserData);\n })\n .catch((err) => res.status(404).json(err));\n }", "function editUser(user) {\n return axios.put(api_host+\":\"+api_port+\"/api/user/\"+user.id, user)\n .then( res => {\n return res.data;\n })\n .catch( err => {\n console.log(err);\n });\n}", "updateUser (callback) {\n\t\tthis.doApiRequest(\n\t\t\t{\n\t\t\t\tmethod: 'put',\n\t\t\t\tpath: '/users/me',\n\t\t\t\tdata: this.data,\n\t\t\t\ttoken: this.token\n\t\t\t},\n\t\t\t(error, response) => {\n\t\t\t\tif (error) { return callback(error); }\n\t\t\t\tObject.assign(this.expectedUser, response.user.$set, this.data, {\n\t\t\t\t\tlastReads: {},\n\t\t\t\t\tpreferences: {\n\t\t\t\t\t\tacceptedTOS: true\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tdelete this.data;\t// don't need this anymore\n\t\t\t\tcallback();\n\t\t\t}\n\t\t);\n\t}", "async updateUser(_, {\n id, name, email, password\n }, { authUser }) {\n // Make sure user is logged in\n if (!authUser) {\n throw new Error('You must log in to continue!');\n }\n // fetch the user by it ID\n const user = await db.user.findById(id);\n // Update the user\n await user.update({\n name,\n email,\n password: await bcrypt.hash(password, 10)\n });\n return user;\n }", "async function Update(req, res) {\n await User.findByIdAndUpdate(req.params.id, req.body);\n return res.status(200).send('User info updatted.');\n}", "async function updateAdminUser(userId, reqBody) {\n try {\n return await knex('tb_admin_users')\n .where('user_id', userId)\n .update({\n first_name: reqBody.first_name,\n last_name: reqBody.last_name,\n username: reqBody.username,\n password: reqBody.password,\n status: reqBody.status\n });\n } catch (ex) {\n console.log('error in updating data by id...');\n }\n}", "function update(req, res, next) {\n\n\tvar body = req.body,\n\t\tuser = req.user;\n\n\t// the update needs to have either an updated username\n\t// or an updated password\n\tif (!body || (!body.username && !body.password && !body.followers && !body.hasOwnProperty('autoApprove'))) {\n\t\treturn res.status(httpStatus.BAD_REQUEST).json({\n\t\t\treason: reasonCodes.BAD_SYNTAX,\n\t\t\tmessage: 'Bad request'\n\t\t});\n\t}\n\n\tif (body.username) {\n\t\tuser.username = body.username;\n\t}\n\n\tif (body.password) {\n\t\tuser.password = body.password;\n\t}\n\n\tif (body.followers) {\n\t\tuser.followers = body.followers;\n\t}\n\n\tif (body.hasOwnProperty('autoApprove')) {\n\t\tuser.autoApprove = body.autoApprove;\n\t}\n\n\tuser.save(function (err) {\n\n\t\tvar saveError;\n\n\t\tif (err) {\n\n\t\t\t// if its a known validation error then return a\n\t\t\t// a bad request\n\t\t\tsaveError = processSaveError(err);\n\t\t\tif (saveError) {\n\t\t\t\treturn res.status(httpStatus.BAD_REQUEST).json(saveError);\n\t\t\t}\n\n\t\t\t// ok - this is a genuine exception - return a 500\n\t\t\treturn next(err);\n\n\t\t}\n\t\tres.status(httpStatus.OK).json({\n\t\t\tmessage: 'Updated'\n\t\t});\n\t});\n}", "async doUserUpdate () {\n\t\tconst now = Date.now();\n\t\tconst op = {\n\t\t\t$set: {\n\t\t\t\tisRegistered: true,\n\t\t\t\tmodifiedAt: now,\n\t\t\t\tregisteredAt: now,\n\t\t\t\t\"preferences.acceptedTOS\": true\n\t\t\t}, \n\t\t\t$unset: {\n\t\t\t\tconfirmationCode: true,\n\t\t\t\tconfirmationAttempts: true,\n\t\t\t\tconfirmationCodeExpiresAt: true,\n\t\t\t\t'accessTokens.conf': true,\n\t\t\t\tinviteCode: true,\n\t\t\t\tneedsAutoReinvites: true,\n\t\t\t\tautoReinviteInfo: true\n\t\t\t}\n\t\t};\n\n\t\tif (this.passwordHash) {\n\t\t\top.$set.passwordHash = this.passwordHash;\n\t\t}\n\n\t\t['email', 'username', 'fullName', 'timeZone'].forEach(attribute => {\n\t\t\tif (this.data[attribute]) {\n\t\t\t\top.$set[attribute] = this.data[attribute];\n\t\t\t}\n\t\t});\n\t\tif (this.data.email) {\n\t\t\top.$set.searchableEmail = this.data.email.toLowerCase();\n\t\t}\n\n\t\tif ((this.user.get('teamIds') || []).length > 0) {\n\t\t\tif (!this.user.get('joinMethod')) {\n\t\t\t\top.$set.joinMethod = 'Added to Team';\t// for tracking\n\t\t\t}\n\t\t\tif (!this.user.get('primaryReferral')) {\n\t\t\t\top.$set.primaryReferral = 'internal';\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!this.user.get('originTeamId') &&\n\t\t\t\tthis.teamCreator && \n\t\t\t\tthis.teamCreator.get('originTeamId')\n\t\t\t) {\n\t\t\t\top.$set.originTeamId = this.teamCreator.get('originTeamId');\n\t\t\t}\n\t\t}\n\n\t\tthis.request.transforms.userUpdate = await new ModelSaver({\n\t\t\trequest: this.request,\n\t\t\tcollection: this.request.data.users,\n\t\t\tid: this.user.id\n\t\t}).save(op);\n\t}", "function updateTUser(name, id) {\n return promessQuery('UPDATE user SET user_name= \"' + name + '\" WHERE user_id= ' + id,\n callBackSucesso, callBackErro);\n }", "function updateUser(req,res){\n var userId = req.params.id;\n var update = req.body;\n \n //BORRAR LA PROPIEDAD PASSWORD.\n delete update.password;\n\n if(userId != req.user.sub){\n return res.status(500).send({message: 'No tienes permiso para actualizar los datos del usuario.'});\n }\n\n User.find({$or:[\n {email: update.email.toLowerCase()},\n {nick: update.nick.toLowerCase()}\n ]}).exec((err,users)=>{\n var user_isset = false;\n users.forEach((user)=>{\n if(user && user._id != userId) user_isset = true;\n });\n \n if(user_isset) return res.status(404).send({message: 'Dato en uso.'});\n\n User.findByIdAndUpdate(userId,update,{new:true},(err,userUpdated)=>{\n if(err) return res.status(500).send({message: 'Error en la peticion.'});\n if(!userUpdated) return res.status(404).send({message: 'No se ha podido actualizar el usuario'});\n return res.status(200).send({user: userUpdated});\n });\n });\n}", "function updateUser() {\n if (model.addAdmin) {\n model.user.roles.push(\"ADMIN\");\n }\n if (model.addMember) {\n model.user.roles.push(\"MEMBER\");\n }\n userService\n .updateUser(model.userId, model.user)\n .then(function() {\n model.message = \"User updated successfully.\";\n });\n }", "UpdateUser(Data, res, User, UserId){\n this.LogAppliInfo(\"Call Api\"+ Data.UserType + \" UpdateUser, Data: \" + JSON.stringify(Data), User, UserId)\n // changement du password que si il est different de vide\n if (Data.Data[this._MongoVar.LoginPassItem] == \"\"){\n delete Data.Data[this._MongoVar.LoginPassItem]\n delete Data.Data[this._MongoVar.LoginConfirmPassItem]\n }\n // Update de type Promise de Mongo\n this._Mongo.UpdateByIdPromise(Data.UsesrId, Data.Data, this._MongoVar.UserCollection).then((reponse)=>{\n if (reponse.matchedCount==1) {\n res.json({Error: false, ErrorMsg: \"User Updated in DB\", Data: null})\n } else {\n this.LogAppliError(\"User not found in DB\", User, UserId)\n res.json({Error: true, ErrorMsg: \"User not found in DB\", Data: null})\n }\n },(erreur)=>{\n this.LogAppliError(\"UpdateUser DB error : \" + erreur, User, UserId)\n res.json({Error: true, ErrorMsg: \"DB Error\", Data: null})\n })\n }", "function updateUser(req,res){\n\tvar userId = req.params.id;\n\n\tvar update = req.body;\n//borrar propiedad password\n\tdelete update.password ;\n\n\tif(userId != req.user.sub){\n\t\treturn res.status(500).send({message: 'no tienes permiso para actualizar este usuario'});\n\t}\n\n\tUser.find({ $or:[\n\t\t\t\t{email: update.email.toLowerCase()},\n\t\t\t\t{nick: update.nick.toLowerCase()}\n\t\t\t\t]}).exec((err,users)=>{\n\t\t\t\t\tvar user_isset = false;\n\t\t\t\t\tusers.forEach((user)=>{\n\t\t\t\t\t\tif(user && user._id != userId) user_isset = true;\n\t\t\t\t\t});\n\t\t\t\t\tif(user_isset) return res.status(200).send({message: 'los datos ya estan en uso'});\n\t\t\t\t\t\n\t\t\t\t\tUser.findByIdAndUpdate(userId,update,{new: true},(err,userUpdated)=>{\n\t\t\t\t\t\tif(err) return res.status(500).send({message: 'Error en la peticion'});\n\n\t\t\t\t\t\tif(!userUpdated) return res.status(404).send({message: 'no se ha podido actualizar el usuario'});\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn res.status(200).send({user: userUpdated});\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\n}", "async updateUser(id, updatedUser) {\n id = idCheck(id);\n const userCollection = await users();\n const currentUser = await this.getUserById(id);\n const updatedUserData = { profile: {} };\n\n if (updatedUser.newPassword) {\n if (typeof updatedUser.newPassword != \"string\") throw \"The new hash must be a string.\";\n updatedUserData.hashedPassword = updatedUser.newPassword;\n } else {\n updatedUserData.hashedPassword = currentUser.hashedPassword;\n }\n\n if (updatedUser.newName) {\n if (typeof updatedUser.newName != \"string\") throw \"The new name must be a string.\";\n updatedUserData.profile._id = currentUser.profile._id;\n updatedUserData.profile.name = updatedUser.newName;\n updatedUserData.profile.prevSearches = currentUser.profile.prevSearches;\n updatedUserData.profile.likes = currentUser.profile.likes;\n updatedUserData.profile.dislikes = currentUser.profile.dislikes;\n } else {\n updatedUserData.profile._id = currentUser.profile._id;\n updatedUserData.profile.name = currentUser.profile.name;\n updatedUserData.profile.prevSearches = currentUser.profile.prevSearches;\n updatedUserData.profile.likes = currentUser.profile.likes;\n updatedUserData.profile.dislikes = currentUser.profile.dislikes;\n }\n\n let updateCommand = {\n $set: updatedUserData\n };\n const query = {\n _id: currentUser._id\n };\n\n const updatedInfo = await userCollection.updateOne(query, updateCommand);\n\n if (updatedInfo.modifiedCount === 0) {\n console.log(\"No changes were made.\");\n }\n\n return await this.getUserById(id);\n }", "function updateUser(req, res, callback) {\n const conditions = {\n _id: req.body.userId,\n };\n\n const update = req.body;\n // eslint-disable-next-line no-underscore-dangle\n delete update._id;\n delete update.email_username;\n\n // Only call hash function if a password was actually provided in the request.\n if (req.body.password !== undefined) {\n const secretpw = bcrypt.hashSync(req.body.password, bcrypt.genSaltSync(8), null);\n update.password = secretpw;\n }\n\n if (req.body.location !== undefined) {\n if (req.body.location === '') {\n // handle empty string\n } else {\n update.location = req.body.location;\n }\n }\n\n userModel.User.findOneAndUpdate(conditions, update, { new: true }, (error, updatedUserRecord) => {\n if (error) {\n callback(cbs.cbMsg(true, `Update failed: ${error}`));\n } else if (!updatedUserRecord) {\n callback(cbs.cbMsg(true, { error: 'No matching user was found' }));\n } else {\n callback(cbs.cbMsg(false, updatedUserRecord));\n }\n });\n}", "function updateProfile(user) {\n UserService\n .updateUser(user._id, user)\n .success(function (user) {\n if(user != '0'){\n $location.url(\"/user/\" + user._id);\n }\n })\n .error(function (error) {\n\n });\n\n }", "updateUser(req, res) {\n User.findOneAndUpdate({ _id: req.params.id }, req.body, { new: true, runValidators: true })\n .then(dbUserData => {\n if (!dbUserData) {\n res.status(404).json({ message: \"No user found with this id!\" });\n return;\n }\n res.json(dbUserData)\n })\n .catch(err => res.json(err));\n }", "function updateUser ( user, cb )\n{\n user.lastJoin = new Date();\n user.isNewbe = false;\n user.save( (err) => \n {\n if (err) return cb(err);\n return cb(null, user);\n }); \n\n}", "function updateUser(userId, name, email, password, role) {\n return (User.findByIdAndUpdate(userId, {\n name,\n email,\n password,\n role\n }, {new: true}));\n}", "async update({request, response, params}){\n const id = params.id;\n const inpUser = request.input('email');\n\n await User.query()\n .where('id', id)\n .update({email: inpUser});\n \n return response.status(201).json('Data berhasil diupdate!');\n }" ]
[ "0.8033117", "0.76418144", "0.7581433", "0.74994916", "0.7426298", "0.73104614", "0.7307136", "0.728519", "0.7258158", "0.72351307", "0.7221518", "0.7221476", "0.72045404", "0.71919835", "0.7190767", "0.71782357", "0.71727574", "0.71509206", "0.7146467", "0.71239436", "0.71119016", "0.7106535", "0.7103591", "0.7103016", "0.7102966", "0.70955086", "0.7066486", "0.7053919", "0.70486975", "0.70187324", "0.7006407", "0.6993649", "0.699026", "0.6973468", "0.6969545", "0.69694614", "0.69677955", "0.69568855", "0.69567657", "0.69442433", "0.691737", "0.690855", "0.6906733", "0.68999726", "0.6884596", "0.6880947", "0.6879158", "0.6849924", "0.684418", "0.6833756", "0.6822306", "0.68167025", "0.68142307", "0.68087006", "0.68077695", "0.6784924", "0.6782399", "0.6764003", "0.6763685", "0.6756919", "0.674946", "0.674861", "0.6746903", "0.6744495", "0.6742264", "0.6738555", "0.6735348", "0.673522", "0.67282087", "0.672699", "0.6720797", "0.6715063", "0.67088556", "0.670529", "0.6698442", "0.66965187", "0.66960675", "0.6692901", "0.6675016", "0.6661076", "0.6648612", "0.6639183", "0.66385597", "0.66369855", "0.661676", "0.6615471", "0.66114044", "0.6606962", "0.66023564", "0.659853", "0.65965956", "0.659259", "0.659035", "0.6578307", "0.6572738", "0.6562553", "0.6560213", "0.65544516", "0.6546752", "0.6542059" ]
0.7173925
16
Method to get user, pass only the context, id will be taken from url
show(context){ HTTP.get(USERS + context.$route.params.id+'/') .then((resp) => { context.user = resp.data }) .catch((err) => { console.log(err) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUserById(id){\n return this.auth.get(`/user/${id}`,{}).then(({data})=> data);\n }", "getUser(_, { id }) {\n return db.user.findById(id);\n }", "function getUser () {return user;}", "getUser(id){\n //postDB(\"user/Get\", { \"use_id\" : id });\n return { \"name\" : \"steven\", \"img\" : '', \"share\" : false };\n }", "function getUserById(id){\n return $http.get(url.user + id).then( handleSuccess, handleError);\n }", "retrieve(context, id){\n HTTP.get(USERS + id)\n .then((resp) => {\n console.log(resp)\n context.usuario = resp.data.usuario;\n context.id = resp.data.id;\n })\n .catch((err) => {\n console.log(err)\n })\n }", "getUserById(id) {\r\n return new SiteUser(this, `getUserById(${id})`);\r\n }", "function getUser (req, res) {\n promiseResponse(userStore.findOne({ userId: req.params.id }), res);\n}", "function getUser(app){\n\treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\treq.app.locals.model.users.getUser(id).\n\t\t\t\tthen((results) => res.json(results)).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(NOT_FOUND);\n\t\t\t\t});\n\t\t}\n\t};\n}", "function api_getuser(ctx) {\n api_req({\n a: 'ug'\n }, ctx);\n}", "function getUser(){\n return user;\n }", "function getUserById(userid) {\n}", "static getUser(userId) {\n const req = new Request(`/api/users/${userId}`, {\n method : 'GET',\n headers : this.requestHeaders()\n });\n return fetch(req).then(res => this.parseResponse(res))\n .catch(err => {\n throw err;\n });\n }", "function getUserById(id) {\n return getUserByProperty('id', id);\n}", "function getUserById(id) {\n // TODO: get user by id and set $scope.user to the user object. Angular will bind the object to the page \n }", "getUserByID(userid, cb) {\n\t\tvar query = {\n\t\t\t_id: global.dbController.convertIdToObjectID(userid)\n\t\t}\n\t\tthis.getUserDetails(query, cb)\n\t}", "user(_, { id }) {\n return User.find(id);\n }", "getUserById(req, res) {\n const id = req.params.id\n model.getUserById(id)\n .then((result) => {\n helper.response(res, result, 200, null)\n })\n .catch((err) => {\n helper.response(res, null, 400, err)\n })\n }", "function getUser() {\n return user;\n }", "async getUser(uid) {\n console.log('GET /user/%s', uid)\n return this.server.getUser(uid)\n }", "async getUser(ctx) {\n\n try {\n const _id = ctx.request.params.id;\n const userData = await User.findById(_id);\n console.log(userData);\n if (!userData) {\n return ctx.body;\n }\n else {\n ctx.body = { userData };\n }\n }\n catch (error) {\n ctx.throw(error);\n }\n }", "getUserById(id) {\n return this.http.get(\"http://localhost:8080/api/users/\" + id);\n }", "function getUser(id) {\n return \"Akhil\";\n}", "function getUser(id,res) {\n var user;\n if ( id && id !== '' && id !== undefined ) {\n userDbStub.forEach(function(element) {\n if(element.id === id ) {\n user = element;\n }\n }, this); \n \n if( !user && user === undefined) {\n if(res != null){\n res.status(404).send('user not found');\n }else{\n console.log('user not found');\n } \n }\n \n } else {\n if(res != null){\n res.status(401).send('id isn\\'t defined'); \n }else{\n console.log('id isn\\'t defined');\n } \n } \n return user;\n}", "static getUserById(_id){\n return axios.get(`${baseUrl}${uniqUser}?_id=${_id}`)\n .then(function(res){\n return res\n }).catch((err) =>{\n throw(err)\n })\n }", "function getCurrentUser(id) {\n // SERVER_CALL Get information of user profile from server\n // For now return fake user we created\n user = patientList.filter(function(account) {\n return account.id == id;\n })[0];\n}", "function getUser(id){\n return fetch(`http://localhost:3000/users/${id}`)\n .then(res => res.json())\n }", "async user(parent,{id},{dataSources}) { \n const user = await dataSources.users.getUser(id)\n return user;\n }", "function getUserById(req, res) {\n\n var userId = req.query.userId;\n console.log(\"user id inside of user controler : \");\n console.log(userId);\n userModel.getUserById(userId, function(error,result) {\n res.json(result);\n });\n\n}", "async get_user(user_id){\r\n\t\t\r\n\t\t//get user entry\r\n\t\tif(this.UsersInfo.has(user_id))\r\n\t\t\treturn this.UsersInfo.get(user_id)\r\n\t\telse \r\n\t\t\treturn this.load(user_id)\r\n\t}", "getById(id) {\r\n return new SiteUser(this, `getById(${id})`);\r\n }", "function getUserById(req, res) {\n var userId = req.params['userId'];\n\n userModel\n .findUserById(userId)\n .then(function (user) {\n res.json(user);\n });\n }", "function getUser(id) {\n // return the one user with that id\n const user = users.find(user => user.id === id);\n return user;\n}", "getUserById(db, userId) {\n return db('users').select('*').where('id', userId).first();\n }", "function findUserById(userId) {\n return window.httpGet(`https://openfin.symphony.com/pod/v2/user/?uid=${userId}`);\n }", "async getUser(userId) {\n let userResult = await this.request(\"user/\" + userId);\n return userResult.user;\n }", "function getCurrentUser() {\n let userId = $('#cu').data(\"cu\");\n user = new User({id: userId});\n return user;\n}", "function getUserID(res, mysql, context, id, complete) {\n mysql.pool.query(\"SELECT * FROM users WHERE user_id = ?\", id, (error, results, fields) => {\n if (error) {\n res.write(JSON.stringify(error));\n res.end();\n }\n context.users = results[0];\n complete();\n });\n }", "async getUser(req, res, next) {\n try {\n let user = await this.controller.getUser(req.params.uid)\n if (user === null) {\n return res.status(httpStatus.NOT_FOUND)\n } else {\n return res.status(httpStatus.OK).json(user)\n }\n } catch (e) {\n next(e)\n }\n }", "static async getUser(id) {\n const userRes = await db.query(\n ` SELECT username,\n first_name,\n last_name,\n email,\n photo_url\n FROM users\n WHERE id = $1`,\n [id]\n );\n\n const user = userRes.rows[0];\n\n if (!user) {\n throw new ExpressError(`There exists no user with id '${id}'`, 404);\n }\n\n return user;\n }", "user({user_id}, _, {loaders: {Users}, user}) {\n if (user && (user.hasRole('ADMIN') || user_id === user.id)) {\n return Users.getByID.load(user_id);\n }\n }", "user(obj) {\n\n // Perform action and return promise\n return user.getUser({id: obj.author});\n }", "async getUser() {\n return (await this._client.helix.users.getUserById(this._data.user_id));\n }", "async getUser() {\n return (await this._client.helix.users.getUserById(this._data.user_id));\n }", "async getUser() {\n return (await this._client.helix.users.getUserById(this._data.user_id));\n }", "async getUser() {\n return (await this._client.helix.users.getUserById(this._data.user_id));\n }", "static getById(userId) {\n const query = 'SELECT * FROM Members WHERE id = $1 LIMIT 1';\n return db.one(query, [userId]).then(data => {\n return new User(data);\n }).catch(err => {\n console.error(err);\n console.error(`Couldn\\'t get user ${userId}.`);\n return null;\n });\n }", "getUser({ commit, dispatch }, userid) {\n api(`account/${userid}`).then(res => {\n commit('setUserView', res.data)\n })\n }", "function get_Current_User(id) {\r\n return c_users.find((p_user) => p_user.id === id);\r\n}", "async getCurrentUser() {\n const options = this.buildOptions({\n path: `${this.path}/user`,\n method: \"get\",\n body: {},\n });\n\n return this.apiCall(options);\n }", "function findUserById(id) {\n return fetch(`${self.url}/${id}`).then(response => response.json())\n }", "function handleGetUser(){\n \n console.log('function handleGetUser() called.');\n \n app.context.getUser().then((user) => {\n \n console.log('app.context.getUser() promise has resolved.');\n \n log('Complete JSON string: ', user);\n log('user.id: ', user.id);\n log('user.orgId: ', user.orgId);\n log('user.email: ', user.email);\n log('user.displayName: ', user.displayName);\n log('user.token: ', user.token);\n \n }); // app.context.getUser().then((user) =>\n \n}", "getUserDetails() {\n return this.api.send('GET', 'user');\n }", "function viewUser(id) {\r\n console.log('Inside user factory now');\r\n var deferred = $q.defer();\r\n\r\n $http.get(userUrl + '/user/' + id)\r\n .then (\r\n function(response) {\r\n deferred.resolve(response.data);\r\n },\r\n function(errResponse) {\r\n deferred.reject(errResponse);\r\n }\r\n );\r\n return deferred.promise;\r\n }", "function getUser(id) {\n return $http.get('http://jsonplaceholder.typicode.com/users?id=' + id)\n .then(getUsersSuccess)\n .catch(getUsersError);\n }", "async getUser () {\n\t\tthis.user = await this.data.users.getById(this.tokenInfo.userId);\n\t\tif (!this.user || this.user.get('deactivated')) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'user' });\n\t\t}\n\t}", "static async getUser(req, res) {\n const id = req.params.id;\n\n try {\n const user = await userModel.find(id);\n res.status(200).json(user);\n } catch (err) {\n res.status(404).json({ message: err.message });\n }\n }", "async get(id) {\n try {\n let user;\n\n if (mongoose.Types.ObjectId.isValid(id)) {\n user = await this.findById(id).exec();\n }\n if (user) {\n return user;\n }\n\n throw new APIError({\n message: \"User does not exist\",\n status: httpStatus.NOT_FOUND,\n });\n } catch (error) {\n throw error;\n }\n }", "async getUser(uid) {\n return this.user[uid]\n }", "async getOneUserId(req, res) {\n try {\n user.findOne({\n where: {\n id: req.params.id\n }\n })\n .then(result => {\n res.json({\n status: 'success',\n data: result\n })\n })\n } catch (e) {\n return res.status(401).json({\n status: \"Error!\",\n message: \"failed get one User by id\"\n })\n }\n\n }", "function getUser(req, res, next) {\n User.findOne({_id: req.params.id}, function (err, user) {\n if (err) {\n return res.status(400).send(err);\n } else if (user == null) {\n return res.status(404).send({});\n } else {\n return res.status(200).send(user);\n }\n });\n}", "function successGetUserById(user) {\n return {\n type: ACTION.GET_USER_BY_ID_SUCCESS,\n user\n }\n}", "function getUser(id){\n for (i in users){\n if (i.userId === id){\n return i\n }\n }\n return null\n}", "function getUserData(id, type) {\n var queryUrl;\n switch (type) {\n case \"user\":\n queryUrl = \"/api/users/\" + id;\n break;\n case \"group\":\n queryUrl = \"/api/groups/\" + id;\n break;\n default:\n return;\n }\n $.get(queryUrl, function(data) {\n if (data) {\n console.log(data.GroupId || data.id);\n // If this user exists, prefill our cms forms with its data\n usernameInput.val(data.username);\n \n groupId = data.GroupId || data.id;\n // If we have a user with this id, set a flag for us to know to update the user\n // when we hit submit\n updating = true;\n }\n });\n }", "static async getById(id) {\n return await user_model.findById(id)\n }", "function checkUser() {\n $.get(\"/api/user_data\").then(function (data) {\n userId = data.id;\n console.log(userId);\n return userId;\n });\n }", "async getUser(req, res, next) {\n const { userId } = req.params;\n try {\n const user = await UsersService.getUser(userId);\n if (user) res.json(user);\n else throw new ExtError('User not found!', { statusCode: HTTPStatus.NOT_FOUND, logType: 'warn' });\n } catch (error) {\n next(extendError(error, { task: 'Controller/getUser', context: { userId } }));\n }\n }", "fetchUser(context) {\n return new Promise((resolve, reject) => {\n service\n .getUser()\n .then(function(user) {\n if (user == null) {\n context.dispatch('signIn');\n context.commit('setUser', null);\n return resolve(null);\n } else {\n context.commit('setUser', user);\n return resolve(user);\n }\n })\n .catch(function(err) {\n context.commit('setError', err);\n return reject(err);\n });\n });\n }", "getUser(id){\n return this.users.filter((user)=> user.id === id)[0]; /* FINDING AND RETURNING THE USER WITH SAME ID AND RETURNING IT WHICH WILL BE AT INDEX 0 */\n }", "function getUser(id) {\n return axios.get(api_host+\":\"+api_port+\"/api/user/\"+id)\n .then( res => {\n return res.data;\n })\n .catch( err => {\n console.log(err);\n });\n}", "async function getCurrentUser(id) {\n const username = await hget(id, 'username');\n const room = await hget(id, 'room')\n return { id, username, room };\n}", "function getCurrentUser(id){\n return users.find(user => user.id === id);\n}", "function getUserFromId(id) {\n let users = getUsers();\n if(users === null) return null;\n return users.find(u => u.user_id === id);\n}", "getUserDetails(id) {\n return apiClient.get(\n `/account?api_key=6c1e80dae659cb7d1abdf16afd8bb0e3&session_id=${id}`\n )\n }", "static async getUser(userId) {\r\n try {\r\n\r\n let response = await axios.request({\r\n url: '/users/' + userId,\r\n method: 'get',\r\n baseURL: DB_URL,\r\n auth: {\r\n username: 'apikey-v2-1zry8ajgypo2q14hzjvdwuemmaiixcz9dhmtedvr14ck',\r\n password: '53fcbf5faa893817605b85afaf7af46f',\r\n },\r\n data: null,\r\n });\r\n return response.data;\r\n } catch (err) {\r\n console.log(\"error\", err);\r\n throw err;\r\n // throw new Error('Please Enter Valid User Id');\r\n }\r\n }", "function getUserById(req, res) {\r\n if (!req.params.userId) return res.status(400).json({success: false, message: 'User ID not provide'}); // Return Error\r\n User.findById(req.params.userId, (err, user) => {\r\n if (err) return res.status(500).json({ success: false, message: `Request failed: ${err}`}); // Return Coneccition Error\r\n if (!user) return res.status(404).json({ success: false, message: 'User not found'}) // Return as not found user\r\n return res.status(200).json({ success:true, user: user}); // Return user\r\n });\r\n}", "function getUser(req, res) {\n var userId = req.params.id;\n\n User.findById(userId, (err, viewUser) => {\n if (err) {\n res.status(500).send(\"Error al solicitar el usuario\");\n } else {\n if (!viewUser) {\n res.status(404).send(\"No se ha podido llamar el usuario\");\n } else {\n res.status(200).send(viewUser);\n }\n }\n });\n}", "function getUserID() {\n var access_token = getAccessToken();\n fetch('https://api.spotify.com/v1/me', {\n headers: {\n 'Authorization': 'Bearer ' + access_token\n }\n }).then(res => res.json()).then(data => {\n console.log(\"user data\");\n console.log(data);\n p.getUser(data.id);\n })\n }", "function getUser(req, res){\r\n var userId=req.params.id;\r\n User.findById(userId).exec((err, user) => {\r\n if(err){\r\n res.status(500).send({message:'Se ha producido un error en la peticion'});\r\n }else{\r\n if(!user){\r\n res.status(404).send({message:'No se ha encontrado lista de administradores de institucion'});\r\n }else{\r\n res.status(200).send({user});\r\n }\r\n }\r\n });\r\n}", "async getInfo() {\n let userResult = await this.request(\"user\");\n return userResult.user;\n }", "getCurrentUser(request, response, next) {\n const args = {\n tenant_id: request.session.tenant_id,\n user_id: request.params.user_id,\n };\n\n UsersService.prototype.getCurrentUserEntities(args).then((user) => {\n response.json(\n user,\n );\n }).catch((error) => next(error));\n }", "function getOne(req,res, next) {\n userDb.findUser(req.params.id)\n .then(data=> {\n res.locals.user = data;\n next();\n })\n .catch(err=> {\n next(err);\n })\n}", "function getUser(req, res, next){\n db.users.findOne({_id: mongojs.ObjectId(req.params.id)}, {pass: 0, admin: 0, email:0}, function(err, user){\n if(err){\n return res.json({success: false, message: err});\n }\n else if(!user){\n return res.json({success: false, message: 'Invalid User'});\n }\n else{\n req.user = user;\n next();\n }\n })\n}", "async user(obj, field, context, info) {\n const user = context.getUser()\n const usersService = context.get(\"users\");\n return await usersService.findOne(field.username, user);\n }", "function getUser(userStore, userId) {\n return userStore.get('users').find(function (u) {\n return u.userId === userId;\n });\n}", "getCurrentUser() {\n return HTTP.get('users/me')\n .then(response => {\n return response.data\n })\n .catch(err => {\n throw err\n })\n }", "viewOne(req, res) {\n const currentUser = UserModel.getOne(req.params.id);\n if (!currentUser) {\n return res.status(404).send({'message': 'user not found'});\n }\n return res.status(200).send(currentUser);\n }", "getUserFromFirebaseAuth(userId) {\n return this.auth.getUser(userId);\n }", "function getInfo (id, authorisation, self) {\n var url = `${API_URL}/user?id=${id}`; \n if (self == 'self') { \n console.log(`${self}`);\n url = `${API_URL}/user`\n };\n return fetch(url, {\n method: 'GET',\n headers: {\n 'Authorization': `Token ${authorisation}`\n },\n })\n .then(res => {\n //catch 403 status \n if (res.status === 403) {\n alert(\"Invalid auth token\");\n } \n return res.json();\n })\n .catch(error => {\n alert(\"He's dead Jim (Issue getting user information)\");\n });\n}", "static async fetchUser({userId}) {\n\t\tconst body = await got.get(`${USERS_SERVICE_API}/users/${userId}`).json();\n\t\treturn body;\n\t}", "function _getUserById(userId, callback)\n{\n validate.valID(userId, function (data)\n {\n if (data)\n {\n User.getUserById(userId, function (data2)\n {\n callback(data2)\n })\n } else callback(false)\n })\n}", "getUser({params}, res) {\n User.findOne({ _id: params.id })\n .then(userData => {\n if(!userData) {\n res.status(404).json({ message: 'No user found with this id!'})\n }\n res.json(userData)\n })\n .catch(err => {\n res.status(400).json(err);\n })\n }", "function user() {\n return currentUser;\n }", "getCurrentUserId() {\r\n return JSON.parse(localStorage.getItem(\"user\")).id;\r\n }", "handleUserDetails(id) {\n let user = this.props.users[id];\n this.props.getUser(user);\n }", "async GetById(id) {\n try {\n let user = await User.GetById(id);\n if (!user) {\n let response = constants.HTTP.ERROR.NOT_FOUND;\n return Promise.reject(response);\n }\n else {\n return user\n }\n } catch (err) {\n return Promise.reject(err);\n }\n }", "function getUser(id) {\n\t\tvar query = User.findOne({'_id': id});\n\t\treturn query;\n\t}", "async queryStudent(ctx, id) {\n const userKey = User.makeKey([id]);\n const user = await ctx.studentList.getUser(userKey);\n if (!user) {\n throw new Error('Can not found User = ' + userKey);\n }\n\n return user;\n }", "getUserById(userId) { //singleton!\n\t\treturn this._getSingleObject(\n\t\t\t(\n\t\t\t\t'SELECT * FROM USERS u ' + \n\t\t\t\t'WHERE u.user_id = :id'\n\t\t\t), \n\t\t\t{\n\t\t\t\tid: userId\n\t\t\t}\n\t\t);\n\t}", "function load(req, res, next, id) {\n _user2.default.get(id).then(function (user) {\n req.user = user; // eslint-disable-line\n return next();\n }).catch(function (e) {\n return next(e);\n });\n}" ]
[ "0.7421686", "0.74015653", "0.7394445", "0.73807", "0.73711514", "0.726187", "0.726019", "0.7244221", "0.7175981", "0.7137499", "0.7078354", "0.70715475", "0.70313776", "0.70271176", "0.7024868", "0.6983703", "0.69728607", "0.6959466", "0.69514894", "0.6951119", "0.69472104", "0.694251", "0.69301534", "0.69230133", "0.69142735", "0.6900754", "0.68913645", "0.68818605", "0.6878468", "0.68739706", "0.68486273", "0.68463814", "0.68422496", "0.68308234", "0.6830356", "0.6825894", "0.68032", "0.68014145", "0.6801038", "0.6776455", "0.6774286", "0.67539734", "0.67495924", "0.67495924", "0.67495924", "0.67495924", "0.67462796", "0.6736031", "0.67300385", "0.6730004", "0.672867", "0.67251086", "0.67096084", "0.6687942", "0.6687232", "0.66857415", "0.66770357", "0.6674022", "0.6668414", "0.6663082", "0.66558367", "0.66551167", "0.6635386", "0.6627831", "0.6614921", "0.6604191", "0.6600659", "0.6593197", "0.65911025", "0.65895814", "0.6587568", "0.6586219", "0.65853393", "0.6581314", "0.6580555", "0.6575415", "0.6567338", "0.65643007", "0.65618014", "0.6554648", "0.65491253", "0.6545903", "0.6542114", "0.653841", "0.6534732", "0.6534539", "0.65333664", "0.6522547", "0.65139544", "0.6506622", "0.6504886", "0.65031916", "0.6502986", "0.648818", "0.6483707", "0.64764047", "0.647031", "0.64679116", "0.64675117", "0.6465196" ]
0.6827066
35
Method to display all users, pass only the context
index(context){ HTTP.get(USERS) .then((resp) => { context.users = resp.data console.log(resp.data) }) .catch((err) => { console.log(err) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getallusers() {\n\n\t}", "function showAllUsers() {\r\n getUsers().then(function(result){\r\n users=[];\r\n for(var i=0;i<result.length;i++){\r\n let user = {\r\n id: result[i].ID,\r\n name:result[i].Name,\r\n currentCredit: result[i].Credit_amount,\r\n email: result[i].Email,\r\n address: \"\",\r\n phone: result[i].phone\r\n }\r\n users.push(user);\r\n \r\n }\r\n renderUsers();\r\n })\r\n}", "function GetUser() {\n showUsers(dataUsers[currentPage]);\n}", "function findAllUsers() {\n userService\n .findAllUsers()\n .then(renderUsers);\n }", "function getAllUsers(){\n $.get(\"/getAllUsers\", function(users){\n let output =\n \"<table class='table table-striped table-bordered'>\" +\n \"<tr>\" +\n \"<th>Username</th>\" +\n \"</tr>\";\n\n for (const user of users){\n output +=\n \"<tr>\" +\n \"<td>\" + user.username + \"</td>\" +\n \"</tr>\";\n }\n output += \"</table>\";\n $(\"#allUsers\").empty().html(output);\n });\n }", "function viewAllUsers() {\n var data = [],\n output,\n config;\n\n config = {\n columns: {\n }\n };\n data[0] = [\"User ID\".cyan, \"Full Name\".cyan, \"Username\".cyan, \"User Type\".cyan];\n let queryStr = \"users\";\n let columns = \"user_id, full_name, username, user_type\";\n\n myConnection.readFunction(columns, queryStr, function (res) {\n console.log(\"\\n Users\".magenta);\n for (let i = 0; i < res.length; i++) {\n data[i + 1] = [res[i].user_id.toString().yellow, res[i].full_name, res[i].username, res[i].user_type];\n }\n output = table.table(data, config);\n console.log(output);\n myConnection.goBack(\"Supervisor\", bamazonSupervisor.runBamazonSupervisor);\n });\n}", "function listUsers() {\n $listUsers.empty();\n\n if (event) event.preventDefault();\n\n var token = localStorage.getItem('token');\n $.ajax({\n url: '/users',\n method: 'GET',\n beforeSend: function beforeSend(jqXHR) {\n if (token) return jqXHR.setRequestHeader('Authorization', 'Bearer ' + token);\n }\n }).done(function (users) {\n showUsers(users, 0, 10);\n });\n }", "getAllUsers() {\n return Api.get(\"/admin/user-list\");\n }", "allUsers() {\r\n this.log(`Getting list of users...`);\r\n return this.context\r\n .retrieve(`\r\n SELECT emailAddress, password\r\n FROM Users\r\n `\r\n )\r\n }", "users(parent, args, ctx, info) {\n return USERS_DATA;\n }", "function displayUsers() {\n if (users && users.length) {\n var str = \"\";\n $(users).each(function () {\n str += this.name + \", \";\n });\n str = str.replace(/, $/, \"\");\n userList.text(str);\n userDisplay.show();\n }\n else {\n userDisplay.hide();\n }\n }", "function getAllUsers(){\n \n\n return fetch(\"http://localhost:3000/users\")\n .then((resp) => resp.json())\n .then(function(users) {\n users.forEach(function(user) {\n \n postContainer.innerHTML += renderSingleProfile(user);\n }); \n\n return users \n } );\n \n}", "function displayUsers(users) {\n for (var i = 0; i < users.length; i++) { \n var user=users[i];\n user.displayUser();\n }\n\n}", "function GetUsers() {\n UserApi.getUser().then(function (response) {\n $scope.user = response.data;\n }), function () {\n aler(\"Unable to load users info\");\n }\n }", "function getUserList() {\n userService.getUsers()\n .then(function (users) {\n var result = users.filter(function (u) {\n return u.Id !== vm.current.details.ownerId;\n });\n vm.ownerForm.users = result;\n });\n }", "async function list(req, res, next) {\n try {\n const users = await User.find({/*activated: true*/}, 'username email')\n .sort({'username': 'asc'}).limit(50).exec();\n res.render('users/list', { title: 'Users', users: users }); \n } catch (err) {\n next(err);\n }\n}", "allUsers() { return queryAllUsers() }", "function retrieve_all_users(){\n\tlet params = {\n\t\t\t\t method: \"GET\",\n\t\t\t\t url: \"/api/admin/all/\"\n \t\t\t\t}\n\t$.ajax(params).done(function(data) {\n\t\tvar allUsers = '<div style=\"border:1px solid black\"><h3>All users</h3><table><tr><th>Username</th>'+\n\t\t'<th>First Name</th><th>Last Name</th><th>e-mail</th><th>Account Type</th><th>Last Login</th></tr>';\n\t\tconsole.log(data[\"users\"].length);\n\t\tfor(i=0;i<data[\"users\"].length;i++){\n\t\t\tallUsers += \"<tr><th>\"+data[\"users\"][i].username+\"</th><th>\"+\n\t\t\tdata[\"users\"][i].firstName+\"</th><th>\"+data[\"users\"][i].lastName+\n\t\t\t\"</th><th>\"+data[\"users\"][i].email+\"</th><th>\"+data[\"users\"][i].userType+\n\t\t\t\"</th><th>\"+data[\"users\"][i].lastLogin+\"</th></tr>\";\n\t\t}\n\t\tallUsers+= \"</table>\";\n\t\t$(\"#allUsers\").html(allUsers);\n\t});\n}", "function listUsers() {\n gapi.client.directory.users.list({\n 'customer': 'my_customer',\n 'maxResults': 100,\n 'orderBy': 'email',\n 'viewType': \"domain_public\"\n }).then(function(response) {\n var users = response.result.users;\n var menu = document.getElementById('menu-main');\n menu.className += \" show-toggle\";\n //appendPre('Directory Loaded, you may now Show Directory <a href=\"link\"> test </a>');\n if (users && users.length > 0) {\n for (i = 0; i < users.length; i++) {\n //console.log(user);\n var user = users[i];\n userlist.push(user)\n /*appendPre('-' + user.primaryEmail + ' (' + user.name.fullName + ')');\n if (user.organizations){\n appendPre(user.organizations[0].title);\n };\n if (user.thumbnailPhotoUrl){\n appendPre(user.thumbnailPhotoUrl)\n }*/\n }\n } else {\n appendPre('No users found.');\n }\n });\n }", "function getUsers(data){\n users = JSON.parse(data).results;\n renderUsers();\n}", "function showAllUsers() {\n userFacade.getUsers()\n .then(users => {\n const userRows = users.map(user => `\n <tr>\n <td>${user.id}</td>\n <td>${user.age}</td>\n <td>${user.name}</td>\n <td>${user.gender}</td>\n <td>${user.email}</td>\n </tr>\n `);\n const userRowsAsString = userRows.join(\"\");\n document.getElementById(\"allUserRows\").innerHTML = userRowsAsString;\n });\n}", "view(req, res) {\n const users = UserModel.getAll();\n return res.status(200).send(users);\n }", "users() {\r\n\t\treturn API.get(\"pm\", \"/list-users\");\r\n\t}", "function getUsers() {\n\n intakeTaskAgeDatalayer.getUsersInFirm()\n .then(function (response) {\n self.allUser = response.data;\n }, function (error) {\n notificationService.error('Users not loaded');\n });\n }", "function getAllUsers() {\n\t\t// url (required), options (optional)\n\t\t/*\n\t\tfetch('/snippets/all') // Call the fetch function passing the url of the API as a parameter\n\t\t.then(function(resp) {\n\t\t\treturn resp.json()\n\t\t}) // Transform the data into json\n\t\t.then(function(data) {\n\t\t\tconsole.log(JSON.parse(data));\n\t\t\t// Your code for handling the data you get from the API\n\t\t\t//_bindTemplate(\"#entry-template\", data, '#sample-data');\n\t\t})\n\t\t.catch(function(errors) {\n\t\t\t// This is where you run code if the server returns any errors\n\t\t\tconsole.log(errors);\n\t\t});\n\t\t*/\n\n\t\t$.ajax({\n\t\t\ttype: 'GET', \t\t// define the type of HTTP verb we want to use (POST for our form)\n\t\t\turl: '/users/all', \t// the url where we want to POST\n\t\t\tdataType: 'json', \t// what type of data do we expect back from the server\n\t\t\tencode: true\n\t\t})\n\t\t// using the done promise callback\n\t\t.done(function(data) {\n\t\t\t_bindTemplate(\"#entry-template\", data, '#sample-data');\n\t\t});\n\t}", "function outputUsers(users) {\n elim();\n let ul = document.createElement(\"ul\");\n ul.setAttribute(\"id\", \"users\");\n document.getElementById(\"list\").appendChild(ul);\n users.forEach(user=>{\n const li = document.createElement('li');\n li.className = 'list-group-item';\n li.innerText = user.username;\n ul.appendChild(li);\n });\n }", "function getUsers() {\r\n var message = \"type=allUser\";\r\n sendFriendData(message, 'showUser');\r\n return 0;\r\n}", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach(user=>{\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n }", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach(user=>{\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n }", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach(user=>{\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n }", "render({ users }) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<Helmet title={`${APP.NAME} - Users`} />\n\t\t\t\t<div class=\"header\"><h1>Users <small style={{ fontSize: '0.8rem'}}>being deprecated</small></h1></div>\n\t\t\t\t<div class={style.profile}>\n\t\t\t\t\t{users.map(user => (<UserCard user={user} />))}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}", "function displayUser(users) {\n\tPromise.all(users.map(function(user) {\n\t\tconst userDisplay = document.createElement('div');\n\t\tuserDisplay.className= \"user\"\n\t\tuserDisplay.innerHTML = user.login;\n\t\tdocument.body.appendChild(userDisplay);\n\t}))\n}", "function outputUsers(users) {\r\n userList.innerHTML = '';\r\n users.forEach((user) => {\r\n const li = document.createElement('li');\r\n li.innerText = user.username;\r\n userList.appendChild(li);\r\n });\r\n}", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach((user) => {\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n}", "function getUsers(req, res, next){\r\n\r\n\tUser.find()\r\n\t.where({privacy: false})\r\n\t.exec(function(err, results){\r\n\t\tif(err){\r\n\t\t\tres.status(500).send(\"Error Getting all the users that have a private set to false => \" + err);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconsole.log(\"Found \" + results.length + \" matching people on the mongoose.\");\r\n\t\tres.status(200).render(\"pages/getUsers\", {users: results , id:req.session.userId});\r\n\t\treturn;\r\n\t});\r\n\r\n}", "index(req, res) {\n User.find({}, (err, users) => {\n if (err) {\n console.log(`Error: ${err} `);\n }\n let context = {\n users: users\n };\n return res.render('index', context);\n })\n }", "function displayUsers(){\n Promise.all([\n fetchData('https://randomuser.me/api/?results=12&nat=us'),\n ])\n .then(data => {\n userList = data[0].results;\n generateCard(userList);\n \n })\n}", "function usersIndex(req, res, next) {\n User\n .find()\n .exec()\n .then((users) => res.render('users/index', { users }))\n .catch(next);\n}", "function getAllUsers(callback) {\n requester.get('user', '', 'kinvey')\n .then(callback)\n}", "async show({view}){\n const users = await User.all()\n return view.render('person.user-list', {users: users.toJSON()})\n }", "function printUsers(){\n if (Users.length === 0){\n console.info('\\nThere appears to be no users here... lonely much?\\n');\n }\n else {\n console.info('there are ' + Users.length + ' active users in the system');\n Users.forEach(function (user) {\n console.log(user.getUserInfo());\n });\n }\n}", "static renderUsers(users) {\n if (users.length > 0) {\n return _.sortBy(users, u => u.name).map(user => {\n return <UserListItem key={user._id} user={user}/>;\n });\n } else {\n return <p>There are no users</p>;\n }\n }", "static getAllUsers(req, res) {\n userService.getAllUsers(db, function (returnvalue) {\n res.status(200).send(returnvalue);\n })\n\n }", "function getAllUsers(){\n return UserService.getAllUsers();\n }", "getAllUsers() {\r\n return this.users;\r\n }", "function fetchAllUsers() {\n var users = [{\n firstName: \"Scott\",\n lastName: \"Jason\",\n email: \"[email protected]\",\n hair: \"blone\",\n hasTwoFirstNames: true\n }, {\n firstName: \"Austin\",\n lastName: \"Bourdier\",\n email: \"[email protected]\",\n hair: \"brown\",\n hasTwoFirstNames: false\n }, {\n firstName: \"Jessica\",\n lastName: \"Raynes\",\n email: \"[email protected]\",\n hair: \"blonde\",\n hasTwoFirstNames: false\n }];\n return function renderUsers() {\n return users;\n };\n}", "async getAllUsers(){\n data = {\n URI: `${ACCOUNTS}`,\n method: 'GET'\n }\n return await this.sendRequest(data)\n }", "userList() {\r\n const users= auth.users;\r\n return (\r\n <ol>\r\n {users.map(users => <li>{users}</li>)}\r\n </ol>\r\n );\r\n }", "function usersDisplayGenerator(){\n msg3 = \"<br/>\";\n if(theUsers != null){\n msg3 = msg3 + \"<b>Here is the display of the users</b><br/>\";\n msg3 = msg3 + \"<table><tr><th>Ord.No</th><th>Username</th><th>email</th></tr>\";\n var count = Object.keys(theUsers).length;\n for(x=0; x<count; x++){\n //console.log(\"Checking user:\" + theUsers[x].username);\n msg3 = msg3 + \"<tr><td>\" + x + \"</td><td>\" + theUsers[x].username + \"</td><td>\" \n + theUsers[x].email + \"</td></tr>\";\n }\n msg3 = msg3 + \"</table>\";\n } else {\n msg3 = msg3 + \"<h3>Remember!</h3><br/>\";\n msg3 = msg3 + \"Treating the users fairly is important!<br/>\";\n msg3 = msg3 + \"Click Refresh to see the users:<br/>\";\n }\n \n msg3 = msg3 + '|<a href=\"/adminpanel.html\">Refresh!</a>|<br/>';\n return msg3;\n}", "async list() {\n\t\treturn this.store.User.findAll()\n\t}", "function outputUsers(users){\n userList.innerHTML = `\n ${users.map(user=>`<h6>${user.username}</h6>`).join('')}\n `;\n}", "function getAllUsers(req, res) {\n User.find((err, users) => {\n if (err) {\n res.status(500).send(\"No se pudo traer los usuarios\");\n } else {\n res.status(200).send(users);\n }\n });\n}", "all() {\n return users;\n }", "function getUsers() {\r\n apiService.getEntity('users')\r\n .then(function (response) {\r\n vm.users = response.data;\r\n notifyService.success('Users loaded.');\r\n }, function (error) {\r\n vm.message = 'Unable to load data: ' + error.message;\r\n });\r\n }", "async users(_, args, ctxt) {\n // This would recieve the context and log it\n // console.log(ctxt);\n return await User.find();\n }", "function getAllUsers (req, res, next) {\n db.any('SELECT * FROM \"user\";')\n .then((users) => {\n res.rows = users;\n next();\n })\n .catch(err => next(err));\n}", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join(\"\")}\n `;\n}", "function getAllUsers() {\n var URL = 'http://localhost:3333/api/users';\n\n errorHandlingFetch(URL, function (data) {\n content.innerHTML = makeTable(data);\n })\n}", "function outputUsers(users) {\r\n userList.innerHTML = `\r\n ${users.map((user) => `<li>${user.username}</li>`).join(\"\")}\r\n `;\r\n}", "static async getAllUsers(req, res, next) {\n try {\n const users = await this.database.getAllUsers();\n return res.send(users);\n } catch (error) {\n next(error);\n }\n }", "displayUsers() {\n let out = \"\";\n for (let i = 0; i < this.allUsers.length; i++) {\n const item = this.allUsers[i];\n out += '<tr id=\"user' + item.id + '\">';\n out += '<td>' + item.username + '</td>';\n out += '<td>' + item.api_key + '</td>';\n out += '</tr>';\n }\n $(\"#user_list\").find(\"tbody\").empty();\n $(\"#user_list\").find(\"tbody\").append(out);\n }", "function fetchAllUsers() {\n return fetch(`${SERVER_URL}/users`, {\n headers: {\n Authorization: `Bearer ${userToken}`,\n },\n })\n .then(response => response.json())\n .then(data => setAllUsers(data))\n }", "function outputUsers(users) {\n userList.innerHTML = `${users.map(user => `<li><i class=\"fa fa-user-circle\"></i>${user.username}</li>`).join('')}`\n}", "function getUsers(res, mysql, context, complete){\n mysql.pool.query(\"SELECT `first_name`, `username`, `user_id` FROM Users\", function(error, results, fields){\n if(error){\n res.write(JSON.stringify(error));\n res.end();\n }\n context.users = results;\n complete();\n });\n}", "function displayUsers(users = []) {\n\n var userCount = users.length;\n\n for (var i = 0; i < userCount; i++) {\n\n var user = users[i];\n\n var userRow = createUserRow(user);\n\n if (user !== null) {\n tableBody.append(userRow);\n }\n }\n}", "function getAll(req, res, next){\n userModel.getAll()\n .then(function(data){\n res.send({ data })\n })\n .catch(next)\n}", "function getAllUsers(req, res, next) {\n usersDetails(req, res).then((result) => {\n return res.status(200).json(result);\n }).catch((err) => {\n next(err);\n });\n}", "function showUsers() {\n\t$.ajax({\n\t\ttype : \"GET\",\n\t\turl : \"user/goShowUsers\",\n\t\tcache : false,\n\t\tsuccess : function(data) {\n\t\t\t$(\"#showDynamicContent\").html(\"\");\n\t\t\t$(\"#dynamicContent\").html(data);\n\t\t\t$('#userLists').dataTable({\n\t\t\t\t\"bJQueryUI\" : true,\n\t\t\t\t\"sPaginationType\" : \"full_numbers\",\n\t\t\t\t\"iDisplayLength\" : 25,\n\t\t\t\t\"sScrollY\" : \"390px\",\n\t\t\t\t\"bFilter\" : true,\n\t\t\t\t\"bDestroy\" : true\n\t\t\t});\n\t\t}\n\t});\n}", "function getUsers(res, mysql, context, complete) {\n mysql.pool.query(\"SELECT * FROM users\", (error, results, fields) => {\n if (error) {\n res.write(JSON.stringify(error));\n res.end();\n }\n context.users = results;\n complete();\n });\n }", "static getAllUsers(){\n return Axios.get(`/users`);\n }", "static getAllUsers() \n {\n return UserDao.showUsersList(); \n }", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join('')}\n `;\n}", "function listUsers (req, res) {\n promiseResponse(userStore.find({}), res);\n}", "listAll(req, res) {\n User.findAll({\n attributes: ['username', 'email', 'title', 'createdAt', 'updatedAt'],\n })\n .then((user) => {\n if (user.length === 0) {\n res.status(200).send({ message: 'Nothing to show.' });\n } else {\n res.status(200).send(user);\n }\n });\n }", "static async getUsers() {\n return await this.request('users/', 'get');\n }", "async function getUsers() {\n const response = await api.get(`/users/?_sort=id&_order=desc`);\n\n if (response.data) {\n setCompletedListUsers(response.data);\n setListUsers(response.data);\n refreshCountPages(response.data);\n }\n }", "function getUsers(){\n return users;\n}", "function index(req, res) {\n User.find({})\n .then((users) => {\n res.render(\"users/index\", {users, user: req.user})\n })\n}", "function displayRoomUsers(userList) {\r\n $(\".users-list\").html(\r\n `${userList.map(\r\n (user) => `\r\n ${user.username}\r\n `\r\n )}`\r\n );\r\n}", "function ListAllUsers(req, res) {\n let userPermission = req.param.userPermission;\n let userId = req.param.userId;\n if (userPermission == 'Admin' || 'superAdmin') {\n UsersModel.find({}, (err, users) => {\n if (err) {\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n return res.status(200).send(users)\n })\n } else {\n UsersModel.findById(userId, (err, users) => {\n if (err) {\n return res.status(422).json({\n 'status': false,\n 'message': 'An Error Occured'\n })\n }\n return res.status(200).send(users)\n })\n }\n\n}", "function displayUsers(users) {\n users.forEach(function(user) {\n var $container = $('.container');\n var $tile = $('<div class=\"tile\"></div>');\n var name = user.name.first + ' ' + user.name.last;\n var $name = $('<p></p>');\n $name.text(name);\n\n var location = user.location.city + ', ' + user.location.state;\n var $location = $('<p></p>');\n $location.text(location);\n\n var $img = $('<img>');\n $img.attr('src', user.picture.large);\n\n $tile.append($img, $name, $location);\n $container.append($tile);\n });\n }", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join('')}`;\n}", "function outputUsers(users) {\n userList.innerHTML = `<ul>\n ${users.map(user => `<li>${user.username}</li>`).join('')}\n </ul>`;\n}", "function getUsers() {\n subscribeService.getUsersContent()\n .then(function(data) {\n vm.data = data.slice(0, vm.data.length + 3);\n });\n }", "function getUsers(){\n\t\t\tgetUsersService.getUserList().then(function(data){\n\t\t\t\tlc.listOfUser = data;\n\t\t\t})\n\t\t\t.catch(function(message){\n\t\t\t\texception.catcher('getUserList Service cannot succeed')(message);\n\t\t\t});\n\t\t}", "function outputUsers(users){\n userList.innerHTML=`\n ${users.map(user => `<li>${user.username}</li>`).join(\"\")}`;\n}", "function outputUsers(users) {\n const userList = document.getElementById('users');\n \n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join('')}\n `;\n}", "function getUsers() {\n axios\n .get(process.env.REACT_APP_API_URL + \"/users\")\n .then((res) => {\n setUsers(res.data);\n // console.log(res.data);\n })\n .catch((err) => {\n console.log(\"Error listing the users\");\n });\n }", "function outputUsers(users){\n userList.innerHTML=`\n ${users.map(user=>`<li>${user.username}</li>`).join('')}\n `\n}", "function findAllUsers() {\n return fetch('https://wbdv-generic-server.herokuapp.com/api/alkhalifas/users')\n .then(response => response.json())\n }", "fetchAllUsers() {\n let account = JSON.parse(localStorage.getItem(\"cachedAccount\")).id;\n let url = (\"./admin/admin_getusers.php?allusers=\" + account);\n\n\t\t\tfetch(url)\n\t\t\t.then(res => res.json())\n\t\t\t.then(data => {\n\t\t\t\tthis.userList = data;\n\t\t\t})\n\t\t\t.catch((err) => console.error(err));\n }", "function render(users) {\n console.log(\"here\");\n const container = document.querySelector('.js-users');\n container.innerHTML = '';\n console.log(users)\n for (const user of users.users) {\n console.log(user);\n\n const div = document.createElement('div');\n div.innerHTML =\n `\n <div class=\"row\">\n <div class=\"col s6 m6\">\n <div class=\"card\">\n <div class=\"card-image\">\n <img src=${user.ACTIVITY_PAYLOAD}>\n </div>\n <div class=\"card-content\">\n <span class=\"card-title\">${user.EMAIL}</span>\n <a class=\"waves-effect waves-light btn right\">Follow</a>\n </div>\n </div>\n </div>\n </div>\n `\n div.classList.add('row')\n container.appendChild(div)\n }\n }", "function render(users) {\n console.log(\"here\");\n const container = document.querySelector('.js-users');\n container.innerHTML = '';\n console.log(users)\n for (const user of users.users) {\n console.log(user);\n\n const div = document.createElement('div');\n div.innerHTML =\n `\n <div class=\"row\">\n <div class=\"col s6 m6\">\n <div class=\"card\">\n <div class=\"card-image\">\n <img src=${user.ACTIVITY_PAYLOAD}>\n </div>\n <div class=\"card-content\">\n <span class=\"card-title\">${user.EMAIL}</span>\n <a class=\"waves-effect waves-light btn right\">Follow</a>\n </div>\n </div>\n </div>\n </div>\n `\n div.classList.add('row')\n container.appendChild(div)\n }\n }", "static getAllUsers(req, res){\n User.find((err, users) => {\n if (err) return res.json({ success: false, error: err });\n return res.json({ success: true, data: users });\n });\n }", "function renderUsers(users) {\n tbody.empty();\n for(var i=0; i<users.length; i++) {\n var user = users[i];\n var clone = template.clone();\n clone.attr('id', user.id);\n clone.find('.wbdv-delete').click(deleteUser);\n clone.find('.wbdv-edit').click(editUser);\n clone.find('.wbdv-username')\n .html(user.username);\n clone.find('.wbdv-first-name')\n .html(user.firstName);\n clone.find('.wbdv-last-name')\n .html(user.lastName);\n clone.find('.wbdv-role')\n .html(user.role);\n tbody.append(clone);\n }\n }", "static async getAll() {\n\t\tconst usersRes = await db.query(`SELECT * FROM users ORDER BY username`);\n\t\treturn usersRes.rows;\n\t}", "function displayUserResults() {\n state.userResults.forEach(function (item) {\n let htmlItem = $('.js-userResult.templ').clone();\n htmlItem.find('.js-name-title').append(`${item.firstName} ${item.lastName}`);\n htmlItem.find('.js-name').attr('uid', item._id);\n htmlItem.find('.js-name').attr('firstName', item.firstName);\n htmlItem.find('.js-username').append(`(${item.username})`);\n if (item.watchlist.length === 1) {\n htmlItem.find('.js-listCount').append(`${item.watchlist.length} item in their Watchlist.`);\n } else {\n htmlItem.find('.js-listCount').append(`${item.watchlist.length} items in their Watchlist.`);\n }\n htmlItem.removeClass('templ');\n $('.js-userResults-list').append(htmlItem);\n $('.js-userResults').removeClass('hidden');\n $('.js-userResults').show();\n });\n $('.js-noUsers').addClass('hidden');\n $('.js-watchlist').hide();\n $('.js-watchlist-results').html('');\n $('.results').hide();\n $('.js-results-container').html('');\n $('.js-returnButton').removeClass('hidden');\n $('.js-welcome').addClass('hidden');\n}", "function getAll() {\n\treturn dispatch => {\n\t\tdispatch(request());\n\n\t\tuserService.getAll()\n\t\t\t.then(\n\t\t\t\tusers => dispatch(success(users)),\n\t\t\t\terror => dispatch(failure(error.toString()))\n\t\t\t);\n\t};\n\n\tfunction request() { return { type: userConstants.GETALL_REQUEST } }\n\tfunction success(users) { return { type: userConstants.GETALL_SUCCESS, users } }\n\tfunction failure(error) { return { type: userConstants.GETALL_FAILURE, error } }\n}", "function findAllUsers(req, res, next){\r\n connection.query('SELECT * FROM Usuarios', function (error, results){\r\n if(error) throw error;\r\n res.send(200, results);\r\n return next();\r\n });\r\n}", "function show(){\n fetch('https://users-dasw.herokuapp.com/api/users',{\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'x-auth': localStorage.token,\n 'x-user-token': locStorage\n }\n })\n .catch(error => console.error('Error:', error))\n .then(response => response.json()\n .then(a => users(Array.from(a)))\n );\n}" ]
[ "0.7185863", "0.71250296", "0.7062023", "0.7016028", "0.6998771", "0.6939878", "0.6880051", "0.684103", "0.6839279", "0.68342394", "0.6828942", "0.6828687", "0.6809471", "0.67914975", "0.6787485", "0.6786206", "0.67813253", "0.6780268", "0.67540145", "0.6743712", "0.6717198", "0.6648865", "0.66480196", "0.66399014", "0.6604356", "0.6604096", "0.6592168", "0.6588487", "0.6588487", "0.6588487", "0.657671", "0.6570146", "0.6568105", "0.6555702", "0.6554882", "0.65469444", "0.65409625", "0.6536257", "0.65358245", "0.6531854", "0.65246665", "0.65054405", "0.64911914", "0.64863", "0.6484369", "0.64703876", "0.64675313", "0.6458833", "0.64488107", "0.6430326", "0.6429974", "0.64190686", "0.64054626", "0.6403392", "0.6396896", "0.6395364", "0.6389663", "0.63855916", "0.6381204", "0.6380786", "0.6379333", "0.6366245", "0.6363527", "0.6358346", "0.63576055", "0.6355422", "0.63552105", "0.6355148", "0.6354792", "0.6353585", "0.6353367", "0.6352131", "0.63510144", "0.6348833", "0.6345579", "0.6343882", "0.634281", "0.63411105", "0.63345194", "0.6329274", "0.63290346", "0.63260084", "0.63231313", "0.6322665", "0.6304579", "0.6303577", "0.63013446", "0.629871", "0.6298467", "0.6296548", "0.629177", "0.62899876", "0.62899876", "0.62867266", "0.6283229", "0.62669754", "0.62545675", "0.62526935", "0.62483317", "0.6247242" ]
0.66302425
24
Method to retrieve user, pass the context and user id, use this method when you need to edit user
retrieve(context, id){ HTTP.get(USERS + id) .then((resp) => { console.log(resp) context.usuario = resp.data.usuario; context.id = resp.data.id; }) .catch((err) => { console.log(err) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async get_user(user_id){\r\n\t\t\r\n\t\t//get user entry\r\n\t\tif(this.UsersInfo.has(user_id))\r\n\t\t\treturn this.UsersInfo.get(user_id)\r\n\t\telse \r\n\t\t\treturn this.load(user_id)\r\n\t}", "function getUserById(id) {\n // TODO: get user by id and set $scope.user to the user object. Angular will bind the object to the page \n }", "fetchUser(context) {\n return new Promise((resolve, reject) => {\n service\n .getUser()\n .then(function(user) {\n if (user == null) {\n context.dispatch('signIn');\n context.commit('setUser', null);\n return resolve(null);\n } else {\n context.commit('setUser', user);\n return resolve(user);\n }\n })\n .catch(function(err) {\n context.commit('setError', err);\n return reject(err);\n });\n });\n }", "getUser(_, { id }) {\n return db.user.findById(id);\n }", "function getUser () {return user;}", "user({user_id}, _, {loaders: {Users}, user}) {\n if (user && (user.hasRole('ADMIN') || user_id === user.id)) {\n return Users.getByID.load(user_id);\n }\n }", "async getUserForEdit(parent, {\n id\n }, context, info) {\n try {\n const user = await context.prisma.user.findUnique({\n where: {\n id\n },\n select: {\n name: true,\n email: true,\n password: true\n }\n });\n return user;\n } catch (error) {\n return error;\n }\n }", "getUserByID(userid, cb) {\n\t\tvar query = {\n\t\t\t_id: global.dbController.convertIdToObjectID(userid)\n\t\t}\n\t\tthis.getUserDetails(query, cb)\n\t}", "function getUser() {\n return user;\n }", "async user(obj, field, context, info) {\n const user = context.getUser()\n const usersService = context.get(\"users\");\n return await usersService.findOne(field.username, user);\n }", "function getUser(){\n return user;\n }", "function getCurrentUser() {\n let userId = $('#cu').data(\"cu\");\n user = new User({id: userId});\n return user;\n}", "function getUser (req, res) {\n promiseResponse(userStore.findOne({ userId: req.params.id }), res);\n}", "getUserById(id){\n return this.auth.get(`/user/${id}`,{}).then(({data})=> data);\n }", "async getUser () {\n\t\tthis.user = await this.data.users.getById(this.tokenInfo.userId);\n\t\tif (!this.user || this.user.get('deactivated')) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'user' });\n\t\t}\n\t}", "user(obj) {\n\n // Perform action and return promise\n return user.getUser({id: obj.author});\n }", "getUserById(db, userId) {\n return db('users').select('*').where('id', userId).first();\n }", "function getUserById(id){\n return $http.get(url.user + id).then( handleSuccess, handleError);\n }", "function getUserById(id) {\n return getUserByProperty('id', id);\n}", "async get(id) {\n try {\n let user;\n\n if (mongoose.Types.ObjectId.isValid(id)) {\n user = await this.findById(id).exec();\n }\n if (user) {\n return user;\n }\n\n throw new APIError({\n message: \"User does not exist\",\n status: httpStatus.NOT_FOUND,\n });\n } catch (error) {\n throw error;\n }\n }", "function getUser(id) {\n // return the one user with that id\n const user = users.find(user => user.id === id);\n return user;\n}", "function handleGetUser(){\n \n console.log('function handleGetUser() called.');\n \n app.context.getUser().then((user) => {\n \n console.log('app.context.getUser() promise has resolved.');\n \n log('Complete JSON string: ', user);\n log('user.id: ', user.id);\n log('user.orgId: ', user.orgId);\n log('user.email: ', user.email);\n log('user.displayName: ', user.displayName);\n log('user.token: ', user.token);\n \n }); // app.context.getUser().then((user) =>\n \n}", "function retrieveUserById(userId, callback) {\n var objUserId = undefined;\n try {\n objUserId = new ObjectId(userId);\n }\n catch (err) {\n objUserId = undefined;\n }\n retrieveUserByQuery({\"_id\": objUserId}, callback);\n}", "tryRetrieveUser(userid) {\n this.userService.getUser(userid).then(reply => {\n this.authModel$.next(reply);\n if (reply.firstName == null && window.location.pathname != \"/register\") {\n this.logger.log(\"new user\", \"\");\n this.router.navigate([\"register\"]);\n }\n else {\n this.isUserAdmin(userid);\n }\n }).catch(err => {\n this.logger.error(\"in checkAuth$\", err);\n this.isAdmin$.next(false);\n });\n }", "function getUserById(req, res) {\n var userId = req.params['userId'];\n\n userModel\n .findUserById(userId)\n .then(function (user) {\n res.json(user);\n });\n }", "async getUser(userId) {\n let userResult = await this.request(\"user/\" + userId);\n return userResult.user;\n }", "async getUser (_id) {\n let user = await this.models.users.findOne({_id: _id, deletedAt: null}, {password: 0})\n .populate('tickets');\n if (!user) {\n throw new Error();\n }\n return user;\n }", "function getActualUser() {\n $http.get('/user/data/' + $scope.profileUserId)\n .success(function(data) {\n console.log(data);\n $scope.profileUser = new User(data._id, data.firstName, data.lastName, data.username,\n data.password, data.gender, data.role, data.doctors);\n })\n .error(function(err) {\n console.log(err);\n });\n }", "getUserById(id) {\r\n return new SiteUser(this, `getUserById(${id})`);\r\n }", "function getUser(req, res) {\n var userId = req.params.id;\n\n User.findById(userId, (err, viewUser) => {\n if (err) {\n res.status(500).send(\"Error al solicitar el usuario\");\n } else {\n if (!viewUser) {\n res.status(404).send(\"No se ha podido llamar el usuario\");\n } else {\n res.status(200).send(viewUser);\n }\n }\n });\n}", "getUser({ commit, dispatch }, userid) {\n api(`account/${userid}`).then(res => {\n commit('setUserView', res.data)\n })\n }", "getUserFromFirebaseAuth(userId) {\n return this.auth.getUser(userId);\n }", "user(_, { id }) {\n return User.find(id);\n }", "function _getUserById(userId, callback)\n{\n validate.valID(userId, function (data)\n {\n if (data)\n {\n User.getUserById(userId, function (data2)\n {\n callback(data2)\n })\n } else callback(false)\n })\n}", "async AuthUser(parent, args, {req}) {\n try {\n let user = await UserModel.findOne({_id: req.user.user_id});\n\n if (user) {\n return user;\n }\n return null;\n } catch (err) {\n onError(err);\n }\n }", "function getUserById(userid) {\n}", "function getUserAndRedirect(){\n UserServices.getOne({action:$scope.user.id}).$promise.then(function(val){\n $scope.user = val;\n shareObjectService.addObject($scope.user);\n $state.go('app.auth.user.detail', {id:$scope.user.id});\n });\n }", "function successGetUserById(user) {\n return {\n type: ACTION.GET_USER_BY_ID_SUCCESS,\n user\n }\n}", "async getUser(uid) {\n return this.user[uid]\n }", "function user() {\n return currentUser;\n }", "function load(req, res, next, id) {\n _user2.default.get(id).then(function (user) {\n req.user = user; // eslint-disable-line\n return next();\n }).catch(function (e) {\n return next(e);\n });\n}", "async getUser(req, res, next) {\n try {\n let user = await this.controller.getUser(req.params.uid)\n if (user === null) {\n return res.status(httpStatus.NOT_FOUND)\n } else {\n return res.status(httpStatus.OK).json(user)\n }\n } catch (e) {\n next(e)\n }\n }", "function getUser() {\n if (promisedUser.data.success) {\n $scope.user = promisedUser.data.user;\n $window.sessionStorage.setItem('currentUser', JSON.stringify($scope.user));\n }\n }", "getUserById(userId) { //singleton!\n\t\treturn this._getSingleObject(\n\t\t\t(\n\t\t\t\t'SELECT * FROM USERS u ' + \n\t\t\t\t'WHERE u.user_id = :id'\n\t\t\t), \n\t\t\t{\n\t\t\t\tid: userId\n\t\t\t}\n\t\t);\n\t}", "getUserById(id, callback) {\r\n if (!id) {\r\n if (callback) {\r\n callback('No call ID passed', null);\r\n }\r\n return false;\r\n }\r\n var user = new User();\r\n user.load(id, function(error, user) {\r\n if (callback) {\r\n if (error) {\r\n callback(error, user);\r\n }\r\n callback(error, user);\r\n }\r\n });\r\n }", "async user(parent,{id},{dataSources}) { \n const user = await dataSources.users.getUser(id)\n return user;\n }", "function get_Current_User(id) {\r\n return c_users.find((p_user) => p_user.id === id);\r\n}", "function getAdminUser() {\n return user;\n}", "function getAdminUser() {\n return user;\n}", "function getUser(req, res, next){\n db.users.findOne({_id: mongojs.ObjectId(req.params.id)}, {pass: 0, admin: 0, email:0}, function(err, user){\n if(err){\n return res.json({success: false, message: err});\n }\n else if(!user){\n return res.json({success: false, message: 'Invalid User'});\n }\n else{\n req.user = user;\n next();\n }\n })\n}", "static async getById(id) {\n return await user_model.findById(id)\n }", "static getById(userId) {\n const query = 'SELECT * FROM Members WHERE id = $1 LIMIT 1';\n return db.one(query, [userId]).then(data => {\n return new User(data);\n }).catch(err => {\n console.error(err);\n console.error(`Couldn\\'t get user ${userId}.`);\n return null;\n });\n }", "function editUser(event) {\n var editButton = $(event.currentTarget);\n var userId = editButton\n .parent()\n .parent()\n .parent()\n .attr('id');\n userId = parseInt(userId);\n currentUserID = userId;\n userService\n .findUserById(userId)\n .then(renderUser);\n }", "function getUser(id,res) {\n var user;\n if ( id && id !== '' && id !== undefined ) {\n userDbStub.forEach(function(element) {\n if(element.id === id ) {\n user = element;\n }\n }, this); \n \n if( !user && user === undefined) {\n if(res != null){\n res.status(404).send('user not found');\n }else{\n console.log('user not found');\n } \n }\n \n } else {\n if(res != null){\n res.status(401).send('id isn\\'t defined'); \n }else{\n console.log('id isn\\'t defined');\n } \n } \n return user;\n}", "function getUser(app){\n\treturn function(req, res){\n\t\tconst id = req.params.id;\n\t\tif(typeof id === 'undefined'){\n\t\t\tres.sendStatus(BAD_REQUEST);\n\t\t}\n\t\telse{\n\t\t\treq.app.locals.model.users.getUser(id).\n\t\t\t\tthen((results) => res.json(results)).\n\t\t\t\tcatch((err) => {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\tres.sendStatus(NOT_FOUND);\n\t\t\t\t});\n\t\t}\n\t};\n}", "function getCurrentUser(id) {\n // SERVER_CALL Get information of user profile from server\n // For now return fake user we created\n user = patientList.filter(function(account) {\n return account.id == id;\n })[0];\n}", "function getUser(userStore, userId) {\n return userStore.get('users').find(function (u) {\n return u.userId === userId;\n });\n}", "getUser(id){\n //postDB(\"user/Get\", { \"use_id\" : id });\n return { \"name\" : \"steven\", \"img\" : '', \"share\" : false };\n }", "get user() {\n return ( async () => this._user || await this.retrieve() )();\n }", "fetchUser() {\n\t\tconst user = _userFromAccessToken(_accessToken);\n\t\treturn _makeRequest('/users/' + user.id, {needsAuth: true})\n\t\t\t.then(responseData => {\n\t\t\t\tif(responseData.success){\n\t\t\t\t\treturn responseData.user;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tconsole.error(error);\n\t\t\t});\n\t}", "async getUser (req, res) {\n const findOneUserQuery = `\n SELECT avatar, firstname, lastname, email, username, location, bio\n FROM users\n WHERE username = $1\n `;\n\n try {\n\n // A user must be signed in to see edit information\n // Signed in user must also be requesting their own user data.\n if (!req.user || req.user.username !== req.params.username) {\n return res.status(403).send('You\\'re not allowed to edit this profile');\n }\n\n const { rows } = await db.query(findOneUserQuery, [ req.params.username ]);\n const profileUser = rows[0];\n\n // If profile user was not found in database\n if (!profileUser) {\n return res.status(404).send('User not found');\n }\n\n return res.status(200).json({ profileUser });\n } catch (error) {\n return res.status(400).send(error);\n }\n }", "async getUser(ctx) {\n\n try {\n const _id = ctx.request.params.id;\n const userData = await User.findById(_id);\n console.log(userData);\n if (!userData) {\n return ctx.body;\n }\n else {\n ctx.body = { userData };\n }\n }\n catch (error) {\n ctx.throw(error);\n }\n }", "function gotUser(err, user) {\n if (err) return callback(err);\n callback(null, user);\n }", "async function getUser(req, res, next) {\n\tlet user;\n\ttry {\n\t\tuser = await User.findById(req.params.userid);\n\t} catch (err) {\n\t\treturn res.status(404).send(err.message);\n\t}\n\tres.user = user;\n\tnext();\n}", "async function userById(req, res, next, id) {\n try {\n let user = await userModel_1.default.findById(id);\n if (!user) {\n res.status(400).json({\n error: \"User not found\",\n });\n }\n req.profile = user;\n next();\n }\n catch (err) {\n return res.status(400).json({\n error: \"Could not retrieve User\",\n });\n }\n}", "function getUserData(id, type) {\n var queryUrl;\n switch (type) {\n case \"user\":\n queryUrl = \"/api/users/\" + id;\n break;\n case \"group\":\n queryUrl = \"/api/groups/\" + id;\n break;\n default:\n return;\n }\n $.get(queryUrl, function(data) {\n if (data) {\n console.log(data.GroupId || data.id);\n // If this user exists, prefill our cms forms with its data\n usernameInput.val(data.username);\n \n groupId = data.GroupId || data.id;\n // If we have a user with this id, set a flag for us to know to update the user\n // when we hit submit\n updating = true;\n }\n });\n }", "function fetchUser() {\n const userId = document.getElementById('user-id').value\n client.user.fetch(userId)\n}", "function get_user(uid, cb) {\n User.findOne({\n id: uid\n }, function(err, u) {\n if (!err && u) {\n cb(u);\n }\n })\n}", "getUser() {\r\n return (this.user instanceof core.User) ? this.user : core.User.fromJWT(this.user);\r\n }", "function findUserById(req, res) {\n var userId = req.params['userId'];\n\n userModel\n .findUserById(userId)\n .then(function (user) {\n res.json(user);\n });\n\n }", "function findUserById(userId) {\n return userService.findUserById(userId);\n }", "function getUser(req, res) {\n User.findById(req.params.id, function (err, user) {\n if (err) return res.status(500).send(\"There was a problem finding the user.\");\n if (!user) return res.status(404).send(\"No user found.\");\n res.status(200).send(user);\n });\n}", "getCurrentUser() {\n var self = this;\n return self.user;\n }", "async getUserById(userId) {\n return db.oneOrNone('select * from users where user_id = $1', userId)\n }", "async function getUser(req, res) {\n try {\n const user = await User.findById(req.currentUser.id);\n if (user.id !== req.params.id) {\n return res.status(401).json({ message: \"Unauthorised\" });\n }\n if (!user) return res.status(404).json({ message: \"User not found\" });\n res.status(200).json(user);\n } catch (err) {\n res.status(400).json(err.message);\n }\n}", "get user() {\n return this._model.data\n }", "static async editUserForm(userId, req, res, next) {\n\t\tlet user = await userModel.getUser(userId);\n\n\t\tif (user[0]) {\n\t\t\tuser = user[0];\n\t\t\tuser.hasImage = this.hasImage(userId);\n\t\t\tlet data = {\n\t\t\t\ttitle: \"User\",\n\t\t\t\tuser: user,\n\t\t\t\tnav: await navmenuModel.getNavmenu()\n\t\t\t};\n\t\t\tif (cfgControllers.json) {\n\t\t\t\treturn res.json(data);\n\t\t\t} else {\n\t\t\t\treturn res.render(\"user/editprofile\", data);\n\t\t\t}\n\t\t} else {\n\t\t\tnext();\n\t\t}\n\t}", "getCurrentUser(request, response, next) {\n const args = {\n tenant_id: request.session.tenant_id,\n user_id: request.params.user_id,\n };\n\n UsersService.prototype.getCurrentUserEntities(args).then((user) => {\n response.json(\n user,\n );\n }).catch((error) => next(error));\n }", "function load (req, res, next, id) {\n User.get(id)\n .then(user => {\n req.user = user // eslint-disable-line no-param-reassign\n return next()\n })\n .catch(e => next(e))\n}", "function getUserById(user_id) {\n return User.findById(user_id);\n}", "function getUserID(res, mysql, context, id, complete) {\n mysql.pool.query(\"SELECT * FROM users WHERE user_id = ?\", id, (error, results, fields) => {\n if (error) {\n res.write(JSON.stringify(error));\n res.end();\n }\n context.users = results[0];\n complete();\n });\n }", "function selectUser(event) {\n var editBtn = $(event.target);\n editIndex = editBtn.attr(\"id\").split('-')[1];\n selectedUserId = users[editIndex]._id;\n try {\n userService.findUserById(selectedUserId)\n .then(function (userInfo) {\n console.log(\"userInfo from findUserById\", userInfo);\n $usernameFld.val(userInfo.username);\n $passwordFld.val(userInfo.password);\n $firstNameFld.val(userInfo.firstName);\n $lastNameFld.val(userInfo.lastName);\n $roleFld.val(userInfo.role);\n selectedUser = userInfo;\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "function getOne(req,res, next) {\n userDb.findUser(req.params.id)\n .then(data=> {\n res.locals.user = data;\n next();\n })\n .catch(err=> {\n next(err);\n })\n}", "function viewUser(id) {\r\n console.log('Inside user factory now');\r\n var deferred = $q.defer();\r\n\r\n $http.get(userUrl + '/user/' + id)\r\n .then (\r\n function(response) {\r\n deferred.resolve(response.data);\r\n },\r\n function(errResponse) {\r\n deferred.reject(errResponse);\r\n }\r\n );\r\n return deferred.promise;\r\n }", "async getUser(uid) {\n console.log('GET /user/%s', uid)\n return this.server.getUser(uid)\n }", "function api_getuser(ctx) {\n api_req({\n a: 'ug'\n }, ctx);\n}", "function getUser(req, res){\r\n var userId=req.params.id;\r\n User.findById(userId).exec((err, user) => {\r\n if(err){\r\n res.status(500).send({message:'Se ha producido un error en la peticion'});\r\n }else{\r\n if(!user){\r\n res.status(404).send({message:'No se ha encontrado lista de administradores de institucion'});\r\n }else{\r\n res.status(200).send({user});\r\n }\r\n }\r\n });\r\n}", "function getUser(req, res, next) {\n User.findOne({_id: req.params.id}, function (err, user) {\n if (err) {\n return res.status(400).send(err);\n } else if (user == null) {\n return res.status(404).send({});\n } else {\n return res.status(200).send(user);\n }\n });\n}", "function findUserById(req, res){\n var userId = req.params.userId;\n userModel\n .findUserById(userId)\n .then(\n function(user) {\n if(user === null) {\n res.status(400).send(\"User \" + userId + \" not found\")\n } else {\n res.json(user);\n }\n },\n function(error) {\n res.status(400).send(\"User \" + userId + \" not found\")\n }\n );\n }", "user({ id }) {\n return User.findById(id);\n }", "function GetUser(userId) {\n var params = userId + \"/\" + 1;\n var user = BitzerIocAdminService.GetUserProfileById(params);\n user.then(function (result) {\n if (result.data != \"\" || result.data != null) {\n $scope.UserId = result.data.userId;\n $scope.Email = result.data.email;\n $scope.Name = result.data.name;\n $scope.RoleId = result.data.roleId[0];\n $scope.HiddenRoleId = result.data.roleId[0];\n $scope.Phone = result.data.phoneNumber == \"004500000000\" ? \"\" : result.data.phoneNumber;\n $scope.IsEnable = result.data.isEnable;\n $('#txtEmail').attr('disabled', true);\n }\n });\n }", "function getUserFromId(id) {\n let users = getUsers();\n if(users === null) return null;\n return users.find(u => u.user_id === id);\n}", "static async getUser(id) {\n const userRes = await db.query(\n ` SELECT username,\n first_name,\n last_name,\n email,\n photo_url\n FROM users\n WHERE id = $1`,\n [id]\n );\n\n const user = userRes.rows[0];\n\n if (!user) {\n throw new ExpressError(`There exists no user with id '${id}'`, 404);\n }\n\n return user;\n }", "function getUserById (id) {\n\n\tvar deferred = Q.defer();\n\n\tUser.findOne({_id: id}, {password:0})\n\t.then(user => {\n\t\tdeferred.resolve(user);\n\t})\n\t.catch(err => {\n\t\tdeferred.reject(err);\n\t});\n\n\treturn deferred.promise\n}", "function load (req, res, next, id) {\n User.get(id)\n .then((result) => {\n req.user = result;\n return next()\n })\n .catch(e => next(e))\n}", "function getUser(id, done, next){\r\n User.findById(id).then((user) => {\r\n if(!user) return done({error: 'User not found'});\r\n return done(user);\r\n }).catch(next);\r\n}", "getCurrentUserId() {\r\n return JSON.parse(localStorage.getItem(\"user\")).id;\r\n }", "function getCurrentUser(id){\n return users.find(user => user.id === id);\n}", "function getUser(req, res) {\n var userId = req.params.id;\n\n User.findById(userId, (err, user) => {\n if (err) {\n return res.status(500).send({\n message: 'Error en la petición'\n });\n }\n if (!user) {\n return res.status(404).send({\n message: 'Usuario no existe'\n });\n }\n followThisUser(req.user.sub, userId).then((value) => {\n user.password = undefined;\n return res.status(200).send({\n user,\n following: value.following,\n followed: value.followed,\n });\n });\n });\n}", "function checkUser() {\n $.get(\"/api/user_data\").then(function (data) {\n userId = data.id;\n console.log(userId);\n return userId;\n });\n }" ]
[ "0.74389935", "0.71849304", "0.7164879", "0.70756245", "0.70740676", "0.7012805", "0.69251674", "0.688234", "0.68064994", "0.67880654", "0.677974", "0.6770735", "0.67553496", "0.6745734", "0.6650322", "0.6642438", "0.66398567", "0.6637054", "0.66314864", "0.6627845", "0.6623942", "0.66068894", "0.6588174", "0.6586808", "0.6583788", "0.6579466", "0.6578211", "0.65746385", "0.6572573", "0.6558971", "0.65512687", "0.654867", "0.65481097", "0.65480626", "0.65444136", "0.6538874", "0.6523166", "0.65212077", "0.65025425", "0.64957285", "0.6489854", "0.648725", "0.64828604", "0.6480833", "0.6478101", "0.6470703", "0.6469457", "0.6465138", "0.6465138", "0.64641815", "0.64624625", "0.64548254", "0.64416504", "0.6421874", "0.64180183", "0.6412605", "0.6410944", "0.64080775", "0.63866305", "0.6380562", "0.6376349", "0.6375939", "0.63673353", "0.63653386", "0.63558155", "0.63525695", "0.6348542", "0.63478047", "0.6346805", "0.6343291", "0.6343156", "0.6340211", "0.63400507", "0.63389224", "0.63343984", "0.63321984", "0.6329721", "0.6329038", "0.6328375", "0.63265234", "0.6319676", "0.6312824", "0.63056445", "0.6304258", "0.63039994", "0.6298715", "0.6298622", "0.6298521", "0.62981683", "0.6297256", "0.6291181", "0.62908214", "0.62903225", "0.62819266", "0.62791085", "0.6275952", "0.62733895", "0.6263003", "0.6258152", "0.6254549" ]
0.64289975
53
Function to check Player life status
isAlive() { if (this.hp > 0) { return true; } else { this.state = LOSER; return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkPlayerCondition() {\r\n\r\n\tif (player.health < 1) {\r\n\t\tplayer.lives--;\r\n\t\tplayer.initCheckpoint();\r\n\t}\r\n\r\n\tif (player.y > 1350) {\r\n\t\t\r\n\t\tSounds.yell.play();\r\n\t\tplayer.lives--;\r\n\t\tplayer.grounded = true;\r\n\t\tplayer.airborne = false;\r\n\t\tplayer.jumping = false;\r\n\t\tplayer.velY = 0;\r\n\t\tplayer.health = 3;\r\n\t\t\r\n\t\tif (player.lives > 0) {\r\n\t\t\tplayer.init(-25, 546);\r\n\t\t}\r\n\r\n\t\r\n\t}\r\n\t\r\n\tif (player.lives < 1) {\r\n\t\tplayer.init(-200,-200);\r\n\t\tgameOver = true;\r\n\t}\r\n\r\n}", "function CheckAlive() {\n\tif(this.currentHealth <= 0) {\n\t\tDie();\n\t}\n}", "function checkStatus() {\n checkWin();\n checkLose();\n }", "function isAlive(playerName,points){\n\tif(playerName == \"ikk\" && points > 30 || playerName == \"gut\" && points > 10){\n\t\treturn true\n\t}else{\n\t\treturn false\n\t}\n}", "function checkAlive(health){\n if (health <=0){\n return false\n }else{\n return true\n }\n}", "checkAlive(){\n if (this.lifeTime > 1000){\n this.alive = false;\n this.lifeTime = 0;\n }\n\n }", "function check_health()\n{\n\tif(player['health'] <= 0){\n\t\tplayer['dead'] = true;\n\t}\n}", "status(){\n if(this.facedown.length <= 0){\n inProgress = false;\n console.log(\"GAME OVER\");\n }\n }", "function checkAlive (health) {\n return !(health <= 0)\n}", "function checkGameStatus(){\r\n\tnumTurns++; //count turn\r\n\t\r\n\tif (checkWin()) {\r\n\t\tgameStatus = currentPlayer + \" Wins\";\r\n\t\tconsole.log(\"Game status: \" + gameStatus);\r\n\t}else if (numTurns == 9) {\r\n\t\tgameStatus = \"TIE\";\r\n\t\tconsole.log(\"Game status: \" + gameStatus);\r\n\t}\r\n\t\r\n\tcurrentPlayer = (currentPlayer == \"X\" ? \"O\" : \"X\");\r\n\t\r\n\tif (gameStatus != \"\"){\r\n\t\tshowLightBox(\"Game is Over: \", gameStatus);\r\n\t\tconsole.log(\"Game is Over: \" + gameStatus);\r\n\t}\r\n} // checkGameStatus", "checkDeath() {\n if(this.lives <= 0) {\n this.isDead = true;\n }\n }", "function loseLife() {\n // Only decrement when greater than zero\n if (player.lives > 0) {\n player.lives--; // decrement lives\n const lives = document.querySelectorAll('.lifebar img'); // Get the life meter\n lives[player.lives].classList.toggle('hide'); // Remove one life on screen\n }\n if (player.lives === 0) {\n gameOver();\n }\n}", "function checkGameStatus() {\n if (xCor[xCor.length - 1] > width ||\n xCor[xCor.length - 1] < 0 ||\n yCor[yCor.length - 1] > height ||\n yCor[yCor.length - 1] < 0 ||\n checkSnakeCollision()) {\n noLoop();\n var scoreVal = parseInt(scoreElem.html().substring(8));\n scoreElem.html('Game ended! Your score was : ' + scoreVal);\n synth.triggerAttackRelease('C2', '4n');\n }\n}", "function checkGameStatus() {\n\tnumTurns++; // count turn\n\t\n\t// check for a Win\n\tif (checkWin()) {\n\t\tgameStatus = currentPlayer + \" wins!\";\n\t} // if\n\t\n\t// check for tie\n\tif (numTurns == 9) {\n\t\tgameStatus = \"Tie Game!\";\n\t} // if\n\t\n\t// switch current player\n\tcurrentPlayer = (currentPlayer == \"X\" ? \"O\" : \"X\");\n\t\n\t// game is over\n\tif(gameStatus != \"\"){\n\t\tsetTimeout(function() {showLightBox(gameStatus, \"Game Over.\");}, 500);\n\t} // if\n\n} // checkGameStatus()", "function gameStatus() {\n if (enemyHealth === totalScore) {\n isGameOver = true;\n $(\"#gameoverbox\").text(\"You defeated the Supreme Leader!!!\");\n wins++;\n totalScore = 0;\n reset();\n } else if (totalScore > enemyHealth) {\n isGameOver = true;\n\n $(\"#gameoverbox\").text(\"You were defeated!!! GAME OVER!!!\");\n losses++;\n totalScore = 0;\n reset();\n }\n }", "checkifGameOver(){\n\t\t//Checks if all players are dead\n\t\tvar gameOver = false;\t\t\n\t\tif(this.player.dead && this.otherPlayer.dead){\n\t\t\tgameOver = true;\n\t\t}\n\n\t\n\t\tif(gameOver) this.gameOver();\n\t}", "function checkGameStatus() {\r\n\tnumTurns++;\r\n\t\r\n\t//check win\r\n\tif (checkWin()) {\r\n\t\tgameStatus = currentPlayer + \" Wins!\";\r\n\t\t\r\n\t}\r\n\t\r\n\t//chec for tie\r\n\tif (numTurns == 9) {\r\n\t\tgameStatus = \"Tie Game\";\r\n\t\t\r\n\t}//numTurns\r\n\t\t\r\n\t//switch current player\r\n\tcurrentPlayer = (currentPlayer == \"X\" ? \"O\" : \"X\");\r\n\t\r\n\t//game is over\t\r\n\tif(gameStatus != \"\") {\r\n\t\tsetTimeout(function() { showLightBox(gameStatus, \"Game Over.\");}, 500);\r\n\t\t\r\n\t}\r\n\t\r\n} //check game status", "checkCollisions() {\n livesTracker.innerHTML = player.lives;\n \n if (player.x < this.x + this.width &&\n player.x + player.width > this.x &&\n player.y < this.y + this.height &&\n player.height + player.y > this.y) {\n \n //if collide, moves player back to starting position, and -1 life.\n player.x = 200;\n player.y = 485;\n player.lives--;\n //if player life = 0 , game resets\n player.gameLost();\n }\n }", "function checkGameStatus(){\r\n\r\n\tnumTurns++; //count turn\r\n\t\r\n\t//check for a win\r\n\tif(checkWin()){\r\n\t\tgameStatus = currentPlayer + \" wins!\";\r\n\t}//if\r\n\t\r\n\r\n\t\r\n\t\tif(gameStatus != \"\"){\r\n\t\tsetTimeout(function(){showLightBox(gameStatus, \"Game Over.\");},500);\r\n\t}//if\r\n\t\r\n}// checkGameStatus", "function livesDown()\r\n{\r\n if(bonusHeartCount == 0)\r\n bonusHeartCount = 1;\r\n\r\n //change the relevent status from visable to hidden\r\n if(lives == 3){\r\n document.getElementById(\"firstLife\").style.visibility = \"hidden\";\r\n }\r\n else if(lives == 2){\r\n document.getElementById(\"secondLastLife\").style.visibility = \"hidden\";\r\n }\r\n else if(lives == 1){\r\n document.getElementById(\"lastLife\").style.visibility = \"hidden\";\r\n }\r\n lives--;\r\n\r\n //if the player stil have live - he didnt lost yet- then reset the board\r\n if(lives > 0)\r\n reset(board);\r\n}", "function isJonAlive(){ //reusable function to check if Jon is alive, functions to run until called\n if(jonSnowHealth > 0){\n console.log('Jon is alive')\n } else {\n console.log('RIP Jon Snow')\n }\n}", "checkHealthAndFood() {\n\n\n if (this.currPlayerHealth <= 0 || this.playerFood <= 0) {\n this.gameOver();\n }\n\n if (this.currPlayerHealth <= 25) {\n //this.toggleBlink(\"healthElement\");\n this.lowHealth = true;\n }\n\n }", "function monitorGame(){\n //cheack the eggs in player\n checkContainer();\n checkTnt();\n checkPirate();\n checkPirateHit();\n checkCarrierHit();\n checkPlayerHit();\n dead();\n}", "function checkGameOver(totalDead){\n if(totalDead >= globalPopulation && gameOver != 3){\n gameOver = 1; // winner\n }else if (cure.progressRate > 100 && gameOver != 3) {\n gameOver = 2; // loser\n }\n}", "function checkPowerUps() {\n if (player.animating) {\n return;\n }\n checkGoal();\n var rect2 = null, rect1 = player.getBounds();\n\n /* Touching a gem will give you 1 extra score */\n if (collectibles.gem) {\n rect2 = collectibles.gem.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n score += 1;\n collectibles.gem = false;\n }\n }\n /* Touching a star will give you 2 extra score and 1 extra life */\n if (collectibles.life) {\n rect2 = collectibles.life.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n lives++;\n if (lives > 3) {\n lives = 3;\n }\n score += 2;\n collectibles.life = false;\n }\n }\n /* Touching a key will give you 2 extra score and the grid row\n * will change in the next level.\n */\n if (collectibles.key) {\n rect2 = collectibles.key.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n changeRows = true;\n score += 2;\n collectibles.key = false;\n }\n }\n }", "function checkGameOver() {\r\n if (lives == 0) {\r\n console.log(\"game over\");\r\n return true;\r\n }\r\n return false;\r\n}", "function checkCollisions() {\n player.collision();\n myPara.textContent = 'Life Lost! ';\n messageDisplay();\n player.x = 2;\n player.y = 5;\n\n if (player.lives === 0) {\n modalLost.style.display = 'block';\n modalWin.style.display = 'none';\n modalOpen();\n }\n}", "function checkLives() {\n if (lives <= 0) {\n swal(\"Game Over!\", \"You reached Level \" + level + \" in \" + time + \" seconds!\", \"error\");\n stopTimer();\n newGame();\n } else {\n swal(\"Whatch out! Lives don't grow on trees, you know.\" ,\"You get one heart every 5 levels.\", \"warning\");\n }\n}", "function checkGameStatus() {\n if (!gGame.isOn && gGame.shownCount === 0) {\n gStartTime = Date.now();\n gGameInterval = setInterval(showTime, 1000)\n gGame.isOn = true;\n } else return false;\n}", "function playerDeathCheck() {\n if (player.hp < 0) {\n player.hp = 0;\n playerHp.innerText = player.name + ' hit points: ' + player.hp;\n go.style.display = 'none';\n newMessage(player.name + ' died. GAME OVER');\n } else {\n player.hp = player.hp;\n }\n}", "function checkLives(lives) {\r\n if (lives <= 0){\r\n getGameOver.innerHTML = \"You lost\";\r\n getGameOver.style.display = \"block\";\r\n getRestartGame.style.display = \"block\";\r\n\r\n updateHighscore();\r\n }\r\n}", "function CheckStateChange() {// decision tree to see if we need to change states\n\tif (currentState != enemyStates.start) {// to make sure we don't change state during the start state, check it\n\t\t// if playerLocation.Count > 1 then we need to follow waypoint\n\t\t// if playerLocation.Count = 1 then we need to follow player\n\t\tif (playerLocation.Count > 1) {// path to player is the number of waypoints to the player, and if there is more than one, we need to follow the waypoints\n\t\t\t//currentState = enemyStates.run; // run after the waypoint\n\t\t} else {// path to player is the number of waypoints to the player, and if there is one, we're at the closest waypoint to the player\n\t\t\t// test if we are close enough to the player to say we saw them\n\t\t\tvar distanceToPlayer = Vector3.Distance(transform.position,playerTransform.position); // see how far we are from the player\n\t\t\tif (distanceToPlayer < sawPlayerDistance) {// Are we close enough to run after the player?\n\t\t\t\tif (distanceToPlayer < attackDistance) { // Are we close enough to attack the player?\n\t\t\t\t\tif(distanceToPlayer < hitDistance){// Are we close enough to hit the player?\n\t\t\t\t\t// hit the player, let game know and die\n\t\t\t\t\t\tNotificationCenter.DefaultCenter().PostNotification(this,\"EnemyDead\"); // tell other objects that we died to attack the player\n\t\t\t\t\t\tDie();// and we explode (die)\n\t\t\t\t\t} else { // if we are NOT close enough to hit the player\n\t\t\t\t\tcurrentState = enemyStates.attack;// ATTACK\n\t\t\t\t\t}// end HIT else\n\t\t\t\t} else {// if we are NOT close enough to attack the player\n\t\t\t\tcurrentState = enemyStates.sawPlayer;// GET HIM\n\t\t\t\t} // end ATTACK else\n\t\t\t}// end saw player IF\n\t\t}// end player location count IF\n\t}// end start state check IF\n}// end CheckStateChange function", "function enemyStatus() {\n var el = enemies.length;\n eNums.data = destroyedCount+\" of \"+el+\" of \"+(Basics.levelShips+(level-1)*2);\n if (el && (Basics.levelShips+(level-1)*2) == destroyedCount) {\n level++; score += 10;\n message(\"Next level reached, bonus added!\");\n eLevel.data = \"Level: \"+level;\n addScore(0);\n Settings.setNight();\n afterLevel(1);\n }\n}", "function logPlayerStatus() {\n console.table(getPlayerStatus());\n}", "function checkHealth(){\n if(health <= 0){\n revealAnswer();\n losses++;\n lossesText.innerText = losses;\n setTimeout(function(){\n if(confirm(\"Game Over! You lost. Play Again?\")){\n newGame();\n }\n },10);\n \n }\n }", "function checks(){\n\t\t// check if all players have voted.\n\n\t\t$.post('./handle/heartbeat.php',{},\n\t\t\tfunction(data){\n\t\t\t\tvar array = JSON.parse(data);\n\t\t\t\t// if the player is inactive, send them back to home screen\n\t\t\t\tif (array['checkPlayer'] == 1){\n\t\t\t\t\twindow.location.href= \"http://\"+location.host+\"/game\";\n\t\t\t\t}\n\t\t\t\telse{}\n\t\t\t\t\n\t\t\t\t// if everybody has voted, set a new black card and refresh the screen\n\t\t\t\tif (array['checkVote'] == 1){\n\t\t\t\t\t$('.player').removeClass('played');\n\t\t\t\t}\n\t\t\t\telse{}\n\t\t});\n\t}", "function checkPlayerDie(player, olive) {\n\n // TODO: check the kind of olive enemy.\n\n var criteria1 = (player.body.touching.up);\n\n var playerX = player.body.x;\n var oliveX = olive.body.x;\n\n var difference = game.math.difference(playerX, oliveX)\n\n if (criteria1 && difference < 30) {\n\n dyingFromOlive = true;\n\n dieFromGreenOlive(olive);\n\n }\n}", "isAlive() {\r\n return this.health > 0;\r\n }", "isAlive() {\r\n return this.health > 0;\r\n }", "isGameOver() {\n\n let gameIsOver = false;\n let playersAliveCounter = 0;\n let lastPlayerAlive;\n\n //Cuenta los jugadores vivos\n GameElements.players.forEach(player => {\n if (!player.isDead) {\n playersAliveCounter++;\n lastPlayerAlive = player;\n }\n });\n\n //Si solo queda un jugador vivo , es el ganador\n if (playersAliveCounter == 1) {\n gameIsOver = true;\n this.winner = {\n id: lastPlayerAlive.id,\n name: lastPlayerAlive.name\n }\n }\n //Si los jugadores mueren todos al mismo tiempo, no hay ganador\n if (playersAliveCounter == 0) {\n gameIsOver = true;\n this.winner = null;\n }\n //Si se acaba el tiempo, lo cual no puede pasar porque las paredes \n //matarian antes de llegar el tiempo a 0\n if (this.time.minutes == 0 && this.time.seconds == 0) {\n gameIsOver = true;\n }\n return gameIsOver;\n\n }", "function loseLife() {\n\n // Decrease the number of lives the player has remaining\n _lives--;\n\n // Pause the player's movements\n freezePlayer();\n\n // Inform other code modules that the player has lost a life\n Frogger.observer.publish(\"player-lost-life\");\n\n if (_lives === 0) {\n // Declare the game to be over if the player has no lives remaining\n gameOver();\n } else {\n\n // If there are lives remaining, wait 2000 milliseconds (2 seconds) before\n // resetting the player's character and other obstacles to their initial\n // positions on the game board\n setTimeout(reset, 2000);\n }\n }", "function status() {\n console.log(`Active : ${game.active}`)\n console.log(`Points : ${game.points}`)\n console.log(`Strikes : ${game.strikes} out of ${game.maxStrikes}`)\n console.log(`Passes : ${game.passes} out of ${game.maxPasses}`)\n console.log(`Words : ${game.words}`)\n console.log(`Word : ${game.word}`)\n console.log(`Scrambled : ${game.scrambled}`)\n }", "function takeLife() {\n if (nodeListOfDivs[walker.index].classList.contains('life')) {\n nodeListOfDivs[walker.index].classList.remove('life')\n score = score + 2;\n audioWaterDrop.play();\n displayScore.innerHTML = score;\n }\n }", "function alive(obj) {\n if (obj.health > 0) {\n return true;\n };\n return false;\n}", "everyoneDead(){\r\n\t\tfor(let i=0; i<this.n; i++){\r\n\t\t\tif(this.players[i].game.alive == true){\r\n\t\t\t\treturn false\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true\r\n\t}", "function _checkPlayer(player) {\n\t\t// We are going to check the player with the server.\n\t\t// There can be 3 possible status':\n\t\t// 1. okay - player is valid to play\n\t\t// 2. finished - player has used all plays\n\t\t// 3. error - player not found\n\t\t$.getJSON( \"/v5/gameapi.php?action=checkPlayer\", { player: player } )\n\t\t\t.done( function( json ) {\n\t\t\t\tlog('API: checkPlayer returned: player: '+json.player+' , status: '+json.status+' , no. of plays: '+json.numberOfPlays);\n\t\t\t\tlog( \"API: Raise event: playerStatusChecked\" );\n\t\t\t\t$.event.trigger({\n\t\t\t\t\ttype: \"playerStatusChecked\",\n\t\t\t\t\tplayer: json.player,\n\t\t\t\t\tstatus: json.status,\n\t\t\t\t\tnumberOfPlays: json.numberOfPlays\n\t\t\t\t});\n\t\t\t})\n\t\t\t.fail( function( jqxhr, textStatus, error ) {\n\t\t\t\tvar err = textStatus + ', ' + error;\n\t\t\t\tlog( \"API: checkPlayer Request Failed: \" + err);\n\t\t\t});\n\t }", "function checkPlayerDie() {\n\tif (gameChar_y > height) {\n\t\tlives -= 1;\n\t\tstartGame();\n\t\tsplashSound.play();\n\t}\n}", "isPlayerDead() {\n return this.player.health <= 0;\n }", "function playerMonitor() {\n for (var i = 0; i <= nextLevel.length; i++) {\n if (currentXP == nextLevel[i]) {\n playerLevel++, playerStrength += 2, playerAgility += 2, playerAttack += 2, playerDefense++,\n playerMaxHealth += 10, playerHealth += 10;\n for (v = 1; v <= playerMaxHealth; v++) {\n if (playerHealth < playerMaxHealth) {\n playerHealth++;\n }\n }\n }\n }\n}", "function checkGameOver() {\n if (predatorGroup[0].health <= 1 || predatorGroup[1].health <= 1 || predatorGroup[2].health <= 1) {\n playGame = \"E\";\n console.log(\"game over\");\n }\n}", "function checkStatus(){\n if(!isPlaying && time === 0){\n message.innerHTML = 'Koniec gry!';\n message.style.color= 'red';\n //if end game reset score\n score = -1;\n }\n}", "function checkHp() {\n if (heroHp <= 0) {\n window.location.href = \"game-over.html\";\n } else if (villainHp <= 0) {\n moveToVillainDeathArea();\n gameStart = false;\n villain = null;\n enemyCounter++;\n checkIfWon();\n //test\n // console.log(\"villain defeated\")\n }\n }", "function checkGameStatus() {\r\n\tnumTurns++; //count turns\r\n\t\r\n\t//check for tie\r\n\tif (numTurns == 9) {\r\n\t\tgameStatus = \"Tie Game\";\r\n\t}//numTurns\r\n\t\r\n\t//check window\r\n\tif (checkWin()) {\r\n\t\tgameStatus = currentPlayer + \" wins!\";\r\n\t}//check wins\r\n\r\n\t//switch current player\r\n\tcurrentPlayer = (currentPlayer == \"X\" ? \"O\" : \"X\" );\r\n}//checkGameStatus", "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 checkLoss(){\n if(lifePoints <= 0) {\n document.getElementById(\"gameover-image\").style.cssText = \"display: block\";\n document.getElementById(\"pressKeyTryAgain\").style.cssText = \"display:block\";\n losses++;\n finished = true;\n }\n}", "function checkLives() {\n\tif (lives <= 0){\n\t\tscore = (winCount * 100) + (lives * 1000);\n\t\tcheckScore();\n\t\tendGame();\n\t}\n\tif (numberPokemon<= 0){\n\t\tscore = (winCount * 100) + (lives * 1000);\n\t\tcheckScore();\n\t\tendGame(); \n\t}\n}", "function checkGameStatus(cellI, cellJ) {\n\n //set gState.isGameOn && gState.isVictory:\n if (gBoard[cellI][cellJ].isExplodedBomb) {\n gState.isGameOn = false;\n gState.isVictory = false;\n }\n var maxShown = gLevel.SIZE * gLevel.SIZE - gLevel.MINES;\n if (gState.shownCount === maxShown && gState.markedCount === gLevel.MINES) {\n gState.isGameOn = false;\n gState.isVictory = true;\n } \n\n //act according to the result: \n //if game is lost\n if (!gState.isGameOn && !gState.isVictory) {\n console.log('lost!');\n showAllBombs(gBoard, gBombs);\n showGameEndPopup('You Lost');\n }\n //if game is won\n if (gState.isVictory) {\n console.log('victory!');\n showGameEndPopup('Victorious!');\n }\n //if game is done (lost/win), reset stuff\n if (!gState.isGameOn) gameOver(); \n}", "function checkPortal() {\n\n // Check whether the player has collided with the portal and all keys are collected\n if(blockCollision(playerRect, goalRect) && keysCollected) {\n \n // Move the goal and player off screen\n playerRect.x = -20;\n goalRect.x = -50;\n \n // Prevent game running\n running = false;\n \n // Reset\n setup();\n \n // Set on ice to false\n onice = false;\n \n // Reset the goal colour\n goalRect.colour = color(0);\n\n // Reload the level\n loadLevel(nextLevel);\n \n // Restart thew game running\n running = true;\n\n }\n}", "function checkStatus() {\n\n }", "gameOver(){\n for(var key in this.playerObjects){\n let Player = this.playerObjects[key];\n if(Player.active){\n return false;\n }\n }\n return true;\n }", "function isAlive(name, userStatuses) {\n // console.log('isAlive: ' + userStatuses);\n for(var i = 0; i < userStatuses.length; i++) {\n if(userStatuses[i].name === name) {\n //console.log(userStatuses[i].name + \": \" + userStatuses[i].alive);\n return (userStatuses[i].alive);\n }\n }\n return false;\n}", "function gameStatus(dachi){\n if(dachi.energy >= 100 && dachi.fullness >= 100 && dachi.happiness >= 100){\n console.log(\"Win\");\n $(\".reaction\").text(\"You won !\");\n $(\"#feed\").hide();\n $(\"#play\").hide();\n $(\"#work\").hide();\n $(\"#sleep\").hide();\n $(\"#restart\").show();\n } else if (dachi.fullness <= 0 || dachi.happiness <= 0){\n console.log(\"Loss\");\n $(\".reaction\").text(\"You lost !\");\n $(\"#feed\").hide();\n $(\"#play\").hide();\n $(\"#work\").hide();\n $(\"#sleep\").hide();\n $(\"#restart\").show();\n }\n }", "async function checkDeathSaveStatus(app, html, data){\r\n\tvar actor = game.actors.entities.find(a => a.data._id === data.actor._id);\r\n\tvar data = actor.data.data;\r\n\tvar currentHealth = data.attributes.hp.value;\r\n\tvar deathSaveSuccess = data.attributes.death.success;\r\n\tvar deathSaveFailure = data.attributes.death.failure;\r\n\r\n\tif(currentHealth > 0 && deathSaveSuccess != 0 || currentHealth > 0 && deathSaveFailure != 0){\r\n\t\t\tawait actor.update({\"data.attributes.death.success\": 0});\r\n\t\t\tawait actor.update({\"data.attributes.death.failure\": 0});\r\n\t}\r\n}", "function isGameWon () {\n console.log('checking if you won the game')\n return gameState.enemiesLeft === 0\n}", "function checkStatus(status){\n\tif(status === 'Z'){\n\t\tuserStatus = true;\n\t\treturn \"<p style='color: green;'>Alive</p>\";\n\t}\n\tuserStatus = false;\n\treturn \"<p style='color: red;'>Dead</p>\";\n}", "checkGameStatus(id){\n let totalCount = 0;\n let aceFlag = false;\n let itemIndex = 0;\n if(id == 'player'){\n this.checkPlayerStatus();\n } else {\n this.checkDealerStatus();\n }\n }", "function status1() {\n\n\n if(guest === computer) {\n wins++;\n $(\"#wins\").html(\"Wins: \" + wins);\n $('#status').html(\"You win!\");\n \n game = false;\n }\n\n else if(guest > computer) {\n losses++;\n $(\"#losses\").html(\"Losses:\" + losses);\n $(\"#status\").html(\"You lost.\");\n game = false;\n }\n\n\n\n\n\n}", "function Awake()\n{\n\tplayerInfo = FindObjectOfType(ThirdPersonStatus);\n\n\tif (!playerInfo)\n\t\tDebug.Log(\"No link to player's state manager.\");\n}", "function playerChecks(playerID){\n\t\t$.post('./handle/check-active.php',{id: playerID},\n\t\t\tfunction(data){\n\t\t\t\tvar array = JSON.parse(data);\n\t\t\t\t\n\t\t\t\t// Checks for the last click of all users and removes inactives\n\t\t\t\tif (array['checkPlayer'] == 1){\n\t\t\t\t\t$('div').remove('#player'+playerID);\n\t\t\t\t}\n\t\t\t\telse{}\n\t\t\t\t// update scores for players\n\t\t\t\t$('#score'+playerID).text(array['score']);\n\t\t});\n\t}", "function CheckPlayable() {\n if ((playerCredit < playerBet)) {\n messageLabel.text = \"low credit\";\n spinButton.mouseEnabled = false;\n spinButton.alpha = 0.3;\n console.log(playerCredit);\n }\n else if (playerBet == 0) {\n messageLabel.text = \"Enter bet\\n amount\";\n spinButton.mouseEnabled = false;\n }\n else {\n spinButton.mouseEnabled = true;\n spinButton.alpha = 1;\n }\n }", "function checkDeath()\n{ \n gameOver = outsideGrid(getSnakeHead()) || snakeIntersection()\n}", "function checkStatus() {\n for (i = 0; i < gameWin.length; i++) {\n if (currentArray.join('') === gameWin[i].join('')) {\n winGame();\n }\n }\n for (i = 0; i < gameLoss.length; i++) {\n if (currentArray.join('') === gameLoss[i].join('')) {\n loseGame();\n }\n }\n}", "function playerEventChecker() {\n for (var i = 0; i < AMNTofPlayers; i++) {\n playerChecked.push(1);\n }\n for (var i = 0; i < AMNTofPlayers; i++) {\n var playerid = i;\n var playerAlive = playerAlive[playerid];\n if (cycle % 2 == 1) {\n if (Math.floor(Math.random() * 10) + gameSpeed >= 8) {\n violentDayEvent(playerid);\n } else {\n peacefulDayEvent(playerid);\n }\n } else {\n if (Math.floor(Math.random() * 10) + gameSpeed >= 8) {\n violentNightEvent(playerid);\n } else {\n peacefulNightEvent(playerid);\n }\n }\n }\n cycle++;\n}", "checkCollisions() {\n // Get actual player position\n let playerPosition = {\n x: player.x,\n y: player.y,\n width: box.width,\n height: box.height\n }\n // Get actual enemy position\n let enemyPosition = {\n x: this.x,\n y: this.y,\n width: box.width +10,\n height: box.height\n }\n // If collision happened:\n if (playerPosition.x < enemyPosition.x + enemyPosition.width && playerPosition.x + playerPosition.width > enemyPosition.x && playerPosition.y < enemyPosition.y + enemyPosition.height && playerPosition.y + playerPosition.height > enemyPosition.y) {\n audioFiles.collision.play();// Play sound\n player.resetPlayer();// Reset player initial position\n player.remainAlive--;// Decrese player lives\n lives.pop();// remove life object from lives array\n //If Player has less than 3 lives, display life key bonus\n (player.remainAlive < 3 && player.remainAlive >0) && keyLife.display();\n }\n\n }", "function gameStatus() {\n\tif (model.right === model.word.length) {\n\t\tmodel.win = true;\n\t\tmodel.imgsrc = 'img/win.png'\n\t\tmodel.score.won++\n\t} else if (model.wrong >= 6) {\n\t\tmodel.lose = true;\n\t\tmodel.imgsrc = 'img/lose.png';\n\t\tmodel.score.lost++\n\t}\n\tif (model.loggedIn) {\n\t\tvar userId = model.user.uid;\n\t\tfirebase.database().ref('score').child(userId).update({\n\t\t\twon: model.score.won,\n\t\t\tlost: model.score.lost\n\t\t});\n\t}\n\trenderForm();\n\trenderGame();\n}", "function checkStatus() {\n\n var users = getUsers();\n // variable count is used to monitor how many users are loged in, if more than\n // one then it sets the loged in status of all users to false\n var count = 0;\n\n for(var k = 0; k < users.length; k++) {\n if(users[k].loggedIn == true) {\n loggedIn = [true, k];\n count += 1;\n }\n }\n //if user is logged in changes the login tab to user information tab\n if(loggedIn[0] && count == 1) {\n if(document.getElementById(\"LoggedInAs\") != null && document.getElementById(\"playersHighscore\") != null) {\n document.getElementById(\"LoggedInAs\").innerHTML = \"Logged in as: \" + users[loggedIn[1]].name;\n document.getElementById(\"playersHighscore\").innerHTML = \"Highest score: \" + users[loggedIn[1]].score;\n selectTab(event, 'logedIn');\n } else {\n //sets the login / sign up value inside the navigation bar to a users username\n document.getElementById(\"user\").innerHTML = users[loggedIn[1]].name;\n }\n } else {\n for(var l = 0; l < users.length; l++) {\n users[l].loggedIn = false;\n }\n }\n }", "loseLive(player, enemy) {\n if (!this.invulnerable) {\n this.lives--;\n this.invulnerable = true;\n this.zelda.alpha = 0.5;\n }\n }", "getGameStatus() {\n this.setMethod('GET');\n this.setPlayerId();\n return this.getApiResult(`${Config.PLAY_API}/${this.playerId}/status`);\n }", "function gameCheck(){\n\n}", "function updateHealth() {\n // Reduce player health, constrain to reasonable range\n //playerHealth = constrain(playerHealth - 0.5,0,playerMaxHealth);\n // Check if the player is dead\n if (playerHealth === 0) {\n // If so, the game is over\n gameOver = true;\n }\n}", "function checkPlayer() {\n return (gInfo.playerList[gInfo.currentPlayer].uid==currentUID);\n}", "function updatePlayerLives() {\n playerLives = playerLives - 1;\n //play sad fog horn sound\n fogHorn.play();\n //display the new number of lives\n drawPlayerLives()\n //if the player has no more lives, make gameOver true\n if (playerLives < 1) {\n gameOver = true;\n }\n}", "function gameOverChecker() {\n if (playerOne.heldScore >= 100 || playerTwo.heldScore >= 100) {\n gameOver = true;\n if (playerOne.heldScore >= 100) {\n playerOneName[0].classList.add(\"winner\");\n }\n else {\n playerTwoName[0].classList.add(\"winner\");\n }\n }\n else {\n if (turnTracker === 1) {\n turnChange();\n }\n else {\n turnChange();\n }\n }\n}", "function lifeCount() {\n if (lives > 1) {\n document.getElementById(\"attempts\").innerText = (lives + \" attempts remaining.\")\n }\n else if (lives === 1) {\n document.getElementById(\"attempts\").innerText = (lives + \" attempt remaining.\")\n }\n else if (lives == 0) {\n gameOver();\n }\n}", "hasGameEnded() {\n const { gameState } = this.state;\n const gameEnded = gameState.every((tileState) => {\n return tileState.status === -1;\n });\n if (gameEnded) {\n alert('You won! You can play again by clicking on the Restart Game button.');\n }\n }", "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 gameStatus(player, opponent, board) {\n // games status\n if (checkWin(player, board)) {\n return \"win\";\n } else if (checkWin(opponent, board)) {\n return \"lost\"\n } else if (checkDraw(board)) {\n return \"draw\"\n } else {\n return \"\";\n }\n}", "function checkStatus() {\n if (!isPlaying && time === 0) {\n message.innerHTML = \"Game Over!!\";\n message.style.color = \"#aa0000\";\n wordInput.style.border = \"3px solid #aa0000\"\n currentWord.style.color = \"#aa0000\";\n score = -1;\n }\n}", "checkInteractValidity() {\n if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_top_mid_info, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y-75;\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown) {\n \n if(roomProgress <= 2000)\n this.coin0.alpha = 1.0;\n roomProgress = 2005;\n \n //this.coin0.alpha = 1.0;\n this.room2_activity1A.alpha = 1.0;\n\t\t// this.resetArrows();\n this.room2_characterMoveable = false;\n this.checkActivityOpened(true, false, false, false, false, false);\n }\n\n } else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_bot_left_info, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y+75;\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown && roomProgress >= 2005) {\n if(roomProgress <= 2010)\n roomProgress = 2010;\n\n this.room2_activity2A.alpha = 1.0;\n this.resetArrows();\n this.checkActivityOpened(false, true, false, false, false, false);\n \n } else if (this.room2_key_E.isDown && roomProgress < 2005) {\n this.room2_activityLocked.alpha = 1.0;\n this.room2_characterMoveable = false;\n }\n\n } else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_top_left_info, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y-75;\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown && roomProgress >= 2010) {\n if(roomProgress <= 2015)\n roomProgress = 2015;\n\n this.room2_activity3A.alpha = 1.0;\n this.resetArrows();\n this.checkActivityOpened(false, false, true, false, false, false);\n\n } else if (this.room2_key_E.isDown && roomProgress < 2010){\n this.room2_activityLocked.alpha = 1.0;\n this.room2_characterMoveable = false;\n }\n\n } else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_bot_mid_info, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y+75;\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown && roomProgress >= 2015) {\n if(roomProgress <= 2020)\n roomProgress = 2020;\n\n this.room2_activity4A.alpha = 1.0;\n this.resetArrows();\n this.checkActivityOpened(false, false, false, true, false, false);\n\n } else if (this.room2_key_E.isDown && roomProgress < 2015){\n this.room2_activityLocked.alpha = 1.0;\n this.room2_characterMoveable = false;\n\n }\n } else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_top_right_info, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y-75;\n\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown && roomProgress >= 2020) {\n if(roomProgress <= 2025)\n roomProgress = 2025;\n\n this.room2_activity5A.alpha = 1.0;\n this.resetArrows();\n this.checkActivityOpened(false, false, false, false, true, false);\n }\n else if (this.room2_key_E.isDown && roomProgress < 2020){\n this.room2_activityLocked.alpha = 1.0;\n this.room2_characterMoveable = false;\n }\n\n } else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_bot_right_info, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y+75;\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown && roomProgress >= 2025) {\n if(roomProgress <= 2030)\n roomProgress = 2030;\n console.log(roomProgress); \n this.room2_activity6A.alpha = 1.0;\n this.resetArrows();\n this.checkActivityOpened(false, false, false, false, false, true);\n }\n else if (this.room2_key_E.isDown && roomProgress < 2025){\n this.room2_activityLocked.alpha = 1.0;\n this.room2_characterMoveable = false;\n }\n\n } else if (Phaser.Geom.Rectangle.ContainsPoint(this.coin0_zone, this.room2_character_north)) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y-75;\n if(this.coin0.alpha == 1.0) this.room2_E_KeyImg.alpha = 1.0;\n if(this.room2_key_E.isDown) {\n if(this.coin0.alpha == 1.0) this.collectCoin(0);\n //this.coin0.alpha = 0.0;\n }\n }\n else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_hole_zone_nextRoom, this.room2_character_north)) {\n if(roomProgress >= 2500) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y+75;\n this.room2_E_KeyImg.alpha = 1.0;\n if (this.room2_key_E.isDown) {\n if (roomProgress <= 3000)\n\t\t roomProgress = 3000;\n\t\t this.scene.start(\"Account_Eqn\");\n\t\t //this.scene.start(\"winners_Room\");\n }\n }\n\n\n }\n\n else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_hole__zone_activity, this.room2_character_north)) {\n if(roomProgress >= 2030) {\n this.room2_E_KeyImg.x = this.room2_character_north.x;\n this.room2_E_KeyImg.y = this.room2_character_north.y+75;\n this.room2_E_KeyImg.alpha = 1.0;\n if(this.room2_key_E.isDown) {\n if(roomProgress <= 2100)\n roomProgress = 2100;\n\t\t this.scene.start(\"BB_ActRoom\");\n }\n }\n }\n\t else if (Phaser.Geom.Rectangle.ContainsPoint(this.room2_exitDoor, this.room2_character_north)){\n\t this.room2_E_KeyImg.x = this.room2_character_north.x+75;\n\t this.room2_E_KeyImg.y = this.room2_character_north.y;\n\t this.room2_E_KeyImg.alpha = 1.0;\n\t if (this.room2_key_E.isDown) {\n\t\t this.scene.start(\"Course_Intro\");\n\t }\n\t }\t\n\n else {\n this.hideActivities();\n this.room2_E_KeyImg.alpha = 0.0;\n }\n }", "checkEndGame()\n {\n\n var totalShipsDamage = ship_size2_hits + ship_size3_hits + ship_size4_hits + ship_size4_2_hits + ship_size5_hits;\n var damageLeft = 18 - totalShipsDamage;\n console.log(totalShipsDamage);\n\n if(totalShipsDamage == 18 && playerShoots >= 0)\n {\n this.drawWinScreen();\n\n }\n else if(playerShoots < damageLeft)\n {\n this.drawLoseScreen();\n\n }\n else if (playerShoots == 0)\n {\n this.drawLoseScreen();\n }\n\n }", "checkLose() {\n\t\tfor (let j = 0; j < 10; j++) {\n\t\t\tif (this.grid.squares[0][j].visible) {\n\t\t\t\t/* Update the high score if needed. */\n\t\t\t\tif (this.score > this.high) {\n\t\t\t\t\tthis.high = this.score;\n\t\t\t\t\tthis._updateScoreBox();\n\t\t\t\t}\n\n\t\t\t\tclient.playerLost(this.high);\n\t\t\t\tthis.gameOverSelectorBox.initialize();\n\t\t\t\tthis.state = STATE_GAME_OVER;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}", "collision(){\n let playerMin = player.x - 75;\n let playerMax = player.x + 75;\n if(this.y === player.y){\n if(this.x > playerMin && this.x < playerMax){\n // if a collison occurs, reset the player to starting position\n player.x = startX;\n player.y = startY;\n\n // the player will loose a life\n return true;\n }\n }else if(player.y === -50){\n // if the player is in the water\n if(player.x !== goal.x){\n player.x = startX;\n player.y = startY;\n goal.x = goal.getStarXPos();\n\n // the player will loose a life\n return true;\n }\n }\n\n // no collisons, return false, no need to update lives\n return false;\n }", "function inLiveHours(){\n var now = new Date();\n var hour = now.getHours()\n return ((hour >= LIVE_SOD) && (hour < LIVE_EOD))\n}", "function CheckFall() {\n\tif(yPosition > 300) {\n\t\tpreGame = true;\n\t}\n}", "_checkIfComplete() {\n\n\t\tif(this._matchedCards === this.rows*this.cols) {\n\n\t\t\t// Delay for the animations\n\t\t\tsetTimeout(() => {\n\n\t\t\t\talert(`You have scored ${this._score} points`);\n\n\t\t\t\tclearInterval(this._timer);\n\n\t\t\t\tthis.initGame();\n\t\t\t}, 400);\n\t\t}\n\t}", "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 playerLives() {\n\tconst scorePanel = document.querySelector('.score-panel');\n\tconst lives = scorePanel.getElementsByTagName('img');\n\t// Set limits for lives based on player.reset() function call count\n\tif (callCount === 1) {\n\t\tlives[0].style.display = 'none';\n\t} else if (callCount === 2) {\n\t\tlives[0, 1].style.display = 'none';\n\t} else if (callCount === 3) {\n\t\tlives[0, 1, 2].style.visibility = 'hidden';\n\t\t// Display game over modal\n\t\tsetTimeout(gameOver, 500);\n\t}\n}", "function checkStatus(currentHeight, currentLength, colHeight, rowLength, field){\n let ph = currentHeight;\n let pl = currentLength;\n let ch = colHeight;\n let rl = rowLength;\n let gameStatus = true\n\n if (pl > rl || pl < 0 || ph > ch || ph < 0){\n console.log(field);\n console.log(\"You move out of the field. You Lose!\");\n gameStatus = false;\n }\n else if (field[ph][pl] === hole){\n field[ph][pl] = \"X\";\n console.log(field);\n console.log(\"You fell into a hole. You Lose!\");\n gameStatus = false;\n }\n else if (field[ph][pl] === hat){\n field[ph][pl] = pathCharacter;\n console.log(field);\n console.log(\"You found your hat! You Win!\");\n gameStatus = false;\n }\n else{\n field[ph][pl] = pathCharacter;\n console.log(field);\n }\n return gameStatus; \n}", "function updateHealth() {\n // Reduce player health, constrain to reasonable range\n playerHealth = constrain(playerHealth - 0.8,0,playerMaxHealth);\n // Check if the player is dead\n if (playerHealth === 0) {\n // If so, the game is over\n gameOver = true;\n }\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}" ]
[ "0.6922503", "0.6683822", "0.6682566", "0.65696174", "0.6508086", "0.65034086", "0.64831626", "0.6448334", "0.6387154", "0.6367053", "0.6307061", "0.6301841", "0.6279603", "0.62718964", "0.62294996", "0.6206866", "0.6200254", "0.61880773", "0.61850685", "0.61775184", "0.61773205", "0.61730105", "0.6149004", "0.6147967", "0.61447316", "0.61406136", "0.6128926", "0.6123087", "0.6110225", "0.6098695", "0.6090819", "0.60897624", "0.60810316", "0.60766846", "0.6073248", "0.606141", "0.60411835", "0.6039123", "0.6039123", "0.6022741", "0.60152745", "0.5991027", "0.59808046", "0.59794486", "0.5972365", "0.5957426", "0.5954658", "0.5952742", "0.594462", "0.5935639", "0.5925261", "0.5924639", "0.5923164", "0.5922414", "0.5916071", "0.59128433", "0.5912698", "0.59123534", "0.5911166", "0.59026533", "0.5899871", "0.58958805", "0.5893372", "0.5889463", "0.58841974", "0.5881293", "0.5877439", "0.58528054", "0.5841418", "0.58402747", "0.5837909", "0.58229744", "0.58135414", "0.5811394", "0.5796534", "0.5793264", "0.57855743", "0.57711387", "0.5766518", "0.5766456", "0.57552606", "0.57539815", "0.5750579", "0.57364345", "0.57294047", "0.57227564", "0.5721534", "0.572028", "0.57185555", "0.57129437", "0.5705571", "0.5700168", "0.56986356", "0.5698322", "0.5697136", "0.56839633", "0.5683251", "0.5679192", "0.5678304", "0.56720436" ]
0.61601657
22
Function to take damage and check damage level(a.k.a dead or alive?)
takeDamage(damage) { if (this.isPlayerAlive()) { this.hp -= damage; console.log(`${this.name} have ${this.hp} Health Points remaining.`); } else { this.state = LOSER; console.log(`${this.name} is dead :(`); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "action(type, damage) {\n const totalDamage = damage + this.player1.magicStatus();\n console.log(totalDamage + ', ' + this.player1.magicStatus());\n\n if (type === 'Attack') {\n if (this.dojoBoss.returnBossArmour() >= totalDamage) {\n this.dojoBoss.decreaseArmour(totalDamage);\n } else {\n const take = totalDamage - this.dojoBoss.returnBossArmour();\n this.dojoBoss.decreaseArmour(totalDamage);\n this.dojoBoss.decreaseHealth(take);\n }\n this.player1.clearMagic();\n } else if (type === 'Magic') {\n this.player1.changeMagicStatus(damage);\n // is this a c or s lmao\n } else if (type === 'Defence') {\n this.player1.addDefence(totalDamage);\n this.player1.clearMagic();\n }\n }", "onDamageTaken (source, damage) {\n return (this.Health -= damage) > 0 ? STATE_ALIVE : STATE_DEAD;\n }", "damage() {}", "function strongAttackHandler(){\n attackMonster('STRONG_ATTACK');\n\n /*const damage = dealMonsterDamage(STRONG_ATTACK_VALUE);\n currentMonsterHealth -= damage;\n const playerDamage = dealPlayerDamage(MONSTER_ATTACK_VALUE);\n currentPlayerHealth -= playerDamage;\n\n //11\n if(currentMonsterHealth <=0 && currentPlayerHealth > 0){\n alert('You won!');\n\n }else if (currentPlayerHealth <=0 && currentMonsterHealth > 0){\n alert('You have Lost'); //Player loses if Monster Health is above 0.\n }\n else if (currentPlayerHealth <=0 && currentMonsterHealth <= 0 ){\n alert('You have a draw');\n }*/\n\n\n }", "@action damageHP(damage, type) {\n // @TODO Should eventually deal more or less damage depending on type\n this.currentHitPoints = Math.max(this.currentHitPoints - damage, 0)\n return this.handleDeath(type)\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}", "takeDamage(damage) {\n this.health -= damage;\n if (this.health <= 0)\n {\n this.alive = false;\n }\n }", "checkHealthAndFood() {\n\n\n if (this.currPlayerHealth <= 0 || this.playerFood <= 0) {\n this.gameOver();\n }\n\n if (this.currPlayerHealth <= 25) {\n //this.toggleBlink(\"healthElement\");\n this.lowHealth = true;\n }\n\n }", "function isDragonDead(){\n if(totalDragonHealth <= 0){\n alert('you have won!')\n }else{\n if (rolledDice1 && rolledDice2 && rolledDice3 && rolledDice4 && rolledDice5 && rolledDice6){\n alert('you have lost!')\n } \n }\n }", "function attack(damage) {\r\n // Code disini\r\n return damage - 2;\r\n\r\n // var damageReduction = damage - 2;\r\n // return damageReduction;\r\n}", "takeDamage(damage, type = null){\r\n if (type in this.resistances) damage *= this.resistances[type];\r\n if (type in this.vulnerabilities) damage *= this.resistances[type];\r\n this.health -= damage;\r\n }", "function checkDamage()\n{\n\tvar currentTime = new Date();\n\tfor (var mapId in damageList)\n\t{\n\t\tvar n = damageList[mapId].length;\n\n\t\t// go through every active attack\n\t\tfor (var i = 0; i < n; i++)\n\t\t{\n\t\t\t// check if the animation reached the frame where it does damage\n\t\t\tif (currentTime.getTime() >= damageList[mapId][i].damage_time)\n\t\t\t{\n\t\t\t\tif (damageList[mapId][i].source == \"iceboss\")\n\t\t\t\t{\n\t\t\t\t\tvar e = getEntity(\"iceboss\",2);\n\t\t\t\t\tfor (var j in connected[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (e.direction == \"Up\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x, e.y - e.depth, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x, e.y - e.depth, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (e.direction == \"Down\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x, e.y + e.depth, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x, e.y + e.depth, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (e.direction == \"Left\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x - e.width / 2, e.y, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x - e.width / 2, e.y, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (e.direction == \"Right\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x + e.width / 2, e.y, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x + e.width / 2, e.y, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\t// check every connected player to see if they were hit\n\t\t\t\tfor (var j in connected[mapId])\n\t\t\t\t{\n\t\t\t\t\tif (damageList[mapId][i].source != connected[mapId][j].id && connected[mapId][j].targetType != \"Passive\" && damageList[mapId][i].collisionCheck(connected[mapId][j]))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar knockback = damageList[mapId][i].knockback;\n\n\t\t\t\t\t\t// tell the client that they took damage\n\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('damageIn', damageList[mapId][i].x, damageList[mapId][i].y, Math.ceil(damageList[mapId][i].damage * Math.sqrt(damageList[mapId][i].damage / connected[mapId][j].defence)), knockback);\n\n\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\taddKillParticipation(connected[mapId][j].id, damageList[mapId][i].source, mapId);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// check every cpu to see if they were hit\n\t\t\t\tfor (var j in mapEntities[mapId])\n\t\t\t\t{\n\t\t\t\t\tif (damageList[mapId][i].source != mapEntities[mapId][j].entity.id && mapEntities[mapId][j].entity.targetType != \"Passive\" && damageList[mapId][i].collisionCheck(mapEntities[mapId][j].entity))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar knockback = damageList[mapId][i].knockback;\n\n\t\t\t\t\t\t// damage the entity\n\t\t\t\t\t\tmapEntities[mapId][j].entity.takeDamage(damageList[mapId][i].x, damageList[mapId][i].y, Math.ceil(damageList[mapId][i].damage * Math.sqrt(damageList[mapId][i].damage / mapEntities[mapId][j].entity.defence)), knockback);\n\n\t\t\t\t\t\t// tell the CPU to target that entity\n\t\t\t\t\t\tmapEntities[mapId][j].setTarget(damageList[mapId][i].source);\n\n\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\taddKillParticipation(mapEntities[mapId][j].entity.id, damageList[mapId][i].source, mapId);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tdamageList[mapId].splice(i,1);\n\t\t\ti--;\n\t\t\tn--;\n\t\t\t}\n\t\t}\n\t}\n\n\t// update projectile and check if it has gone offscreen or hit someone\n\tfor (var mapId in projectileList)\n\t{\n\t\tn = projectileList[mapId].length;\n\n\t\tfor (var i = 0; i < n; i++)\n\t\t{\n\t\t\tif (currentTime.getTime() >= projectileList[mapId][i].update_time)\n\t\t\t{\n\t\t\t\tprojectileList[mapId][i].update();\n\n\t\t\t\tif (projectileList[mapId][i].offscreen())\n\t\t\t\t{\n\t\t\t\t\tprojectileList[mapId].splice(i, 1);\n\t\t\t\t\ti--;\n\t\t\t\t\tn--;\n\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar dmg = false;\n\n\t\t\t\t\t// check every connected player to see if they were hit\n\t\t\t\t\tfor (var j in connected[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (projectileList[mapId][i].source != connected[mapId][j].id && connected[mapId][j].targetType != \"Passive\" && projectileList[mapId][i].collisionCheck(connected[mapId][j]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar knockback = projectileList[mapId][i].knockback;\n\n\t\t\t\t\t\t\t// tell the client that they took damage\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('damageIn', projectileList[mapId][i].x, projectileList[mapId][i].y, Math.ceil(projectileList[mapId][i].damage * Math.sqrt(projectileList[mapId][i].damage / connected[mapId][j].defence)), knockback);\n\n\t\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\t\taddKillParticipation(connected[mapId][j].id, projectileList[mapId][i].source, mapId);\n\n\t\t\t\t\t\t\tdmg = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// check every cpu to see if they were hit\n\t\t\t\t\tfor (var j in mapEntities[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (projectileList[mapId][i].source != mapEntities[mapId][j].entity.id && mapEntities[mapId][j].entity.targetType != \"Passive\" && projectileList[mapId][i].collisionCheck(mapEntities[mapId][j].entity))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar knockback = projectileList[mapId][i].knockback;\n\n\t\t\t\t\t\t\t// damage the entity\n\t\t\t\t\t\t\tmapEntities[mapId][j].entity.takeDamage(projectileList[mapId][i].x, projectileList[mapId][i].y, Math.ceil(projectileList[mapId][i].damage * Math.sqrt(projectileList[mapId][i].damage / mapEntities[mapId][j].entity.defence)), knockback);\n\n\t\t\t\t\t\t\t// tell the CPU to target that entity\n\t\t\t\t\t\t\tmapEntities[mapId][j].setTarget(projectileList[mapId][i].source);\n\n\t\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\t\taddKillParticipation(mapEntities[mapId][j].entity.id, projectileList[mapId][i].source, mapId);\n\n\t\t\t\t\t\t\tdmg = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// check every mapobject to see if it's hit a solid object\n\t\t\t\t\tfor (var j in mapObjects[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (projectileList[mapId][i].collisionCheck(mapObjects[mapId][j]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdmg = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (dmg && projectileList[mapId][i].destroyOnHit)\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectileList[mapId].splice(i, 1);\n\t\t\t\t\t\ti--;\n\t\t\t\t\t\tn--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}", "function ApplyDamage(damage : float) {\n\t//if the player is invincible, do not apply damage\n\tif(this.invincible) {\n\t\treturn;\n\t}\n\t\t\n}", "doDamage(dmg){\r\n if (!(dmg > 0))\r\n return;\r\n\r\n this.hp -= dmg;\r\n if (this.hp <= 0){\r\n this.alive = false;\r\n this.hp = 0;\r\n }\r\n }", "function check_health()\n{\n\tif(player['health'] <= 0){\n\t\tplayer['dead'] = true;\n\t}\n}", "TakeDamage(dmg){\n this.currentHealth = this.currentHealth - dmg;\n }", "function hpCheck (){ // tell me where to find health variables!\n\tHPBar();\n\tif (pPIdentifier.HP < 1){\n\t\tbattleMsg = \"You have been defeated.\"\n\t\tbattleMsgFunc();\n\t\tbattleState = false;\n\t\t//hideBattle(); // Define me! Because otherwise the battle is not ending! D:\n\t\t\n\t\t//endGame Msg;\n\t}else if ( currentBattle.HP < 1){\n\t\tbattleMsg = \"You have defeated \" + currentBattle.Identifier + \"!\";\n\t\tbattleMsgFunc();\n\t\tbattleState = false;\n\t\t//hideBattle(); // Define me!\n\t\t//continue story\n\t}else{ \n\t\t// Continue on your merry way :)\n\t};\n}", "set damage(damage){this._damage = Utils.protectionError(\"Hero\", \"damage\");}", "function battle(victimStrength, attackerStrength){\nif (victim.strength === attacker.strength) {\n console.log(\"Dead\");\n}\nelse if (victim.strength < attacker.strength) {\n console.log(\"Also dead\");\n}\nelse {\n console.log(\"Alive\");\n}\n}", "function ApplyDamage (damage : float) {\n\thealth = health - damage;\n\tif (health > 0) {\n\t\taddPain();\n\t\tyield WaitForFixedUpdate();\n\t\trigidbody2D.velocity = Vector2(0, -6);\n\t\tyield WaitForSeconds(painDuration);\n\t\treducePain();\n\t}\n\telse Exit();\n}", "performAttack() {\n return this.attack + this.levelDmgModifier;\n }", "attack(attackName) {\n _target.health -= _target.attacks[attackName]\n if (_target.health < 0) {\n _target.health = 0\n }\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}", "playerAttack(attack, opponent) {\r\n // 0: return false if attack misses\r\n // 1: otherwise update opponents health and return true\r\n let accuracy = 10;\r\n \r\n if(attack.type == 'electric' && opponent.type == 'water') {\r\n attack.power += this.damageAtack();\r\n }\r\n\r\n if((this.willAttackMiss(100 - attack.accuracy))) {\r\n this.evolution();\r\n let newHP = opponent.playerHp - attack.power;\r\n opponent.updatePlayerHp(newHP)\r\n return 1;\r\n }\r\n return 0;\r\n }", "function damageStep(actionOne, actionTwo) {\n disableTwo();\n if (actionOne === \"attack\" && actionTwo === \"attack\") {\n doubleAttack(playerOne, playerTwo, \"#healthTwo\", \"#healthOne\");\n showAnimation(\"#animateAttackOne\", 900);\n showAnimation(\"#animateAttackTwo\", 900);\n enableOne();\n } else if (actionOne === \"attack\" && actionTwo === \"strongAttack\") {\n attackPlayer(playerOne, playerTwo, \"#healthTwo\");\n showAnimation(\"#animateAttackTwo\", 900);\n strAttack(playerTwo, playerOne, \"#healthOne\");\n showAnimation(\"#animateStrongOne\", 1400);\n enableOne();\n } else if (actionOne === \"attack\" && actionTwo === \"defense\") {\n defendSelf(playerOne, playerTwo, \"#health2\");\n showAnimation(\"#animateAttackTwo\", 900);\n showAnimation(\"#animateDefendTwo\", 1400);\n enableOne();\n } else if (actionOne === \"attack\" && actionTwo === \"counter\") {\n counter(playerOne, playerTwo, \"#healthOne\", \"#healthTwo\");\n showAnimation(\"#animateAttackTwo\", 900);\n showAnimation(\"#animateCounterOne\", 450);\n enableOne();\n } else if (actionOne === \"defense\" && actionTwo === \"attack\") {\n defendSelf(playerTwo, playerOne, \"#healthOne\");\n showAnimation(\"#animateDefendOne\", 1400);\n showAnimation(\"#animateAttackOne\", 900);\n enableOne();\n } else if (actionOne === \"defense\" && actionTwo === \"strongAttack\") {\n defendSelfStr(playerTwo, playerOne, \"#healthOne\");\n showAnimation(\"#animateDefendOne\", 1400);\n showAnimation(\"#animateStrongOne\", 1400);\n\n enableOne();\n } else if (actionOne === \"defense\" && actionTwo === \"defense\") {\n doubleDefense(playerOne, playerTwo);\n showAnimation(\"#animateDefendOne\", 1400);\n showAnimation(\"#animateDefendTwo\", 1400);\n enableOne();\n } else if (actionOne === \"defense\" && actionTwo === \"counter\") {\n defendCounter(playerOne, playerTwo);\n showAnimation(\"#animateDefendOne\", 1400);\n\n enableOne();\n } else if (actionOne === \"strongAttack\" && actionTwo === \"attack\") {\n attackPlayer(playerTwo, playerOne, \"#healthOne\");\n showAnimation(\"#animateStrongTwo\", 1400);\n showAnimation(\"#animateAttackOne\", 900);\n strAttack(playerOne, playerTwo, \"#healthTwo\");\n enableOne();\n } else if (actionOne === \"strongAttack\" && actionTwo === \"defense\") {\n defendSelfStr(playerOne, playerTwo, \"#healthTwo\");\n showAnimation(\"#animateStrongTwo\", 1400);\n showAnimation(\"#animateDefendTwo\", 1400);\n\n enableOne();\n } else if (actionOne === \"strongAttack\" && actionTwo === \"strongAttack\") {\n strAttack(playerOne, playerTwo, \"#healthTwo\");\n strAttack(playerTwo, playerOne, \"#healthOne\");\n showAnimation(\"#animateStrongTwo\", 1400);\n showAnimation(\"#animateStrongOne\", 1400);\n enableOne();\n } else if (actionOne === \"strongAttack\" && actionTwo === \"counter\") {\n strCounter(playerOne, playerTwo, \"#healthOne\", \"#healthTwo\");\n showAnimation(\"#animateStrongTwo\", 1400);\n showAnimation(\"#animateStrongCounterOne\", 1000);\n\n enableOne();\n } else if (actionOne === \"counter\" && actionTwo === \"attack\") {\n counter(playerTwo, playerOne, \"#healthTwo\", \"#healthOne\");\n showAnimation(\"#animateAttackOne\", 900);\n showAnimation(\"#animateCounterTwo\", 450);\n enableOne();\n } else if (actionOne === \"counter\" && actionTwo === \"strongAttack\") {\n strCounter(playerTwo, playerOne, \"#healthTwo\", \"#healthOne\");\n showAnimation(\"#animateStrongCounterTwo\", 1000);\n showAnimation(\"#animateStrongOne\", 1400);\n enableOne();\n } else if (actionOne === \"counter\" && actionTwo === \"defense\") {\n defendCounter(playerTwo, playerOne);\n showAnimation(\"#animateDefendTwo\", 1500);\n\n enableOne();\n } else if (actionOne === \"counter\" && actionTwo === \"counter\") {\n doubleCounter(playerOne, playerTwo);\n enableOne();\n }\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 }", "async function damage(target, amount, type){\r\n //gets the pet row for values\r\n let petrow = await sql.get(ownedpet, petname)\r\n //gets the fight row for values\r\n let frow = await sql.get(`SELECT * FROM fights WHERE user = \"${petrow.owner}\" AND pet = \"${petrow.name}\"`).catch(allerrors)\r\n //updates the pet and enemy defense variable so they're up to date\r\n let petdef = petrow.health+petrow.shields\r\n let edef = frow.ehealth+frow.eshields\r\n\r\n //applies or resets damage multipliers\r\n if(target == \"pet\" && type != \"ranged\"){amount = Math.ceil(amount*frow.dmgmult)} //changes damage depending on the pet's damage multiplier (NOT FOR RANGED DAMAGE)\r\n else if(target == \"enemy\" && type != \"ranged\"){amount = Math.ceil(amount*frow.edmgmult)} //changes damage depending on the enemies damage multiplier (NOT FOR RANGED DAMAGE)\r\n //if the multipliers were changed last round, change them back\r\n if(frow.dmgmult != 1){sql.run(`UPDATE fights SET dmgmult = \"1\" WHERE user = \"${petrow.owner}\" AND pet = \"${petrow.name}\"`).catch(allerrors)} //resets the damage multiplier for the pet\r\n if(frow.edmgmult != 1){sql.run(`UPDATE fights SET edmgmult = \"1\" WHERE user = \"${petrow.owner}\" AND pet = \"${petrow.name}\"`).catch(allerrors)} //resets the damage multiplier for the enemy\r\n \r\n //rounds the damage to ensure no .5s, etc\r\n amount = Math.round(amount)\r\n //do different things for each different type of damage\r\n switch(type.toLowerCase()){\r\n case'melee':{\r\n //applies normal damage\r\n if(target == `pet`){\r\n //end fight if pet is killed\r\n if(petdef-amount<=0) {\r\n //sets the pets health to 0 and exits the fight\r\n await sql.run(`UPDATE pets SET health = \"0\" WHERE owner = \"${petrow.owner}\" AND name = \"${petrow.name}\"`).catch(allerrors)\r\n await exitfight(`defeat`, frow.roundrecap, frow.nextround)\r\n }\r\n //applies damage if pet survives\r\n else {sql.run(`UPDATE pets SET health = \"${petdef-amount}\" WHERE owner = \"${petrow.owner}\" AND name = \"${petrow.name}\"`).catch(allerrors)}\r\n }\r\n else if(target == `enemy`){\r\n //end fight if enemy is killed\r\n if(edef-amount<=0){\r\n //sets the enemy health to 0 and exits the fight\r\n await sql.run(`UPDATE fights SET ehealth = \"0\" WHERE user = \"${petrow.owner}\"`).catch(allerrors)\r\n await exitfight(`win`, frow.roundrecap, frow.nextround)\r\n }\r\n //applies damage if enemy survives\r\n else {sql.run(`UPDATE fights SET ehealth = \"${edef-amount}\" WHERE user = \"${petrow.owner}\"`).catch(allerrors)}\r\n }\r\n break;\r\n }\r\n case'raw':{\r\n //applies raw damage (shields don't count)\r\n if(target == `pet`){\r\n //end fight if pet is killed\r\n if(petrow.health-amount<=0) {\r\n //sets the pets health to 0 and exits the fight\r\n await sql.run(`UPDATE pets SET health = \"0\" WHERE owner = \"${petrow.owner}\" AND name = \"${petrow.name}\"`).catch(allerrors)\r\n await exitfight(`defeat`, frow.roundrecap, frow.nextround)\r\n }\r\n //applies damage if pet survives\r\n else {sql.run(`UPDATE pets SET health = \"${petrow.health-amount}\" WHERE owner = \"${petrow.owner}\" AND name = \"${petrow.name}\"`).catch(allerrors)}\r\n }\r\n else if(target == `enemy`){\r\n //end fight if enemy is killed\r\n if(frow.ehealth-amount<=0) {\r\n //sets the enemy health to 0 and exits the fight\r\n await sql.run(`UPDATE fights SET ehealth = \"0\" WHERE user = \"${petrow.owner}\"`).catch(allerrors)\r\n await exitfight(`win`, frow.roundrecap, frow.nextround)\r\n }\r\n //applies damage if enemy survives\r\n else {sql.run(`UPDATE fights SET ehealth = \"${frow.ehealth-amount}\" WHERE user = \"${petrow.owner}\"`).catch(allerrors)}\r\n }\r\n break;\r\n }\r\n case'ranged':{\r\n //applies ranged damage (ignores damage multipliers)\r\n }\r\n //if the defined type is something else, throw an error message in chat\r\n default:{errmsg(`Unknown damage type \"${type}\"`)}\r\n }\r\n }", "function playerDamage(tempHealth) {\n if (!playerInvulnerability){\n playerInvulnerability = true; \n player.alpha = 0.3; \n setTimeout(playerInvulnerabilityStop, playerInvulnerabilityWait);\n currentHealth -= tempHealth;\n parseHealthBarAnimate();\n if (currentHealth <= 0) {\n gameOver(); \n }\n }\n}", "function combat(health, damage) {\n health = health - damage;\n return health >= 0 ? health : 0;\n}", "receiveDamage(amount){\n this.health -= amount;\n if (this.health <= 0) {\n return this.name + \" has died in act of combat\";\n ;\n }\n else{\n return this.name + \" has received \" + amount + \" points of damage\";\n }\n }", "takeDamage(damage) {\n this.hp -= damage\n return this.hp\n }", "receiveDamage(damage) {\n this.health -= damage\n if (this.health <= 0) {\n return `${this.name} has died in act of combat` //\"NAME has died in act of combat\"\n } else {\n return `${this.name} has received ${damage} points of damage`//\"NAME has received DAMAGE points of damage\"\n }\n }", "function checkPowerUps() {\n if (player.animating) {\n return;\n }\n checkGoal();\n var rect2 = null, rect1 = player.getBounds();\n\n /* Touching a gem will give you 1 extra score */\n if (collectibles.gem) {\n rect2 = collectibles.gem.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n score += 1;\n collectibles.gem = false;\n }\n }\n /* Touching a star will give you 2 extra score and 1 extra life */\n if (collectibles.life) {\n rect2 = collectibles.life.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n lives++;\n if (lives > 3) {\n lives = 3;\n }\n score += 2;\n collectibles.life = false;\n }\n }\n /* Touching a key will give you 2 extra score and the grid row\n * will change in the next level.\n */\n if (collectibles.key) {\n rect2 = collectibles.key.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n changeRows = true;\n score += 2;\n collectibles.key = false;\n }\n }\n }", "function checkHp() {\n if (heroHp <= 0) {\n window.location.href = \"game-over.html\";\n } else if (villainHp <= 0) {\n moveToVillainDeathArea();\n gameStart = false;\n villain = null;\n enemyCounter++;\n checkIfWon();\n //test\n // console.log(\"villain defeated\")\n }\n }", "function wildPokemonAttack() {\r\n if (pokemonHealth > 0) {\r\n pokemonHealth = pokemonHealth - damage;\r\n alert(\"Wild \" + pokemonStats[wildPokemonid].type + \" uses \" + moves[moveid].move + \" dealing \" + damage + \" damage!\");\r\n attackLoop();\r\n } else {\r\n alert(\"Pokemon fainted\");\r\n }\r\n }", "function getDamageUser(userMove, userMoveName){\n damage = 10;\n for (var i = 0; i < wildPokemonType.length; i++) {\n var multiplier = pokeTypesEffect[userMove][pokeTypes[wildPokemonType[i]]]\n damage = damage * multiplier;\n \n }\n console.log(damage)\n $(\".battle-text\").empty();\n if (damage > 10){\n genBattSuperEffective(userPokeName, userMoveName);\n }else if (damage < 10){\n genBattNonEffective(userPokeName, userMoveName);\n }else if (damage = 10){\n genBattEffective(userPokeName, userMoveName);\n }\n\n wildHealth = wildHealth - damage;\n $(\"#wild-health\").val(wildHealth);\n disableMoves();\n}", "function healthcheck() {\n if (target.healthScore <= 0) {\n drawLoser();\n }\n}", "@action damageShields(damage, type) {\n return this.damageAttribute('currentShields', damage, type, 'shields')\n }", "dealDamage(victim) {\n console.log(`${this.name} is attacking ${victim.name} and is inflicting them ${this.dmg} Points.`);\n if (victim.isPlayerAlive()) {\n victim.hp -= this.dmg;\n\n if(victim <= 0) {\n victim.state = LOSER;\n console.log(`${this.name} killed ${victim.name}. ${this.name} won 20 mana points.`);\n this.winMana();\n }\n return this.dmg;\n } else {\n console.log(\"Player is dead. Can't run attack.\")\n }\n }", "function attack(){\n\tif(canAttack){\n\n\t\t//Weapon Sound\n\t\tvar randWeapon = Math.floor(Math.random()*AUDIO_WEAPON.length);\n\t\tchangeAudio(AUDIO_WEAPON[randWeapon]);\n\n\t\t//Player stats\n\t\t//var playerHP = parseInt($(\"#avatar_HP_0\").html());\n\t\tvar playerName = $(\"#avatar_NAME_0\").html();\n\t\tvar playerNum = $(\"#avatarContainer_0\").attr('value');\n\t\tvar playerAttack = AVATAR_STATS[playerNum][\"ATTACK\"];\n\t\tvar totalPlayerAttack = playerAttack+playerPower;\n\n\t\t//CPU stats\n\t\tvar cpuName = $(\"#currentEnemy_NAME\").html();\n\t\t//var cpuHP = parseInt($(\"#currentEnemy_HP\").html());\n\t\tvar cpuNum = $(\"#currentEnemyContainer\").attr('value');\n\t\tvar cpuAttack = AVATAR_STATS[cpuNum][\"DEFENSE\"];\n\n\t\t//Game logic/math\n\t\tcurrentEnemyHP -= totalPlayerAttack;\n\t\tcurrentPlayerHP -= cpuAttack;\n\t\t$(\"#currentEnemy_HP\").html(\"HP: \"+currentEnemyHP);\n\t\t$(\"#avatar_HP_0\").html(\"HP: \"+currentPlayerHP);\n\t\tplayerPower+=playerAttack;\n\n\t\t//Message box results\n\t\t$(\"#playerText\").html(\"You hit \"+cpuName+\" for \"+totalPlayerAttack+\" damage!\");\n\t\t$(\"#cpuText\").html(cpuName+\" hit you for \"+cpuAttack+\" damage!\");\n\n\t\tif(!gameOver){\n\n\t\t\t//Tie condition\n\t\t\tif (currentPlayerHP<= 0 && currentEnemyHP <=0 && enemyNum.length<1){\n\t\t\t\t//$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#avatar_IMG_0\").addClass(\"dead\");\n\t\t\t\t$(\"#avatar_HP_0\").html(\"DEFEATED\");\n\t\t\t\t$(\"#currentEnemy_IMG\").addClass(\"dead\");\n\t\t\t\t$(\"#currentEnemy_HP\").html(\"DEFEATED\");\n\n\t\t\t\tcanAttack=false;\n\t\t\t\tgameOver=true;\n\t\t\t\t$(\"#playerText\").html(\"There was a tie! You and \"+cpuName+\" have both been defeated\");\n\t\t\t\t$(\"#cpuText\").html(\"Press Start a new game to play again!\");\n\t\t\t}\n\n\t\t\t//Lose condition\n\t\t\telse if(currentPlayerHP <= 0){\n\t\t\t\t//$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#avatar_IMG_0\").addClass(\"dead\");\n\t\t\t\t$(\"#avatar_HP_0\").html(\"DEFEATED\");\n\t\t\t\tif(currentPlayerHP <= 0 && currentEnemyHP <= 0){\n\t\t\t\t\t$(\"#currentEnemy_IMG\").addClass(\"dead\");\n\t\t\t\t\t$(\"#currentEnemy_HP\").html(\"DEFEATED\");\n\t\t\t\t}\n\t\t\t\tcanAttack=false;\n\t\t\t\tgameOver=true;\n\t\t\t\tnewEnemy=false;\n\t\t\t\t$(\"#playerText\").html(\"You have been defeated by \"+cpuName+\" !!\");\n\t\t\t\t$(\"#cpuText\").html(\"Press Start a new game to play again!\");\n\t\t\t\tlosses+=1;\n\t\t\t\t$(\"#losses\").html(losses);\n\t\t\t}\n\n\t\t\t//Win condition\n\t\t\telse if(currentEnemyHP <= 0 && enemyNum.length<1 && currentPlayerHP >0 ){\n\t\t\t\t//$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#currentEnemy_IMG\").addClass(\"dead\");\n\t\t\t\t$(\"#currentEnemy_HP\").html(\"DEFEATED\");\n\t\t\t\tcanAttack=false;\n\t\t\t\tgameOver=true;\n\t\t\t\t$(\"#playerText\").html(\"You have defeated all enemies. Congratulations!!\");\n\t\t\t\t$(\"#cpuText\").html(\"Press Start a new game to play again!\");\n\t\t\t\twins+=1;\n\t\t\t\t$(\"#wins\").html(wins);\n\n\t\t\t}\n\n\t\t\t//Enemy defeated, select another enemy\n\t\t\telse if(currentEnemyHP <= 0 && enemyNum.length>0){\n\t\t\t\tcanAttack=false;\n\t\t\t\t$(\"#currentEnemyContainer\").css({\"display\":\"none\"});\n\t\t\t\t$(\"#playerText\").html(\"You have defeated \"+cpuName+\"!!\");\n\t\t\t\t$(\"#cpuText\").html(\"Select another enemy to defeat..\");\n\n\t\t\t\tnewEnemy=true;\n\t\t\t\t\n\n\t\t\t}\n\t\t}\n\t}\n}", "function attackPlayer(health) {\n return health - randomDamage();\n}", "attack(warrior){\n if(warrior instanceof Elf){\n let dodge = Math.random();\n if(dodge > warrior.dodgingChance){\n warrior.hp -= this.strength;\n }\n }else{\n warrior.hp -= this.strength;\n }\n }", "damageAtack() {\r\n return Math.floor(Math.random() * 100);\r\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}", "checkEndGame()\n {\n\n var totalShipsDamage = ship_size2_hits + ship_size3_hits + ship_size4_hits + ship_size4_2_hits + ship_size5_hits;\n var damageLeft = 18 - totalShipsDamage;\n console.log(totalShipsDamage);\n\n if(totalShipsDamage == 18 && playerShoots >= 0)\n {\n this.drawWinScreen();\n\n }\n else if(playerShoots < damageLeft)\n {\n this.drawLoseScreen();\n\n }\n else if (playerShoots == 0)\n {\n this.drawLoseScreen();\n }\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 combat(health, damage){\n return health > damage\n ? health - damage\n : 0\n}", "function clickDmgClicked(){\n if (player.gold > 2) {\n player.gold = player.gold - 2;\n player.clickDmg = player.clickDmg + 1;\n }\n else {\n console.log('Too poor, failed purchase');\n }\n}", "survivorDamage(dmg) {\n console.log(\"Survivor taking damage = \" + dmg);\n //Deduct health.\n this.currPlayerHealth -= dmg;\n\n }", "function evaluateEquipmentEfficiency(equipName) {\n var equip = equipmentList[equipName];\n var gameResource = equip.Equip ? game.equipment[equipName] : game.buildings[equipName];\n if (equipName == 'Shield') {\n if (gameResource.blockNow) {\n equip.Stat = 'block';\n } else {\n equip.Stat = 'health';\n }\n }\n var Eff = Effect(gameResource, equip);\n var Cos = Cost(gameResource, equip);\n var Res = Eff / Cos;\n var Status = 'white';\n var Wall = false;\n\n //white - Upgrade is not available\n //yellow - Upgrade is not affordable\n //orange - Upgrade is affordable, but will lower stats\n //red - Yes, do it now!\n if (!game.upgrades[equip.Upgrade].locked) {\n //Evaluating upgrade!\n var CanAfford = canAffordTwoLevel(game.upgrades[equip.Upgrade]);\n if (equip.Equip) {\n var NextEff = PrestigeValue(equip.Upgrade);\n //Scientist 3 and 4 challenge: set metalcost to Infinity so it can buy equipment levels without waiting for prestige. (fake the impossible science cost)\n //also Fake set the next cost to infinity so it doesn't wait for prestiges if you have both options disabled.\n if ((game.global.challengeActive == \"Scientist\" && getScientistLevel() > 2) || ((!getPageSetting('BuyArmorUpgrades') && !getPageSetting('BuyWeaponUpgrades'))))\n var NextCost = Infinity;\n else\n var NextCost = Math.ceil(getNextPrestigeCost(equip.Upgrade) * Math.pow(1 - game.portal.Artisanistry.modifier, game.portal.Artisanistry.level));\n Wall = (NextEff / NextCost > Res);\n }\n\n if (!CanAfford) {\n Status = 'yellow';\n } else {\n if (!equip.Equip) {\n //Gymystic is always cool, fuck shield - lol\n Status = 'red';\n } else {\n var CurrEff = gameResource.level * Eff;\n\n var NeedLevel = Math.ceil(CurrEff / NextEff);\n var Ratio = gameResource.cost[equip.Resource][1];\n\n var NeedResource = NextCost * (Math.pow(Ratio, NeedLevel) - 1) / (Ratio - 1);\n\n if (game.resources[equip.Resource].owned > NeedResource) {\n Status = 'red';\n } else {\n Status = 'orange';\n }\n }\n }\n }\n //what this means:\n //wall (don't buy any more equipment, buy prestige first) is true if the limit equipment option is on and we are past our limit \n //res = 0 sets the efficiency to 0 so that it will be disregarded. if not, efficiency will still be somenumber that is cheaper, \n // and the algorithm will get stuck on whatever equipment we have capped, and not buy other equipment.\n if (game.jobs[mapresourcetojob[equip.Resource]].locked){\n //cap any equips that we haven't unlocked metal for (new/fresh game/level1/no helium code)\n Res = 0;\n Wall = true; \n }\n if (gameResource.level > 10 - gameResource.prestige && getPageSetting('LimitEquipment')) {\n Res = 0;\n Wall = true;\n }\n if (gameResource.level >= 10 && getPageSetting('CapEquip')) {\n Res = 0;\n Wall = true;\n }\n if (game.global.world >= 58 && game.global.world < 60 && getPageSetting('WaitTill60')){\n Wall = true;\n }\n if (gameResource.level < 2 && equip.Stat == 'health' && getPageSetting('AlwaysArmorLvl2')){\n Res = 9999 - gameResource.prestige;\n }\n //manage prestige\n if (hiderwindow > 20 && game.global.world != 200 && equip.Stat == 'attack' && gameResource.level > 1) {\n Wall = true;\n }\n if (10*Cos > NextCost && equip.Stat == 'attack' && game.global.world > 37 && hiderwindow > 3) {\n Wall = true;\n }\n if ((gameResource.prestige < ((game.global.world-10)/5)+2 && gameResource.level > 2) && (equip.Stat == 'attack') && game.global.world > 37 && hiderwindow > 3) {\t\t\n Res = 0;\n Wall = true;\n }\n if (gameResource.prestige+1 < ((game.global.world-10)/5)+2 && gameResource.level > 0 && game.global.world > 37 && hiderwindow > 3) {\t\t\n Res = 0;\n Wall = true;\n }\n if (gameResource.level > 11 && game.global.world != 200 && game.global.world > 37 && (game.global.world < 200 || ( game.global.world > 200 && (4 * Cos) > game.resources.metal.owned))) {\t\t\n Res = 0;\n Wall = true;\n }\n\n return {\n Stat: equip.Stat,\n Factor: Res,\n Status: Status,\n Wall: Wall\n };\n}", "function fight(attacker, victim) {\n const def = victim.lvl.defence;\n let dmg = 0;\n for (let i = 0; i < attacker.lvl.strength; i++) {\n const rand = Math.floor(Math.random() * 8) + 2;\n if (rand >= def) {\n dmg++;\n }\n }\n\n return dmg;\n }", "function setdmg1(maxhit) //Prevents additional action if hp2 is 0\n{\n //document.getElementById(\"test\").innerHTML=\"\";\n if (hp1 != 0)\n {\n elem=document.getElementById(\"player1\");\n var rand = Math.floor(Math.random()*(maxhit+1));\n var chance = Math.floor(Math.random()*(monsterAccuracyLevel-1));\n if (chance == 0) rand = 0;\n if (monsterAbbreviation == \"nope\" && protectedpray) rand = 0; \n else if (monsterAbbreviation == \"nope\" && attackcount == 6 && phase == 3) { //Araxxor phase 3 swipe\n\trand = 25 + Math.floor(Math.random()*21);\n\tattackcount = 0;\n }\n else if (monsterAbbreviation == \"nope\" && attackcount >= 6 && attackcount < 9 && phase == 1) { //Araxxor phase 1 web\n\tif (reflected == 0) {\n\t\thp2+=15;\n\t\tif (hp2 > 1000) hp2 = 1000;\n\t\t$(\"#greenhp2\").css({\"width\": (hp2*monsterHPbarDRAINAGE)});\n\t}\n\trand = reflected;\n\tif (attackcount == 8) {\n\t\tmonsterDefenceRank = 2.5;\n\t}\n }\n else if (monsterAbbreviation == \"nope\" && attackcount >= 13 && phase == 1) { //Araxxor phase 1 cacoon\n\tif (prayer == \"mage\" && attackcount == 13) protectcacoon = true; //I wouldn't reach this else if condition if I use protectedpray bool\n\t//if (protectcacoon == false) rand = 20; //Old implementation\n\t//else rand = 10;\n\trand = 20;\n\tif (attackcount == 15) {\n\t\tprotectcacoon = false;\n\t\tnotfrozen = true;\n\t\tplayer1frozen.src=\"gifs/invisible.gif\"; \n\t\tattackcount = 0;\n\t}\n }\n else if (mageatk && monsterAbbreviation == \"ogre\") {\n\t rand = 5;\n\t mageatk = false;\n\t monsterDefenceRank = 3;\n\t if (stopcount == 0) {\n\t\t $(\"#msg\").css({\"opacity\": defaultopacity});\n\t\t document.getElementById(\"msg\").innerHTML=\"Your accuracy has been weakened by the ice.\"; \n\t\t gamemsg = setInterval(function () {\n\t\t\t defaultopacity -= 0.002;\n\t\t\t if (defaultopacity < -100) defaultopacity = 0; //To prevent non-stop decrementation\n\t\t\t $(\"#msg\").css({\"opacity\": defaultopacity});\n\t\t }, 10);\t\n\t stopcount++;\n\t }\n }\n else if (monsterAbbreviation == \"jad\") { \n\t if (protectedpray && jadhardmode != \"Normal\") rand = Math.round(rand/2);\n\t else if (protectedpray) rand = 0;\n\t if (!protectedpray && jadhardmode == \"Hard\") rand = 50 + Math.round(rand*0.48);\n\t if (!protectedpray && jadhardmode == \"Impossible\") rand = 97;\n\t if (protectedpray && jadhardmode == \"Impossible\" && rand < 20) rand += 30;\n }\n else if (monsterAbbreviation == \"brid\") { \n\t if (protectedpray) rand = 0;\n }\n else if (monsterAbbreviation == \"ele\") {\n\t monsterDefenceRank -= 0.01;\n\t monsterAccuracyLevel += 0.01;\n }\n if (rand >= hp1) //Sets what rand is based on hp1\n {\n rand = hp1;\n if (hp1 == 0)//Prevents additional 0s that randomly appear\n {\n rand = null;\n }\n }\n hp1 = hp1 - rand; //This line is the reason why \"if (hp1==0)\" appears twice\n\t\tif (monsterAbbreviation == \"drag\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\";}\n\t\t\telse {attackGIFname = \"atk2\";}\n\t\t}\n\t\tif (monsterAbbreviation == \"brid\") {\n\t\t\tif (attackcount <= 5) {\n\t\t\t\tif (attackGIFname == \"atk2\") {attackGIFname = \"atk\"; magerangeatk = \"range\";}\n\t\t\t\telse if (attackGIFname == \"atk\") {attackGIFname = \"atk2\"; magerangeatk = \"mage\";}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"range\";} \n\t\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"mage\";}\n\t\t\t}\n\t\t\tattackcount++;\n\t\t\tif (attackcount == 10) attackcount = 0;\n\t\t}\n\t\telse if (monsterAbbreviation == \"jad\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"mage\";}\n\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"range\"; }\n\t\t}\n\t\telse if (monsterAbbreviation == \"nope\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (attackcount == 5 && phase == 3) { //Araxxor mechanic checks for protectedpray so magerangeatk is needed\n\t\t\t\tattackGIFname = \"swipe\"; magerangeatk = \"melee\";\n\t\t\t}\n\t\t\telse if (attackcount == 5 && phase == 1) { \n\t\t\t\tattackGIFname = \"web1\"; magerangeatk = \"reflect\";\n\t\t\t\treflected = 0;\n\t\t\t\tmonsterDefenceRank = 10;\n\t\t\t}\n\t\t\telse if (attackcount == 6 && phase == 1) { \n\t\t\t\tattackGIFname = \"web2\"; \n\t\t\t}\n\t\t\telse if (attackcount == 7 && phase == 1) { \n\t\t\t\tattackGIFname = \"web3\"; \n\t\t\t}\n\t\t\telse if (attackcount == 12 && phase == 1) { \n\t\t\t\tstopatk1();\n\t\t\t\tstopdmg1();\n\t\t\t\tnotfrozen = false;\n\t\t\t\tmagerangeatk = \"bleed\";\n\t\t\t\tattackGIFname = \"cacoon1\";\t\t\n\t\t\t\tplayer1frozen=document.getElementById(\"player1frozen\");\n\t\t\t\tsetTimeout(function () \n\t\t\t\t{ \n\t\t\t\t\tplayer1frozen.src=\"gifs/cacoon.png\"\n\t\t\t\t}, 1000);\n\t\t\t}\n\t\t\telse if (attackcount == 13 && phase == 1) { \n\t\t\t\tattackGIFname = \"cacoon2\"; \n\t\t\t\tif (protectcacoon == true) attackcount++; //New implementation makes cacoon hit 2x instead of 3x if protected\n\t\t\t}\n\t\t\telse if (attackcount == 14 && phase == 1) { \n\t\t\t\tattackGIFname = \"cacoon3\"; \n\t\t\t}\n\t\t\telse if (phase >= 2) {\n\t\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk3\"; magerangeatk = \"melee\";}\n\t\t\t\telse {attackGIFname = \"atk4\"; magerangeatk = \"range\"; }\t\n\t\t\t}\n\t\t\telse if (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"melee\";}\n\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"range\"; }\n\t\t\tif (phase == 3 || phase == 1) attackcount++;\n\t\t}\n\t\telse if (monsterAbbreviation == \"ogre\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {\n\t\t\t\tif (prayer != \"mage\") { //Using protectedpray code mechanic works too, but no need (too much work for this monster)\n\t\t\t\t\tstopatk1();\n\t\t\t\t\tstopdmg1();\n\t\t\t\t\tnotfrozen = false;\n\t\t\t\t\tmageatk = true;\n\t\t\t\t\tattackGIFname = \"atk2\"; //Same as stand animation, but stand is used in other code so using it here will cause disruptions\n\t\t\t\t\tif (typeof(freezeanimation) != 'undefined') clearInterval(freezeanimation);\n\t\t\t\t\ticeopacity = 0;\n\t\t\t\t\topacityone = false;\n\t\t\t\t\tfreezeanimation = setInterval(function () {\n\t\t\t\t\t\tplayer1frozen=document.getElementById(\"player1frozen\");\n\t\t\t\t\t\tplayer1frozen.src=\"gifs/barrage.png\"\n\t\t\t\t\t\tif (opacityone) iceopacity -= 0.005;\n\t\t\t\t\t\telse iceopacity += 0.005;\n\t\t\t\t\t\tif (iceopacity > 1) opacityone = true;\n\t\t\t\t\t\tif (iceopacity < -100) iceopacity = 0; //To prevent non-stop decrementation \n\t\t\t\t\t\t$(\"#player1frozen\").css({\"opacity\": iceopacity});\n\t\t\t\t\t}, 10);\t\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnotfrozen = true;\n\t\t\t\t\tattackGIFname = \"atk\";\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnotfrozen = true;\n\t\t\t\tattackGIFname = \"atk\";\n\t\t\t}\n\t\t}\n\t\telse attackGIFname = \"atk\";\t \t\n\t\telem3=document.getElementById(\"player2\");\n\t\telem3.src=\"gifs/\" + monsterAbbreviation + attackGIFname +\".gif\";\n if (hp1 == 0) //Prevents eating when dead\n {\n\twon = false;\n if (monsterAbbreviation == \"me\") player1killpoints = 0;\n\tdocument.getElementById(\"killsPVM\").innerHTML=player1killpoints;\n player2kills += 1;\n\tdocument.getElementById(\"deathsPVM\").innerHTML=player2kills; \n stopatk1();\n\tstopatk2();\n\tsetTimeout(function () \n\t{\n\tstopdmg1(); \n\tstopdmg2();\t\n\t}, 1);\n\t$(\".item1\").css({\"display\": \"none\"}); \t\t\t\t\t\t\t \n document.getElementById(\"player2\").removeAttribute(\"onclick\");\t\t\n\tallowattack = false;\n setTimeout(function () \n { \n\t $(\"#hphp1\").css({\"display\": \"none\"});\n elem.src=\"gifs/rangedeath.gif\";\t\n }, 3000);\n\t setTimeout(function () \n { \n\t player1frozen=document.getElementById(\"player1frozen\"); \n\t player1frozen.src=\"gifs/invisible.gif\";\n\t elem.src=\"gifs/youlose.gif\"; \n\t $(\"#restart\").css({\"visibility\": \"visible\"});\n }, 5000);\n }\n document.getElementById(\"hpcount1\").innerHTML=hp1;//Note: Always make sure that the logic is correct before outputting\n $(\"#redhp1\").css({\"height\": 50 - hp1/2}); \n $(\"#hitsplat1\").css({\"visibility\": \"visible\"});\n if (rand == 0) \n {\n $(\"#hitsplat1\").css({\"background-image\": \"url('images/dmg0.gif')\"});\n $(\".singledigitdmg1\").css({\"display\": \"none\"});\n $(\".leftsplathalf1\").css({\"display\": \"none\"});\n $(\".rightsplathalf1\").css({\"display\": \"none\"});\n } \n else {$(\"#hitsplat1\").css({\"background-image\": \"url('images/dmg.gif')\"});}//The else must be there for damages to not stay blue\n if (rand < 10 && rand > 0) //Single digit damage number\n { //dmg#-width,0-6,1-4,2-6,3-5,4-5,5-5,6-6,7-5,8-6,9-6,\n $(\".leftsplathalf1\").css({\"display\": \"none\"});\n $(\".rightsplathalf1\").css({\"display\": \"none\"}); \n if (rand == 0 || rand == 2 || rand == 6 || rand == 8 || rand == 9)\n {\n $(\".singledigitdmg1\").attr(\"width\", \"6\"); //Adjusting the gif width of the single digit number\n $(\".singledigitdmg1\").css({\"margin-left\": \"9px\"}); //Adjusting the position of the single digit number\n }\n else if (rand == 3 || rand == 4 || rand == 5 || rand == 7)\n {\n $(\".singledigitdmg1\").attr(\"width\", \"5\");\n $(\".singledigitdmg1\").css({\"margin-left\": \"9.5px\"});\n }\n else \n {\n $(\".singledigitdmg1\").attr(\"width\", \"4\");\n $(\".singledigitdmg1\").css({\"margin-left\": \"10px\"});\n }\n $(\".singledigitdmg1\").css({\"display\": \"\"});\n $(\".singledigitdmg1\").attr(\"src\", \"images/\" + rand + \".gif\");\n }\n else if (rand >= 10)\n {//dmg#-width,0-6,1-4,2-6,3-5,4-5,5-5,6-6,7-5,8-6,9-6,\n leftdigit = Math.floor(rand / 10); //Split 2 digit damages to a left number and right number\n rightdigit = rand % 10;\n $(\".singledigitdmg1\").css({\"display\": \"none\"});\n if (leftdigit == 0 || leftdigit == 2 || leftdigit == 6 || leftdigit == 8 || leftdigit == 9) //Adjusting the gif width of the number\n {$(\".leftsplathalf1\").attr(\"width\", \"6\");}\n else if (leftdigit == 3 || leftdigit == 4 || leftdigit == 5 || leftdigit == 7)\n {$(\".leftsplathalf1\").attr(\"width\", \"5\");}\n else {$(\".leftsplathalf1\").attr(\"width\", \"4\");}\n if (rightdigit == 0 || rightdigit == 2 || rightdigit == 6 || rightdigit == 8 || rightdigit == 9)\n {$(\".rightsplathalf1\").attr(\"width\", \"6\");}\n else if (rightdigit == 3 || rightdigit == 4 || rightdigit == 5 || rightdigit == 7)\n {$(\".rightsplathalf1\").attr(\"width\", \"5\");}\n else {$(\".rightsplathalf1\").attr(\"width\", \"4\");}\n $(\".leftsplathalf1\").css({\"display\": \"\"});\n $(\".leftsplathalf1\").attr(\"src\", \"images/\" + leftdigit + \".gif\");\n $(\".rightsplathalf1\").css({\"display\": \"\"}); \n $(\".rightsplathalf1\").attr(\"src\", \"images/\" + rightdigit + \".gif\");\n }\n $(\"#greenhp1\").css({\"width\": (hp1*10/33)});\n if (monsterTime > 2000) \n {\n\t setTimeout(function () //Commented out because hits are too fast\n\t { \n\t\t\t$(\".singledigitdmg1\").css({\"display\": \"none\"});\n\t\t\t$(\".leftsplathalf1\").css({\"display\": \"none\"});\n\t\t\t$(\".rightsplathalf1\").css({\"display\": \"none\"});\n\t\t\t$(\"#hitsplat1\").css({\"visibility\": \"hidden\"});\n\t }, 2000);\n }\n }\n}", "function calcDamage(){\n if (flankFlag == true)\n {\n return Math.floor((cannonPB.value / 12.0) * 150);\n }\n else {\n return Math.floor((cannonPB.value / 12.0) * 75);\n }\n}", "function updateHealth() {\n // Reduce harry health, constrain to reasonable range\n harryHealth = constrain(harryHealth - 0.5,0,harryMaxHealth);\n // Check if the harry is dead\n if (harryHealth === 0) {\n // If so, the game is over\n gameOver = true;\n }\n}", "doDamage(damage){\r\n if (!(damage > 0))\r\n return;\r\n\r\n this.hp -= damage;\r\n\r\n if (this.hp <= 0){\r\n this.alive = false;\r\n this.hp = 0;\r\n if (this.nextEnemy != null && this.prevEnemy != null){\r\n this.nextEnemy.prevEnemy = this.prevEnemy;\r\n }\r\n player.changeMoneyBy(50);\r\n }\r\n }", "attacked(animal,attacker,damage,type,last){}", "takeDamage(damage) {\n this.health -= damage;\n return this.health;\n }", "takeDamage(damage) {\n this.health -= damage;\n return this.health;\n }", "function damage(power : float) {\n\tzombieResources.reduceHealth(power);\n}", "function checkGrimoire() {\n if (fullMana()) {\n castSpell( ConjureBakedGoods );\n }\n }", "function lossCheck() {\n if (playerChar === \"roy\"){\n if (roy.health <= 0){\n alert(\"You lose!\")\n reset();\n \n }\n }\n\n if (playerChar === \"ridley\"){\n if (ridley.health <= 0){\n alert(\"You lose!\")\n reset();\n }\n }\n\n if (playerChar === \"cloud\"){\n if (cloud.health <= 0){\n alert(\"You lose!\")\n reset();\n }\n }\n\n if (playerChar === \"incineroar\"){\n if (incineroar.health <= 0){\n alert(\"You lose!\")\n reset();\n }\n }\n}", "function attack(damage, target) {\n\t// Generates and stores a random number from 1 to 10.\n $(\"#room-hider\").hide();\n $(\"#searcher-images\").hide();\n // hide room description on attack in case it bugs out and is showing\n\tvar hitChance = Math.floor(Math.random() * 10) + 1;\n var defense = target.defense;\n\n if(hitChance <= defense) {\n $(\"#combat-display\").append(\"<p>\" + target.name + \" defended, no damage.</p>\");\n } else if(hitChance >= 1 && hitChance <= 10) {\n \ttarget.takeDamage(damage);\n // Doesn't need to be an else if, but made it one to illustrate \tthe concept.\n }\n}", "function healthPotion() {\n // If player has any health potions\n if (Player.healthPotions > 0){\n //This conditional branch is so that it doesn't gain over max health\n var diff = Player.maxHealth - Player.health;\n \n if (diff >= 50){\n alert(\"You have used a health potion to gain 50 Health points!\");\n Player.health = Player.health + 50;\n Player.healthPotions--;\n document.getElementById(\"health\").innerHTML = Player.health + \" health / \" + Player.maxHealth + \" health\";\n document.getElementById(\"healthP\").innerHTML = Player.healthPotions + \" Health Potions\";\n \n // enemy turn \n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n eAttack(defendRating);\n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n\n }\n\n else {\n alert(\"You have used a health potion to gain \" + diff + \" Health points!\");\n Player.health = Player.health + diff;\n Player.healthPotions--;\n document.getElementById(\"health\").innerHTML = Player.health + \" health / \" + Player.maxHealth + \" health\";\n document.getElementById(\"healthP\").innerHTML = Player.healthPotions + \" Health Potions\";\n \n // enemy turn \n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n eAttack(defendRating);\n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n }\n }\n\n else {\n alert(\"You do not have enough health potions!\");\n }\n}", "function checkChangesToHUD() {\r\n if(menu){\r\n staminaSprite.visible = false;\r\n healthSprite.visible = false;\r\n staminaSprite2.visible = false;\r\n healthSprite2.visible = false;\r\n }\r\n else{\r\n staminaSprite.visible = true;\r\n healthSprite.visible = true;\r\n staminaSprite2.visible = true;\r\n healthSprite2.visible = true;\r\n }\r\n\r\n staminaSprite.scale.set((Math.abs(stamina) / 200) * spriteXScale, spriteYScale, 1);\r\n staminaSprite.position.x = (spriteXPosition) - (1 - (Math.abs(stamina)/200)) * spriteXScale / 2;\r\n\r\n // Damage effect\r\n if(damageWarning){\r\n if(damageFrames > 5){\r\n damageSprite.visible = false;\r\n damageWarning = false;\r\n }\r\n damageFrames += 1;\r\n }\r\n\r\n // If you have been hurt, we update the apperance of your health\r\n if (damaged) {\r\n \r\n // Update the size of the health bar according to your amount of health\r\n healthSprite.scale.set((Math.abs(health) / 100) * spriteXScale, spriteYScale, 1);\r\n healthSprite.position.x = (spriteXPosition) - (1 - (Math.abs(health)/100)) * spriteXScale / 2;\r\n\r\n // Color codes your health bar according to amount of health\r\n if (health > 80) {\r\n healthSprite.material.color.setHex(0x00ff00); // Green\r\n }\r\n if (health < 80) {\r\n healthSprite.material.color.setHex(0xffff00); // Yellow\r\n }\r\n if (health < 50) {\r\n healthSprite.material.color.setHex(0xff0000); // Red\r\n }\r\n\r\n // Set damaged to false to prevent taking further damage from the source\r\n damaged = false;\r\n }\r\n\r\n // Fading in the game over screen(s)\r\n if (gameOverScreen) {\r\n if (bloodSprite.material.opacity < 0.8) {\r\n bloodSprite.material.opacity += 0.01;\r\n gameOverSprite.material.opacity += 0.015;\r\n } else if (restartSprite.material.opacity < 0.5) {\r\n restartSprite.material.opacity += 0.02;\r\n }\r\n }\r\n \r\n // TODO: Comment\r\n if(level == 2 && !menu){\r\n var distance = new THREE.Vector3();\r\n distance.subVectors(charMesh.position, puzzle.position);\r\n if(distance.length() < 10){\r\n crossHairSprite.visible = true;\r\n }\r\n else{\r\n crossHairSprite.visible = false;\r\n }\r\n }\r\n}", "function enemyAttackPlayer(isCounter = false) {\n // Assumes dodge and counterAttack are false \n var dodge = false;\n var counterAttack = false;\n var playerLost = false;\n // We either check if it's a genuine allowable attack, or if it's a counter\n if ((!enemy.isAttacking && enemyCanGo && !player.isAttacking) || isCounter) {\n // Check odds of a dodge\n var playerDodge = getRandom(100);\n if (playerDodge <= player.dodgeProbability) {\n dodge = true;\n }\n // If it's not a counter ....\n if (!isCounter) {\n // Check the odds of a counter\n var counter = getRandom(100);\n if (counter <= player.counterAttackProbability) {\n counterAttack = true;\n }\n }\n\n // Prevent 0 attack power.\n var attackPower = getRandom(enemy.attackPoints) + 1;\n\n // If the last attack was more than the amount of hitpoints the player has left, pin it to the amount of hitpoints.\n // This will prevent negative hitpoints from occuring.\n attackPower = (attackPower > player.hitPoints) ? player.hitPoints : attackPower;\n\n // We hit the enemy!\n playSound(attackStartSound);\n\n // Load enemy's attackingImage\n swapImage(enemy, enemy.attackingImage);\n // Flag the enemy is attacking\n enemy.isAttacking = true;\n\n // Run css animations\n // The callback will check for a dodge and animate the enemy back into position\n enemy.imageElement.animate({\n right: \"240px\"\n }, 300, function () {\n // Right before the enemy hits, we allow a dodge\n quickDodgeAllowed = true;\n\n enemy.imageElement.animate({\n right: \"250px\"\n }, 150, function () {\n quickDodgeAllowed = false;\n // If the player didn't dodge...\n if (!dodge && !quickDodgeExecuted) {\n // Display to the battle screen\n displayText(player, \"-\" + attackPower);\n // Add the event to the console log\n gameConsoleLog(enemy.name + \" hit \" + player.name + \" for \" + attackPower + \"hps!\");\n // Play the hit sound\n playSound(smackSound);\n // Animate the player being hit\n characterHitAnimation(player, \"left\");\n // Take away the player's health\n player.hitPoints -= attackPower;\n // If the player DID dodge\n } else {\n if (quickDodgeExecuted) {\n // if it was a quick dodge rather than a random dodge, flag it to false now since we are running the dodge\n quickDodgeExecuted = false;\n }\n // Log the dodge\n gameConsoleLog(player.name + \" dodged \" + enemy.name + \"'s attack!\");\n dodgeAttack(player);\n }\n // Update the display\n updateStats();\n // Check if the player is out of hitPoints\n if (player.hitPoints <= 0) {\n gameConsoleLog(player.name + \" has fallen!\");\n killCharacter(player);\n playerLost = true;\n }\n // Now that the actual hit is done, animate player back to their original position.\n enemy.imageElement.animate({\n right: \"-180px\"\n }, 300, function () {\n // Go back to the standing image\n swapImage(enemy, enemy.standingImage);\n // Flag the attack is over\n enemy.isAttacking = false;\n\n // Do we get a counter attack?\n // We also check to see if the player is still alive to prevent a \"ghost\" counter-attack from happening.\n if (counterAttack === true && !playerLost) {\n gameConsoleLog(player.name + \" has counter-attacked!\");\n playerAttackEnemy(true);\n }\n // If this wasn't an enemy counter-attack, we have to restart the enemy's attack timer.\n if (!isCounter) {\n startEnemyTimer();\n }\n });\n });\n });\n return true;\n }\n}", "function calcMissChance(){\n if(enemyPoints >= myPoints){\n missChance += 1;\n if(missChance >= 39){\n missChance = 40;\n } \n }else{\n missChance -= 1\n if(missChance <= 35){\n missChance = 35\n }\n }\n}", "calculateDamage(isWeaker) {\n let useLevel = this.level;\n if(isWeaker){\n useLevel++;\n }\n let num = Math.floor(Math.random() * useLevel) + 1;\n return num;\n }", "function dealDamage(room, obj, attacker, dmg, selfInflicted = false) {\n obj.health -= dmg;\n\n // if the damage was NOT self inflicted (like bumping into an island or dock/city)\n if(!selfInflicted) {\n // if the attacker was a player ship, they receive a (feedback) message about the attack\n if(attacker.myUnitType == 0) {\n attacker.attackInfo.hits++;\n }\n\n // if the victim was a player ship, they receive an (error) message about the attack\n if(obj.myUnitType == 0) {\n obj.errorMessages.push([4,0]);\n }\n }\n\n // TO DO: Differentiate messages more, using the second parameter (now it's just a vague \"You were attacked!\")\n // TO DO: If a similar message already exists, nothing new is added. \n // => (If you have three cannonballs hitting the same ship, you don't want three messages saying \"Succesful attack! You hit ship X!\")\n\n // TO DO: This could be more efficient. We're repeating the code used when first CREATING monsters/aiShips/etc. \n // => On the other hand, it's not so bad as it's slightly different and short code :p\n\n // if we're dead ...\n if(obj.health <= 0) {\n // respawn (based on unit type)\n let uType = obj.myUnitType;\n\n // if the PLAYER killed something\n // they should get a message (\"You destroyed a <unit type>\"! Check your resources for loot\")\n if(attacker.myUnitType == 0) {\n attacker.errorMessages.push([7, uType]);\n }\n\n switch(uType) {\n // Player ship: no respawning, inform of game over\n case 0:\n // TO DO ... what do we do?\n\n // TO DO ... give REWARD to the attacker?\n\n break;\n\n // Monster: respawn to respawn location for this type\n // placeUnit() on the new location, change the monster's attributes\n case 1:\n // give reward to attacker\n if(attacker.myUnitType == 0) {\n // save it; monsters always give gold\n attacker.resources[0] = (+attacker.resources[0]) + (+obj.loot); \n }\n\n // get a spawn point\n let spawnPoint = room.spawnPoints[ Math.floor(Math.random() * room.spawnPoints.length) ];\n\n // move monster to new location\n placeUnit(room, {x: obj.x, y: obj.y, index: obj.index}, spawnPoint.x, spawnPoint.y, 'monsters');\n\n // give it new attributes (just replace the old object with a new one)\n let randomMonsterType = Math.floor( Math.random() * room.monsterTypes.length );\n room.monsters[obj.index] = createMonster(randomMonsterType, obj.index, room.averagePlayerLevel);\n\n break;\n\n // AI ship: respawn to random dock (with a route, which you pick immediately)\n case 2:\n // give reward to attacker\n if(attacker.myUnitType == 0) {\n // calculate reward\n // AI ships have different resources, based on their type\n // Those resources are scaled by the ship level (and attack strength)\n for(let res = 0; res < 4; res++) {\n // save it; get it directly from the object\n attacker.resources[res] = (+attacker.resources[res]) + (+obj.loot[res] );\n }\n\n }\n\n // Find a dock (WITH routes)\n let dockIndex, numDockRoutes;\n do {\n dockIndex = Math.floor(Math.random() * room.docks.length);\n numDockRoutes = room.docks[dockIndex].routes.length;\n } while(numDockRoutes < 1);\n\n // Pick a random route => get first position\n let routeIndex = Math.floor(Math.random() * numDockRoutes);\n let randRouteStart = room.docks[dockIndex].routes[routeIndex].route[0];\n\n // Change to a new ship\n room.aiShips[obj.index] = createAIShip(randRouteStart, routeIndex, room.averagePlayerLevel);\n\n // Start at one of the routes (placeUnit)\n placeUnit(room, {x: obj.x, y: obj.y, index: obj.index}, randRouteStart[0], randRouteStart[1], 'aiShips');\n break;\n\n // Docks (3) can't respawn => should change owner\n // Cities (3) can't respawn => should change owner\n }\n }\n}", "function checkEnemyDeath(enemy) {\n if (enemy.HP <= 0) {\n player.XP += enemy.XP;\n console.log(\n `${player.name} defeats ${enemy.name} and gains ${enemy.XP}XP!`\n );\n }\n}", "attack(player, minion) {\r\n console.log(player, minion);\r\n while (player.isAlive() && minion.isAlive()) {\r\n /*1. Calculate the actual damage by multiplying the strength \r\n * of the player times the damage value of the weapon.*/\r\n const playerDmg = player.strength * this.damage;\r\n /*2. Call the applyDamage function of the \r\n * minion object and pass it the actual damage value you just calculated.*/\r\n minion.applyDamage(playerDmg);\r\n /*Call the isAlive function of the minion object. If the minion is dead, exit. \r\n * If the minion is not dead, call the attack function of the minion and pass it the player object.*/\r\n if (minion.isAlive()) {\r\n minion.attack(player);\r\n } else {\r\n break;\r\n }\r\n }\r\n return player.isAlive();\r\n }", "async function inflictDamage( /* creature */ attacker, /* creature */ defender,\n damage, /* color */ flashColor, ignoresProtectionShield)\n{\n\tlet killed = false;\n\tlet theBlood;\t// dungeonFeature\n let transferenceAmount;\n\n\tif (damage == 0\n || (defender.info.flags & MONST_INVULNERABLE))\n\t{\n\t\treturn false;\n\t}\n\n\tif (!ignoresProtectionShield\n && defender.status[STATUS_SHIELDED])\n\t{\n\t\tif (defender.status[STATUS_SHIELDED] > damage * 10) {\n\t\t\tdefender.status[STATUS_SHIELDED] -= damage * 10;\n\t\t\tdamage = 0;\n\t\t} else {\n\t\t\tdamage -= (defender.status[STATUS_SHIELDED] + 9) / 10;\n\t\t\tdefender.status[STATUS_SHIELDED] = defender.maxStatus[STATUS_SHIELDED] = 0;\n\t\t}\n\t}\n\n\tdefender.bookkeepingFlags &= ~MB_ABSORBING; // Stop eating a corpse if you are getting hurt.\n\n\t// bleed all over the place, proportionately to damage inflicted:\n\tif (damage > 0 && defender.info.bloodType) {\n\t\ttheBlood = dungeonFeatureCatalog[defender.info.bloodType];\n\t\ttheBlood.startProbability = (theBlood.startProbability * (15 + min(damage, defender.currentHP) * 3 / 2) / 100);\n\t\tif (theBlood.layer == GAS) {\n\t\t\ttheBlood.startProbability *= 100;\n\t\t}\n\t\tawait spawnDungeonFeature(defender.xLoc, defender.yLoc, theBlood, true, false);\n\t}\n\n\tif (defender !== player && defender.creatureState == MONSTER_SLEEPING) {\n\t\twakeUp(defender);\n\t}\n\n\tif (defender === player\n && rogue.easyMode\n && damage > 0)\n\t{\n\t\tdamage = max(1, damage/5);\n\t}\n\n if (((attacker === player && rogue.transference) || (attacker && attacker !== player && (attacker.info.abilityFlags & MA_TRANSFERENCE)))\n && !(defender.info.flags & (MONST_INANIMATE | MONST_INVULNERABLE)))\n\t\t{\n transferenceAmount = min(damage, defender.currentHP); // Maximum transferred damage can't exceed the victim's remaining health.\n\n if (attacker === player) {\n transferenceAmount = transferenceAmount * rogue.transference / 20;\n if (transferenceAmount == 0) {\n transferenceAmount = ((rogue.transference > 0) ? 1 : -1);\n }\n } else if (attacker.creatureState == MONSTER_ALLY) {\n transferenceAmount = transferenceAmount * 4 / 10; // allies get 40% recovery rate\n } else {\n transferenceAmount = transferenceAmount * 9 / 10; // enemies get 90% recovery rate, deal with it\n }\n\n attacker.currentHP += transferenceAmount;\n\n if (attacker === player && player.currentHP <= 0) {\n await gameOver(\"Drained by a cursed ring\", true);\n return false;\n }\n }\n\n\tif (defender.currentHP <= damage) { // killed\n\t\tawait killCreature(defender, false);\n\t\tanyoneWantABite(defender);\n\t\tkilled = true;\n\t} else { // survived\n\t\tif (damage < 0 && defender.currentHP - damage > defender.info.maxHP) {\n\t\t\tdefender.currentHP = max(defender.currentHP, defender.info.maxHP);\n\t\t} else {\n\t\t\tdefender.currentHP -= damage; // inflict the damage!\n if (defender === player && damage > 0) {\n rogue.featRecord[FEAT_INDOMITABLE] = false;\n }\n\t\t}\n\n\t\tif (defender !== player && defender.creatureState != MONSTER_ALLY\n\t\t\t&& defender.info.flags & MONST_FLEES_NEAR_DEATH\n\t\t\t&& defender.info.maxHP / 4 >= defender.currentHP)\n\t\t{\n\t\t\tdefender.creatureState = MONSTER_FLEEING;\n\t\t}\n\t\tif (flashColor && damage > 0) {\n\t\t\tflashMonster(defender, flashColor, MIN_FLASH_STRENGTH + (100 - MIN_FLASH_STRENGTH) * damage / defender.info.maxHP);\n\t\t}\n\t}\n\n\trefreshSideBar(-1, -1, false);\n\treturn killed;\n}", "attack(player) {\r\n player.applyDamage(this.strength);\r\n }", "function attackDamage (attackersAttack, attackersMovePower, defendersDefense, sameTypeAttackBonus = 1, \n typeModifier = 10, pokemonLevel = 60) {\n const randomNumber = Math.floor(Math.random() * (255 - 217) + 217)\n const fullDamage = (((((((((2*pokemonLevel)/5+2)*attackersAttack*attackersMovePower)/defendersDefense)\n /50)+2)*sameTypeAttackBonus)*typeModifier/10)*randomNumber)/255\n return Math.floor(fullDamage);\n\n // Pokemon Battle Damage Calculation: \n // https://www.math.miami.edu/~jam/azure/compendium/battdam.htm\n // A = attacker's Level\n // B = attacker's Attack or Special\n // C = attack Power\n // D = defender's Defense or Special\n // X = same-Type attack bonus (1 or 1.5)\n // Y = Type modifiers (40, 20, 10, 5, 2.5, or 0)\n // Z = a random number between 217 and 255\n }", "checkDeath() {\n if(this.lives <= 0) {\n this.isDead = true;\n }\n }", "function CheckAlive() {\n\tif(this.currentHealth <= 0) {\n\t\tDie();\n\t}\n}", "function calcDamage(obj) {\n let accuracy = Math.floor(Math.random() * Math.floor(100));\n let attackPower = Math.round((obj.attack * accuracy) / 100);\n return attackPower;\n}", "function autoDmgClicked(){\n if (player.gold > 2) {\n player.gold = player.gold - 2;\n player.autoDmg = player.autoDmg + 0.1;\n }\n else {\n console.log('Too poor, failed purchase');\n }\n}", "takeDamage(damage){\n let damagePerUnit = damage / this._units.length;\n Logger.logSquad(this, `took ${damage.toFixed(2)} damage, ${damagePerUnit.toFixed(2)} per unit`);\n this._units.forEach((unit) => {\n unit.takeDamage(damagePerUnit);\n });\n }", "hurt(dmg){\n this.life = this.life - dmg;\n }", "function healCheck() {\n if (combatant[\"healing\"] === true && combatant[\"hitPoints\"] < 75 && combatant[\"healCounter\"] > 0 && combatant[\"hitPoints\"] > 0) {\n combatant[\"hitPoints\"] = combatant[\"hitPoints\"] + combatant[\"healPoints\"];\n document.getElementById(\"combatHitPoints\").innerHTML = `HP: ${combatant[\"hitPoints\"]}`;\n document.getElementById(\"combatText2\").textContent = `${combatant[\"name\"]} used their super heaing and healed ${combatant[\"healPoints\"]} hit points!`;\n combatant[\"healCounter\"]--;\n counterAttack();\n } else counterAttack();\n}", "function attack() {\n clash.play();\n if(enemySelect){\n player.HP = player.HP - enemy.AP;\n enemy.HP = enemy.HP - player.AP;\n player.AP = player.AP + player.baseAP;\n $(\".player\").children(\".hp\").text(\"HP: \" + player.HP);\n $(\".enemy\").children(\".hp\").text(\"HP: \" + enemy.HP);\n deathCheck();\n }\n}", "damage(source, dmg, inputX = 0, inputY = 0, damageType = DAMAGE_TYPE.PHYSICAL_WEAPON) {\n const savedAngle = this.angle;\n super.damage(source, dmg, inputX, inputY, damageType);\n if (!damageType.hazardal && !this.attackedLastTime && this.stun <= 0) {\n if (this.turnDelay === 0) {\n this.cancelAnimation();\n this.angle = savedAngle;\n this.cancellable = false;\n }\n this.triggered = true;\n }\n }", "checkStatus(index){\n\t\tvar party = combat.currentTurn == 0 ? player.party : enemyParty.party;\n\t\tvar affiliation = combat.currentTurn == 0 ? \"actor\" : \"enemy\";\n\t\tvar takeTurn = true;\n\n\t\tif(combat.checkDeathStatus(party[index]) == false && party[index].status.statusEffects.length > 0){\n\t\t\t\n\t\t\tfor(var i = (party[index].status.statusEffects.length - 1);i > -1;i--){\n\t\t\t\tif(party[index].status.statusEffects[i].stats.duration == 0){\n\t\t\t\t\tif(party[index].status.statusEffects[i].identity.category == \"Buff\"){\n\t\t\t\t\t\tif(party[index].status.statusEffects[i].identity.subCategory == \"buff\"){\n\t\t\t\t\t\t\tstat.modifyStat(party[index], party[index].status.statusEffects[i].stats.stat, \"debuff\", party[index].status.statusEffects[i].stats.amount);\n\t\t\t\t\t\t\tconsole.log(party[index].stats);\n\t\t\t\t\t\t\tparty[index].status.statusEffects.splice(i, 1);\n\t\t\t\t\t\t}else if(party[index].status.statusEffects[i].identity.subCategory == \"debuff\"){\n\t\t\t\t\t\t\tstat.modifyStat(party[index], party[index].status.statusEffects[i].stats.stat, \"buff\", party[index].status.statusEffects[i].stats.amount);\n\t\t\t\t\t\t\tparty[index].status.statusEffects.splice(i, 1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}else{\n\t\t\t\t\t\tparty[index].status.statusEffects.splice(i, 1);\n\t\t\t\t\t}\n\t\t\t\t}else if(party[index].status.statusEffects[i].stats.duration > 0){\n\t\t\t\t\tparty[index].status.statusEffects[i].stats.duration -= 1;\n\t\t\t\t\ttakeTurn = stat.callStatusMechanic(party[index], party[index].status.statusEffects[i], affiliation);\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t/* add checks for num-flag to either 0:run turn as normal, 1: skip that actors turn, or 2: random attack any target */\n\t\tif(takeTurn == true){\n\t\t\treturn true;\n\t\t}else if(takeTurn == false){\n\t\t\treturn false;\n\t\t}\n\t}", "function check_collision()\n{\n\tvar missile_hit = false;\n\t//player -> power ups\n\tif(Math.abs(power_up['position'][0] - player['position'][0]) <= 5 && \n\t\tMath.abs(power_up['position'][1] - player['position'][1]) <= 5)\n\t{\t\n\t\tpowerup.play();\n\t\tactivate_power_up();\n\t\tmake_power_up();\n\t} \n\t \n\t //player -> enemy \n\tfor(var i = 0;i<enemies.length;i++)\n\t{\n\t\tif (player['position'][0] == enemies[i]['position'][0] && player['position'][1] == enemies[i]['position'][1])\n\t\t{\n\t\t\tif (player['shield'] <= 0)\n\t\t\t{\n\t\t\t\tplayer['health'] -= 1;\n\t\t\t\tcrash.currentTime = 0;\n\t\t\t\tcrash.play();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tshield_sound.currentTime = 0;\n\t\t\t\tshield_sound.play();\n\t\t\t\tplayer['shield'] -= 1;\n\t\t\t\teffect = \"Shield \" + player['shield'];\n\t\t\t\tdocument.getElementById(\"currenteffect\").innerHTML = effect;\n\t\t\t}\n\n\t\t}\t\n\t}\t\n\n\t//missile -> enemy \n\tif (missile_caliber == \"regular\")\n\t{\n\t\tfor(var i = 0;i<missiles.length;i++)\n\t\t{\n\t\t\tfor(var e = 0;e<enemies.length;e++)\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif (missiles[i]['direction'] == 'left' || missiles[i]['direction'] == 'right')\n\t\t\t\t{\n\t\t\t\t\tif (Math.abs(missiles[i]['position'][0] - enemies[e]['position'][0]) <= 6 && \n\t\t\t\t\t\tmissiles[i]['position'][1] == enemies[e]['position'][1])\n\t\t\t\t\t{\n\t\t\t\t\t\tmake_explosion(enemies[e]['position'][0], enemies[e]['position'][1], \"small\");\n\t\t\t\t\t\tenemies.splice(e, 1);\n\t\t\t\t\t\tmissiles.splice(i, 1);\n\t\t\t\t\t\tupdate_score();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (missiles[i]['position'][0] == enemies[e]['position'][0] && \n\t\t\t\t\t\tMath.abs(missiles[i]['position'][1] - enemies[e]['position'][1]) <= 6)\n\t\t\t\t\t{\n\t\t\t\t\t\tmake_explosion(enemies[e]['position'][0], enemies[e]['position'][1], \"small\");\n\t\t\t\t\t\tenemies.splice(e, 1);\n\t\t\t\t\t\tmissiles.splice(i, 1);\n\t\t\t\t\t\tupdate_score();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse \n\t{\n\t\tfor(var i = 0;i<missiles.length;i++)\n\t\t{\n\t\t\tmissile_hit = false;\n\t\t\tfor(var e = 0;e<enemies.length;e++)\n\t\t\t{\n\t\t if (Math.abs(missiles[i]['position'][0] - enemies[e]['position'][0]) <= 25 && \n\t\t\t\t\tMath.abs(missiles[i]['position'][1] - enemies[e]['position'][1]) <= 25)\n\t\t\t\t{\n\t\t\t\t\tmake_explosion(enemies[e]['position'][0], enemies[e]['position'][1], \"big\");\n\t\t\t\t\tenemies.splice(e, 1);\n\t\t\t\t\tupdate_score();\n\t\t\t\t\tmissile_hit = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (missile_hit)\n\t\t\t{\n\t\t\t\tmissiles.splice(i, 1);\n\t\t\t}\n\t\t\t\n\t\t}\n\t} \n\n\tupdate_health();\n}", "@action takeDamage(damage, type, armourPiercing) {\n const undealtShieldDamage = this.damageShields(damage, type)\n if (this.hasShields()) { return } // shields are not gone!\n const armourDamageRatio = this.getArmourDamageRatio(armourPiercing)\n const armourDamageAllocation = undealtShieldDamage * armourDamageRatio\n let undealtArmourDamage = this.damageArmour(armourDamageAllocation, type)\n return this.damageHP(undealtShieldDamage - armourDamageAllocation + undealtArmourDamage, type)\n }", "function dealDamage(dice,result,turn,autoPlay)\n{\n\t//Player update based of die that was rolled\n\tif (turn ==0) {\n\t\tif (dice == 10) {\n\t\t\tprintHtmlResult('display',result);\n\t\t\tprintHtmlString('display2',\"Dagger Hit!\");\n\t\t\tHealth(result,0,autoPlay);\n\t\t\ttoggleDamageColor('ComputerID');\n\t\t}\n\t\telse if (dice == 8) {\n\t\t\tprintHtmlResult('display',result);\n\t\t\tprintHtmlString('display2',\"Magic Hit!\");\n\t\t\tHealth(result,0,autoPlay);\n\t\t\ttoggleDamageColor('ComputerID');\n\t\t}\n\t\telse if (dice == 6) {\n\t\t\tprintHtmlResult('display',result);\n\t\t\tprintHtmlString('display2',\"Rock Hit!\");\n\t\t\tHealth(result,0,autoPlay);\n\t\t\ttoggleDamageColor('ComputerID');\n\t\t}\n\t\telse if (dice == 4) {\n\t\t\tprintHtmlResult('display',result);\n\t\t\tprintHtmlString('display2',\"Life Steal!\");\n\t\t\tHealth(result,0,autoPlay);\n\t\t\tHeal(result,0);\n\t\t\ttoggleDamageColor('ComputerID');\n\t\t}\n\t}\n\t//CP update based off die that was rolled\n\telse{\n\t\tif (dice == 10) {\n\t\t\tprintHtmlResult('display3',result);\n\t\t\tprintHtmlString('display4',\"Dagger Hit!\");\n\t\t\tHealth(result,1,autoPlay);\n\t\t\ttoggleDamageColor('PlayerID');\n\n\t\t}\n\t\telse if (dice == 8) {\n\t\t\tprintHtmlResult('display3',result);\n\t\t\tprintHtmlString('display4',\"Magic Hit!\")\n\t\t\tHealth(result,1,autoPlay);\n\t\t\ttoggleDamageColor('PlayerID');\n\t\t}\n\t\telse if (dice == 6) {\n\t\t\tprintHtmlResult('display3',result);\n\t\t\tprintHtmlString('display4',\"Rock Hit!\");\n\t\t\tHealth(result,1,autoPlay);\n\t\t\ttoggleDamageColor('PlayerID');\n\t\t}\n\t\telse if (dice == 4) {\n\t\t\tprintHtmlResult('display3',result);\n\t\t\tprintHtmlString('display4',\"Life Steal!\");\n\t\t\tHealth(result,1,autoPlay);\n\t\t\tHeal(result,1);\n\t\t\ttoggleDamageColor('PlayerID');\n\t\t}\n\t}\n}", "function calculateDamage(move, AtkPokemon, DefPokemon){\n power = move.power\n ad = 0 //idk how this one is calculated exactly\n modifier = 0 //this ones complicated\n damage = (((2*AtkPokemon.level/5 + 2)*power*ad)/50 + 2)*modifier\n}", "player_got_hit()\n {\n const newAudio = this.sound.damage.cloneNode();\n newAudio.play();\n this.health--;\n if(this.health <=0)\n this.gameOver=true;\n this.tookDamage=true;\n\n }", "function autoLevelEquipment() {\n //if((game.jobs.Miner.locked && game.global.challengeActive != 'Metal') || (game.jobs.Scientist.locked && game.global.challengeActive != \"Scientist\"))\n //return;\n var Best = {\n 'healthwood': {\n Factor: 0,\n Name: '',\n Wall: false,\n Status: 'white'\n },\n 'healthmetal': {\n Factor: 0,\n Name: '',\n Wall: false,\n Status: 'white'\n },\n 'attackmetal': {\n Factor: 0,\n Name: '',\n Wall: false,\n Status: 'white'\n },\n 'blockwood': {\n Factor: 0,\n Name: '',\n Wall: false,\n Status: 'white'\n }\n };\n var enemyDamage = getEnemyMaxAttack(game.global.world + 1, 30, 'Snimp', .85);\n var enemyHealth = getEnemyMaxHealth(game.global.world + 1);\n \n //below challenge multiplier not necessarily accurate, just fudge factors\n if(game.global.challengeActive == \"Toxicity\") {\n //ignore damage changes (which would effect how much health we try to buy) entirely since we die in 20 attacks anyway?\n if(game.global.world < 61)\n enemyDamage *= 2;\n enemyHealth *= 2;\n }\n if(game.global.challengeActive == 'Lead') {\n enemyDamage *= 2.5;\n enemyHealth *= 7;\n }\n //change name to make sure these are local to the function\n var enoughHealthE = !(doVoids && voidCheckPercent > 0) && (baseHealth * 4 > 30 * (enemyDamage - baseBlock / 2 > 0 ? enemyDamage - baseBlock / 2 : enemyDamage * 0.2) || baseHealth > 30 * (enemyDamage - baseBlock > 0 ? enemyDamage - baseBlock : enemyDamage * 0.2));\n var enoughDamageE = (baseDamage * 4 > enemyHealth);\n \n if (game.global.world == 200) { //&& ((new Date().getTime() - game.global.zoneStarted) / 1000 / 60) > 10 && ((new Date().getTime() - game.global.zoneStarted) / 1000 / 60) < 20){\t\t\n enoughHealthE = false;\t\t\n enoughDamageE = false;\t\t\n }\n\n for (var equipName in equipmentList) {\n var equip = equipmentList[equipName];\n // debug('Equip: ' + equip + ' EquipIndex ' + equipName);\n var gameResource = equip.Equip ? game.equipment[equipName] : game.buildings[equipName];\n // debug('Game Resource: ' + gameResource);\n if (!gameResource.locked) {\n document.getElementById(equipName).style.color = 'white';\n var evaluation = evaluateEquipmentEfficiency(equipName);\n // debug(equipName + ' evaluation ' + evaluation.Status);\n var BKey = equip.Stat + equip.Resource;\n // debug(equipName + ' bkey ' + BKey);\n\n if (Best[BKey].Factor === 0 || Best[BKey].Factor < evaluation.Factor) {\n Best[BKey].Factor = evaluation.Factor;\n Best[BKey].Name = equipName;\n Best[BKey].Wall = evaluation.Wall;\n Best[BKey].Status = evaluation.Status;\n }\n\n document.getElementById(equipName).style.borderColor = evaluation.Status;\n if (evaluation.Status != 'white' && evaluation.Status != 'yellow') {\n document.getElementById(equip.Upgrade).style.color = evaluation.Status;\n }\n if (evaluation.Status == 'yellow') {\n document.getElementById(equip.Upgrade).style.color = 'white';\n }\n if (evaluation.Wall) {\n document.getElementById(equipName).style.color = 'yellow';\n }\n\n //Code is Spaced This Way So You Can Read It:\n if (\n evaluation.Status == 'red' &&\n (\n ( getPageSetting('BuyWeaponUpgrades') && equipmentList[equipName].Stat == 'attack' ) \n ||\n ( getPageSetting('BuyWeaponUpgrades') && equipmentList[equipName].Stat == 'block' )\n ||\n ((getPageSetting('BuyArmorUpgrades') && ((equipmentList[equipName].Resource != 'metal')\n || ((gameResource.prestige+5 <= (game.global.world-5)/5 && game.global.soldierHealth > 0 && ((armorTempValue > 50 && armorTempValue < 100)|| armorValue < 1000))\n || (gameResource.prestige+4 <= (game.global.world-5)/5 && game.global.soldierHealth > 0 && ((armorTempValue > 20 && armorTempValue < 50)|| armorValue < 500))\n || (gameResource.prestige+3 <= (game.global.world-5)/5 && game.global.soldierHealth > 0 && ((armorTempValue > 10 && armorTempValue < 20)|| armorValue < 200))\n || (gameResource.prestige+2 <= (game.global.world-5)/5 && game.global.soldierHealth > 0 && ((armorTempValue > 1 && armorTempValue < 10)|| armorValue < 100)))\n || gameResource.prestige < 5 || game.global.world == 200 ) && (equipmentList[equipName].Stat == 'health'))\n && \n //Only buy Armor prestiges when 'DelayArmorWhenNeeded' is on, IF:\n (\n (game.global.world == 200) // not in level 200\n ||\n\t\t\t(getPageSetting('DelayArmorWhenNeeded') && !shouldFarm) // not during \"Farming\" mode \n || // or\n (getPageSetting('DelayArmorWhenNeeded') && enoughDamage) // has enough damage (not in \"Wants more Damage\" mode)\n || // or \n (getPageSetting('DelayArmorWhenNeeded') && !enoughDamage && !enoughHealth) // if neither enough dmg or health, then tis ok to buy.\n || \n (getPageSetting('DelayArmorWhenNeeded') && equipmentList[equipName].Resource == 'wood')\n || \n !getPageSetting('DelayArmorWhenNeeded') //or when its off.\n )\n )\n )\n ) \n {\n var upgrade = equipmentList[equipName].Upgrade;\n if (upgrade != \"Gymystic\")\n debug('Upgrading ' + upgrade + \" - Prestige \" + game.equipment[equipName].prestige, '*upload');\n else\n debug('Upgrading ' + upgrade + \" # \" + game.upgrades[upgrade].allowed, '*upload');\n buyUpgrade(upgrade, true, true);\n }\n }\n }\n preBuy();\n game.global.buyAmt = 1;\n for (var stat in Best) {\n if (Best[stat].Name !== '') {\n var eqName = Best[stat].Name;\n var DaThing = equipmentList[eqName];\n document.getElementById(Best[stat].Name).style.color = Best[stat].Wall ? 'orange' : 'red';\n //If we're considering an attack item, we want to buy weapons if we don't have enough damage, or if we don't need health (so we default to buying some damage)\n if (getPageSetting('BuyWeapons') && DaThing.Stat == 'attack' && (!enoughDamageE || enoughHealthE)) {\n if (DaThing.Equip && !Best[stat].Wall && canAffordBuilding(eqName, null, null, true)) {\n debug('Leveling equipment ' + eqName, '*upload3');\n buyEquipment(eqName, null, true);\n }\n }\n //If we're considering a health item, buy it if we don't have enough health, otherwise we default to buying damage\n if (getPageSetting('BuyArmor') && (DaThing.Stat == 'health' || DaThing.Stat == 'block') && !enoughHealthE) {\n if (DaThing.Equip && !Best[stat].Wall && canAffordBuilding(eqName, null, null, true)) {\n debug('Leveling equipment ' + eqName, '*upload3');\n buyEquipment(eqName, null, true);\n }\n }\n if (getPageSetting('BuyArmor') && (DaThing.Stat == 'health') && getPageSetting('AlwaysArmorLvl2') && game.equipment[eqName].level < 2){\n if (DaThing.Equip && !Best[stat].Wall && canAffordBuilding(eqName, null, null, true)) { \n debug('Leveling equipment ' + eqName + \" (AlwaysArmorLvl2)\", '*upload3');\n buyEquipment(eqName, null, true);\n } // ??idk?? && (getPageSetting('DelayArmorWhenNeeded') && enoughDamage)\n }\n }\n }\n postBuy();\n}", "function daDamageThing(damage, typeBonus, currentDragonHealth) {\r\n //secondEle.innerHTML=\"\"\r\n dragonHealth = currentDragonHealth - (damage + typeBonus)\r\n\r\n secondEle.innerHTML = \"Dragon Health:\" + dragonHealth\r\n if (dragonHealth<=0){\r\n secondEle.innerHTML=\"Dragon Health:\" + 0\r\n //dragonHealth=0\r\n thirdEle.innerHTML=\"AYO YOU DID IT YOU BEAT THIS DRAGON'S ASS, have a cookie!\"\r\n }\r\n}", "takeDamage(amount){\n this.activePokemon().takeDamage(amount)\n }", "function minusHealthOne () {\n compPlayer.health = compPlayer.health - playerOne.abilities.attackOne[1];\n loadHealth();\n}", "attack(animal,attackee,damage,type,last){}", "damagePlayer(player) {\r\n player.health -= this.damage;\r\n player.damageTakenSound.play();\r\n }", "function monitorGame(){\n //cheack the eggs in player\n checkContainer();\n checkTnt();\n checkPirate();\n checkPirateHit();\n checkCarrierHit();\n checkPlayerHit();\n dead();\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 raiseShield(level)\n{\n player.imgElement.classList.add(\"shielded\");\n player.shielded = true;\n\n shieldCooldown = 100*level;\n weaponCooldown = 150*level;\n}", "function TauntOnVictory(enemy) \r\n{ \r\n\tif(getLife(enemy) <= 0 && getTP() >= 1){ \r\n\t\tsay(randomCitation());\r\n\t}\r\n}", "function punch() {\n if (Player.health <= 0) {\n return;\n }\n Player.health -= 5 - (5 * Player.addMods());\n Player.damageMods();\n document.getElementById(\"armor-message\").innerText = \"\"\n //this is to keep the health bars current\n Player.hits++;\n update();\n}", "receiveDamage(damage) {\n this.health -= damage\n if (this.health <= 0) {\n return `A Saxon has died in combat`\n } else {\n return `A Saxon has received ${damage} points of damage`\n }\n }" ]
[ "0.72023326", "0.72004867", "0.71565896", "0.7151993", "0.707943", "0.70436406", "0.7000108", "0.6978521", "0.6899295", "0.6873306", "0.6868125", "0.68588173", "0.6846649", "0.6844506", "0.6819691", "0.68194765", "0.67859757", "0.6759175", "0.67527014", "0.6705977", "0.67057765", "0.6704791", "0.6699871", "0.66933674", "0.669028", "0.66891897", "0.6681507", "0.6664907", "0.66560954", "0.662875", "0.66280216", "0.6618111", "0.66041124", "0.65905553", "0.65640086", "0.6563294", "0.6561507", "0.65496165", "0.6549121", "0.65475065", "0.6546327", "0.6544049", "0.65357614", "0.65334624", "0.65297806", "0.6527846", "0.65276223", "0.65226126", "0.6512554", "0.65053684", "0.65028965", "0.649332", "0.645497", "0.64354426", "0.6424989", "0.6424365", "0.642188", "0.642188", "0.6412027", "0.6407758", "0.6406041", "0.639867", "0.63933325", "0.6391694", "0.63912654", "0.63857037", "0.63820577", "0.63710535", "0.6364476", "0.63480395", "0.63389486", "0.6337474", "0.6331328", "0.6329242", "0.6326872", "0.6313833", "0.63093674", "0.63070965", "0.6306488", "0.6306205", "0.630359", "0.6303481", "0.62981445", "0.6297387", "0.6291102", "0.6291011", "0.62887406", "0.6284005", "0.6280668", "0.6280092", "0.62683225", "0.62674546", "0.62569016", "0.625661", "0.6253115", "0.6252828", "0.62407297", "0.62406296", "0.62272525", "0.62188447" ]
0.74243003
0
Function to inflict damage
dealDamage(victim) { console.log(`${this.name} is attacking ${victim.name} and is inflicting them ${this.dmg} Points.`); if (victim.isPlayerAlive()) { victim.hp -= this.dmg; if(victim <= 0) { victim.state = LOSER; console.log(`${this.name} killed ${victim.name}. ${this.name} won 20 mana points.`); this.winMana(); } return this.dmg; } else { console.log("Player is dead. Can't run attack.") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "damage() {}", "function ApplyDamage(damage : float) {\n\t//if the player is invincible, do not apply damage\n\tif(this.invincible) {\n\t\treturn;\n\t}\n\t\t\n}", "set damage(damage){this._damage = Utils.protectionError(\"Hero\", \"damage\");}", "static attack(attacker, defender) {\n let a = attacker.attack.damage;\n let d = defender;\n \n b.defend = a;\n \n \n }", "function attack(damage) {\r\n // Code disini\r\n return damage - 2;\r\n\r\n // var damageReduction = damage - 2;\r\n // return damageReduction;\r\n}", "async function inflictDamage( /* creature */ attacker, /* creature */ defender,\n damage, /* color */ flashColor, ignoresProtectionShield)\n{\n\tlet killed = false;\n\tlet theBlood;\t// dungeonFeature\n let transferenceAmount;\n\n\tif (damage == 0\n || (defender.info.flags & MONST_INVULNERABLE))\n\t{\n\t\treturn false;\n\t}\n\n\tif (!ignoresProtectionShield\n && defender.status[STATUS_SHIELDED])\n\t{\n\t\tif (defender.status[STATUS_SHIELDED] > damage * 10) {\n\t\t\tdefender.status[STATUS_SHIELDED] -= damage * 10;\n\t\t\tdamage = 0;\n\t\t} else {\n\t\t\tdamage -= (defender.status[STATUS_SHIELDED] + 9) / 10;\n\t\t\tdefender.status[STATUS_SHIELDED] = defender.maxStatus[STATUS_SHIELDED] = 0;\n\t\t}\n\t}\n\n\tdefender.bookkeepingFlags &= ~MB_ABSORBING; // Stop eating a corpse if you are getting hurt.\n\n\t// bleed all over the place, proportionately to damage inflicted:\n\tif (damage > 0 && defender.info.bloodType) {\n\t\ttheBlood = dungeonFeatureCatalog[defender.info.bloodType];\n\t\ttheBlood.startProbability = (theBlood.startProbability * (15 + min(damage, defender.currentHP) * 3 / 2) / 100);\n\t\tif (theBlood.layer == GAS) {\n\t\t\ttheBlood.startProbability *= 100;\n\t\t}\n\t\tawait spawnDungeonFeature(defender.xLoc, defender.yLoc, theBlood, true, false);\n\t}\n\n\tif (defender !== player && defender.creatureState == MONSTER_SLEEPING) {\n\t\twakeUp(defender);\n\t}\n\n\tif (defender === player\n && rogue.easyMode\n && damage > 0)\n\t{\n\t\tdamage = max(1, damage/5);\n\t}\n\n if (((attacker === player && rogue.transference) || (attacker && attacker !== player && (attacker.info.abilityFlags & MA_TRANSFERENCE)))\n && !(defender.info.flags & (MONST_INANIMATE | MONST_INVULNERABLE)))\n\t\t{\n transferenceAmount = min(damage, defender.currentHP); // Maximum transferred damage can't exceed the victim's remaining health.\n\n if (attacker === player) {\n transferenceAmount = transferenceAmount * rogue.transference / 20;\n if (transferenceAmount == 0) {\n transferenceAmount = ((rogue.transference > 0) ? 1 : -1);\n }\n } else if (attacker.creatureState == MONSTER_ALLY) {\n transferenceAmount = transferenceAmount * 4 / 10; // allies get 40% recovery rate\n } else {\n transferenceAmount = transferenceAmount * 9 / 10; // enemies get 90% recovery rate, deal with it\n }\n\n attacker.currentHP += transferenceAmount;\n\n if (attacker === player && player.currentHP <= 0) {\n await gameOver(\"Drained by a cursed ring\", true);\n return false;\n }\n }\n\n\tif (defender.currentHP <= damage) { // killed\n\t\tawait killCreature(defender, false);\n\t\tanyoneWantABite(defender);\n\t\tkilled = true;\n\t} else { // survived\n\t\tif (damage < 0 && defender.currentHP - damage > defender.info.maxHP) {\n\t\t\tdefender.currentHP = max(defender.currentHP, defender.info.maxHP);\n\t\t} else {\n\t\t\tdefender.currentHP -= damage; // inflict the damage!\n if (defender === player && damage > 0) {\n rogue.featRecord[FEAT_INDOMITABLE] = false;\n }\n\t\t}\n\n\t\tif (defender !== player && defender.creatureState != MONSTER_ALLY\n\t\t\t&& defender.info.flags & MONST_FLEES_NEAR_DEATH\n\t\t\t&& defender.info.maxHP / 4 >= defender.currentHP)\n\t\t{\n\t\t\tdefender.creatureState = MONSTER_FLEEING;\n\t\t}\n\t\tif (flashColor && damage > 0) {\n\t\t\tflashMonster(defender, flashColor, MIN_FLASH_STRENGTH + (100 - MIN_FLASH_STRENGTH) * damage / defender.info.maxHP);\n\t\t}\n\t}\n\n\trefreshSideBar(-1, -1, false);\n\treturn killed;\n}", "takeDamage(inflictedDamages) {\n\n if (this.resistance > 0) {\n inflictedDamages -= this.resistance;\n this.resistance = 0;\n }\n return super.takeDamage(inflictedDamages)\n }", "predictDamage() {\n let dmg = this.getConstantDamage()[0]\n return dmg\n }", "takeDamage(damage, type = null){\r\n if (type in this.resistances) damage *= this.resistances[type];\r\n if (type in this.vulnerabilities) damage *= this.resistances[type];\r\n this.health -= damage;\r\n }", "function dealDamage(attackingCombatant, targetCombatant) {\n\n}", "attack(warrior){\n if(warrior instanceof Elf){\n let dodge = Math.random();\n if(dodge > warrior.dodgingChance){\n warrior.hp -= this.strength;\n }\n }else{\n warrior.hp -= this.strength;\n }\n }", "function shield() {\n\t\n}", "function calcDamage(){\n if (flankFlag == true)\n {\n return Math.floor((cannonPB.value / 12.0) * 150);\n }\n else {\n return Math.floor((cannonPB.value / 12.0) * 75);\n }\n}", "attack(attackName) {\n _target.health -= _target.attacks[attackName]\n if (_target.health < 0) {\n _target.health = 0\n }\n }", "function badDefense(/* code here */) {\n /* code here */\n}", "function combatDamage(attacker, defender) {\n return attacker.baseDmg + attacker.stats.str - defender.stats.def;\n}", "doDamage(dmg){\r\n if (!(dmg > 0))\r\n return;\r\n\r\n this.hp -= dmg;\r\n if (this.hp <= 0){\r\n this.alive = false;\r\n this.hp = 0;\r\n }\r\n }", "function badDefense(/* code here */) {\n\n /* code here */\n\n}", "takeDamage(damage) {\n this.hp -= damage\n return this.hp\n }", "applyHazardDamage() {\n for (const cowboy of this.game.cowboys) {\n if (cowboy.tile && cowboy.tile.hasHazard) {\n cowboy.damage(1);\n }\n }\n }", "TakeDamage(dmg){\n this.currentHealth = this.currentHealth - dmg;\n }", "takeDamage(inflictedDamages) {\n if (!this.protected) {\n return super.takeDamage(inflictedDamages)\n } else {\n this.protected = false;\n return this;\n }\n }", "takeDamage(damage) {\n this.health -= damage;\n if (this.health <= 0)\n {\n this.alive = false;\n }\n }", "hurt(dmg){\n this.life = this.life - dmg;\n }", "function reflect(a, player1){\n // FIRE OFF BATS HERE\n // --- Should disable rats for testing ---\n // rats are pesty T_T\n enemies.generateRat()\n\n if(player1.y > (shield.y +15)){\n return true;\n }\n else if(trampDude.flipBonusTurns > 0){\n trampDude.flipBonusTurns -= 1\n sounds.bounce()\n player1.body.velocity.y = trampDude.yVelocityBonus\n trampDude.checkLanding(trampDude.getRotation())\n player1.body.velocity.x = shield.body.velocity.x * 1.35 ;\n //Adjust x velocity\n var px = player1.body.x\n var sx = shield.body.x\n if(px - sx > 42 && px-sx < 56){player1.body.velocity.x = 0}\n else{\n player1.body.velocity.x += (-50 + (px - sx)) * 2.8\n }\n return false;\n }\n else{\n sounds.bounce()\n // Reset Difficulty\n trampDude.difficulty = 1\n multiplierText.text = 'Bounce: x1'\n multiplierText.fill = 'rgb(222, 222, 222)'\n multiplierText.stroke = '#000000'\n if(trampDude.flipsNeeded[0][0] >= 3 || trampDude.flipsNeeded[0][1] >= 3){\n trampDude.addToFlipsArr()\n trampDude.addToFlipsArr()\n }\n player1.body.velocity.y = -400 || player1.body.velocity.y\n player1.body.velocity.x = 0;\n trampDude.checkLanding(trampDude.getRotation())\n player1.body.velocity.x = shield.body.velocity.x * 1.35 ;\n //Adjust x velocity\n var px = player1.body.x\n var sx = shield.body.x\n if(px - sx > 42 && px-sx < 55){player1.body.velocity.x = 0}\n else{\n player1.body.velocity.x += (-50 + (px - sx)) * 2.8\n }\n return false;\n }\n //Add logic to change x velocity on shield x-location\n}", "attacked(animal,attacker,damage,type,last){}", "function getInfantryDamageAttacker(roll) {\r\n let total_roll;\r\n let current_modifier;\r\n let phase_modifier;\r\n let defender_modifier;\r\n let base;\r\n if (current_phase === \"fire\") {\r\n total_roll = roll + attacker.infantry_offensive_fire_pip - defender.infantry_defensive_fire_pip - Math.floor(defender.artillery_defensive_fire_pip / 2);\r\n current_modifier = attacker.infantry_fire_modifier;\r\n phase_modifier = attacker.fire_damage;\r\n defender_modifier = defender.fire_received; \r\n } else {\r\n total_roll = roll + attacker.infantry_offensive_shock_pip - defender.infantry_defensive_shock_pip - Math.floor(defender.artillery_defensive_shock_pip / 2);\r\n current_modifier = attacker.infantry_shock_modifier;\r\n phase_modifier = attacker.shock_damage;\r\n defender_modifier = defender.shock_received;\r\n }\r\n base = total_roll * 5 + 15;\r\n return getDamage(base, attacker.unit_strength, current_modifier, phase_modifier, attacker.infantry_combat_ability, attacker.discipline, defender.discipline, defender.tactics, defender_modifier);\r\n}", "attack(animal,attackee,damage,type,last){}", "takeDamage(amount) {\n let vehicleDamage = amount * 0.6;\n let operatorBiggerDamage = amount * 0.2;\n let operatorEvenDamage = amount * 0.1;\n\n this.takeVehicleDamage(vehicleDamage);\n this.takeOperatorsDamage(operatorBiggerDamage, operatorEvenDamage);\n }", "attack(player) {\r\n player.applyDamage(this.strength);\r\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 strongAttackHandler() {\n attackMonster(modeStrongAttack);\n\n}", "function getInfantryDamageDefender(roll) {\r\n let total_roll;\r\n let current_modifier;\r\n let phase_modifier;\r\n let defender_modifier;\r\n let base;\r\n if (current_phase === \"fire\") {\r\n total_roll = roll + defender.infantry_offensive_fire_pip - attacker.infantry_defensive_fire_pip - Math.floor(attacker.artillery_defensive_fire_pip / 2);\r\n current_modifier = defender.infantry_fire_modifier;\r\n phase_modifier = defender.fire_damage;\r\n defender_modifier = attacker.fire_received;\r\n } else {\r\n total_roll = roll + defender.infantry_offensive_shock_pip - attacker.infantry_defensive_shock_pip - Math.floor(attacker.artillery_defensive_shock_pip / 2);\r\n current_modifier = defender.infantry_shock_modifier;\r\n phase_modifier = defender.shock_damage;\r\n defender_modifier = attacker.shock_received;\r\n }\r\n base = total_roll * 5 + 15;\r\n return getDamage(base, defender.unit_strength, current_modifier, phase_modifier, defender.infantry_combat_ability, defender.discipline, attacker.discipline, attacker.tactics, defender_modifier);\r\n}", "damage(source, dmg, inputX = 0, inputY = 0, damageType = DAMAGE_TYPE.PHYSICAL_WEAPON) {\n const savedAngle = this.angle;\n super.damage(source, dmg, inputX, inputY, damageType);\n if (!damageType.hazardal && !this.attackedLastTime && this.stun <= 0) {\n if (this.turnDelay === 0) {\n this.cancelAnimation();\n this.angle = savedAngle;\n this.cancellable = false;\n }\n this.triggered = true;\n }\n }", "get basicDamage() {\n if (this._viewId === 'all') return\n return this._calculators[this._viewId].basicDamage\n }", "get effectiveDamage() {\n if (this._parent.isRangedHalfDamage) {\n return Math.floor(this._basicDamage / 2)\n } else if (this._parent.isShotgun) {\n return this._basicDamage * this._parent.shotgunDamageMultiplier\n } else if (this._parent.isExplosion) {\n return Math.floor(this._basicDamage / this._parent.explosionDivisor)\n } else {\n return this._basicDamage\n }\n }", "function dealDamage(room, obj, attacker, dmg, selfInflicted = false) {\n obj.health -= dmg;\n\n // if the damage was NOT self inflicted (like bumping into an island or dock/city)\n if(!selfInflicted) {\n // if the attacker was a player ship, they receive a (feedback) message about the attack\n if(attacker.myUnitType == 0) {\n attacker.attackInfo.hits++;\n }\n\n // if the victim was a player ship, they receive an (error) message about the attack\n if(obj.myUnitType == 0) {\n obj.errorMessages.push([4,0]);\n }\n }\n\n // TO DO: Differentiate messages more, using the second parameter (now it's just a vague \"You were attacked!\")\n // TO DO: If a similar message already exists, nothing new is added. \n // => (If you have three cannonballs hitting the same ship, you don't want three messages saying \"Succesful attack! You hit ship X!\")\n\n // TO DO: This could be more efficient. We're repeating the code used when first CREATING monsters/aiShips/etc. \n // => On the other hand, it's not so bad as it's slightly different and short code :p\n\n // if we're dead ...\n if(obj.health <= 0) {\n // respawn (based on unit type)\n let uType = obj.myUnitType;\n\n // if the PLAYER killed something\n // they should get a message (\"You destroyed a <unit type>\"! Check your resources for loot\")\n if(attacker.myUnitType == 0) {\n attacker.errorMessages.push([7, uType]);\n }\n\n switch(uType) {\n // Player ship: no respawning, inform of game over\n case 0:\n // TO DO ... what do we do?\n\n // TO DO ... give REWARD to the attacker?\n\n break;\n\n // Monster: respawn to respawn location for this type\n // placeUnit() on the new location, change the monster's attributes\n case 1:\n // give reward to attacker\n if(attacker.myUnitType == 0) {\n // save it; monsters always give gold\n attacker.resources[0] = (+attacker.resources[0]) + (+obj.loot); \n }\n\n // get a spawn point\n let spawnPoint = room.spawnPoints[ Math.floor(Math.random() * room.spawnPoints.length) ];\n\n // move monster to new location\n placeUnit(room, {x: obj.x, y: obj.y, index: obj.index}, spawnPoint.x, spawnPoint.y, 'monsters');\n\n // give it new attributes (just replace the old object with a new one)\n let randomMonsterType = Math.floor( Math.random() * room.monsterTypes.length );\n room.monsters[obj.index] = createMonster(randomMonsterType, obj.index, room.averagePlayerLevel);\n\n break;\n\n // AI ship: respawn to random dock (with a route, which you pick immediately)\n case 2:\n // give reward to attacker\n if(attacker.myUnitType == 0) {\n // calculate reward\n // AI ships have different resources, based on their type\n // Those resources are scaled by the ship level (and attack strength)\n for(let res = 0; res < 4; res++) {\n // save it; get it directly from the object\n attacker.resources[res] = (+attacker.resources[res]) + (+obj.loot[res] );\n }\n\n }\n\n // Find a dock (WITH routes)\n let dockIndex, numDockRoutes;\n do {\n dockIndex = Math.floor(Math.random() * room.docks.length);\n numDockRoutes = room.docks[dockIndex].routes.length;\n } while(numDockRoutes < 1);\n\n // Pick a random route => get first position\n let routeIndex = Math.floor(Math.random() * numDockRoutes);\n let randRouteStart = room.docks[dockIndex].routes[routeIndex].route[0];\n\n // Change to a new ship\n room.aiShips[obj.index] = createAIShip(randRouteStart, routeIndex, room.averagePlayerLevel);\n\n // Start at one of the routes (placeUnit)\n placeUnit(room, {x: obj.x, y: obj.y, index: obj.index}, randRouteStart[0], randRouteStart[1], 'aiShips');\n break;\n\n // Docks (3) can't respawn => should change owner\n // Cities (3) can't respawn => should change owner\n }\n }\n}", "action(type, damage) {\n const totalDamage = damage + this.player1.magicStatus();\n console.log(totalDamage + ', ' + this.player1.magicStatus());\n\n if (type === 'Attack') {\n if (this.dojoBoss.returnBossArmour() >= totalDamage) {\n this.dojoBoss.decreaseArmour(totalDamage);\n } else {\n const take = totalDamage - this.dojoBoss.returnBossArmour();\n this.dojoBoss.decreaseArmour(totalDamage);\n this.dojoBoss.decreaseHealth(take);\n }\n this.player1.clearMagic();\n } else if (type === 'Magic') {\n this.player1.changeMagicStatus(damage);\n // is this a c or s lmao\n } else if (type === 'Defence') {\n this.player1.addDefence(totalDamage);\n this.player1.clearMagic();\n }\n }", "performAttack() {\n return this.attack + this.levelDmgModifier;\n }", "function monsterRetaliater(monster, player) {\n var retaliationDamage = monster.whatDamage();\n attack(retaliationDamage, player);\n monster.saySomething();\n}", "takeDamage(amount){\n\t\tamount = amount - this.stats.armor;\n\t\tif(amount <= 0)\n\t\t\tamount = 0;\n\n\t\tthis.stats.health -= amount;\n\t}", "function ApplyDamage (damage : float) {\n\thealth = health - damage;\n\tif (health > 0) {\n\t\taddPain();\n\t\tyield WaitForFixedUpdate();\n\t\trigidbody2D.velocity = Vector2(0, -6);\n\t\tyield WaitForSeconds(painDuration);\n\t\treducePain();\n\t}\n\telse Exit();\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 }", "onTakeDamage(evt) {\n this.current -= evt.data.amount;\n evt.handle();\n }", "doeffectafterdamage(skill, cast, target, tmppassvalue) {\n var dinfo = []\n var rand = Math.floor(Math.random() * 5) + 1\n var buff = skilldata.buffs[rand]\n cast.addbuff(buff.id, 1)\n dinfo.push(cast.name + \"的[\" + skill.name + \"]对自身产生了[\" + buff.name + \"]\")\n return dinfo\n }", "SetDamage(num) {\n if (num == 1) { return \"3d6\"; }\n if (num == 2) { return \"3d6+2\"; }\n if (num == 3) { return \"3d8\"; }\n if (num == 4) { return \"3d8+2\"; }\n if (num == 5) { return \"3d10\"; }\n }", "damageAtack() {\r\n return Math.floor(Math.random() * 100);\r\n }", "function attack(attacker, defender) {\n return defender - attacker;\n}", "function damages_map(){\n\n}", "function getDamageUser(userMove, userMoveName){\n damage = 10;\n for (var i = 0; i < wildPokemonType.length; i++) {\n var multiplier = pokeTypesEffect[userMove][pokeTypes[wildPokemonType[i]]]\n damage = damage * multiplier;\n \n }\n console.log(damage)\n $(\".battle-text\").empty();\n if (damage > 10){\n genBattSuperEffective(userPokeName, userMoveName);\n }else if (damage < 10){\n genBattNonEffective(userPokeName, userMoveName);\n }else if (damage = 10){\n genBattEffective(userPokeName, userMoveName);\n }\n\n wildHealth = wildHealth - damage;\n $(\"#wild-health\").val(wildHealth);\n disableMoves();\n}", "computeDamage(){\n return this._units.reduce((accum, curUnit) => accum + curUnit.computeDamage(), 0.0);\n }", "function fight(attacker, victim) {\n const def = victim.lvl.defence;\n let dmg = 0;\n for (let i = 0; i < attacker.lvl.strength; i++) {\n const rand = Math.floor(Math.random() * 8) + 2;\n if (rand >= def) {\n dmg++;\n }\n }\n\n return dmg;\n }", "@action damageShields(damage, type) {\n return this.damageAttribute('currentShields', damage, type, 'shields')\n }", "takeDamage(damage){\n let damagePerUnit = damage / this._units.length;\n Logger.logSquad(this, `took ${damage.toFixed(2)} damage, ${damagePerUnit.toFixed(2)} per unit`);\n this._units.forEach((unit) => {\n unit.takeDamage(damagePerUnit);\n });\n }", "damageShipExternal(damageAmount){\n var remaining_damage = damageAmount;\n //-> ORDER is important here. Keys must relate to this.parts, but are in a dif order.\n var keys = [\"shields\",\"hull\",\"thrusters\",\"engine\",\"life-support systems\"];\n var k = 0;\n while (remaining_damage > 0 && k < keys.length){\n if (!this.parts[keys[k]] in this.parts){\n console.log(\"Something went wrong when damaging the ship.\");\n return;\n }\n if (this.parts[keys[k]] > 0){\n var dmg = remaining_damage;\n remaining_damage = remaining_damage - this.parts[keys[k]];\n console.log(\"remaining_damage: \" + remaining_damage);\n this.parts[keys[k]] -= dmg;\n }\n k++;\n }\n //---[ set all parts that are negative to 0 ]---//\n this._ensurePartsAboveZero();\n\n }", "function CalculateDamageBonus(weapon = OPC.mainHand) {\n\tdamageBonus = 0;\n\thasFinesse = 0;\n\tfor(iAB = 0; iAB < weapon[4].length; iAB ++) {\n\t\tif(weapon[4][iAB] == \"finesse\") { // weaopn has finesse property\n\t\t\thasFinesse = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(hasFinesse > 0) { // weaopn has finesse property, take better between str and dex\n\t\tdamageBonus += Math.floor(Math.max(OPC.abilityScores[0],OPC.abilityScores[1])/2)-5;\n\t}\n\telse { // add str mod\n\t\tdamageBonus += Math.floor(OPC.abilityScores[0]/2)-5;\n\t}\n\treturn damageBonus;\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 }", "usePotion(){\n if(this.healingItem > 0){\n this.healingItem -= 1;\n this.hp += 10;\n }\n }", "function attack() {\n // Do something...\n}", "takeDamage(damage) {\n this.health -= damage;\n return this.health;\n }", "takeDamage(damage) {\n this.health -= damage;\n return this.health;\n }", "receiveDamage(damage) {\n this.health -= damage\n if (this.health <= 0) {\n return `${this.name} has died in act of combat` //\"NAME has died in act of combat\"\n } else {\n return `${this.name} has received ${damage} points of damage`//\"NAME has received DAMAGE points of damage\"\n }\n }", "survivorDamage(dmg) {\n console.log(\"Survivor taking damage = \" + dmg);\n //Deduct health.\n this.currPlayerHealth -= dmg;\n\n }", "function damage(power : float) {\n\tzombieResources.reduceHealth(power);\n}", "function calcDamage(obj) {\n let accuracy = Math.floor(Math.random() * Math.floor(100));\n let attackPower = Math.round((obj.attack * accuracy) / 100);\n return attackPower;\n}", "function setdmg1(maxhit) //Prevents additional action if hp2 is 0\n{\n //document.getElementById(\"test\").innerHTML=\"\";\n if (hp1 != 0)\n {\n elem=document.getElementById(\"player1\");\n var rand = Math.floor(Math.random()*(maxhit+1));\n var chance = Math.floor(Math.random()*(monsterAccuracyLevel-1));\n if (chance == 0) rand = 0;\n if (monsterAbbreviation == \"nope\" && protectedpray) rand = 0; \n else if (monsterAbbreviation == \"nope\" && attackcount == 6 && phase == 3) { //Araxxor phase 3 swipe\n\trand = 25 + Math.floor(Math.random()*21);\n\tattackcount = 0;\n }\n else if (monsterAbbreviation == \"nope\" && attackcount >= 6 && attackcount < 9 && phase == 1) { //Araxxor phase 1 web\n\tif (reflected == 0) {\n\t\thp2+=15;\n\t\tif (hp2 > 1000) hp2 = 1000;\n\t\t$(\"#greenhp2\").css({\"width\": (hp2*monsterHPbarDRAINAGE)});\n\t}\n\trand = reflected;\n\tif (attackcount == 8) {\n\t\tmonsterDefenceRank = 2.5;\n\t}\n }\n else if (monsterAbbreviation == \"nope\" && attackcount >= 13 && phase == 1) { //Araxxor phase 1 cacoon\n\tif (prayer == \"mage\" && attackcount == 13) protectcacoon = true; //I wouldn't reach this else if condition if I use protectedpray bool\n\t//if (protectcacoon == false) rand = 20; //Old implementation\n\t//else rand = 10;\n\trand = 20;\n\tif (attackcount == 15) {\n\t\tprotectcacoon = false;\n\t\tnotfrozen = true;\n\t\tplayer1frozen.src=\"gifs/invisible.gif\"; \n\t\tattackcount = 0;\n\t}\n }\n else if (mageatk && monsterAbbreviation == \"ogre\") {\n\t rand = 5;\n\t mageatk = false;\n\t monsterDefenceRank = 3;\n\t if (stopcount == 0) {\n\t\t $(\"#msg\").css({\"opacity\": defaultopacity});\n\t\t document.getElementById(\"msg\").innerHTML=\"Your accuracy has been weakened by the ice.\"; \n\t\t gamemsg = setInterval(function () {\n\t\t\t defaultopacity -= 0.002;\n\t\t\t if (defaultopacity < -100) defaultopacity = 0; //To prevent non-stop decrementation\n\t\t\t $(\"#msg\").css({\"opacity\": defaultopacity});\n\t\t }, 10);\t\n\t stopcount++;\n\t }\n }\n else if (monsterAbbreviation == \"jad\") { \n\t if (protectedpray && jadhardmode != \"Normal\") rand = Math.round(rand/2);\n\t else if (protectedpray) rand = 0;\n\t if (!protectedpray && jadhardmode == \"Hard\") rand = 50 + Math.round(rand*0.48);\n\t if (!protectedpray && jadhardmode == \"Impossible\") rand = 97;\n\t if (protectedpray && jadhardmode == \"Impossible\" && rand < 20) rand += 30;\n }\n else if (monsterAbbreviation == \"brid\") { \n\t if (protectedpray) rand = 0;\n }\n else if (monsterAbbreviation == \"ele\") {\n\t monsterDefenceRank -= 0.01;\n\t monsterAccuracyLevel += 0.01;\n }\n if (rand >= hp1) //Sets what rand is based on hp1\n {\n rand = hp1;\n if (hp1 == 0)//Prevents additional 0s that randomly appear\n {\n rand = null;\n }\n }\n hp1 = hp1 - rand; //This line is the reason why \"if (hp1==0)\" appears twice\n\t\tif (monsterAbbreviation == \"drag\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\";}\n\t\t\telse {attackGIFname = \"atk2\";}\n\t\t}\n\t\tif (monsterAbbreviation == \"brid\") {\n\t\t\tif (attackcount <= 5) {\n\t\t\t\tif (attackGIFname == \"atk2\") {attackGIFname = \"atk\"; magerangeatk = \"range\";}\n\t\t\t\telse if (attackGIFname == \"atk\") {attackGIFname = \"atk2\"; magerangeatk = \"mage\";}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"range\";} \n\t\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"mage\";}\n\t\t\t}\n\t\t\tattackcount++;\n\t\t\tif (attackcount == 10) attackcount = 0;\n\t\t}\n\t\telse if (monsterAbbreviation == \"jad\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"mage\";}\n\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"range\"; }\n\t\t}\n\t\telse if (monsterAbbreviation == \"nope\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (attackcount == 5 && phase == 3) { //Araxxor mechanic checks for protectedpray so magerangeatk is needed\n\t\t\t\tattackGIFname = \"swipe\"; magerangeatk = \"melee\";\n\t\t\t}\n\t\t\telse if (attackcount == 5 && phase == 1) { \n\t\t\t\tattackGIFname = \"web1\"; magerangeatk = \"reflect\";\n\t\t\t\treflected = 0;\n\t\t\t\tmonsterDefenceRank = 10;\n\t\t\t}\n\t\t\telse if (attackcount == 6 && phase == 1) { \n\t\t\t\tattackGIFname = \"web2\"; \n\t\t\t}\n\t\t\telse if (attackcount == 7 && phase == 1) { \n\t\t\t\tattackGIFname = \"web3\"; \n\t\t\t}\n\t\t\telse if (attackcount == 12 && phase == 1) { \n\t\t\t\tstopatk1();\n\t\t\t\tstopdmg1();\n\t\t\t\tnotfrozen = false;\n\t\t\t\tmagerangeatk = \"bleed\";\n\t\t\t\tattackGIFname = \"cacoon1\";\t\t\n\t\t\t\tplayer1frozen=document.getElementById(\"player1frozen\");\n\t\t\t\tsetTimeout(function () \n\t\t\t\t{ \n\t\t\t\t\tplayer1frozen.src=\"gifs/cacoon.png\"\n\t\t\t\t}, 1000);\n\t\t\t}\n\t\t\telse if (attackcount == 13 && phase == 1) { \n\t\t\t\tattackGIFname = \"cacoon2\"; \n\t\t\t\tif (protectcacoon == true) attackcount++; //New implementation makes cacoon hit 2x instead of 3x if protected\n\t\t\t}\n\t\t\telse if (attackcount == 14 && phase == 1) { \n\t\t\t\tattackGIFname = \"cacoon3\"; \n\t\t\t}\n\t\t\telse if (phase >= 2) {\n\t\t\t\tif (chance2 % 2 == 0) {attackGIFname = \"atk3\"; magerangeatk = \"melee\";}\n\t\t\t\telse {attackGIFname = \"atk4\"; magerangeatk = \"range\"; }\t\n\t\t\t}\n\t\t\telse if (chance2 % 2 == 0) {attackGIFname = \"atk\"; magerangeatk = \"melee\";}\n\t\t\telse {attackGIFname = \"atk2\"; magerangeatk = \"range\"; }\n\t\t\tif (phase == 3 || phase == 1) attackcount++;\n\t\t}\n\t\telse if (monsterAbbreviation == \"ogre\") {\n\t\t\tchance2 = Math.floor(Math.random()*100);\n\t\t\tif (chance2 % 2 == 0) {\n\t\t\t\tif (prayer != \"mage\") { //Using protectedpray code mechanic works too, but no need (too much work for this monster)\n\t\t\t\t\tstopatk1();\n\t\t\t\t\tstopdmg1();\n\t\t\t\t\tnotfrozen = false;\n\t\t\t\t\tmageatk = true;\n\t\t\t\t\tattackGIFname = \"atk2\"; //Same as stand animation, but stand is used in other code so using it here will cause disruptions\n\t\t\t\t\tif (typeof(freezeanimation) != 'undefined') clearInterval(freezeanimation);\n\t\t\t\t\ticeopacity = 0;\n\t\t\t\t\topacityone = false;\n\t\t\t\t\tfreezeanimation = setInterval(function () {\n\t\t\t\t\t\tplayer1frozen=document.getElementById(\"player1frozen\");\n\t\t\t\t\t\tplayer1frozen.src=\"gifs/barrage.png\"\n\t\t\t\t\t\tif (opacityone) iceopacity -= 0.005;\n\t\t\t\t\t\telse iceopacity += 0.005;\n\t\t\t\t\t\tif (iceopacity > 1) opacityone = true;\n\t\t\t\t\t\tif (iceopacity < -100) iceopacity = 0; //To prevent non-stop decrementation \n\t\t\t\t\t\t$(\"#player1frozen\").css({\"opacity\": iceopacity});\n\t\t\t\t\t}, 10);\t\t\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tnotfrozen = true;\n\t\t\t\t\tattackGIFname = \"atk\";\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tnotfrozen = true;\n\t\t\t\tattackGIFname = \"atk\";\n\t\t\t}\n\t\t}\n\t\telse attackGIFname = \"atk\";\t \t\n\t\telem3=document.getElementById(\"player2\");\n\t\telem3.src=\"gifs/\" + monsterAbbreviation + attackGIFname +\".gif\";\n if (hp1 == 0) //Prevents eating when dead\n {\n\twon = false;\n if (monsterAbbreviation == \"me\") player1killpoints = 0;\n\tdocument.getElementById(\"killsPVM\").innerHTML=player1killpoints;\n player2kills += 1;\n\tdocument.getElementById(\"deathsPVM\").innerHTML=player2kills; \n stopatk1();\n\tstopatk2();\n\tsetTimeout(function () \n\t{\n\tstopdmg1(); \n\tstopdmg2();\t\n\t}, 1);\n\t$(\".item1\").css({\"display\": \"none\"}); \t\t\t\t\t\t\t \n document.getElementById(\"player2\").removeAttribute(\"onclick\");\t\t\n\tallowattack = false;\n setTimeout(function () \n { \n\t $(\"#hphp1\").css({\"display\": \"none\"});\n elem.src=\"gifs/rangedeath.gif\";\t\n }, 3000);\n\t setTimeout(function () \n { \n\t player1frozen=document.getElementById(\"player1frozen\"); \n\t player1frozen.src=\"gifs/invisible.gif\";\n\t elem.src=\"gifs/youlose.gif\"; \n\t $(\"#restart\").css({\"visibility\": \"visible\"});\n }, 5000);\n }\n document.getElementById(\"hpcount1\").innerHTML=hp1;//Note: Always make sure that the logic is correct before outputting\n $(\"#redhp1\").css({\"height\": 50 - hp1/2}); \n $(\"#hitsplat1\").css({\"visibility\": \"visible\"});\n if (rand == 0) \n {\n $(\"#hitsplat1\").css({\"background-image\": \"url('images/dmg0.gif')\"});\n $(\".singledigitdmg1\").css({\"display\": \"none\"});\n $(\".leftsplathalf1\").css({\"display\": \"none\"});\n $(\".rightsplathalf1\").css({\"display\": \"none\"});\n } \n else {$(\"#hitsplat1\").css({\"background-image\": \"url('images/dmg.gif')\"});}//The else must be there for damages to not stay blue\n if (rand < 10 && rand > 0) //Single digit damage number\n { //dmg#-width,0-6,1-4,2-6,3-5,4-5,5-5,6-6,7-5,8-6,9-6,\n $(\".leftsplathalf1\").css({\"display\": \"none\"});\n $(\".rightsplathalf1\").css({\"display\": \"none\"}); \n if (rand == 0 || rand == 2 || rand == 6 || rand == 8 || rand == 9)\n {\n $(\".singledigitdmg1\").attr(\"width\", \"6\"); //Adjusting the gif width of the single digit number\n $(\".singledigitdmg1\").css({\"margin-left\": \"9px\"}); //Adjusting the position of the single digit number\n }\n else if (rand == 3 || rand == 4 || rand == 5 || rand == 7)\n {\n $(\".singledigitdmg1\").attr(\"width\", \"5\");\n $(\".singledigitdmg1\").css({\"margin-left\": \"9.5px\"});\n }\n else \n {\n $(\".singledigitdmg1\").attr(\"width\", \"4\");\n $(\".singledigitdmg1\").css({\"margin-left\": \"10px\"});\n }\n $(\".singledigitdmg1\").css({\"display\": \"\"});\n $(\".singledigitdmg1\").attr(\"src\", \"images/\" + rand + \".gif\");\n }\n else if (rand >= 10)\n {//dmg#-width,0-6,1-4,2-6,3-5,4-5,5-5,6-6,7-5,8-6,9-6,\n leftdigit = Math.floor(rand / 10); //Split 2 digit damages to a left number and right number\n rightdigit = rand % 10;\n $(\".singledigitdmg1\").css({\"display\": \"none\"});\n if (leftdigit == 0 || leftdigit == 2 || leftdigit == 6 || leftdigit == 8 || leftdigit == 9) //Adjusting the gif width of the number\n {$(\".leftsplathalf1\").attr(\"width\", \"6\");}\n else if (leftdigit == 3 || leftdigit == 4 || leftdigit == 5 || leftdigit == 7)\n {$(\".leftsplathalf1\").attr(\"width\", \"5\");}\n else {$(\".leftsplathalf1\").attr(\"width\", \"4\");}\n if (rightdigit == 0 || rightdigit == 2 || rightdigit == 6 || rightdigit == 8 || rightdigit == 9)\n {$(\".rightsplathalf1\").attr(\"width\", \"6\");}\n else if (rightdigit == 3 || rightdigit == 4 || rightdigit == 5 || rightdigit == 7)\n {$(\".rightsplathalf1\").attr(\"width\", \"5\");}\n else {$(\".rightsplathalf1\").attr(\"width\", \"4\");}\n $(\".leftsplathalf1\").css({\"display\": \"\"});\n $(\".leftsplathalf1\").attr(\"src\", \"images/\" + leftdigit + \".gif\");\n $(\".rightsplathalf1\").css({\"display\": \"\"}); \n $(\".rightsplathalf1\").attr(\"src\", \"images/\" + rightdigit + \".gif\");\n }\n $(\"#greenhp1\").css({\"width\": (hp1*10/33)});\n if (monsterTime > 2000) \n {\n\t setTimeout(function () //Commented out because hits are too fast\n\t { \n\t\t\t$(\".singledigitdmg1\").css({\"display\": \"none\"});\n\t\t\t$(\".leftsplathalf1\").css({\"display\": \"none\"});\n\t\t\t$(\".rightsplathalf1\").css({\"display\": \"none\"});\n\t\t\t$(\"#hitsplat1\").css({\"visibility\": \"hidden\"});\n\t }, 2000);\n }\n }\n}", "receiveDamage(amount){\n this.health -= amount;\n if (this.health <= 0) {\n return this.name + \" has died in act of combat\";\n ;\n }\n else{\n return this.name + \" has received \" + amount + \" points of damage\";\n }\n }", "function calculateDamage(move, AtkPokemon, DefPokemon){\n power = move.power\n ad = 0 //idk how this one is calculated exactly\n modifier = 0 //this ones complicated\n damage = (((2*AtkPokemon.level/5 + 2)*power*ad)/50 + 2)*modifier\n}", "function daDamageThing(damage, typeBonus, currentDragonHealth) {\r\n //secondEle.innerHTML=\"\"\r\n dragonHealth = currentDragonHealth - (damage + typeBonus)\r\n\r\n secondEle.innerHTML = \"Dragon Health:\" + dragonHealth\r\n if (dragonHealth<=0){\r\n secondEle.innerHTML=\"Dragon Health:\" + 0\r\n //dragonHealth=0\r\n thirdEle.innerHTML=\"AYO YOU DID IT YOU BEAT THIS DRAGON'S ASS, have a cookie!\"\r\n }\r\n}", "damagePlayer(player) {\r\n player.health -= this.damage;\r\n player.damageTakenSound.play();\r\n }", "postAttacked(animal,attacker,damage,type,last){}", "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}", "@action takeDamage(damage, type, armourPiercing) {\n const undealtShieldDamage = this.damageShields(damage, type)\n if (this.hasShields()) { return } // shields are not gone!\n const armourDamageRatio = this.getArmourDamageRatio(armourPiercing)\n const armourDamageAllocation = undealtShieldDamage * armourDamageRatio\n let undealtArmourDamage = this.damageArmour(armourDamageAllocation, type)\n return this.damageHP(undealtShieldDamage - armourDamageAllocation + undealtArmourDamage, type)\n }", "hit(enemy, point=1){\r\n let damage = point*this.power;\r\n console.log(`${this.name} try to bring damage to ${enemy.name} by damage(${damage})`);\r\n enemy.setDamage( damage );\r\n }", "damage( n ) {\n\t\tsuper.damage( n );\n\t\tif( !this.dead ) {\n\t\t\tthis.anim = display.getAnim( this.name + 'dmg' );\n\t\t\tgame.setCB( () => {\n\t\t\t\tif( !this.dead ) {\n\t\t\t\t\tthis.anim = display.getAnim( this.name );\n\t\t\t\t}\n\t\t\t}, 6, true );\n\t\t}\n\t}", "takeDamage(amount){\n this.activePokemon().takeDamage(amount)\n }", "function attack(move, attacker, defender) {\n if (currentOppPokemon.fainted == true) {\n return;\n }\n if (move.pp <= 0) {\n rollText(\"battle_text\", \"Not enough PP!\", 25);\n return;\n }\n move.pp -= 1;\n document.getElementById('buttonsBattle').style['display'] = 'none';\n damage = Math.round(((move.damage * ((Math.random() * 15) + 85) / 100)) * stab(attacker, move));\n\n let multiplier = typeChart[getKeyByValue(ElementalTypes, move.type)][defender.type];\n damage *= multiplier;\n\n switch (multiplier) {\n case 0:\n rollText(\"battle_text\", `${attacker.name} used ${move.name}! It had no effect.`, 25);\n break;\n case 0.5:\n rollText(\"battle_text\", `${attacker.name} used ${move.name}! It's not very effective.`, 25);\n notEffectiveSound.play();\n break;\n case 2:\n rollText(\"battle_text\", `${attacker.name} used ${move.name}! It's super effective!`, 25);\n superEffectiveSound.play();\n break;\n default:\n rollText(\"battle_text\", `${attacker.name} used ${move.name}!`, 25);\n damageSound.play();\n break;\n }\n\n defender.hp -= Math.ceil(damage);\n updateHealth(defender);\n}", "@action damageHP(damage, type) {\n // @TODO Should eventually deal more or less damage depending on type\n this.currentHitPoints = Math.max(this.currentHitPoints - damage, 0)\n return this.handleDeath(type)\n }", "function attack(damage, target) {\n\t// Generates and stores a random number from 1 to 10.\n $(\"#room-hider\").hide();\n $(\"#searcher-images\").hide();\n // hide room description on attack in case it bugs out and is showing\n\tvar hitChance = Math.floor(Math.random() * 10) + 1;\n var defense = target.defense;\n\n if(hitChance <= defense) {\n $(\"#combat-display\").append(\"<p>\" + target.name + \" defended, no damage.</p>\");\n } else if(hitChance >= 1 && hitChance <= 10) {\n \ttarget.takeDamage(damage);\n // Doesn't need to be an else if, but made it one to illustrate \tthe concept.\n }\n}", "damageEnvironment(environmentObject){\r\n environmentObject.health -= this.damage;\r\n }", "function getDamage(base, unitStrength, unitModifier, phaseModifier, combatAbility, discipline, e_discipline, e_tactic, e_damage_reduction) {\r\n let damage = base * (unitStrength / 1000) * unitModifier * phaseModifier * combatAbility * discipline / (e_tactic * e_discipline) * (1 - e_damage_reduction) * battle_length;\r\n return damage;\r\n}", "@action receiveAttack(ammo, damage) {\n if (this.currentHitPoints <= 0) {\n return\n }\n\n if (damage === undefined) {\n if (ammo.damage === undefined) {\n throw 'Must pass damage in ammo object or separately.'\n }\n damage = ammo.damage\n }\n\n this.takeHit(ammo.type)\n return this.takeDamage(damage, ammo.type, ammo.armourPiercing)\n }", "takeDamage(damage) {\n if (this.isPlayerAlive()) {\n this.hp -= damage;\n console.log(`${this.name} have ${this.hp} Health Points remaining.`);\n } else {\n this.state = LOSER;\n console.log(`${this.name} is dead :(`);\n }\n }", "attack(target) {\n return (target.res -= this.power);\n }", "takeDamage(dmg) {\n this.health -= (dmg * 0.6);\n this.operators[Helper.random(0, this.operators.length - 1)].takeDamage(dmg * 0.2);\n for (let i = 0; i < this.operators.length; i++) {\n this.operators[i].takeDamage(dmg * 0.1);\n }\n this.operators = this.operators.filter(a => a.isActive());\n }", "function totalBaseDamage(dictionary){\n let total = 0\n for (let keys in dictionary){\n let element = dictionary[keys]\n if(element.quantity == 0){\n continue;\n }\n if(dictionary == autoHacks){\n let effectChance = Math.random();\n while(effectChance <= element.effectChance){\n total += element.effectDmg + element.damage\n effectChance = Math.random();\n }\n }\n else {\n total += element.damage * element.quantity\n }\n }\n return total\n}", "function damage(health,htmlid,damage) {\n\thealth = document.getElementById(htmlid);\n\thealth.value = health.value - damage;\n}", "function damaged(){\n\tdamage.style.display = \"block\";\n\tsetTimeout(function(){\n\t\tdamage.style.display = \"none\";\n\t},100);\n}", "function wildPokemonAttack() {\r\n if (pokemonHealth > 0) {\r\n pokemonHealth = pokemonHealth - damage;\r\n alert(\"Wild \" + pokemonStats[wildPokemonid].type + \" uses \" + moves[moveid].move + \" dealing \" + damage + \" damage!\");\r\n attackLoop();\r\n } else {\r\n alert(\"Pokemon fainted\");\r\n }\r\n }", "@action damageArmour(damage, type) {\n return this.damageAttribute('currentArmour', damage, type, 'armour')\n }", "postAttack(animal,attackee,damage,type,last){}", "function makeDamage(grid, x, y){\n\tlet sqr = grid.squares[y][x];\n\tlet d = grid.damageG.create(sqr.x, sqr.y, 'atlas', 'DamageTile');\n\td.xCoord = x;\n\td.yCoord = y;\n\td.sqr = sqr;\n\td.scale.x = sqr.tile.scale.x;\n\td.scale.y = sqr.tile.scale.y;\n}", "function betray(name){\n attackXY(); \n swingAxe();\n}", "handleDamage(player) {\n let d = dist(this.x, this.y, player.x, player.y);\n if (d < 5) {\n this.reset();\n player.sentence += 36;\n console.log(\"36 days added to community service, current sentence is \" + player.sentence + \" days\");\n //Stop any potential instance of the sound effect and play it again\n audioPlayerHit.stop();\n audioPlayerHit.play();\n }\n }", "function strongAttackHandler(){\n attackMonster('STRONG_ATTACK');\n\n /*const damage = dealMonsterDamage(STRONG_ATTACK_VALUE);\n currentMonsterHealth -= damage;\n const playerDamage = dealPlayerDamage(MONSTER_ATTACK_VALUE);\n currentPlayerHealth -= playerDamage;\n\n //11\n if(currentMonsterHealth <=0 && currentPlayerHealth > 0){\n alert('You won!');\n\n }else if (currentPlayerHealth <=0 && currentMonsterHealth > 0){\n alert('You have Lost'); //Player loses if Monster Health is above 0.\n }\n else if (currentPlayerHealth <=0 && currentMonsterHealth <= 0 ){\n alert('You have a draw');\n }*/\n\n\n }", "function infuse(weapons) {\n var mainWeapon = weapons[0];\n weapons.shift();\n weapons.forEach(function (fodder, index, array) {\n var diff = fodder.light - mainWeapon.light;\n if (diff > 0) {\n var threshold = THRESHOLD['main'][mainWeapon.rarity] + THRESHOLD['fodder'][fodder.rarity];\n var oldLight = mainWeapon.light;\n var increasedLight = diff;\n if (diff > threshold) {\n increasedLight = Math.round(diff * PENALTIES[mainWeapon.rarity]);\n }\n mainWeapon.light += increasedLight;\n var costShards = fodder.rarity === 'e' ? SHARDS : 0;\n var costMarks = (fodder.rarity === 'e' || fodder.rarity === 'l') ? MARKS : 0;\n\n totalCosts.marks += costMarks;\n totalCosts.shards += costShards;\n console.log('Main weapon has gone from ' + oldLight + ' to ' + mainWeapon.light + '. Marks: ' + costMarks + ', Shards: ' + costShards);\n } else {\n console.log('Max light of ' + mainWeapon.light + ' reached after infusing ' + fodder.rarity + fodder.light);\n return;\n }\n });\n}", "function writeDefenses() {\n\tbaseDodgeDv = Math.round((myCharacter['attributes']['dexterity'] + myCharacter['skills']['athletics']) / 2) + convertToEpic(myCharacter['epicAttributes']['epicDexterity']);\n\n\tadjustedMobilityPenalty = 0;\n\tfor(var armorName in myCharacter['armors']) {\n\t\tif(myCharacter['armors'][armorName]['enabled'] == true) {\n\t\t\tadjustedMobilityPenalty = parseInt(nanEqualsZero(myCharacter['armors'][armorName]['mobilityPenalty']));\n\t\t}\n\t}\n\tif(myCharacter['knacks']['epicStrength']['kingsOfMetal'] == true) {\n\t\tadjustedMobilityPenalty = 0;\n\t}\n\ttempDodgeDv = 0;\n\tfor(var tempName in myCharacter['tempModifier']) {\n\t\tif(myCharacter['tempModifier'][tempName]['tempModifier'] == \"DodgeDv\") {\n\t\t\ttempDodgeDv += parseInt(myCharacter['tempModifier'][tempName]['tempModifierLevel']);\n\t\t}\n\t}\n\trelicDodgeDv = 0;\n\tfor(var relicName in myCharacter['relics']) {\n\t\tif(myCharacter['relics'][relicName]['enabled'] == true) {\n\t\t\tfor(var bonusDice in myCharacter['relics'][relicName]['bonusDice']) {\n\t\t\t\tif(bonusDice == \"dodgeDv\") {\n\t\t\t\t\trelicDodgeDv += convertToEffectiveNumberBoons(myCharacter['relics'][relicName]['bonusDice'][bonusDice]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tadjustedDodgeDv = baseDodgeDv + adjustedMobilityPenalty + tempDodgeDv + relicDodgeDv;\n\tknowingIsHalfTheBattleDv = Math.round((myCharacter['attributes']['intelligence'] + myCharacter['skills']['athletics']) / 2) + convertToEpic(myCharacter['epicAttributes']['epicIntelligence']) + adjustedMobilityPenalty + tempDodgeDv + relicDodgeDv;\n\tlightningReflexesDv = Math.round((myCharacter['attributes']['wits'] + myCharacter['skills']['athletics']) / 2) + convertToEpic(myCharacter['epicAttributes']['epicWits']) + adjustedMobilityPenalty + tempDodgeDv + relicDodgeDv;\n\tevasiveActionDv = Math.round((myCharacter['attributes']['wits'] + myCharacter['skills']['athletics']) / 2) + convertToEpic(myCharacter['epicAttributes']['epicWits']) + adjustedMobilityPenalty + tempDodgeDv + relicDodgeDv;\n\tdoNotWantDv = Math.round((myCharacter['attributes']['appearance'] + myCharacter['skills']['athletics']) / 2) + convertToEpic(myCharacter['epicAttributes']['epicAppearance']) + adjustedMobilityPenalty + tempDodgeDv + relicDodgeDv;\n\n\tparryString = \"\";\n\tfor(var attackName in myCharacter['attacks']) {\n\t\tthisParryAttribute = 0;\n\t\tthisParryEpic = 0;\n\t\tswitch(myCharacter['attacks'][attackName]['attackAttribute']){\n\t\t\tcase 'strength':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['strength']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicStrength'])));\n\t\t\tbreak;\n\t\t\tcase 'dexterity':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['dexterity']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicDexterity'])));\n\t\t\tbreak;\n\t\t\tcase 'stamina':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['stamina']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicStamina'])));\n\t\t\tbreak;\n\t\t\tcase 'charisma':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['charisma']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicCharisma'])));\n\t\t\tbreak;\n\t\t\tcase 'manipulation':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['manipulation']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicManipulation'])));\n\t\t\tbreak;\n\t\t\tcase 'appearance':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['appearance']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicAppearance'])));\n\t\t\tbreak;\n\t\t\tcase 'perception':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['perception']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicPerception'])));\n\t\t\tbreak;\n\t\t\tcase 'intelligence':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['intelligence']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicIntelligence'])));\n\t\t\tbreak;\n\t\t\tcase 'wits':\n\t\t\tthisParryAttribute = parseInt(myCharacter['attributes']['wits']);\n\t\t\tthisParryEpic = parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicWits'])));\n\t\t\tbreak;\n\t\t}\n\t\tthisParrySkill = 0;\n\t\tswitch(myCharacter['attacks'][attackName]['attackAttribute']){\n\t\t\tcase 'academics':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['academics']));\n\t\t\tbreak;\n\t\t\tcase 'animalken':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['animalken']));\n\t\t\tbreak;\n\t\t\tcase 'art':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['art']));\n\t\t\tbreak;\n\t\t\tcase 'athletics':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['athletics']));\n\t\t\tbreak;\n\t\t\tcase 'awareness':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['awareness']));\n\t\t\tbreak;\n\t\t\tcase 'brawl':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['brawl']));\n\t\t\tbreak;\n\t\t\tcase 'command':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['command']));\n\t\t\tbreak;\n\t\t\tcase 'control':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['control']));\n\t\t\tbreak;\n\t\t\tcase 'craft':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['craft']));\n\t\t\tbreak;\n\t\t\tcase 'empathy':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['empathy']));\n\t\t\tbreak;\n\t\t\tcase 'fortitude':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['fortitude']));\n\t\t\tbreak;\n\t\t\tcase 'integrity':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['integrity']));\n\t\t\tbreak;\n\t\t\tcase 'investigation':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['investigation']));\n\t\t\tbreak;\n\t\t\tcase 'larceny':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['larceny']));\n\t\t\tbreak;\n\t\t\tcase 'marksmanship':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['marksmanship']));\n\t\t\tbreak;\n\t\t\tcase 'medicine':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['medicine']));\n\t\t\tbreak;\n\t\t\tcase 'melee':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['melee']));\n\t\t\tbreak;\n\t\t\tcase 'occult':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['occult']));\n\t\t\tbreak;\n\t\t\tcase 'politics':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['politics']));\n\t\t\tbreak;\n\t\t\tcase 'presence':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['presence']));\n\t\t\tbreak;\n\t\t\tcase 'science':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['science']));\n\t\t\tbreak;\n\t\t\tcase 'stealth':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['stealth']));\n\t\t\tbreak;\n\t\t\tcase 'survival':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['survival']));\n\t\t\tbreak;\n\t\t\tcase 'thrown':\n\t\t\tthisParrySkill = parseInt(nanEqualsZero(myCharacter['skills']['thrown']));\n\t\t\tbreak;\n\t\t}\n\t\tthisParryBase = parseInt(myCharacter['attacks'][attackName]['parryBase']);\n\t\ttempParryDv = 0;\n\t\tfor(var tempName in myCharacter['tempModifier']) {\n\t\t\tif(myCharacter['tempModifier'][tempName]['tempModifier'] == \"ParryDv\") {\n\t\t\t\ttempParryDv += parseInt(myCharacter['tempModifier'][tempName]['tempModifierLevel']);\n\t\t\t}\n\t\t}\n\t\trelicParryDv = 0;\n\t\tfor(var relicName in myCharacter['relics']) {\n\t\t\tif(myCharacter['relics'][relicName]['enabled'] == true) {\n\t\t\t\tfor(var bonusDice in myCharacter['relics'][relicName]['bonusDice']) {\n\t\t\t\t\tif(bonusDice == attackName + \"Parry\") {\n\t\t\t\t\t\trelicParryDv += convertToEffectiveNumberBoons(myCharacter['relics'][relicName]['bonusDice'][bonusDice]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor(var itemEn in myCharacter['relics'][relicName]['itemEnhancements']) {\n\t\t\t\t\tif(itemEn == attackName + \"parryDv\") {\n\t\t\t\t\t\trelicParryDv += convertToEpic(parseInt(myCharacter['relics'][relicName]['itemEnhancements'][itemEn]));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tadjustedParry = Math.round((thisParryAttribute + thisParrySkill) / 2) + thisParryEpic + thisParryBase + tempParryDv + relicParryDv;\n\t\tparryString += attackName + \" Parry DV: <strong>\" + adjustedParry + \"</strong><br>\";\n\t\tif(myCharacter['knacks']['epicStrength']['empoweredDeflection'] == true) {\n\t\t\tadjustedParry = Math.round((parseInt(myCharacter['attributes']['strength']) + thisParrySkill) / 2) + parseInt(nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicStrength']))) + thisParryBase + tempParryDv + relicParryDv;\n\t\t\tparryString += attackName + \" Parry DV (Empowered Deflection): <strong>\" + adjustedParry + \"</strong><br>\";\n\t\t}\n\t}\n\n\tbaseBashingSoak = parseInt(myCharacter['attributes']['stamina']) + nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicStamina']));\n\tbaseLethalSoak = Math.round(parseInt(myCharacter['attributes']['stamina']) / 2) + nanEqualsZero(convertToEpic(myCharacter['epicAttributes']['epicStamina']));\n\tbaseAggravatedSoak = parseInt(myCharacter['epicAttributes']['epicStamina']);\n\n\tarmorBashingSoak = 0;\n\tarmorLethalSoak = 0;\n\tarmorAggravatedSoak = 0;\n\tfor(var armorName in myCharacter['armors']) {\n\t\tif(myCharacter['armors'][armorName]['enabled'] == true) {\n\t\t\tarmorBashingSoak = parseInt(myCharacter['armors'][armorName]['bSoak']);\n\t\t\tarmorLethalSoak =\tparseInt(myCharacter['armors'][armorName]['lSoak']);\n\t\t\tarmorAggravatedSoak = parseInt(myCharacter['armors'][armorName]['aSoak']);\n\t\t\tif(myCharacter['armors'][armorName]['lethalAddAg'] == true) {\n\t\t\t\tarmorAggravatedSoak += armorLethalSoak;\n\t\t\t}\n\t\t}\n\t}\n\ttempBashingSoak = 0;\n\ttempLethalSoak = 0;\n\ttempAggravatedSoak = 0;\n\tfor(var tempName in myCharacter['tempModifier']) {\n\t\tif(myCharacter['tempModifier'][tempName]['tempModifier'] == \"soak\") {\n\t\t\ttempBashingSoak += parseInt(convertToEffectiveNumberBoons(myCharacter['tempModifier'][tempName]['tempModifierLevel']));\n\t\t\ttempLethalSoak += parseInt(convertToEffectiveNumberBoons(myCharacter['tempModifier'][tempName]['tempModifierLevel']));\n\t\t\ttempAggravatedSoak += parseInt(convertToEffectiveNumberBoons(myCharacter['tempModifier'][tempName]['tempModifierLevel']));\n\t\t}\n\t}\n\tfor(var tempName in myCharacter['tempModifier']) {\n\t\tif(myCharacter['tempModifier'][tempName]['tempModifier'] == \"blsoak\") {\n\t\t\ttempBashingSoak += parseInt(convertToEffectiveNumberBoons(myCharacter['tempModifier'][tempName]['tempModifierLevel']));\n\t\t\ttempLethalSoak += parseInt(convertToEffectiveNumberBoons(myCharacter['tempModifier'][tempName]['tempModifierLevel']));\n\t\t}\n\t}\n\tfor(var tempName in myCharacter['tempModifier']) {\n\t\tif(myCharacter['tempModifier'][tempName]['tempModifier'] == \"asoak\") {\n\t\t\ttempAggravatedSoak += parseInt(convertToEffectiveNumberBoons(myCharacter['tempModifier'][tempName]['tempModifierLevel']));\n\t\t}\n\t}\n\trelicBashingSoak = 0;\n\trelicLethalSoak = 0;\n\trelicAggravatedSoak = 0;\n\tfor(var relicName in myCharacter['relics']) {\n\t\tif(myCharacter['relics'][relicName]['enabled'] == true) {\n\t\t\tfor(var bonusDice in myCharacter['relics'][relicName]['bonusDice']) {\n\t\t\t\tif(bonusDice == relicName + \"Soak\") {\n\t\t\t\t\trelicBashingSoak += convertToEffectiveNumberBoons(myCharacter['relics'][relicName]['bonusDice'][bonusDice]);\n\t\t\t\t\trelicLethalSoak += convertToEffectiveNumberBoons(myCharacter['relics'][relicName]['bonusDice'][bonusDice]);\n\t\t\t\t\trelicAggravatedSoak += convertToEffectiveNumberBoons(myCharacter['relics'][relicName]['bonusDice'][bonusDice]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(var itemEn in myCharacter['relics'][relicName]['itemEnhancements']) {\n\t\t\t\tif(itemEn == relicName + \"soak\") {\n\t\t\t\t\trelicBashingSoak += convertToEpic(parseInt(myCharacter['relics'][relicName]['itemEnhancements'][itemEn]));\n\t\t\t\t\trelicLethalSoak += convertToEpic(parseInt(myCharacter['relics'][relicName]['itemEnhancements'][itemEn]));\n\t\t\t\t\trelicAggravatedSoak += convertToEpic(parseInt(myCharacter['relics'][relicName]['itemEnhancements'][itemEn]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tadjustedBashingSoak = baseBashingSoak + armorBashingSoak + tempBashingSoak + relicBashingSoak;\n\tadjustedLethalSoak = baseLethalSoak + armorLethalSoak + tempLethalSoak + relicLethalSoak;\n\tadjustedAggravatedSoak = baseAggravatedSoak + armorAggravatedSoak + tempAggravatedSoak + relicAggravatedSoak;\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel2'] == true) {\n\t\tadjustedBashingSoak += 1;\n\t\tadjustedLethalSoak += 1;\n\t\tadjustedAggravatedSoak += 1;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel4'] == true) {\n\t\tadjustedBashingSoak += 1;\n\t\tadjustedLethalSoak += 1;\n\t\tadjustedAggravatedSoak += 1;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel5'] == true) {\n\t\tadjustedBashingSoak += 2;\n\t\tadjustedLethalSoak += 2;\n\t\tadjustedAggravatedSoak += 2;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel6'] == true) {\n\t\tadjustedBashingSoak += 1;\n\t\tadjustedLethalSoak += 1;\n\t\tadjustedAggravatedSoak += 1;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel9'] == true) {\n\t\tadjustedBashingSoak += 4;\n\t\tadjustedLethalSoak += 4;\n\t\tadjustedAggravatedSoak += 4;\n\t}\n\tpiercingBashingSoak = adjustedBashingSoak - Math.round(armorBashingSoak / 2);\n\tpiercingLethalSoak = adjustedLethalSoak - Math.round(armorLethalSoak / 2);\n\tpiercingAggravatedSoak = adjustedAggravatedSoak - Math.round(armorAggravatedSoak / 2);\n\tnoArmorBashingSoak = adjustedBashingSoak - armorBashingSoak;\n\tnoArmorLethalSoak = adjustedLethalSoak - armorLethalSoak;\n\tnoArmorAggravatedSoak = adjustedAggravatedSoak - armorAggravatedSoak;\n\n\tbaseZeroHealthLevels = 1;\n\tbaseOneHealthLevels = 2;\n\tbaseTwoHealthLevels = 2;\n\tbaseFourHealthLevels = 1;\n\tbaseIncapacitatedHealthLevels = 1;\n\tbaseDeadHealthLevels = parseInt(myCharacter['coreTraits']['legend']) + parseInt(myCharacter['attributes']['stamina']) + parseInt(myCharacter['epicAttributes']['epicStamina']);\n\tif(myCharacter['knacks']['epicStamina']['trueGrit'] == true) {\n\t\tbaseZeroHealthLevels = baseZeroHealthLevels * 2;\n\t\tbaseOneHealthLevels = baseOneHealthLevels * 2;\n\t\tbaseTwoHealthLevels = baseTwoHealthLevels * 2;\n\t\tbaseFourHealthLevels = baseFourHealthLevels * 2;\n\t}\n\tadjustedZeroHealthLevels = baseZeroHealthLevels + convertToEpic(myCharacter['epicAttributes']['epicStamina']);\n\tadjustedOneHealthLevels = baseOneHealthLevels;\n\tadjustedTwoHealthLevels = baseTwoHealthLevels;\n\tadjustedFourHealthLevels = baseFourHealthLevels;\n\tadjustedIncapacitatedHealthLevels = baseIncapacitatedHealthLevels;\n\tadjustedDeadHealthLevels = baseDeadHealthLevels;\n\tif(adjustedDeadHealthLevels > 20) {\n\t\tadjustedDeadHealthLevels = 20;\n\t}\n\tif(myCharacter['knacks']['epicStamina']['trueGrit'] == true) {\n\t\tadjustedFourHealthLevels += parseInt(myCharacter['epicAttributes']['epicStamina']);\n\t}\n\tfor(var tempName in myCharacter['tempModifier']) {\n\t\tif(myCharacter['tempModifier'][tempName]['tempModifier'] == \"healthLevels\") {\n\t\t\tadjustedZeroHealthLevels += parseInt(myCharacter['tempModifier'][tempName]['tempModifierLevel']);\n\t\t}\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel1'] == true) {\n\t\tadjustedZeroHealthLevels += 1;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel2'] == true) {\n\t\tadjustedZeroHealthLevels += 1;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel5'] == true) {\n\t\tadjustedZeroHealthLevels += 2;\n\t}\n\tif(myCharacter['characterPantheon'] == \"Aesir\" && myCharacter['boons']['psp']['pspLevel9'] == true) {\n\t\tadjustedZeroHealthLevels += 4;\n\t}\n\n\tdefensesString = \"\";\n\tdefensesString += \"Dodge DV: <strong>\" + adjustedDodgeDv + \"</strong><br>\";\n\tif(myCharacter['knacks']['epicIntelligence']['knowingIsHalfTheBattle'] == true) {\n\t\tdefensesString += \"Dodge DV (Knowing Is Half the Battle): <strong>\" + knowingIsHalfTheBattleDv + \"</strong><br>\";\n\t}\n\tif(myCharacter['knacks']['epicWits']['lightningReflexes'] == true) {\n\t\tdefensesString += \"Dodge DV (Lightning Reflexes): <strong>\" + lightningReflexesDv + \"</strong><br>\";\n\t}\n\tif(myCharacter['knacks']['epicAppearance']['doNotWant'] == true) {\n\t\tdefensesString += \"Dodge DV (Do Not Want): <strong>\" + doNotWantDv + \"</strong><br>\";\n\t}\n\tif(myCharacter['knacks']['epicWits']['evasiveAction'] == true) {\n\t\tdefensesString += \"Optional Dodge DV against Area of Effects: <strong>\" + evasiveActionDv + \"</strong><br>\";\n\t}\n\tif(myCharacter['boons']['water']['commanderOfCurrents'] == true && myValidChannelsList['water'] == true) {\n\t\tdefensesString += \"Bonus Dodge DV while in water: <strong>+\" + effectiveNumberWater + \"</strong><br>\";\n\t}\n\tif(myCharacter['boons']['frost']['wintersGrace'] == true && myValidChannelsList['frost'] == true) {\n\t\tdefensesString += \"Bonus Dodge DV while on ice/snow: <strong>+\" + effectiveNumberFrost + \"</strong><br>\";\n\t}\n\tdefensiveDoOverValue = Math.round(myCharacter['skills']['athletics'] / 2);\n\tif(myCharacter['knacks']['epicDexterity']['untouchableOpponent']) {\n\t\tdefensiveDoOverValue += parseInt(myCharacter['epicAttributes']['epicDexterity']);\n\t}\n\tdefensesString += \"Defensive Do-Over can reflexively add +\" + defensiveDoOverValue + \" DV<br>\";\n\tif(myCharacter['boons']['illusion']['shadowPartner'] == true && myValidChannelsList['illusion'] == true) {\n\t\tif(myCharacter['selfName'] == \"Enoch\") {\n\t\t\tdefensesString += \"Shadow Partner can reflexively add +\" + parseInt(effectiveNumberIllusion + myCharacter['coreTraits']['legend']) + \" DV<br>\";\n\t\t} else {\n\t\t\tdefensesString += \"Shadow Partner can reflexively add +\" + effectiveNumberIllusion + \" DV<br>\";\n\t\t}\n\t}\n\tif(myCharacter['boons']['prophecy']['defensiveForesight'] == true && myValidChannelsList['prophecy'] == true) {\n\t\tdefensesString += \"Defensive Foresight can reflexively add +\" + effectiveNumberProphecy + \" DV<br>\";\n\t}\n\tdefensesString += \"<br>\";\n\tdefensesString += parryString;\n\tdefensesString += \"<br>\";\n\tdefensesString += \"Bashing Soak: <strong>\" + adjustedBashingSoak + \"</strong> (vs Piercing: \" + piercingBashingSoak + \", vs Armor-Ignoring: \" + noArmorBashingSoak + \")<br>\";\n\tdefensesString += \"Lethal Soak: <strong>\" + adjustedLethalSoak + \"</strong> (vs Piercing: \" + piercingLethalSoak + \", vs Armor-Ignoring: \" + noArmorLethalSoak + \")<br>\";\n\tdefensesString += \"Aggravated Soak: <strong>\" + adjustedAggravatedSoak + \"</strong> (vs Piercing: \" + piercingAggravatedSoak + \", vs Armor-Ignoring: \" + noArmorAggravatedSoak + \")<br>\";\n\tif(myCharacter['knacks']['epicAppearance']['rockHardAbs'] == true) {\n\t\tdefensesString += \"Rock Hard Abs/Chainmail Bikini can reflexively add +\" + parseInt(myCharacter['epicAttributes']['epicAppearance']) + \" Soak<br>\";\n\t}\n\tif(myCharacter['knacks']['epicDexterity']['rollWithIt'] == true) {\n\t\tif(myCharacter['selfName'] == \"Marcela\") {\n\t\t\tdefensesString += \"Roll With It can reflexively add +\" + parseInt(myCharacter['epicAttributes']['epicDexterity'] * 2) + \" Soak<br>\";\n\t\t} else {\n\t\t\tdefensesString += \"Roll With It can reflexively add +\" + parseInt(myCharacter['epicAttributes']['epicDexterity']) + \" Soak<br>\";\n\t\t}\n\t}\n\tif(myCharacter['boons']['fire']['fireAffinity'] == true && myValidChannelsList['fire'] == true) {\n\t\tdefensesString += \"Fire Affinity automatically adds +\" + (2 * effectiveNumberFire) + \" Soak against fire-based damage<br>\"\n\t}\n\tif(myCharacter['boons']['frost']['frostAffinity'] == true && myValidChannelsList['frost'] == true) {\n\t\tdefensesString += \"Frost Affinity automatically adds +\" + (2 * effectiveNumberFrost) + \" Soak against cold-based damage<br>\"\n\t}\n\tif(myCharacter['boons']['thunder']['lightningAffinity'] == true && myValidChannelsList['thunder'] == true) {\n\t\tdefensesString += \"Lightning Affinity automatically adds +\" + (2 * effectiveNumberThunder) + \" Soak against electricity-based damage<br>\"\n\t}\n\tif(myCharacter['selfName'] == \"Arev\" || myCharacter['selfName'] == \"Cora\" || myCharacter['selfName'] == \"Shrimati\") {\n\t\tif(myCharacter['relics']['Raven\\'s Favor']['enabled'] == true) {\n\t\t\tdefensesString += \"Raven's Favor automatically adds +\" + (2 * parseInt(myCharacter['coreTraits']['legend'])) + \" Soak against cold-based damage<br>\"\n\t\t}\n\t}\n\n\tdefensesString += \"<br>\";\n\tdefensesString += \"-0 Health Levels: <strong>\" + adjustedZeroHealthLevels + \"</strong><br>\";\n\tdefensesString += \"-1 Health Levels: <strong>\" + adjustedOneHealthLevels + \"</strong><br>\";\n\tdefensesString += \"-2 Health Levels: <strong>\" + adjustedTwoHealthLevels + \"</strong><br>\";\n\tdefensesString += \"-4 Health Levels: <strong>\" + adjustedFourHealthLevels + \"</strong><br>\";\n\tdefensesString += \"Incapacitated Health Levels: <strong>\" + adjustedIncapacitatedHealthLevels + \"</strong><br>\";\n\tdefensesString += \"Dead Health Levels: <strong>\" + adjustedDeadHealthLevels + \"</strong><br>\";\n\tdefensesString += \"<br>\";\n\n\tdocument.getElementById('defensesArea').innerHTML = defensesString;\n}", "doDamage(damage){\r\n if (!(damage > 0))\r\n return;\r\n\r\n this.hp -= damage;\r\n\r\n if (this.hp <= 0){\r\n this.alive = false;\r\n this.hp = 0;\r\n if (this.nextEnemy != null && this.prevEnemy != null){\r\n this.nextEnemy.prevEnemy = this.prevEnemy;\r\n }\r\n player.changeMoneyBy(50);\r\n }\r\n }", "attackTarget(attack) {\n _gameService.attackTarget(attack)\n draw()\n }", "function getDamageWild(wildMove){\n damage = 10;\n for (var i = 0; i < wildPokemonType.length; i++) {\n var multiplier = pokeTypesEffect[wildMove][pokeTypes[wildPokemonType[i]]]\n damage = damage * multiplier;\n }\n userHealth = userHealth - damage;\n $(\"#user-health\").val(userHealth);\n}", "function checkDamage()\n{\n\tvar currentTime = new Date();\n\tfor (var mapId in damageList)\n\t{\n\t\tvar n = damageList[mapId].length;\n\n\t\t// go through every active attack\n\t\tfor (var i = 0; i < n; i++)\n\t\t{\n\t\t\t// check if the animation reached the frame where it does damage\n\t\t\tif (currentTime.getTime() >= damageList[mapId][i].damage_time)\n\t\t\t{\n\t\t\t\tif (damageList[mapId][i].source == \"iceboss\")\n\t\t\t\t{\n\t\t\t\t\tvar e = getEntity(\"iceboss\",2);\n\t\t\t\t\tfor (var j in connected[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (e.direction == \"Up\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x, e.y - e.depth, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x, e.y - e.depth, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (e.direction == \"Down\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x, e.y + e.depth, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x, e.y + e.depth, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (e.direction == \"Left\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x - e.width / 2, e.y, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x - e.width / 2, e.y, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (e.direction == \"Right\")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('createEffect', \"groundcrack\", e.x + e.width / 2, e.y, 600, mapId);\n\t\t\t\t\t\t\t//io.to(connected[mapId][j].id).emit('createEffect', \"dust\", e.x + e.width / 2, e.y, 30, mapId);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\t// check every connected player to see if they were hit\n\t\t\t\tfor (var j in connected[mapId])\n\t\t\t\t{\n\t\t\t\t\tif (damageList[mapId][i].source != connected[mapId][j].id && connected[mapId][j].targetType != \"Passive\" && damageList[mapId][i].collisionCheck(connected[mapId][j]))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar knockback = damageList[mapId][i].knockback;\n\n\t\t\t\t\t\t// tell the client that they took damage\n\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('damageIn', damageList[mapId][i].x, damageList[mapId][i].y, Math.ceil(damageList[mapId][i].damage * Math.sqrt(damageList[mapId][i].damage / connected[mapId][j].defence)), knockback);\n\n\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\taddKillParticipation(connected[mapId][j].id, damageList[mapId][i].source, mapId);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// check every cpu to see if they were hit\n\t\t\t\tfor (var j in mapEntities[mapId])\n\t\t\t\t{\n\t\t\t\t\tif (damageList[mapId][i].source != mapEntities[mapId][j].entity.id && mapEntities[mapId][j].entity.targetType != \"Passive\" && damageList[mapId][i].collisionCheck(mapEntities[mapId][j].entity))\n\t\t\t\t\t{\n\t\t\t\t\t\tvar knockback = damageList[mapId][i].knockback;\n\n\t\t\t\t\t\t// damage the entity\n\t\t\t\t\t\tmapEntities[mapId][j].entity.takeDamage(damageList[mapId][i].x, damageList[mapId][i].y, Math.ceil(damageList[mapId][i].damage * Math.sqrt(damageList[mapId][i].damage / mapEntities[mapId][j].entity.defence)), knockback);\n\n\t\t\t\t\t\t// tell the CPU to target that entity\n\t\t\t\t\t\tmapEntities[mapId][j].setTarget(damageList[mapId][i].source);\n\n\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\taddKillParticipation(mapEntities[mapId][j].entity.id, damageList[mapId][i].source, mapId);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tdamageList[mapId].splice(i,1);\n\t\t\ti--;\n\t\t\tn--;\n\t\t\t}\n\t\t}\n\t}\n\n\t// update projectile and check if it has gone offscreen or hit someone\n\tfor (var mapId in projectileList)\n\t{\n\t\tn = projectileList[mapId].length;\n\n\t\tfor (var i = 0; i < n; i++)\n\t\t{\n\t\t\tif (currentTime.getTime() >= projectileList[mapId][i].update_time)\n\t\t\t{\n\t\t\t\tprojectileList[mapId][i].update();\n\n\t\t\t\tif (projectileList[mapId][i].offscreen())\n\t\t\t\t{\n\t\t\t\t\tprojectileList[mapId].splice(i, 1);\n\t\t\t\t\ti--;\n\t\t\t\t\tn--;\n\t\t\t\t}\n\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tvar dmg = false;\n\n\t\t\t\t\t// check every connected player to see if they were hit\n\t\t\t\t\tfor (var j in connected[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (projectileList[mapId][i].source != connected[mapId][j].id && connected[mapId][j].targetType != \"Passive\" && projectileList[mapId][i].collisionCheck(connected[mapId][j]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar knockback = projectileList[mapId][i].knockback;\n\n\t\t\t\t\t\t\t// tell the client that they took damage\n\t\t\t\t\t\t\tio.to(connected[mapId][j].id).emit('damageIn', projectileList[mapId][i].x, projectileList[mapId][i].y, Math.ceil(projectileList[mapId][i].damage * Math.sqrt(projectileList[mapId][i].damage / connected[mapId][j].defence)), knockback);\n\n\t\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\t\taddKillParticipation(connected[mapId][j].id, projectileList[mapId][i].source, mapId);\n\n\t\t\t\t\t\t\tdmg = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// check every cpu to see if they were hit\n\t\t\t\t\tfor (var j in mapEntities[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (projectileList[mapId][i].source != mapEntities[mapId][j].entity.id && mapEntities[mapId][j].entity.targetType != \"Passive\" && projectileList[mapId][i].collisionCheck(mapEntities[mapId][j].entity))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar knockback = projectileList[mapId][i].knockback;\n\n\t\t\t\t\t\t\t// damage the entity\n\t\t\t\t\t\t\tmapEntities[mapId][j].entity.takeDamage(projectileList[mapId][i].x, projectileList[mapId][i].y, Math.ceil(projectileList[mapId][i].damage * Math.sqrt(projectileList[mapId][i].damage / mapEntities[mapId][j].entity.defence)), knockback);\n\n\t\t\t\t\t\t\t// tell the CPU to target that entity\n\t\t\t\t\t\t\tmapEntities[mapId][j].setTarget(projectileList[mapId][i].source);\n\n\t\t\t\t\t\t\t// track most recent attackers\n\t\t\t\t\t\t\taddKillParticipation(mapEntities[mapId][j].entity.id, projectileList[mapId][i].source, mapId);\n\n\t\t\t\t\t\t\tdmg = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// check every mapobject to see if it's hit a solid object\n\t\t\t\t\tfor (var j in mapObjects[mapId])\n\t\t\t\t\t{\n\t\t\t\t\t\tif (projectileList[mapId][i].collisionCheck(mapObjects[mapId][j]))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdmg = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (dmg && projectileList[mapId][i].destroyOnHit)\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectileList[mapId].splice(i, 1);\n\t\t\t\t\t\ti--;\n\t\t\t\t\t\tn--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}" ]
[ "0.7356317", "0.70224667", "0.70133823", "0.6839083", "0.67888325", "0.67204803", "0.66766804", "0.6652065", "0.6529668", "0.650876", "0.65002847", "0.64326906", "0.64096236", "0.64029527", "0.6395782", "0.63202643", "0.6320158", "0.6319817", "0.6283521", "0.62433195", "0.62068695", "0.6196759", "0.6194976", "0.61926234", "0.6180613", "0.6145028", "0.61176604", "0.610623", "0.610148", "0.61013246", "0.6051597", "0.6050158", "0.6046473", "0.6042537", "0.60417914", "0.60387516", "0.6031719", "0.6026303", "0.6019172", "0.59996206", "0.5993002", "0.5986598", "0.5943928", "0.5940014", "0.59316576", "0.5928768", "0.5927115", "0.5919734", "0.59150267", "0.589427", "0.5886589", "0.5881476", "0.58743817", "0.58729315", "0.5862129", "0.58466125", "0.5843674", "0.58329153", "0.58229846", "0.5819891", "0.5819891", "0.58197474", "0.58153504", "0.58115375", "0.58081377", "0.58070326", "0.5802747", "0.578462", "0.57815224", "0.5778069", "0.57740897", "0.5767705", "0.576756", "0.5766652", "0.5762276", "0.5756239", "0.5742515", "0.5742379", "0.5738887", "0.57300436", "0.5714944", "0.57093465", "0.57063603", "0.5705754", "0.5699363", "0.569757", "0.5696227", "0.56908804", "0.5687883", "0.5685645", "0.56848955", "0.5680614", "0.5672562", "0.5670687", "0.56702006", "0.56680346", "0.566474", "0.5661243", "0.5659715", "0.56593007", "0.56557566" ]
0.0
-1
Reinitiate original mana points for next turn and add 20 mana points to winner
winMana() { this.mana += 20; let playerCategory; if (playerClass === 'Assassin') { if (this.mana >= 20){ this.mana = 20; } } if (playerClass === 'Berzerker') { if (this.mana > 0){ this.mana = 0; } } if (playerClass === 'Fighter') { if (this.mana >= 40){ this.mana = 40; } } if (playerClass === 'Monk') { if (this.mana >= 200){ this.mana = 200; } } if (playerClass === 'Paladin') { if (this.mana > 160){ this.mana = 160; } } return this.mana; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "regenerateMana(amountToRegenerate){\n\n //Determine maximum\n let maxToRegen = this.props.stats_current.mana - this.props.mana_points;\n\n //If trying to regenerate more than maximum, only regen up to maximum\n let appliedAmountToRegenerate = ((amountToRegenerate > maxToRegen) ? maxToRegen : amountToRegenerate);\n\n this.incrementProperty('mana_points', appliedAmountToRegenerate)\n }", "function toNewMaze(){\n if(maze && gift ==3){\n maze = maze2;\n goal = imgGoal;\n }\n// if you have 6 gifts in total, you win and can see your scores \n if(maze2 && gift==6){\n let result = gift+point;\n soundCheers();\n canvas.style.display = \"none\";\n totalScore.innerHTML = 'You have ' + result + ' points in total';\n }\n}", "function newMove() {\n game.currentGame.push(game.possibilities[Math.floor(Math.random()*4)]);\n showMoves();\n }", "function chooseMove() {\n if (state.turnCount === 20) {\n alert('You win!');\n return reset();\n }\n var choice = getRandomInt(0, buttons.options.length - 1);\n state.moves.push(buttons.options[choice]);\n playBack(state.moves);\n state.turnCount++;\n if (state.turnCount >= 10) state.playbackSpeed -= 40;\n turnCount();\n state.playerCount = 0;\n }", "function calculateGoldNewTurn() {\n gold += getGoldPerTurn();\n }", "awardPoints(numPoints) {\n this.points += numPoints;\n }", "function nextTurn(){\n\t// save destination index to source index\n\t$(\"#characters\").children().each(function(index) {\n\t\t$(this).attr(\"srcPos\", $(this).attr(\"destPos\"));\n\t});\n\t\n\t// if it came to specific level, make playground wider\n\tif(marioGame.enStatus == enStep.nInit)\n\t\tmarioGame.Position = [1, 2, 3, 4, 5, 6, 7, 8, 9];\n\telse\n\t{\n\t\tif(marioGame.nLevel == 0)\n\t\t\tmarioGame.Position = [3, 4, 5, 6, 7];\n\t\telse if(marioGame.nLevel == 1)\n\t\t\tmarioGame.Position = [2, 3, 4, 5, 6, 7];\n\t\telse if(marioGame.nLevel == 2)\n\t\t\tmarioGame.Position = [2, 3, 4, 5, 6, 7, 8];\n\t\telse if(marioGame.nLevel == 3)\n\t\t\tmarioGame.Position = [1, 2, 3, 4, 5, 6, 7, 8];\n\t\telse if(marioGame.nLevel == 4)\n\t\t\tmarioGame.Position = [1, 2, 3, 4, 5, 6, 7, 8, 9];\n\t\telse if(marioGame.nLevel == 5)\n\t\t\tmarioGame.Position = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\n\t}\n\t\t\n\t// disorder, player's position randomly\n\tmarioGame.Position.sort(shuffle);\n\t\n\t// save new destination position of each character\n\t$(\"#characters\").children().each(function(index) {\n\t\t$(this).attr(\"destPos\", marioGame.Position[index]);\n\t});\n\t\n\tmarioGame.nFrame = 0;\n\t\n\t// Check turns of this level are all done\n\tif( (marioGame.enStatus == enStep.nPlaying)&& (marioGame.nTurn > (5+marioGame.nLevel) ) )\n\t{\n\t\tmarioGame.enStatus = enStep.nSelect;\n\t\treturn;\n\t}\n}", "function nextRound() {\n let resetSuspects = suspects.filter((playerItem) => {\n return playerItem.sus === \"Suspect\";\n });\n\n let resetImpostors = impostors.filter((playerItem) => {\n return playerItem.sus === \"Impostor\";\n });\n\n let resetKilled = killed.filter((playerItem) => {\n return playerItem.sus === \"Killed\";\n });\n\n setSuspects((prevPlayers) => {\n return prevPlayers.filter((playerItem) => {\n return playerItem.sus !== \"Suspect\";\n });\n });\n\n setImpostors((prevPlayers) => {\n return prevPlayers.filter((playerItem) => {\n return playerItem.sus !== \"Impostor\";\n });\n });\n\n setKilled((prevPlayers) => {\n return prevPlayers.filter((playerItem) => {\n return playerItem.sus !== \"Killed\";\n });\n });\n\n setCrew((prevPlayers) => {\n return [\n ...prevPlayers,\n ...resetSuspects,\n ...resetImpostors,\n ...resetKilled,\n ];\n });\n }", "function ourTurn(){\n if (Pokemon.theirAttack.hp <= Pokemon.ourAttack.power) {\n Pokemon.results.theirFaint = true;\n console.log(`${Pokemon.theirAttack.name} fainted ${Pokemon.results.theirFaint}`);\n Pokemon.results.theirAttackPower = 0;\n return 0;\n } else {\n Pokemon.results.theirAttackPower = Pokemon.theirAttack.power;\n $('#instructions-text').text(`You did ${Pokemon.ourAttack.power} damage. Click fight or switch button.`);\n // Add: they have X hit points left here...\n return Pokemon.theirAttack.hp - Pokemon.ourAttack.power;\n }\n }", "reflow() {\n this.calcPoints();\n this._updateActive();\n }", "gameWon(){\n this.addToScore(this.SCORE);\n this.resetCards();\n this.next();\n }", "goal(paddle){\n paddle.score++;\n this.reset();\n }", "function win() {\n if(player.y <= 0){\n // Increase Score by 5\n score = score + 5;\n // Display score above canvas\n document.querySelector('.score').textContent = score;\n // Set player to intial location\n player.restart();\n // Increase Enemies speed after each win\n for (enemy of allEnemies){\n enemy.speed += 40;\n }\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}", "function set() {\n\t\tif ($(this).html() !== EMPTY) {\n\t\t\treturn;\n\t\t}\n\t\t$(this).html(turn);\n\t\tmoves += 1;\n\t\tscore[turn] += $(this)[0].identifier;\n\t\tif (win($(this))) {\n\t\t\talert('Wygrał: Gracz ' + turn);\n\t\t\tstartNewGame();\n\t\t} else if (moves === N_SIZE * N_SIZE) {\n\t\t\talert(\"Remis\");\n\t\t\tstartNewGame();\n\t\t} else {\n\t\t\tturn = turn === \"X\" ? \"O\" : \"X\";\n\t\t\t$('#turn').text('Gracz ' + turn);\n\t\t}\n\t}", "recalculate(player){}", "function adjustPlayer3GP() {\n for (let i = 0; i < Player[2].Hand.length; i++) {\n Player[2].Points += Player[2].Hand[i];\n }\n Player[0].Points += 10;\n Player[1].Points += 10;\n Player[3].Points += 10;\n console.log('adding one to count ' + roundCount)\n roundCount++;\n\n }", "function playerMoves() {\n const arrClicked = arr[this.dataset.array];\n // Block overwriting used square or adding moves after gameOver\n if ((arrClicked !== humanSide && arrClicked !== AIside) && (!gameOver)) {\n arr[this.dataset.array] = humanSide;\n moves += 1;\n winConditions();\n // Start next AI turn after checking if player or AI has won\n deepMind();\n } else {\n return; // Do nothing\n }\n }", "function setLeaderAdvantage() {\r\n // Reset all advantage\r\n attacker.leader_fire_advantage = 0;\r\n attacker.leader_shock_advantage = 0;\r\n defender.leader_fire_advantage = 0;\r\n defender.leader_shock_advantage = 0;\r\n // Sets fire advantage\r\n if (attacker.leader_fire_pip > defender.leader_fire_pip) {\r\n attacker.leader_fire_advantage = attacker.leader_fire_pip - defender.leader_fire_pip;\r\n } else {\r\n defender.leader_fire_advantage = defender.leader_fire_pip - attacker.leader_fire_pip;\r\n }\r\n\r\n // Sets shock advantage\r\n if (attacker.leader_shock_pip > defender.leader_shock_pip) {\r\n attacker.leader_shock_advantage = attacker.leader_shock_pip - defender.leader_shock_pip;\r\n } else {\r\n defender.leader_shock_advantage = defender.leader_shock_pip - attacker.leader_shock_pip;\r\n }\r\n}", "function automateAce() {\n if (dealerScore.includes(11) && totalDealerScore > 22) {\n totalDealerScore = (totalDealerScore - 10)\n }\n if (playerScore.includes(11) && totalPlayerScore > 22) {\n totalPlayerScore = (totalPlayerScore - 10)\n }\n }", "function correct() {\n score += 20;\n next();\n }", "function experiencePoints() {\r\n if (winBattle()) {\r\n return 10;\r\n } else {\r\n return 1;\r\n }\r\n}", "advanceTurnOrder() {\n super.updatePlayerScore(this.redTurnOrder[0], \"Red\");\n super.updatePlayerScore(this.blueTurnOrder[0], \"Blue\");\n const lastPlayer = this.redTurnOrder.shift();\n this.redTurnOrder.push(lastPlayer);\n const lastPlayer2 = this.blueTurnOrder.shift();\n this.blueTurnOrder.push(lastPlayer2);\n }", "randomizeNumber(playerName) {\n //Math.random begins at 0 so we need to increase number +1 to be able to miss the shots entirely \n this.currentPlayer = playerName;\n this.pinsKnockedDown = Math.floor(Math.random() * (this.pinsKnockedDown + 1));\n\n //Smalltests\n // this.pinsKnockedDown = 5;\n // if (firstTest === 2 && yes === false) {\n // this.pinsKnockedDown = 10;\n // firstTest = 3;\n // yes = true;\n // }\n // if (this.frame === 2 && yes === true) {\n // this.pinsKnockedDown = 6;\n // }\n // if (this.frame === 2 && yes === false) {\n // this.pinsKnockedDown = 1;\n // yes = true;\n // } \n // if (this.frame === 1 && firstTest === 2) {\n // this.pinsKnockedDown = 10;\n // }\n // if (this.frame === 2 && this.throwCounter == 1) {\n // this.pinsKnockedDown = 10;\n // }\n // if (this.frame === 1 && this.throwCounter === 1) {\n // this.pinsKnockedDown = 10;\n // }\n // if (this.frame === 10 && this.throwCounter === 1) {\n // this.pinsKnockedDown = 0;\n // }\n\n // if (this.frame === 10 && this.throwCounter == 2) {\n // this.pinsKnockedDown = 10;\n // }\n\n //If all pins are down check if its the first or second throw\n if (this.pinsKnockedDown === 10) {\n\n //If we are at the end of the series and still getting strike / spares \n if (this.frame >= 10) {\n this.assignScore(this.strikeValue);\n this.changeFrame(); \n endGameIfMaxFrameValueIsSet();\n return;\n }\n\n if (this.throwCounter === 1) {\n this.assignScore(this.strikeValue);\n this.throwCounter = 2;\n } else if (this.throwCounter === 2) {\n this.assignScore(this.strikeValue);\n }\n this.changeFrame();\n\n //Proceed by resetting the pins and change to the next player \n }\n //If an open this.frame has been made, proceed displaying the remaining pins\n else if (this.throwCounter === 1) {\n this.assignScore(this.pinsKnockedDown);\n this.throwCounter = 2;\n }\n //If the player is on his second throw proceed by resetting the pins and change to the next player\n else {\n this.assignScore(this.pinsKnockedDown);\n this.changeFrame();\n }\n //Set the remaning pins for new randomization\n this.pinsKnockedDown = 10 - this.pinsKnockedDown;\n endGameIfMaxFrameValueIsSet();\n }", "pointMade(winner){\n\n //identify what player to add point to\n let winnerIdx = this.players.findIndex(player => player.name === winner);\n let winnerPlyr = this.players[winnerIdx];\n \n\n //if not a game ending point, add point to winner\n if(winnerPlyr.points <= 3){\n //winning player adds a point\n winnerPlyr.addPoint();\n }\n\n //if player is over 3, game is won by player\n if(winnerPlyr.points > 3){\n\n //Show player is winner on screen\n this.winningPlayer = winner + \" is the winner!\";\n }\n }", "refreshCombatPoints(){\n this.updateProperty('hit_points', this.props.stats_current.health)\n this.updateProperty('mana_points', Math.round(this.props.stats_current.mana * .5))\n this.updateProperty('stamina_points', Math.round(this.props.stats_current.stamina * .5))\n }", "function manaPotion() {\n // If player has any health potions\n if (Player.manaPotions > 0){\n //This conditional branch is so that it doesn't gain over max mana\n var diff = Player.maxMana - Player.mana;\n \n if (diff >= 30){\n alert(\"You have used a mana potion to gain 30 mana points!\");\n Player.health = Player.mana + 30;\n Player.healthPotions--;\n document.getElementById(\"mana\").innerHTML = Player.mana + \" mana / \" + Player.maxMana + \" mana\";\n document.getElementById(\"manaP\").innerHTML = Player.manaPotions + \" Mana Potions\";\n \n // enemy turn \n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n eAttack(defendRating);\n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n\n }\n\n else {\n alert(\"You have used a mana potion to gain \" + diff + \" mana points!\");\n Player.health = Player.mana + diff;\n Player.manaPotions--;\n document.getElementById(\"mana\").innerHTML = Player.mana + \" mana / \" + Player.maxMana + \" mana\";\n document.getElementById(\"manaP\").innerHTML = Player.manaPotions + \" Mana Potions\";\n \n // enemy turn \n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n eAttack(defendRating);\n turns++;\n document.getElementById(\"turn\").innerHTML= \"Turn \" + turns;\n }\n }\n\n else {\n alert(\"You do not have enough health potions!\");\n }\n}", "function takeANoviceMove(turn) {\n var available = game.currentState.emptyCells();\n //enumerate and calculate the score for each available actions to the ai player\n var availableActions = available.map(function(pos) {\n var action = new AIAction(pos);//create the action object\n //get next state by applying the action\n var next = action.applyTo(game.currentState);\n //calculate and set the action's minimax value;\n action.minimaxVal = minimaxVal(next);\n return action;\n });\n //sort the enumerated actions list by score\n //X maximizes ---> descend sort the actions to have the largest minimax at first\n if (turn === 'X') availableActions.sort(AIAction.DESCENDING);\n //else sort ascending\n else availableActions.sort(AIAction.ASCENDING);\n //take the optimal action 40% of the time\n var chosenAction;\n if (Math.random() * 100 <= 40) chosenAction = availableActions[0];\n //if there are two or more available actions, choose the 1st suboptimal\n else if(availableActions.length >= 2) chosenAction = availableActions[1];\n //choose the only available action\n else chosenAction = availableActions[0];\n var next = chosenAction.applyTo(game.currentState);\n ui.insertAt(chosenAction.movePosition, turn);\n //take the game to the next state\n game.advanceTo(next);\n}", "function newGoal (){\n //obtain random values within the bounds\n var randomFreq = Math.random() * (rateMax - rateMin) + rateMin;\n var randomAmount = Math.random() * (amountMax - amountMin) + amountMin;\n //update the position of the hole.\n setHolePos(randomFreq,randomAmount);\n}", "function resetWinCounts() {\n LEAGUE = [\n {\n playerName: 'Dustin',\n wins: 11,\n points: 1386\n },\n {\n playerName: 'Glenn',\n wins: 8,\n points: 1365\n },\n {\n playerName: 'Blake',\n wins: 7,\n points: 1374\n },\n {\n playerName: 'Travis',\n wins: 5,\n points: 1203\n }, \n {\n playerName: 'Jason',\n wins: 5,\n points: 1202\n}, \n{\n playerName: 'George',\n wins: 4,\n points: 1326\n}, \n{\n playerName: 'Justin',\n wins: 5,\n points: 1270\n}, \n{\n playerName: 'Sean',\n wins: 4,\n points: 1245\n}, \n{\n playerName: 'Matt',\n wins: 4,\n points: 1263\n}, \n{\n playerName: 'Dan',\n wins: 2,\n points: 1180\n}\n];\n}", "forceTurnEvaluation() {\n this.turnIndicator -= 1;\n this.turnIndicator += 1;\n }", "function stage2(){\n player.attack.plusser += 62;\n}", "incrementAfterRound() {\n this.leader_idx++;\n if (this.leader_idx === this.num_players) {\n this.leader_idx = 0;\n }\n this.round++;\n this.players_selected = [];\n this.players_voted_round = [];\n this.player_to_excalibur = null;\n this.player_given_excalibur = null;\n }", "function updateTurn(){\n // check winner\n model.getWinner();\n\n // update player turn with visual effct\n showTurn();\n model.round++;\n // call this function to see if there are no cards left in the game.\n createGameOverPage();\n createWinnerPage();\n // rest time stamp\n model.initialTime = (new Date()).getTime();\n }", "function experiencePoints() {\n if (winBattle()) {\n return 10;\n } else {\n return 1;\n }\n}", "function experiencePoints() {\n if (winBattle()) {\n return 10;\n } else {\n return 1;\n }\n}", "updateHealth(points){\n this.health += points;\n if (this.health < 0) {\n this.health = 0;\n }\n //cap castle health at 250\n else if(this.health > 250){\n this.health = 250;\n }\n this.updateHealthBar();\n }", "function determineMove() {\n \n return chooseRandomItem(cardinalPoints);\n}", "function beginTurn(state, player) {\n state = {\n ...state,\n turn: player,\n maxMana: state.maxMana.update(player, m => m + 1),\n };\n return {\n ...state,\n mana: state.maxMana\n };\n}", "function updateScoreBoard() {\n totalMoves++;\n $('#moves-counter').text(totalMoves);\n if (totalMoves > 15 && totalMoves <= 20) {\n setStars(2);\n } else if (totalMoves > 20) {\n setStars(1);\n }\n}", "function changeSpawnRate() {\n\tif (game.score < 50) {\n\t\tgame.spawnRate = 1.3;\n\t}\n\telse if (game.score < 100) {\n\t\tgame.spawnRate = 1.15;\n\t}\n\telse if (game.score < 150) {\n\t\tgame.spawnRate = 1;\n\t}\n\telse if (game.score < 200) {\n\t\tgame.spawnRate = 0.9;\n\t}\n\telse if (game.score < 250) {\n\t\tgame.spawnRate = 0.8;\n\t}\n\telse if (game.score < 300) {\n\t\tgame.spawnRate = 0.7;\n\t}\n\telse if (game.score < 350) {\n\t\tgame.spawnRate = 0.6;\n\t}\n\telse {\n\t\tgame.spawnRate = 0.5;\n\t}\n}", "resetGame(){\n this.player1.points = 0;\n this.player2.points = 0;\n this.winningPlayer = \"\";\n }", "function set() {\n if (this.innerHTML !== EMPTY) {\n return;\n }\n\n this.innerHTML = turn;\n moves += 1;\n score[turn] += this.identifier;\n console.log(`score[${turn}]: ${score[turn]}`);\n if (win(this)) {\n alert('Winner: Player ' + turn);\n startNewGame();\n } else if (moves === N_SIZE * N_SIZE) {\n alert(\"Draw\");\n startNewGame();\n } else {\n turn = turn === \"X\" ? \"O\" : \"X\";\n document.getElementById('turn').textContent = 'Player ' + turn;\n }\n\n mSet()\n}", "function p2WinPot(){\n let newPlayer2Money = player2Money + potMoney\n setPlayer2Money(newPlayer2Money)\n setPotMoney(0)\n }", "increasePointsOfPlayer2() {\n this.P2point++;\n }", "nextMonster() {\n const spriteMonster = document.querySelector(\".sprite-monster\");\n spriteMonster.children[0].classList.remove(\n dictMonster.headsIdle[this.monster.head]\n );\n spriteMonster.children[1].classList.remove(\n dictMonster.bodiesIdle[this.monster.body]\n );\n spriteMonster.children[2].classList.remove(\n dictMonster.legsIdle[this.monster.legs]\n );\n\n this.player.score += 1;\n this.monster = new Monster(this.player.score);\n this.monster.drawMonster(this.player);\n\n /*adding some health to the player before the new round*/\n this.player.health = Math.min(\n this.player.health + mylib.getRandomFromTo(10, 15 + this.player.score),\n this.player.startHealth\n );\n this.player.drawHealth();\n document\n .getElementById(\"btn-choose-spell\")\n .addEventListener(\"click\", this.btnChooseSpell);\n }", "function takeAHardMove(turn) {\n var available = game.currentState.emptyCells();\n\n //enumerate and calculate the score for each avaialable actions to the ai player\n var availableActions = available.map(function(pos) {\n var action = new AIAction(pos); //create the action object\n var next = action.applyTo(game.currentState); //get next state by applying the action\n\n action.minimaxVal = minimaxValue(next); //calculate and set the action's minmax value\n\n return action;\n });\n\n //sort the enumerated actions list by score\n if(turn === \"X\")\n //X maximizes --> sort the actions in a descending manner to have the action with maximum minimax at first\n availableActions.sort(AIAction.DESCENDING);\n else\n //O minimizes --> sort the actions in an ascending manner to have the action with minimum minimax at first\n availableActions.sort(AIAction.ASCENDING);\n\n\n //take the first action as it's the optimal\n var chosenAction = availableActions[0];\n var next = chosenAction.applyTo(game.currentState);\n\n ui.insertAt(chosenAction.movePosition, turn);\n\n game.advanceTo(next);\n }", "function addPoint() {\n score ++;\n if(score === 6) {\n restartGame();\n }\n}", "function setPointsUsed(){\n\n\t// Set text with current and max points\n\t$(\"#skill_points > #skillPointNumber\").text( getSkillpoints() );\n\n}", "function reset() {\n currentMonsterHealth = chosenMaxLife;\n currentPlayerHealth = chosenMaxLife;\n resetGame(chosenMaxLife);\n}", "function reset() {\n\n setTimeout(() => {\n player.hp = 20;\n player2.hp = 20;\n let pointEle = document.getElementById('points')\n player.points2 += 1;\n pointEle.innerHTML = `Score: ${player.points2}`\n // player.position.set(0, 20, 0);\n // player2.position.set(0, 20, 0);\n // location.reload()\n // animate().reset();\n }, 0);\n // animate();\n // requestAnimationFrame(animate);\n}", "function setGoal() {\n goal = Math.floor(Math.random() * 102) + 19;\n}", "function holdingPoint(){\n if (currentPlayer === true){\n globalScore1 += currentScore\n globalPointsP1.textContent = globalScore1\n } else {\n globalScore2 += currentScore\n globalPointsP2.textContent = globalScore2\n }\n \n nextPlayer()\n checkScore()\n \n }", "function cardReDrawMobActionPointsAttribute(cardID){\n var card = mobCardOjbects[cardID];\n var actionPoints = card.getChildAt(2);\n actionPoints.setText(mobCards[cardID].remMoves);\n }", "function bankPoints() {\n // Banking is allowed only if the player has TotalScore of 300 or more in the current turn\n if (lockedScore + currentScore >= 300) {\n setTotalPoints(lockedScore + currentScore);\n setCurrentScore(0);\n setLockedScore(0);\n setGameState(\"INIT\");\n dispatch({ type: RESET, payload: initialState })\n }\n }", "function takeAMasterMove(turn) {\n var available = game.currentState.emptyCells();\n //enumerate and calculate the score for each available actions to the ai player\n var availableActions = available.map(function(pos) {\n var action = new AIAction(pos);//create the action object\n //get next state by applying the action\n var next = action.applyTo(game.currentState);\n //calculate and set the action's minimax value;\n action.minimaxVal = minimaxVal(next);\n return action;\n });\n //sort the enumerated actions list by score\n //X maximizes ---> descend sort the actions to have the largest minimax at first\n if (turn === 'X') availableActions.sort(AIAction.DESCENDING);\n //else sort ascending\n else availableActions.sort(AIAction.ASCENDING);\n //take the first step as it's the optimal\n var chosenAction = availableActions[0];\n var next = chosenAction.applyTo(game.currentState);\n //this just adds an X or an O at the chosen position on the board in the UI\n ui.insertAt(chosenAction.movePosition, turn);\n //take the game to the next state\n game.advanceTo(next);\n}", "aiMakesMove(x, y) {\n boardArr = []\n var boardArr = game.boardToArray(x, y);\n x = boardArr[1]\n y = boardArr[2]\n var move = game.minimax(boardArr[0], game.ai);\n\n var newBoardArr = game.spliceBoard(boardArr[0]);\n\n // Set game difficutly probability\n if (game.difficulty == 'easy') {\n var actualMove = (Math.random() < 0.5) ? move : newBoardArr[Math.floor(Math.random()*newBoardArr.length)]\n console.log(\"EASY MODE\")\n }\n else if (game.difficulty == 'medium') {\n var actualMove = (Math.random() < 0.7) ? move : newBoardArr[Math.floor(Math.random()*newBoardArr.length)]\n console.log(\"MEDIUM MODE\")\n }\n else if (game.difficulty == 'hard') {\n var actualMove = (Math.random() < 0.98) ? move : newBoardArr[Math.floor(Math.random()*newBoardArr.length)]\n\n console.log(\"HARD MODE\")\n }\n console.log(\"MOVE: \", move)\n console.log(\"ACTUAL MOVE: \", actualMove)\n\n if (actualMove == move)\n {\n console.log(\"a\")\n var convertedMove = game.convertMove(actualMove);\n }\n else\n {\n console.log(\"b\")\n\n var convertedMove = game.convertRandMove(actualMove);\n }\n\n console.log(\"AI's move: \", move);\n console.log(\"convertedMove: \", convertedMove);\n\n game.placePieceAt(y, x, convertedMove.row, convertedMove.column, boardArr[0]);\n\n if(game.isOver(x, y, convertedMove.column, convertedMove.row)) {\n game.displayWinner();\n }\n\n\n aiCoords = [x, y, convertedMove.column, convertedMove.row]\n\n return (aiCoords)\n }", "update() {\n for(let enemy of allEnemies) {\n if ((this.y === enemy.y) && (enemy.x + 60 > this.x) && (this.x + 60 > enemy.x)) {\n this.reset();\n } else if (this.y === -20) {\n this.win();\n }\n }\n }", "async afterTurn() {\n await super.afterTurn();\n // <<-- Creer-Merge: after-turn -->>\n this.updateSpawnedCowboys();\n this.game.currentPlayer.siesta = Math.max(0, this.game.currentPlayer.siesta - 1);\n this.updateCowboys();\n this.advanceBottles();\n this.resetPianoPlaying();\n this.applyHazardDamage();\n utils_1.filterInPlace(this.game.cowboys, (c) => !c.isDead);\n utils_1.filterInPlace(this.game.furnishings, (f) => !f.isDestroyed);\n utils_1.filterInPlace(this.game.bottles, (b) => !b.isDestroyed);\n this.game.currentPlayer.youngGun.update();\n // <<-- /Creer-Merge: after-turn -->>\n }", "function fight() {\n // Update interface with fighters' name and hp's\n refreshDomElement($outputDiv, playersArray[0].name + ' and ' + playersArray[1].name + ' are going to fight !');\n\n // Choose first attacker and add new property on chosen player\n var first = randomIntFromInterval(1, 2);\n player1 = playersArray[0];\n player2 = playersArray[1];\n\n if (first === 1) {\n player1.start = 1;\n } else {\n player2.start = 1;\n }\n\n // Round function\n round();\n}", "function punch() {\n health -= 2 + target.modifier\n health.hit++\n drawhealth()\n console.log(\"punchworks\")\n}", "reset(){\n\t\tthis.selectedPieces = [];\n\t\tthis.inUseWhitePieces = [];\n\t\tthis.inUseBlackPieces = [];\n\t\tthis.validMoves = []\n\t\t\n\t\t\tfor(let i = 0; i <= 7; i++){\n\t\t\t\tthis.inUseWhitePieces.push(new Piece(\"Pawn\",(i),[2,i+1],\"White\",\"./images/white_pawn.png\"));\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Knight\",8,[1,7],\"White\",\"./images/white_knight.png\"));\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Knight\",9,[1,2],\"White\",\"./images/white_knight.png\"));\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Bishop\",10,[1,6],\"White\",\"./images/white_bishop.png\"));\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Bishop\",11,[1,3],\"White\",\"./images/white_bishop.png\"));\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Rook\",12,[1,8],\"White\",\"./images/white_rook.png\"));\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Rook\",13,[1,1],\"White\",\"./images/white_rook.png\"));\n\t\t\t\n\t\t\t\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"King\",14,[1,5],\"White\",\"./images/white_king.png\"));\n\t\t\tthis.inUseWhitePieces.push(new Piece (\"Queen\",15,[1,4],\"White\",\"./images/white_queen.png\"));\n\t\t\t//Create other type of pieces\n\t\t\tfor(let i = 0; i <= 7; i++){\n\t\t\t\tthis.inUseBlackPieces.push(new Piece(\"Pawn\",(i),[7,i+1],\"Black\",\"./images/black_pawn.png\"));\n\t\t\t}\n\t\t\t\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Knight\",8,[8,7],\"Black\",\"./images/black_knight.png\"));\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Knight\",9,[8,2],\"Black\",\"./images/black_knight.png\"));\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Bishop\",10,[8,6],\"Black\",\"./images/black_bishop.png\"));\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Bishop\",11,[8,3],\"Black\",\"./images/black_bishop.png\"));\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Rook\",12,[8,8],\"Black\",\"./images/black_rook.png\"));\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Rook\",13,[8,1],\"Black\",\"./images/black_rook.png\"));\n\t\t\t\n\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"King\",14,[8,5],\"Black\",\"./images/black_king.png\"));\n\t\t\tthis.inUseBlackPieces.push(new Piece (\"Queen\",15,[8,4],\"Black\",\"./images/black_queen.png\"));\n\t}", "function addMoves() {\n 'use strict'; // turn on Strict Mode\n moves++;\n movesCounter.innerHTML = moves;\n rating();\n //Starting timer when user makes its first click on the cards\n if (moves == 1) {\n second = 0;\n minute = 0;\n hour = 0;\n startTimer();\n }\n}", "function addScorePoint() {\n oxo.player.addToScore(5);\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 }", "function generate(){\n\n // increase difficulty after it scored over 10 points\n if(variables.score > 10) {\n variables.max = Math.ceil(variables.score / 5) * 5\n }\n if(variables.score > 20){\n variables.min = Math.ceil(variables.score / 10) * 5\n }\n\n variables.leftNumber = getRandomNumber(variables.min, variables.max)\n variables.rightNumber = getRandomNumber(variables.min, variables.max)\n variables.result = getRandomBoolean()\n variables.score++\n refreshNumbers()\n}", "function finishTurn(room) {\n console.log(\"Finishing turn in room \" + room)\n let curRoom = rooms[room];\n\n /***\n\n RESET STUFF (like messages)\n\n **/\n let averagePlayerLevel = 0;\n for(let i = 0; i < curRoom.playerShips.length; i++) {\n let curShip = curRoom.playerShips[i];\n\n // clear error messages\n curShip.errorMessages = [];\n\n // add delayed error messages (mostly treasure clues/info); then clear the array\n for(let c = 0; c < curShip.delayedClues.length; c++) {\n curShip.errorMessages.push(curShip.delayedClues[c]);\n }\n curShip.delayedClues = [];\n\n // count the average for this ship\n // NOTE: \"role = 1\", because we IGNORE the captain (which is \"role 0\")\n let tempAverage = 0;\n for(let role = 1; role < curShip.roleStats.length; role++) {\n tempAverage += curShip.roleStats[role].lvl;\n }\n tempAverage *= (1/curShip.roleStats.length);\n\n // add it to the total average; weighted\n averagePlayerLevel += (1/curRoom.playerShips.length) * tempAverage;\n }\n\n curRoom.averagePlayerLevel = averagePlayerLevel;\n\n /***\n\n REVEAL SOME FOG\n\n **/\n // pick a few tiles from the marked tiles\n // TO DO: Right now, the maximum is set to 10 - is this good??\n let numMarkedTiles = curRoom.markedFogTiles.length;\n const maxReveals = 10;\n let numReveals = Math.min(numMarkedTiles, maxReveals);\n let fogRevealTiles = [];\n\n //console.log(JSON.stringify(curRoom.markedFogTiles), numReveals);\n\n for(let i = 0; i < numReveals; i++) {\n let randIndex = Math.floor(Math.random() * curRoom.markedFogTiles.length);\n let getTile = curRoom.markedFogTiles.splice(randIndex, 1)[0]; // splice already removes it from the array\n\n // set this tile to be fogless on the map\n curRoom.map[ getTile.y ][ getTile.x ].fog = false;\n\n // check for other tiles around it, which are still in fog\n const positions = [[1,0],[-1,0],[0,1],[0,-1]]\n for(let a = 0; a < 4; a++) {\n let x = wrapCoords(getTile.x + positions[a][0], curRoom.mapWidth);\n let y = wrapCoords(getTile.y + positions[a][1], curRoom.mapHeight);\n\n // if so, add it to the possible reveals\n // (this is mutating an array we're accessing, but I don't care, it's not bad if we randomly pick this newly added tile)\n if( curRoom.map[y][x].fog ) {\n curRoom.markedFogTiles.push({x: x, y: y});\n }\n }\n\n // add the tile to the array (which we'll send to the monitors)\n fogRevealTiles.push(getTile) \n }\n\n // save it on the room\n curRoom.discoveredTiles = fogRevealTiles;\n\n\n /*** \n\n FIGHT BATTLES\n\n ***/\n // Ships shoot cannonballs. They always fire everything at once.\n // We follow the cannonball along its path. \n // => If it hits something, it damages that thing, and then disappears. (If that is an AI ship, it might just fight back)\n // => Otherwise, if it hits the end of its range, it just disappears\n //\n // NOTE: Islands do not count. Docks do count.\n // NOTE: Yes, this is a separate loop from the next one. All units battle FIRST, then MOVE.\n for(let i = 0; i < curRoom.playerShips.length; i++) {\n let curShip = curRoom.playerShips[i];\n\n // if this ship doesn't fire, well, there's no battle here\n if(!curShip.willFire) {\n continue;\n }\n\n // stop firing (in the future)!\n curShip.willFire = false;\n\n curShip.attackInfo = { hits: 0, shots: 0 }\n\n let ammo = curShip.cannons;\n\n // Set range based on level\n let weaponLvl = curShip.roleStats[4].lvl;\n let tempUpgradeEffects = UPGRADE_EFFECT_DICT[4][weaponLvl];\n let range = tempUpgradeEffects.range;\n let spread = tempUpgradeEffects.spread;\n\n // if we're playing the beginner variant, set fixed cannon stats\n // TO DO: Do an actual check (if cannoneer is in the game)\n let cannoneerInGame = false;\n if(!cannoneerInGame) {\n ammo = [2,2,2,2];\n }\n\n // establish the ship angle\n // shooting directions are based on that\n let baseAngle = curShip.orientation * 45;\n\n // go through all the cannons\n for(let c = 0; c < 4; c++) {\n // if no load, or cannon isn't even purchased, continue immediately\n const curAmmo = ammo[c];\n if(curAmmo <= 0) {\n continue;\n }\n\n curShip.attackInfo.shots += curAmmo;\n\n // increase angle (each cannon represents a different side, 90 degrees rotated towards the previous)\n const angle = (baseAngle + c*90) * Math.PI / 180;\n let directionVector = [Math.round( Math.cos(angle) ), Math.round( Math.sin(angle) )];\n let perpendicularVector = [directionVector[1], -directionVector[0]]\n\n // otherwise, go through all the bullets\n // QUESTION: Does a bullet hit EVERYTHING on a certain tile? Or just one random unit (if there are multiple)?\n for(let b = 0; b < curAmmo; b++) {\n // determine starting position: a cannon with spread has multiple possibilites\n let tempSpread = Math.round( Math.random()*spread*2 - spread);\n let tempX = curShip.x + tempSpread * perpendicularVector[0];\n let tempY = curShip.y + tempSpread * perpendicularVector[1];\n \n // bS stands for \"bullet steps\", not what you think it might mean\n for(let bS = 0; bS < range; bS++) {\n tempX = wrapCoords(tempX + directionVector[0], curRoom.mapWidth);\n tempY = wrapCoords(tempY + directionVector[1], curRoom.mapHeight);\n\n let tile = curRoom.map[tempY][tempX];\n\n // if it's a dock or city, stop the bullet immediately \n if(hasDock(tile) || hasCity(tile)) {\n break;\n\n // if this tile has no units, nothing to do here, continue to next bullet position!\n } else if(!tile.hasUnits) {\n continue;\n\n // if we're still here, this means there is something to hit\n // hit it, then break out of the loop (the bullet is finished)\n } else {\n for(let i = 0; i < tile.monsters.length; i++) {\n dealDamage(curRoom, curRoom.monsters[ tile.monsters[i] ], curShip, 10);\n }\n\n for(let i = 0; i < tile.aiShips.length; i++) {\n dealDamage(curRoom, curRoom.aiShips[ tile.aiShips[i] ], curShip, 10);\n\n // TO DO: With a certain chance, the ai ship FIGHTS BACK\n }\n\n for(let i = 0; i < tile.playerShips.length; i++) {\n dealDamage(curRoom, curRoom.playerShips[ tile.playerShips[i] ], curShip, 10);\n }\n\n break;\n } \n }\n }\n\n // set ammo to zero\n curShip.cannons[c] = 0;\n }\n\n // relay info about attacking\n if(curShip.attackInfo.hits > 0) {\n // if we hit at least something, send a congratulatory message, including how many shots we took and how many were succesful\n curShip.errorMessages.push([6, [curShip.attackInfo.shots, curShip.attackInfo.hits] ]); \n } else {\n // otherwise, send an insulting message about how the player couldn't hit anything!\n curShip.errorMessages.push([16, 0]);\n }\n\n }\n\n /*** \n\n LET MONSTERS FIGHT\n\n ***/\n // Attack the target, if we're close enough\n // TO DO (QUESTION): Do I still need to check everything in their vicinity? Meh, makes monsters more dangerous, but also unrealistic (you can't fight ten ships simultaneously)\n for(let i = 0; i < curRoom.monsters.length; i++) {\n const target = curRoom.monsters[i].target;\n if(target != null) {\n // Check if the distance is within our attacking range\n let attackRange = curRoom.monsters[i].range;\n if(wrapDistance(target, curRoom.monsters[i], curRoom.mapWidth, curRoom.mapHeight) <= attackRange) {\n dealDamage(curRoom, target, curRoom.monsters[i], curRoom.monsters[i].attackStrength);\n }\n }\n }\n\n /*** \n\n MOVE PLAYER SHIPS\n\n ***/\n let averageResources = [0,0,0,0]; // to keep track of average player resources, to know what docks should deal\n for(let i = 0; i < curRoom.playerShips.length; i++) {\n // get ship\n let curShip = curRoom.playerShips[i];\n\n // (update average resources; weighted by player count)\n for(let res = 0; res < 4; res++) {\n averageResources[res] += (1 / curRoom.playerShips.length) * curShip.resources[res];\n }\n\n // get vector from orientation\n let angle = curShip.orientation * 45 * Math.PI / 180;\n\n // round everything non-zero upwards to a 1 \n // this ONLY works because we're working with 8 angles; diagonal angles still get rounded (to 1 or -1, depending on the angle)\n // if we had more/different angles, we'd need something else\n let movementVector = [Math.round( Math.cos(angle) ), Math.round( Math.sin(angle) )];\n\n // speed is saved inside the object (and automatically updated when sails/peddle level changes)\n let speed = curShip.speed;\n let oldObj = { x: curShip.x, y: curShip.y, index: i }\n let x = curShip.x, y = curShip.y;\n\n // move through it stepwise\n for(let a = 0; a < speed; a++) {\n let tempX = wrapCoords(x + movementVector[0], curRoom.mapWidth);\n let tempY = wrapCoords(y + movementVector[1], curRoom.mapHeight);\n\n let tile = curRoom.map[tempY][tempX];\n\n // check if the next tile (we want to go to) is reachable\n // NOT REACHABLE if: an island or a dock or a city\n if(isIsland(tile) || hasDock(tile) || hasCity(tile)) {\n // ship gets damage\n dealDamage(curRoom, curShip, curShip, 10, true)\n\n // tile also gets damage! (This way, docks/cities can be \"taken over\" by bumping into them)\n dealDamage(curRoom, tile, curShip, 10);\n\n // Inform captain of damage\n curShip.errorMessages.push([5,0]);\n\n // set speed to 0\n // don't forget to turn off the sails and peddles as well => extra penalty AND keeps code clean and synchronized\n curShip.speed = 0;\n curShip.roleStats[3].sailLvl = 0;\n curShip.roleStats[3].peddleLevel = 0;\n break;\n\n // if it's reachable, then we just update the position and move to the next step\n } else {\n x = tempX;\n y = tempY;\n }\n }\n\n // move the unit to the final location\n placeUnit(curRoom, oldObj, x, y, 'playerShips');\n }\n\n /*** \n\n MOVE AI SHIPS\n\n ***/\n // Just follow their predetermined route\n for(let i = 0; i < curRoom.aiShips.length; i++) {\n // get the SHIP\n let s = curRoom.aiShips[i];\n\n // Get ship properties (like speed) from the ai ship object\n let shipSpeed = s.speed;\n\n // get the route object (contains the actual route (\"route\") and the dock where the route ends (\"target\"))\n let routeObject = curRoom.docks[ s.routeIndex[0] ].routes[ s.routeIndex[1] ];\n\n //increase pointer by ship speed\n s.routePointer = Math.min(routeObject.route.length - 1, s.routePointer + 3);\n\n // move to next spot\n let nextSpot = routeObject.route[s.routePointer]\n\n // IMPORTANT: Use the placeUnit function! Otherwise it doesn't update the map (correctly)\n placeUnit(curRoom, { x: s.x, y: s.y, index: i}, nextSpot[0], nextSpot[1], 'aiShips');\n\n // if we're at the end, pick a new route\n if(s.routePointer == (routeObject.route.length - 1)) {\n let newDock = curRoom.docks[ routeObject.target ];\n let routeIndex = Math.floor( Math.random() * newDock.routes.length );\n\n // Save the dock we're coming form (which was previously our target) and which of its routes we're taking\n s.routeIndex = [routeObject.target, routeIndex]\n s.routePointer = -1;\n }\n }\n\n /*** \n\n MOVE MONSTERS\n\n // NOTE: They move AFTER the player ships, as monsters can then succesfully CHASE them.\n ***/\n\n // For each monster ...\n for(let i = 0; i < curRoom.monsters.length; i++) {\n let curMon = curRoom.monsters[i];\n // Loop through their sight radius to pick a target\n // We use a SPIRAL, starting from the right hand of the monster. (TO DO: Maybe give monsters orientation as well, start the spiral from there)\n // Just pick the first one we can find (which should automatically be within the sight distance)\n\n let sightRadius = curMon.sight;\n let chaseSpeed = curMon.speed;\n\n let targetPos;\n\n // if we've chased for long enough, let go\n // TO DO: Do we always let go? Or only after we've destroyed the ship/stolen what we needed?\n if(curMon.chasingCounter >= 4) {\n curMon.chasingCounter = 0;\n curMon.chasing = false;\n curMon.target = null;\n }\n\n /***\n\n PICK A TARGET\n\n ***/\n let bestDeepSeaTile = null;\n let bestRemainingTile = null;\n\n if(curMon.target == null) {\n // (di, dj) is a vector - direction in which we move right now\n let curDir = [1,0]\n // length of current segment\n let segLength = 1;\n\n // with sight radius of \"X\", the number of sight points would be X*X-1 \n let numberOfSightPoints = sightRadius*sightRadius - 1;\n\n // current position (x,y) and how much of current segment we passed\n let tempX = curMon.x;\n let tempY = curMon.y;\n let segPassed = 0;\n for (let n = 0; n < numberOfSightPoints; n++) {\n // make a step, add 'direction' vector to current position\n tempX = wrapCoords(tempX + curDir[0], curRoom.mapWidth);\n tempY = wrapCoords(tempY + curDir[1], curRoom.mapHeight);\n\n // here we actually check if there's something of value\n let curTile = curRoom.map[tempY][tempX];\n\n // if we're one tile away (from the MONSTER), already find possible tiles\n if(n < 8) {\n if(curTile.val <= -0.3) {\n if(bestDeepSeaTile == null || Math.random() >= 0.5) {\n bestDeepSeaTile = [tempX, tempY]\n }\n } else if(curTile.val < 0.2) {\n if(bestRemainingTile == null || Math.random() >= 0.5) {\n bestRemainingTile = [tempX, tempY]\n }\n }\n }\n\n // if this tile has units, pick the first one we like!\n // It always picks player ships first. Then docks (with a chance of failure). Then ai ships (with a chance of failure)\n if(curTile.hasUnits) {\n if(curTile.playerShips.length > 0) {\n curMon.target = curRoom.playerShips[ curTile.playerShips[ Math.floor(Math.random() * curTile.playerShips.length) ] ];\n } else if(curTile.dock != null && Math.random() >= 0.5) {\n curMon.target = curRoom.docks[ curTile.dock ];\n } else if(curTile.aiShips.length > 0 && Math.random() >= 0.5) {\n curMon.target = curRoom.aiShips[ curTile.aiShips[ Math.floor(Math.random() * curTile.aiShips.length) ] ];\n }\n }\n\n // this code is for switching to the next tile again.\n // this is responsible for rotating to a new segment (and increasing length) once this one's finished\n segPassed++;\n if (segPassed == segLength) {\n // done with current segment\n segPassed = 0;\n\n // 'rotate' directions\n curDir = [-curDir[1], curDir[0]]\n\n // increase segment length if necessary\n if (curDir[1] == 0) {\n segLength++;\n }\n }\n }\n }\n\n /***\n\n MOVE TOWARDS TARGET\n\n ***/\n // if we have a target, keep pursuing it\n if(curMon.target != null) {\n curMon.chasingCounter++;\n targetPos = [curMon.target.x, curMon.target.y];\n\n // if we're already at our target, no need to calculate the route again!\n if((targetPos[0] == curMon.x && targetPos[1] == curMon.y)) {\n // nothing\n } else {\n // calculate a route to this position\n let tempRoute = calculateRoute(curRoom, [curMon.x, curMon.y], targetPos)\n\n // if destination was unreachable, too bad, try again next turn\n if(tempRoute.length < 1) {\n continue;\n }\n\n // shave first bit from the route (that's the monster's current position)\n // it's possible that the route is just the starting tile, nothing else, that's why the IF statement is\n tempRoute.splice(0, 1); \n\n // follow the route for as long as our moveSpeed allows\n let routeIndex = Math.min(tempRoute.length - 1, chaseSpeed);\n targetPos = tempRoute[routeIndex]\n }\n\n // if there's no target, pick the best tile around us \n } else {\n targetPos = bestDeepSeaTile;\n\n // if there IS no deep sea tile, choose the best remaining tile\n // alternatively, there's a slight (10%) chance of going out of the deep sea.\n if(targetPos == null || Math.random() >= 0.9) { targetPos = bestRemainingTile; }\n }\n\n\n // check one last time that we have a position to go to\n if(targetPos != null && targetPos.length > 0) { \n // Use the placeUnit function to move the unit across the map, as close as possible towards the target position\n placeUnit(curRoom, {x: curMon.x, y: curMon.y, index: i}, targetPos[0], targetPos[1], 'monsters');\n }\n }\n\n /*** \n\n CHANGE DOCK DEALS\n\n ***/\n // on average, change deals every ~5 turns\n // deals are always updated after the first turn\n let changeDeals = (Math.random() <= 0.2) || (curRoom.turnCount == 1); \n\n // With X% probability, change the deals on the docks\n // Use the \"averageResources\" variable to get a random deal, then improve it (by lowering one and raising the other - no negative numbers)\n // Scale the result based on dock size\n if(changeDeals) {\n for(let d = 0; d < curRoom.docks.length; d++) {\n let good1 = Math.floor(Math.random() * 4)\n let good2 = Math.floor(Math.random() * 4)\n\n // TO DO (QUESTION): Is this a good concept?\n if(good1 == 1) { good1 = 0; } // you cannot trade away your crew, instead it ensures more deals start with you spending gold\n if(good1 == 3) { good1 = 0; } // you cannot trade away your treasures\n if(good2 == 3) { good2 = 0; } // you cannot gain treasures by trading at the docks\n\n let val1 = Math.max( averageResources[good1] - Math.random()*3, 0);\n let val2 = (averageResources[good2] + Math.random()*3)\n const maxVal = Math.max(val1, val2) + 0.01;\n\n // this formula is similar to how we determine how many routes each dock gets\n // the larger the dock, the more I want to \"compress\" its size with a square root (or similar function)\n const dockSize = Math.sqrt(curRoom.docks[d].size)*0.5;\n val1 = Math.round( val1 / maxVal * dockSize );\n val2 = Math.round( val2 / maxVal * dockSize );\n\n // If they are the same good, val2 surely must be larger than val1\n // (Otherwise we get bad deals, like \"1 Wood for 0 Wood in return!\")\n if(good1 == good2 && val2 <= val1) {\n val2 = Math.round(val1 + 1 + Math.random()*3);\n }\n\n // If the second good is 0, also update it to be at least 1\n if(val2 == 0) {\n val2 = Math.round(1 + Math.random()*3);\n }\n\n // this is the final deal, with the right goods and correctly scaled values\n const finalDeal = [[good1, val1], [good2, val2]];\n\n // save the deal on the dock\n curRoom.docks[d].deal = finalDeal\n\n // TO DO: Update monitors (not necessary right now)\n }\n }\n\n // Start next turn\n startTurn(room)\n}", "function addMovement() {\n moves.innerHTML = ++ moveCounter;\n\n if (moveCounter > 16 && moveCounter <= 32) {\n goodRank.className = 'fa fa-star-o';\n }\n else if (moveCounter > 32) {\n fairRank.className = 'fa fa-star-o';\n }\n}", "updateMatchup(result) {\n // Get the current matchup\n let matchup = this.state.matchup;\n\n // Give a point to the winner, or 0.5 to both if a draw (x10 to prevent rounding error)\n if (result < 2) data.items[this.matchups[matchup][result]].points += 10;\n else {\n data.items[this.matchups[matchup][0]].points += 5;\n data.items[this.matchups[matchup][1]].points += 5;\n }\n\n // If this was the last matchup, move to the next page, otherwise increment\n if (matchup === this.numMatchups - 1) this.props.nextPage();\n else {\n this.setState({\n matchup: matchup + 1,\n });\n }\n }", "function Start ()\n{\n nextTeleport = spawnRate;\n}", "startTurn () { this.resetResources (); this._startTurn (); }", "function turnsScore() {\n if(turn>=0 && turn<=15) {\n turnbonus=10\n } else if (turn>=25) {\n turnbonus=0\n } switch (turn) {\n case 16:\n turnbonus = 9;\n break\n case 17:\n turnbonus = 8;\n break\n case 18:\n turnbonus = 7;\n break\n case 19:\n turnbonus = 6;\n break\n case 20:\n turnbonus = 5;\n break\n case 21:\n turnbonus = 4;\n break\n case 22:\n turnbonus = 3;\n break\n case 23:\n turnbonus = 2;\n break\n case 24:\n turnbonus = 1;\n break\n }\n}", "function enemyRacketMovement(){\n yEnemySpeed = yBall -yEnemyRacket - lengthRacket / 2 - 30;\n yEnemyRacket += yEnemySpeed + missChance\n calcMissChance()\n}", "function updateScoreboard(p) {\n totalPoints(p);\n exactMatchs(p);\n within5(p);\n within10(p);\n attempts();\n}", "moveMrX_Easy(positions, turn) {\n // this is the second shot at improving the AI\n\n // generate the players' heat maps\n const heatMaps = []; // null for index 0\n for (let i = 1; i <= this.CONSTS.MAX_PLAYERS; i++) {\n heatMaps.push(this._generateDistanceArray(positions[i]));\n }\n\n // now compare the heatmaps and combine into one map by taking the lowest value for each\n const fHeatMap = [];\n for (let i = 0; i < 200; i++) {\n let thisNumber = 999;\n // in heatMaps array player 1 is at index 0\n for (let j = 0; j < this.CONSTS.MAX_PLAYERS; j++) {\n if (heatMaps[j][i] < thisNumber) {\n thisNumber = heatMaps[j][i];\n }\n }\n fHeatMap.push(thisNumber);\n }\n\n // ok so now we get into the AI\n\n // start by creating an array of all nodes around Mr X's node with a radius\n // this array should contain the NodeLocation and its current heatmap number\n\n // first get the raw locations in a radius around Mr. X:\n const NodeLocationArrayRelativeToMrX = this._getNodeLocationArrayRelativeToMrX(positions, 2);\n\n // add the heatmap sum to the array\n const NodeLocationArrayWithHeatmapSums = this._getNodeLocationArrayWithHeatmapSums(NodeLocationArrayRelativeToMrX);\n\n // add the heatmap value to the array as the third element and make the final array in which each element is an array with three integers:\n // LOCATION, HEATMAP SUM, and HEATMAP value\n // these are the three things we need to take a stab at some non-retarded AI\n const DataArray = [];\n\n for (let i = 0; i < NodeLocationArrayWithHeatmapSums.length; i++) {\n const thisArray = [];\n thisArray.push (NodeLocationArrayWithHeatmapSums[i][0]);\n thisArray.push (NodeLocationArrayWithHeatmapSums[i][1]);\n thisArray.push (fHeatMap[NodeLocationArrayWithHeatmapSums[i][0]]);\n DataArray.push(thisArray);\n }\n\n DataArray.sort(this._compareHeatmapSums);\n // DataArray now is complete for a 'radius' number of hops with ratings for heatmap and heatmapSum\n\n // AI decisions start now\n\n // SAFE AI:\n // Mr. X should first look for the location with the highest heatmapSum with a heatmap of 2 or greater (not potentially being insta-killed)\n // After that he should look for the location with the highest heatmapSum with a heatmap of 1\n // Then find the best path to that location (it may not be adjacent to Mr. X)\n\n // *** BUT THE DATAARRAY NEEDS A PASS ON IT FIRST:\n // If MrX wants to go 2 or 3 spaces away to a spot, he needs to make sure first that his NEXT MOVE isn't on a heatmap of 1 or less...\n // ...so do another pass on the DataArray and update the heatmap on any entry that isn't next to Mr. X\n\n for (let i = 0; i < DataArray.length; i++) {\n // look at each item and replace it's heatmap, which = DataArray[i][2]\n // remember that each element in DataArray has LOCATION, HEATMAP SUM, and HEATMAP value\n const firstLocationAndTransport = this._findStartingPointOnPathAndTransportation(positions[0],DataArray[i][0]);\n DataArray[i][2] = fHeatMap[firstLocationAndTransport[0]];\n }\n\n // OK, now search through the entries!\n let destinationLocation = this._findBestDestination(DataArray, 2);\n let boolDead = false;\n if (destinationLocation < 1) {\n destinationLocation = this._findBestDestination(DataArray, 1);\n if (destinationLocation < 1) {\n // MRX HAS NO MOVEZZZZZZZ IF THIS GETS HIT\n boolDead = true;\n }\n }\n\n // now you have the starting point, positions[0], and the destination, destinationLocation...\n // ...figure out where Mr X should move next!\n // loop through the heatmap for the Mr. X location and look at all the spots connected to it (heatmap value of 1)...\n // ...these are the only places he can move this turn!\n\n let firstLocationAndTransport = this._findStartingPointOnPathAndTransportation(positions[0],destinationLocation);\n // firstLocationAndTransport[0] = the location that Mr X should move to next!\n // firstLocationAndTransport[1] = the transportation that Mr X will use to get to that spot (0:taxi, 1: bus, etc.)\n\n\n return {\n position: firstLocationAndTransport[0],\n transportation: firstLocationAndTransport[1], /// ???\n isVisible: this.CONSTS.MRX_VISIBLE_TURNS.indexOf(turn) >= 0,\n dead: boolDead // nowhere to move\n };\n }", "function playerWins() {\n setGameState('playerWins');\n setRunRoundConfetti(true);\n increasePlayerScore();\n // Wait a moment before setting up the next round\n setTimeout(function () {\n setUpRoundN();\n }, 2000);\n }", "reset(){\n this.playing = false;\n this.die = 0;\n this.players[0].spot = 0;\n this.players[1].spot = 0;\n this.currentTurn.winner = false;\n this.currentSpot = null;\n this.spot = null;\n this.currentTurn = this.players[0];\n \n }", "function resetScoreAndLives() {\n game.data.lives = game.data.initialLives;\n game.data.score = game.data.initialScore;\n}", "function newGame() {\n userScore = 0;\n targetNumber = Math.floor(Math.random() * 100) + 19;\n updateStats();\n\n }", "function reset() {\n targetScore = Math.floor(Math.random() * 101) + 19\n $(\"#targetScore\").text(targetScore)\n\n $(\"#winTotal\").text(wins)\n $(\"#lossesTotal\").text(losses)\n\n score = 0\n $(\"#score\").text(\"Score: \" + score)\n\n diamondPoints = Math.floor(Math.random() * 12) + 1\n emeraldPoints = Math.floor(Math.random() * 12) + 1\n rubyGemPoints = Math.floor(Math.random() * 12) + 1\n saphirePoints = Math.floor(Math.random() * 12) + 1\n}", "updateBoard(){\r\n for(let x = 0; x<13; ++x) {\r\n if(this.hasWinner){break;}\r\n for (let y = 0; y < 13; ++y) {\r\n if(this.hasWinner){break;}\r\n if(this.getColor(x,y) !== 0){\r\n this.removeSandwich(x,y);\r\n if (this.hasFiveInARow(x,y)) {\r\n this.hasWinner = true;\r\n this.declareWinner(x,y);\r\n }\r\n }\r\n }\r\n }\r\n this.updateTurn();\r\n }", "move() \n\t{\n\t\tthis.raindrop.nudge(0,-1,0);\n\n\t\tif (this.raindrop.getY() <= this.belowplane ) \n\t\t{\n\t\t\t//setting the y value to a certain number\n\t\t\tthis.raindrop.setY(random(200,400))\n\t\t}\n\t}", "getMove() {\n if (this.infected) {\n let nearby = this.world.characters.filter((character) => Math.abs(character.x - this.x) <= 2 && Math.abs(character.y - this.y) <= 2 && character != this)\n for (let c of nearby) {\n let probability = 1 / (Math.sqrt((c.x - this.x) * (c.x - this.x) + (c.y - this.y) * (c.y - this.y))) * this.world.outsideInfectionRate\n if (Math.random() < probability) {\n c.particlesIn()\n }\n }\n }\n\n let distances = this.currentBuilding.distancesFrom;\n if (distances[this.x][this.y] == 1) {\n this.world.intoBuilding(this.currentBuilding, this)\n return\n }\n\n // Make sure every coordinate is in the map and valid\n let possibleValues = moves.map((diff) => [this.x + diff[0], this.y + diff[1]]).filter((coord) => this.world.isEmpty(coord[0], coord[1]))\n\n // Sort by rating\n possibleValues.sort((first, second) => distances[second[0]][second[1]] - distances[first[0]][first[1]])\n\n if (possibleValues.length == 0) {\n return\n }\n\n var distancing = this.world.sdRange\n let nearbies = this.world.characters.filter((character) => Math.abs(character.x - this.x) <= 3 && Math.abs(character.y - this.y) <= 3).filter((c) => c != this)\n\n let maxVal = distances[possibleValues[0][0]][possibleValues[0][1]]\n // score based on how it can get to the home\n let scores = possibleValues.map((coord) => Math.abs(distances[coord[0]][coord[1]] - maxVal - 1))\n\n\n scores = scores.map(function (currentScore, i) {\n let [x, y] = possibleValues[i]\n if (nearbies.length == 0) {\n return currentScore\n }\n let closestDistance = Math.sqrt(nearbies.map((char) => (char.x - x) * (char.x - x) + (char.y - y) * (char.y - y)).reduce((last, current) => Math.min(last, current)))\n\n let multiplier = Math.pow(1 - distancing / 3 / (Math.pow(2, 2 * (closestDistance - 2.5)) + 1), 2)\n return currentScore * multiplier\n })\n\n let maxScore = scores.reduce((last, cur) => Math.max(last, cur))\n for (let i = 0; i < scores.length; ++i) {\n if (scores[i] == maxScore) {\n this.world.move(this, possibleValues[i][0], possibleValues[i][1])\n }\n }\n }", "function calcMoves() {\n moves++;\n movesSpan.innerText = moves;\n updateStars();\n }", "function checkPowerUps() {\n if (player.animating) {\n return;\n }\n checkGoal();\n var rect2 = null, rect1 = player.getBounds();\n\n /* Touching a gem will give you 1 extra score */\n if (collectibles.gem) {\n rect2 = collectibles.gem.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n score += 1;\n collectibles.gem = false;\n }\n }\n /* Touching a star will give you 2 extra score and 1 extra life */\n if (collectibles.life) {\n rect2 = collectibles.life.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n lives++;\n if (lives > 3) {\n lives = 3;\n }\n score += 2;\n collectibles.life = false;\n }\n }\n /* Touching a key will give you 2 extra score and the grid row\n * will change in the next level.\n */\n if (collectibles.key) {\n rect2 = collectibles.key.getBounds();\n if (Helpers.rectCollision(rect1, rect2)) {\n changeRows = true;\n score += 2;\n collectibles.key = false;\n }\n }\n }", "increasePointsOfPlayer1() {\n this.P1point++;\n }", "function set() {\r\n if (this.innerHTML !== CLEAR) {\r\n return;\r\n }\r\n\r\n this.innerHTML = turn;\r\n moves += 1;\r\n score[turn] += this.identifier;\r\n if (win(this)) {\r\n alert('Player ' + turn + ' Wins');\r\n restartGame();\r\n } else if (moves === BoardSize * BoardSize) {\r\n alert('It is a tie');\r\n restartGame();\r\n } else {\r\n turn = turn === 'X' ? 'O' : 'X';\r\n document.getElementById('turn').textContent = 'Player ' + turn;\r\n }\r\n}", "function move(){\n const pacmanGridBox = gridBoxes[position]\n const player = gridBoxes.find(box => box.classList.contains('pacman'))\n player.classList.remove('pacman')\n player.removeAttribute('data-direction')\n pacmanGridBox.classList.add('pacman')\n\n\n pacmanGridBox.setAttribute('data-direction', pacmanDirection.toString())\n\n if ((pacmanGridBox.classList.contains('ghost')) && (!pacmanGridBox.classList.contains('blue'))) deathClear()\n\n if (pacmanGridBox.classList.contains('pac-dot')){\n pacmanGridBox.classList.remove('pac-dot')\n score++\n scoreElem.innerText = score\n }\n\n if (pacmanGridBox.classList.contains('power-dot')) startBlueGhostPhase(pacmanGridBox)\n\n if ((pacmanGridBox.classList.contains('blue'))){\n score = score + powerScore\n powerScore = powerScore*2\n scoreElem.innerText = score\n\n if (pacmanGridBox.classList.contains('yellow')){\n clearInterval(yellowGhostInterval)\n pacmanGridBox.classList.remove('blue','yellow','ghost')\n yellowGhostPosition = 298\n gridBoxes[yellowGhostPosition].classList.add('yellow', 'ghost')\n }\n if (pacmanGridBox.classList.contains('red')){\n clearInterval(redGhostInterval)\n pacmanGridBox.classList.remove('blue','red','ghost')\n redGhostPosition = 274\n gridBoxes[redGhostPosition].classList.add('red', 'ghost')\n }\n if (pacmanGridBox.classList.contains('pink')){\n clearInterval(pinkGhostInterval)\n pacmanGridBox.classList.remove('blue','pink','ghost')\n pinkGhostPosition = 301\n gridBoxes[pinkGhostPosition].classList.add('pink', 'ghost')\n }\n if (pacmanGridBox.classList.contains('aqua')){\n clearInterval(aquaGhostInterval)\n pacmanGridBox.classList.remove('blue','aqua','ghost')\n aquaGhostPosition = 277\n gridBoxes[aquaGhostPosition].classList.add('aqua', 'ghost')\n }\n }\n }", "function numLimit(){ \n if (points > popLimit){\n points = reset;\n } \n}", "function ajoutPDuck(){ //fonction pour ajouter les points au canard\n scoreCanard++; \n CanardPoint.innerText = scoreCanard;//inserer les points a leurs place\n \n}", "function collectWheatSeeds()\n\t\t\t{\n\t\t\t\twheatSeedBank += randInt(1,3);\n\t\t\t\tif (randInt(1,20) == 1)\n\t\t\t\t{\n\t\t\t\t\twormBank += 5;\n\t\t\t\t}\n\t\t\t\taction(1,1,1);\n\t\t\t\tadvanceTime();\n\t\t\t\tupdateDisp();\n\t\t\t}", "function addPoints() {\n score += 10;\n}", "function SetPointsEarned(amt : int)\n{\n\tif(dead)\n\t\treturn;\n\t\t\n\tthis.pointsEarned = amt;\n}", "prepAndStartNewGame() {\n this.resetPlayers(Player.TOWN);\n this.assignRoles(this.options.numMafia, this.options.numCops, this.options.numDoctors);\n this.updateRoleCounts();\n this.gameState = MAFIA_TIME;\n }", "function p1WinPot(){\n let newPlayer1Money = player1Money + potMoney\n setPlayer1Money(newPlayer1Money)\n setPotMoney(0)\n }", "function resetMatch()\r\n\t\t{\r\n\t\t\tx = 350;\r\n\t\t\ty = 300;\r\n\t\t\tpaddle1Y = 200;\r\n\t\t\tpaddle2Y = 200;\r\n\t\t\tpaddle1YDimension = 66;\r\n\t\t\tpaddle2YDimension = 66;\r\n\t\t\tt = 300;\r\n\t\t\tif(dx > 0)\r\n\t\t\t{\r\n\t\t\t\tdx = -3;\r\n\t\t\t\tdy = 3;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdx = 3;\r\n\t\t\t\tdy = -3;\r\n\t\t\t}\r\n\t\t\tif(gameLvl == 3)\r\n\t\t\t{\r\n\t\t\t\tspeed = 15;\r\n\t\t\t}\r\n\t\t\telse if(gameLvl == 1)\r\n\t\t\t{\r\n\t\t\t\tspeed = 6;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tspeed = 10;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}", "goNextMove() {\n let piecesToMove = null; // this holds the pieces that are allowed to move\n let piecesToStayStill = null; // the others\n if (this.WhiteToMove == true) {\n // white is moving\n piecesToMove = this.GameData.getPiecesOfColor(PieceColors.White); // get the info from the model\n piecesToStayStill = this.GameData.getPiecesOfColor(PieceColors.Black);\n } else {\n // black is moving\n piecesToMove = this.GameData.getPiecesOfColor(PieceColors.Black);\n piecesToStayStill = this.GameData.getPiecesOfColor(PieceColors.White);\n }\n // add listeners for the pieces to move\n piecesToMove.forEach(curPiece => {\n this.GameView.bindMouseDown(\n curPiece.RowPos,\n curPiece.ColPos,\n this.mouseDownOnPieceEvent\n );\n });\n\n // remove listeners for the other pieces\n piecesToStayStill.forEach(curPiece => {\n // TRICKY: remove piece and add it again to remove the listeners !\n this.GameView.removePieceFromBoard(\n curPiece.RowPos,\n curPiece.ColPos,\n curPiece.getClassName()\n );\n this.GameView.putPieceOnBoard(\n curPiece.RowPos,\n curPiece.ColPos,\n curPiece.getClassName()\n );\n });\n this.WhiteToMove = !this.WhiteToMove; // switch player\n }", "function pacMove() {\n if (directionPM == 1) {\n if (maze[pacman.y][pacman.x-1] ==7 || maze[pacman.y][pacman.x-1] ==9 || maze[pacman.y][pacman.x-1] ==10 || maze[pacman.y][pacman.x-1] ==11) {\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y][pacman.x-1] ==6) {\n maze[pacman.y][pacman.x] = 3;\n pacman.x = 26;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y][pacman.x-1] ==4) {\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y][pacman.x-1] !==1) {\n if (maze[pacman.y][pacman.x-1] ==2) {\n maze[pacman.y][pacman.x] = 3;\n pacman.x = pacman.x - 1;\n maze[pacman.y][pacman.x] = 5;\n score += 100;\n drawMaze();\n } else {\n maze[pacman.y][pacman.x] = 3;\n pacman.x = pacman.x - 1;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n }\n }\n } else if (directionPM == 2) {\n $(\".pacman\").css(\"transform\",\"rotate(270deg)\");\n if (maze[pacman.y-1][pacman.x] ==7 || maze[pacman.y-1][pacman.x] ==9 || maze[pacman.y-1][pacman.x] ==10 || maze[pacman.y-1][pacman.x] ==11) {\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y-1][pacman.x] ==4) {\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y-1][pacman.x] !==1) {\n if (maze[pacman.y-1][pacman.x] ==2) {\n maze[pacman.y][pacman.x] = 3;\n pacman.y = pacman.y - 1;\n maze[pacman.y][pacman.x] = 5;\n score += 100;\n drawMaze();\n } else {\n maze[pacman.y][pacman.x] = 3;\n pacman.y = pacman.y - 1;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n }\n }\n } else if (directionPM == 3) {\n $(\".pacman\").css(\"transform\",\"rotate(0deg)\");\n if (maze[pacman.y][pacman.x+1] ==7 || maze[pacman.y][pacman.x+1] ==9 || maze[pacman.y][pacman.x+1] ==10 || maze[pacman.y][pacman.x+1] ==11) {\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y][pacman.x+1] ==4) {\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y][pacman.x+1] ==6) {\n maze[pacman.y][pacman.x] = 3;\n pacman.x = 1;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y][pacman.x+1] !==1) {\n if (maze[pacman.y][pacman.x+1] ==2) {\n maze[pacman.y][pacman.x] = 3;\n pacman.x = pacman.x + 1;\n maze[pacman.y][pacman.x] = 5;\n score += 100;\n drawMaze();\n } else {\n maze[pacman.y][pacman.x] = 3;\n pacman.x = pacman.x + 1;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n }\n }\n } else if (directionPM == 4) {\n $(\".pacman\").css(\"transform\",\"rotate(90deg)\");\n if (maze[pacman.y+1][pacman.x] ==7 || maze[pacman.y+1][pacman.x] ==9 || maze[pacman.y+1][pacman.x] ==10 || maze[pacman.y+1][pacman.x] ==11) {\n pacman.x = 14;\n pacman.y = 23;\n lives--;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y+1][pacman.x] ==4) {\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else if (maze[pacman.y+1][pacman.x] !==1) {\n if (maze[pacman.y+1][pacman.x] ==2) {\n maze[pacman.y][pacman.x] = 3;\n pacman.y = pacman.y + 1;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n } else {\n maze[pacman.y][pacman.x] = 3;\n pacman.y = pacman.y + 1;\n maze[pacman.y][pacman.x] = 5;\n drawMaze();\n }\n }\n }\n }", "function computerTurnEasy() {\n document.getElementById(\"player2\").classList.add(\"active\");\n document.getElementById(\"player1\").classList.remove(\"active\");\n for (let i = 0; i < randomIndex.length; i++) {\n let testNum = randomIndex[i];\n let test = document.querySelectorAll(\".box\")[testNum];\n\n if (\n test.classList.contains(\"box-filled-1\") ||\n test.classList.contains(\"box-filled-2\")\n ) {\n } else {\n document.querySelectorAll(\".box\")[testNum].classList.add(\"box-filled-2\");\n testNum = testNum + 1;\n player2Moves[testNum] = player2Moves[testNum] + 1;\n player2TestMoves.push(testNum);\n totalMoves.push([testNum]);\n count = count + 1;\n i = 100;\n }\n }\n checkWinner();\n} //function computerTurnEasy", "captureSeeds(num1) {\n if ((this.playerOne.isTurn && num1 > -1 && num1 < 6) || (this.playerTwo.isTurn && num1 > 6 && num1 < 13) ) {\n let num2 = this.getOppositeHole(num1);\n let sum = 0;\n sum = this.masterBoardArray[num1] + this.masterBoardArray[num2];\n if (this.masterBoardArray[num2] !== 0) {\n if (this.playerOne.isTurn) {\n this.masterBoardArray[6] += sum;\n }\n if (this.playerTwo.isTurn) {\n this.masterBoardArray[13] += sum;\n }\n this.masterBoardArray[num1] = 0;\n this.masterBoardArray[num2] = 0;\n }\n this.render();\n }\n }", "takeTurn() {\n let myBestMove = this.getBestMove(this.sym);\n let theirSym = this.sym === 'x' ? 'o' : 'x';\n let theirBestMove = this.getBestMove(theirSym);\n let squareNum;\n \n if (theirBestMove.movesLeft === 0 && myBestMove.movesLeft > 0) {\n squareNum = theirBestMove.squareNum;\n } else {\n squareNum = myBestMove.squareNum;\n }\n\n UI.fillSquare(squareNum, this.sym);\n grid[squareNum] = this.sym;\n }" ]
[ "0.6441226", "0.6417184", "0.62204164", "0.61645633", "0.6146238", "0.6139135", "0.61323893", "0.6107404", "0.6054268", "0.6048422", "0.60111725", "0.5959677", "0.59577596", "0.59576505", "0.5947963", "0.5918017", "0.5913302", "0.5899507", "0.5897049", "0.58847034", "0.5862848", "0.58479345", "0.5839754", "0.5835855", "0.58336943", "0.5825676", "0.5817243", "0.5805578", "0.5804665", "0.5797679", "0.5797561", "0.5797097", "0.5785592", "0.5783004", "0.5777524", "0.5777524", "0.57738346", "0.57628506", "0.5758215", "0.5757542", "0.57487744", "0.5744953", "0.5742333", "0.5736134", "0.5731965", "0.57297635", "0.5727782", "0.57245576", "0.5724104", "0.57102346", "0.5709065", "0.5697848", "0.56958264", "0.56948996", "0.5692652", "0.56876296", "0.5683655", "0.56826884", "0.56819266", "0.56791955", "0.5669624", "0.56696063", "0.56689453", "0.56675446", "0.5665887", "0.56608534", "0.56593084", "0.56529903", "0.5651779", "0.5644478", "0.5643318", "0.5641865", "0.5641446", "0.56409407", "0.56378126", "0.56376374", "0.5635216", "0.56338894", "0.5632245", "0.5623262", "0.5622065", "0.56194884", "0.5618615", "0.5615519", "0.56127286", "0.5612214", "0.561195", "0.561046", "0.5607474", "0.560535", "0.56052744", "0.5603452", "0.5603251", "0.56032085", "0.5599346", "0.55989534", "0.5594774", "0.55944806", "0.5591956", "0.5583481", "0.5583364" ]
0.0
-1
Look for characters still alive during current turn
static findPlayersStillAlive() { return Character.instances.filter((player) => { player.state === "Playing"; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_checkTurnEnd() {\n let p0alive=false, p1alive=false;\n for (let i=0; i<9; i++) {\n p0alive = p0alive || !this.cells[i].isDead;\n p1alive = p1alive || !this.cells[i+9].isDead;\n }\n if (p0alive && p1alive) return (this.turn==20) ? \"draw\" : \"continue\";\n if (!p0alive && !p1alive) return \"draw\";\n return (p0alive) ? \"p0win\" : \"p1win\";\n }", "function wasCowMonster() {\r\n\r\n\tif(spaces[lastKilledCow].state == \"deadCow\") {\r\n\t\treturn false;\r\n\t}\r\n\telse {\r\n\t\treturn true;\r\n\t}\r\n\r\n}", "function numberOFEnemiesRemainingToFight() {\n var NumOfEnemiesRemaining = 0;\n\n for (var i = 0; i < characters.length; i++) {\n if (characters[i].id != humanPlayer.id) {\n if (characters[i].isAlive) {\n NumOfEnemiesRemaining++;\n }\n }\n }\n\n return NumOfEnemiesRemaining;\n}", "checkIfCharacterIsDead() {\n if (this.character.dead) {\n this.endBoss.killedCharacter = true;\n }\n }", "checkForWin() {\n let unsolvedLetters = 0;\n\n for (let i = 0; i < phraseLetters.length; i++) {\n phraseLetters[i].className == `hide letter ${ phraseLetters[i].textContent }` ? \n unsolvedLetters++ : unsolvedLetters = unsolvedLetters;\n }\n\n return unsolvedLetters === 0;\n }", "checkForWin() {\r\n return this.activePhrase.phrase.split(\"\")\r\n // if any letter in the phrase hasn't been guessed, allLettersGuessed\r\n // will be false from that point on, and false will be returned.\r\n // if all letters of the phrase have been guessed, they'll all be in\r\n // this.guessedLetters, and truth will be maintained;\r\n .reduce((allLettersGuessed,currentLetter) => {\r\n return (this.guessedLetters[currentLetter] || false) && allLettersGuessed\r\n },true);\r\n }", "function computerMonster() {\r\n\tif(killPossible()) {\r\n\t\tvar cowKilled = spaces[0];\r\n\t\tswitch (difficulty) {\r\n\t\t\tcase 0:\t// easy mode\r\n\t\t\t\t/* randomly chosen from living cows connected to the first monster\r\n\t\t\t\t* found in the array that is still alive and has an available kill\r\n\t\t\t\t*/\r\n\t\t\t\tvar mon = 0;\r\n\t\t\t\tvar liveCowFound = false;\r\n\t\t\t\tfor (i = 0; i < 24; i++) {\r\n\t\t\t\t\tif (spaces[i].state == \"monster\") {\r\n\t\t\t\t\t\tfor (j = 0; j < spaces[i].adjacentSpaces.length; j++) {\r\n\t\t\t\t\t\t\tif (spaces[spaces[i].adjacentSpaces[j]].state == \"cow\"){\r\n\t\t\t\t\t\t\t\tliveCowFound = true;\r\n\t\t\t\t\t\t\t\tmon = i;\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 (liveCowFound) {\r\n\t\t\t\t\t\t\tbreak;\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\tvar index = Math.floor(Math.random() * spaces[mon].adjacentSpaces.length);\r\n\t\t\t\twhile(spaces[index].state != \"cow\") {\r\n\t\t\t\t\tindex = Math.floor(Math.random() * spaces[mon].adjacentSpaces.length);\r\n\t\t\t\t}\r\n\t\t\t\tspaces[index].state = \"deadCow\";\r\n\t\t\t\tcowKilled = spaces[index];\r\n\t\t\t\tbreak;\r\n\t\t\tcase 1: // normal mode\r\n\t\t\tcase 2: // hard mode\r\n\t\t\t\t// finds available cows for killing\r\n\t\t\t\tcowsThatCanBeKilled = [];\r\n\t\t\t\tfor(var i = 0; i < 24; ++i) {\r\n\t\t\t\t\tvar currentSpace = spaces[i];\r\n\t\t\t\t\tif (currentSpace.state == \"monster\") {\r\n\t\t\t\t\t\tvar adjacentSpaces = currentSpace.adjacentSpaces;\r\n\t\t\t\t\t\tfor (var j = 0; j < adjacentSpaces.length; ++j) {\r\n\t\t\t\t\t\t\tvar currentAdjacentSpace = spaces[ adjacentSpaces[j] ];\r\n\t\t\t\t\t\t\tif (currentAdjacentSpace.state == \"cow\") {\r\n\t\t\t\t\t\t\t\tvar addToArray = true;\r\n\t\t\t\t\t\t\t\tfor (var k = 0; k < cowsThatCanBeKilled.length; ++k) {\r\n\t\t\t\t\t\t\t\t\tif (cowsThatCanBeKilled[k] == adjacentSpaces[j]) {\r\n\t\t\t\t\t\t\t\t\t\taddToArray = false;\r\n\t\t\t\t\t\t\t\t\t\tbreak;\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 (addToArray) {\r\n\t\t\t\t\t\t\t\t\tcowsThatCanBeKilled.push(adjacentSpaces[j]);\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\t// randomly choose from cows connected to any monster(s)\r\n\t\t\t\tvar cow = Math.floor(Math.random() * cowsThatCanBeKilled.length);\r\n\t\t\t\tvar index = cowsThatCanBeKilled[cow];\r\n\t\t\t\twhile(spaces[index].state != \"cow\") {\r\n\t\t\t\t\tcow = Math.floor(Math.random() * cowsThatCanBeKilled.length);\r\n\t\t\t\t\tindex = cowsThatCanBeKilled[cow];\r\n\t\t\t\t}\r\n\t\t\t\tspaces[index].state = \"deadCow\";\r\n\t\t\t\tdrawSpaces();\r\n\t\t\t\tcowKilled = spaces[index];\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\t// moves cows/monsters connected to killedCow\r\n\t\tfor (var i = 0; i < cowKilled.adjacentSpaces.length; i++) {\r\n\t\t\tvar movingCow = spaces[cowKilled.adjacentSpaces[i]];\r\n\t\t\t\tif (movingCow.state != \"deadCow\" && movingCow.state != \"deadMonster\" && movingCow.state != \"empty\") {\r\n\t\t\t\t\tvar newPos = Math.floor(Math.random() * 24);\r\n\t\t\t\twhile(spaces[newPos].state != \"empty\") {\r\n\t\t\t\t\tnewPos = Math.floor(Math.random() * 24);\r\n\t\t\t\t}\r\n\t\t\t\tspaces[newPos].state = movingCow.state;\r\n\t\t\t\tmovingCow.state = \"empty\";\r\n\r\n\t\t\t\t$(\"#space\" + newPos).css(\"border\", \"5px solid orange\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tdrawSpaces();\r\n\t\treturn 1;\r\n\t} else {\r\n\t\treturn 0;\r\n\t}\r\n}", "everyoneDead(){\r\n\t\tfor(let i=0; i<this.n; i++){\r\n\t\t\tif(this.players[i].game.alive == true){\r\n\t\t\t\treturn false\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true\r\n\t}", "gameWon() {\n if (this._gameBoard[0] == this._currentPlayer && this._gameBoard[1] == this._currentPlayer && this._gameBoard[2] == this._currentPlayer ||\n this._gameBoard[3] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[5] == this._currentPlayer ||\n this._gameBoard[6] == this._currentPlayer && this._gameBoard[7] == this._currentPlayer && this._gameBoard[8] == this._currentPlayer ||\n this._gameBoard[0] == this._currentPlayer && this._gameBoard[3] == this._currentPlayer && this._gameBoard[6] == this._currentPlayer ||\n this._gameBoard[1] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[7] == this._currentPlayer ||\n this._gameBoard[2] == this._currentPlayer && this._gameBoard[5] == this._currentPlayer && this._gameBoard[8] == this._currentPlayer ||\n this._gameBoard[0] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[8] == this._currentPlayer ||\n this._gameBoard[2] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[6] == this._currentPlayer) {\n this._gameOver = true;\n if (this._currentPlayer == 'X') {\n this._xWins += 1;\n } else {\n this._yWins += 1; \n }\n }\n //checks to see if the game is tied\n var isTie = true;\n for (var i = 0; i < this._gameBoard.length; i++) {\n if (this._gameBoard[i] == \"\") { //there is an empty spot on the board\n isTie = false; \n }\n }\n if (isTie) {\n this._gameOver = true;\n this._ties += 1;\n }\n this._tiedGame = isTie;\n }", "function gameWon () {\n var matchedCards = $(\".card.match\").length;\n var totalCards = 16;\n if (matchedCards === totalCards) {\n stopTimer();\n return true\n }\n}", "checkForWin() {\n const noSpacesArray = game.activePhrase.phraseArray.filter(\n (character) => character !== \" \"\n );\n return matchedLetterList.length === noSpacesArray.length;\n }", "checkEndOfBattle() {\n // The battle should continue...\n if (this.player.isAlive() && this.currentEnemy.isAlive()) {\n this.isPlayerTurn = !this.isPlayerTurn;\n this.battle();\n // The next enemy should be faced...\n } else if (this.player.isAlive() && !this.currentEnemy.isAlive()) {\n console.log(`You've defeated the ${this.currentEnemy.name}`);\n\n this.player.addPotion(this.currentEnemy.potion);\n console.log(`${this.player.name} found a ${this.currentEnemy.potion.name} potion`);\n\n this.roundNumber++;\n\n if (this.roundNumber < this.enemies.length) {\n this.currentEnemy = this.enemies[this.roundNumber];\n this.startNewBattle();\n // The player had defeated all enemies.\n } else {\n console.log('You win!');\n }\n // The player has died.\n } else {\n console.log(\"You've been defeated!\");\n }\n }", "function isChallenging(battleId) {\r\n renewDash = false;\r\n challangeable = true;\r\n clearInterval(dashboardTime);\r\n checkRequest = true;\r\n $(\".right\").html('<pre>You have challenged an opponent</pre>');\r\n requestCheck(battleId);\r\n checkRequestTime = setInterval(\"requestCheck(battleId)\", 3000);\r\n }", "checkIfDeadPlayerNearby(){\n\t\tif(!this.player.dead){\t\t\t\t\t\n\t\t\tif(Math.abs(Phaser.Point.distance(this.player.position, this.otherPlayer.position)) < 64 && this.otherPlayer.dead){\n\t\t\t\tthis.player.resurrectText.setText(\"Press Resurrect Key\");\n\t\t\t\tif(this.player.keys.Resurrect.isDown){\t\n\t\t\t\t\tthis.player.resurrecting = true;\n\t\t\t\t\tthis.resurrectTimer.add(3500, this.resurrectPlayer, this, this.otherPlayer, this.player);\t\n\t\t\t\t\tthis.resurrectTimer.start();\t\n\t\t\t\t\tthis.player.resurrectText.setText(Math.floor(this.resurrectTimer.duration/1000) + 1);\t\t\n\t\t\t\t} else {\n\t\t\t\t\tthis.resurrectTimer.stop();\n\t\t\t\t\tthis.player.resurrecting = false;\n\t\t\t\t}\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\tthis.player.resurrectText.setText(\" \");\n\t\t\t}\t\t\n\t\t}\n\t}", "checkForWin() {\n const hiddenLetters = document.getElementsByClassName(\"hide letter\"); //Total hidden litters which are set by Phrase class\n if (hiddenLetters.length > 0) {\n //if more than zero, not winning yet if 0 return true and player won\n return false;\n } else {\n return true;\n }\n }", "checkForWin(){\n let unguessedLetters = 0; \n for(let c = 0; c < this.activePhrase.phrase.length; c++){\n if(phraseSection.firstElementChild.children[c].classList.contains('hide')){\n unguessedLetters ++;\n } \n } \n if(unguessedLetters === 0){\n return true;\n } \n }", "checkWin() {\n let that = this;\n if (this.matched.length === this.deck.len()) {\n setTimeout(function () {\n alert(`You won in ${that.turns} turns!`);\n }, 700);\n }\n }", "function movesRemaining () {\n for (var i = 0; i < state.words.length; i++) {\n if (hasMoreMoves(state.words[i])) {\n return true;\n }\n }\n state.hint = {};\n return false;\n}", "function checkIfHandedOff(){\n if (tagpro.players[currentlyScoring].dead){\n timer = clearInterval(timer);\n timer = setInterval(searchForScorer,10);\n }\n}", "function C012_AfterClass_Roommates_ChitChat() {\n\n\t// It slowly raises love\n\tC012_AfterClass_Roommates_ChitChatCount++;\n\tCurrentTime = CurrentTime + 290000;\n\tif (C012_AfterClass_Roommates_ChitChatCount % 5 == 4) ActorChangeAttitude(1, 0);\n\t\n\t// Sarah will kick the player out after 20:00\n\tif ((CurrentTime >= 20 * 60 * 60 * 1000) && (CurrentActor == \"Sarah\")) {\n\t\tOverridenIntroText = GetText(\"SarahKickOutAfter20\");\n\t\tC012_AfterClass_Roommates_CurrentStage = 201;\n\t}\n\t\n}", "gameOver() {\n const {matchedKeys, letter, error} = this.state;\n let goodLetters = 0;\n letter.forEach((element) => {\n if (matchedKeys.includes(element)) goodLetters++;\n });\n if (goodLetters === letter.length) return 'won';\n if (error >= 10) return 'loose';\n else return 'playing';\n }", "async battle_phase_end() {\n for (let i = 0; i < this.on_going_effects.length; ++i) {\n const effect = this.on_going_effects[i];\n effect.char.remove_effect(effect);\n effect.char.update_all();\n }\n if (this.allies_defeated) {\n this.battle_log.add(this.allies_info[0].instance.name + \"' party has been defeated!\");\n } else {\n this.battle_log.add(this.enemies_party_data.name + \" has been defeated!\");\n await this.wait_for_key();\n const total_exp = this.enemies_info.map(info => info.instance.exp_reward).reduce((a, b) => a + b, 0);\n this.battle_log.add(`You got ${total_exp.toString()} experience points.`);\n await this.wait_for_key();\n for (let i = 0; i < this.allies_info.length; ++i) {\n const info = this.allies_info[i];\n const char = info.instance;\n if (!char.has_permanent_status(permanent_status.DOWNED)) {\n const change = char.add_exp(info.entered_in_battle ? total_exp : total_exp >> 1);\n if (change.before.level !== change.after.level) {\n this.battle_log.add(`${char.name} is now a level ${char.level} ${char.class.name}!`);\n await this.wait_for_key();\n const gained_abilities = _.difference(change.after.abilities, change.before.abilities);\n for (let j = 0; j < gained_abilities.length; ++j) {\n const ability = abilities_list[gained_abilities[j]];\n this.battle_log.add(`Mastered the ${char.class.name}'s ${ability.name}!`);\n await this.wait_for_key();\n }\n for (let j = 0; j < change.before.stats.length; ++j) {\n const stat = Object.keys(change.before.stats[j])[0];\n const diff = change.after.stats[j][stat] - change.before.stats[j][stat];\n if (diff !== 0) {\n let stat_text;\n switch (stat) {\n case \"max_hp\": stat_text = \"Maximum HP\"; break;\n case \"max_pp\": stat_text = \"Maximum PP\"; break;\n case \"atk\": stat_text = \"Attack\"; break;\n case \"def\": stat_text = \"Defense\"; break;\n case \"agi\": stat_text = \"Agility\"; break;\n case \"luk\": stat_text = \"Luck\"; break;\n }\n this.battle_log.add(`${stat_text} rises by ${diff.toString()}!`);\n await this.wait_for_key();\n }\n }\n }\n }\n }\n const total_coins = this.enemies_info.map(info => info.instance.coins_reward).reduce((a, b) => a + b, 0);\n this.battle_log.add(`You got ${total_coins.toString()} coins.`);\n await this.wait_for_key();\n for (let i = 0; i < this.enemies_info.length; ++i) {\n const enemy = this.enemies_info[i].instance;\n if (enemy.item_reward && Math.random() < enemy.item_reward_chance) {\n //add item\n const item = items_list[enemy.item_reward];\n if (item !== undefined) {\n this.battle_log.add(`You got a ${item.name}.`);\n await this.wait_for_key();\n } else {\n this.battle_log.add(`${enemy.item_reward} not registered...`);\n await this.wait_for_key();\n }\n }\n }\n }\n this.unset_battle();\n }", "function coole_ai(){\n curr_char = 0;\n curr_pos = 0;\n position = [];\n cards = document.getElementsByClassName(\"card\");\n i = 0;\n scope = setInterval(function(){check_scope()}, 100)\n}", "showMatchedLetter(letter){\r\n $(letter).addClass('show');\r\n // display the char of the corresponding letters check if game is won\r\n }", "function battleWinner() {\n\t$(\".defendant\").empty();\n\tconsole.log(gameState);\n\t$(\".results\").html(\"You beat \" + gameState.enemyCharacters.name + \" Choose another character too attack.\");\n\n\t// selectAnother();\n}", "deadCellLives(alive, aliveNeighbors){\n return !alive && aliveNeighbors.length >= 3;\n }", "deadTile(tile, tilesRemaining) {\n this.checkChicken(tilesRemaining);\n\n // all tiles are welcome in a chicken hand.\n if (this.chicken) return false;\n\n // is this in a suit we want to get rid of?\n if (this.playClean !== false && tile < 27) {\n let suit = this.suit(tile);\n if (this.playClean !== suit) {\n // return how many of this suit we're going to get rid of.\n return this.player.tiles.map(t => this.suit(t.getTileFace())).filter(s => s===suit).length;\n }\n }\n\n // is this tile part of a concealed pung,\n // while we're going for a chow hand?\n let stats = this.analyse();\n if (stats.locked.chows > 0 && stats.counts[tile] > 2) {\n return true;\n }\n\n return false;\n }", "function remainingChar() {\n let pendingChar = falseChar;\n falseChar = 0;\n for (var i = 0; i < pendingChar; i++) {\n console.log(\"remaining \" + i);\n randomChar();\n pushPassword();\n }\n }", "currentPlayerWon() {\n let winStr = this.currentPlayer.sym.repeat(3);\n let winMove = winningMoves.findIndex((_,j) => getWinningMoveStrings(j) === winStr);\n\n if (winMove !== -1) {\n highlightWinningMove(winMove);\n return true;\n } else {\n return false; \n }\n }", "willLikelySurvive() {\n let count = 0;\n for (let i = 0; i < this.dna.length; i++) {\n if (this.dna[i] === \"C\" || this.dna[i] === \"G\") {\n count++;\n }\n }\n if ((count * 100) / this.dna.length >= 60) {\n return true;\n } else {\n return false;\n }\n }", "function checkCellsGhosts() {\n if (cells[ghost1].classList.contains('pacman_left') || cells[ghost1].classList.contains('pacman_right') ||\n cells[ghost1].classList.contains('pacman_up') || cells[ghost1].classList.contains('pacman_down') ||\n cells[ghost2].classList.contains('pacman_left') || cells[ghost2].classList.contains('pacman_right') ||\n cells[ghost2].classList.contains('pacman_up') || cells[ghost2].classList.contains('pacman_down') ||\n cells[ghost3].classList.contains('pacman_left') || cells[ghost3].classList.contains('pacman_right') ||\n cells[ghost3].classList.contains('pacman_up') || cells[ghost3].classList.contains('pacman_down') ||\n cells[ghost4].classList.contains('pacman_left') || cells[ghost4].classList.contains('pacman_right') ||\n cells[ghost4].classList.contains('pacman_up') || cells[ghost4].classList.contains('pacman_down')) {\n lives -= 1 \n if (lives === 0) {\n gameOver()\n \n } else if (lives > 0 ){\n lostLife()\n } \n }\n}", "function processGame() {\n // clear canvas for new draw,when update coordinate letters or not show some letters\n canvasDraw.clearRect(0, 0, canvas.width, canvas.height)\n if (Counterletters == MaxNumberLetter) { //win\n clearInterval(createLetter)\n win = true\n // check if create all letters and all letters caught\n letters.forEach((letter) => {\n if (letter.show && letter.colorCircle == colorLive || letter.time < 25) win = false\n })\n if (win) {\n canvasDraw.font = `${(canvas.height+canvas.width)/30}px arial`\n canvasDraw.textAlign = 'center'\n canvasDraw.fillStyle = 'black'\n canvasDraw.fillText('you have won in our Game', canvas.width / 2, canvas.height / 2)\n // stop create letter\n clearInterval(createLetter)\n // stop redraw game space\n cancelAnimationFrame(step)\n return 0\n }\n }\n // check if five letters arrive to canvas's left wihtout catching them\n if (CounterLeft >= 5) {\n // write lose phrase \n canvasDraw.font = `${(canvas.height+canvas.width)/30}px arial`\n canvasDraw.textAlign = 'center'\n canvasDraw.fillStyle = 'black'\n canvasDraw.fillText('good luck in the future', canvas.width / 2, canvas.height / 2)\n // stop create letter and delete it \n clearInterval(createLetter)\n // stop redraw gaem space\n cancelAnimationFrame(step)\n }\n //else coutinue with Game\n else {\n // update radius letters for change size screen ,.....\n let radius = (canvas.height + canvas.width) / 60\n // press in letters\n letters.forEach(letter => {\n //update or catch one of letters , start it big then not show \n if (letter.show) {\n // check if letter arrive to scanner left\n if (letter.show // letter is live and it without caught \n &&\n letter.colorCircle == colorLive // not catch\n &&\n letter.x - letter.radius < 0 //arrive left \n ) {\n CounterLeft++ // increase counter\n letter.show = false//hide the letter\n }\n // process when letter dead\n if (letter.colorCircle == colorDead) {\n letter.time++//change time to death\n }\n\n if (letter.time == 25) // it's time to death\n letter.show = false\n else // except update the letter -it's maybe live or about to die- ,and press radius for chang size\n letter.update(radius)\n }\n })\n }\n // counter error and counter are update in screen \n document.getElementById('Countererror').innerHTML = CounterError\n document.getElementById('Counterleft').innerHTML = 5 - CounterLeft\n // call function is responsible for call processGame 60 times per second\n step = requestAnimationFrame(processGame)\n}", "checkForWin() {\n let win = true;\n $('.letter').map(letter => {\n if ($('.letter').eq(letter).hasClass('hide')) {\n win = false;\n }\n });\n return win;\n }", "hasWon() {\n let f = this.foundations;\n if ([0].length == 13 && \n f[1].length == 13 && \n f[2].length == 13 && \n f[3].length == 13) {\n this._event(Game.EV.WON);\n return true;\n }\n return false;\n }", "function attackIt() {\n while (true) {\n var flag = hero.findFlag();\n if (flag) {\n if (flag.color == \"green\") {\n break;\n }\n hero.jumpTo(flag.pos);\n hero.pickUpFlag(flag);\n }\n \n if (hero.canCast(\"summon-burl\")) hero.cast(\"summon-burl\");\n if (hero.canCast(\"summon-undead\")) hero.cast(\"summon-undead\");\n if (hero.canCast(\"raise-dead\")) hero.cast(\"raise-dead\");\n \n var enemy = hero.findNearestEnemy();\n if (enemy && enemy.type != \"sand-yak\") {\n var distance = hero.distanceTo(enemy);\n if (distance < 25 && hero.canCast(\"fear\"))\n hero.cast(\"fear\", enemy);\n else if (distance < 30 && hero.canCast(\"chain-lightning\")) hero.cast(\"chain-lightning\", enemy);\n else if (distance < 30 && hero.canCast(\"poison-cloud\")) hero.cast(\"poison-cloud\", enemy);\n else if (distance < 15 && hero.canCast(\"drain-life\"))\n hero.cast(\"drain-life\", enemy);\n else hero.attack(enemy);\n }\n \n if (hero.health < hero.maxHealth / 2) {\n var friend = hero.findNearest(hero.findFriends());\n if (friend && friend.type != \"burl\" && hero.canCast(\"drain-life\") && hero.distanceTo(friend) <= 15)\n hero.cast(\"drain-life\", friend);\n }\n }\n}", "function winOrlose() {\n if (charArray.length == 0 && player.health > 0) { // when you select a character, there are 3 enemies left in the array. If you kill all enemies, then the array length becomes 0\n return true;\n } else {\n return false;\n };\n}", "function checkGame() {\n var cells = document.querySelectorAll('.cell');\n\n var clearCells = 0;\n var isWinner = true;\n\n for (var i = 0; i < cells.length; i++) {\n if (cells[i].getAttribute(\"isBomb\") === \"true\" && cells[i].getAttribute(\"flagged\") !== \"true\") {\n isWinner = false;\n }\n }\n\n if (isWinner) {\n startConfetti();\n }\n}", "function playerCheckDialogueWalkAway(){\n if ((player.x > dialoguex + dialogueWalkAway) || (player.x < dialoguex - dialogueWalkAway)) {\n dialogueAlreadyEngaged = false; \n dialogueActive = false; \n npcDialogue.setText(''); \n currentDialogue = 0;\n clearDialogueBox();\n }\n}", "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}", "_checkColumnCellsAlive(playerID, column) {\n let base = column + playerID*9;\n return !(this.cells[base].isDead && this.cells[base+3].isDead && this.cells[base+6].isDead);\n }", "game_over() {\n var row, col;\n var attacked_positions = [];\n var current_player_king;\n var has_valid_moves = false;\n for (row = 0; row < this.board.length; row++) {\n for (col = 0; col < this.board[0].length; col++) {\n var piece = this.board[row][col];\n if (piece === null) {\n continue;\n }\n\n if (piece.get_color() === this.get_curr_player()) {\n if (piece instanceof King) {\n current_player_king = new Location(row, col);\n }\n if (piece.get_valid_moves(this).length !== 0) {\n has_valid_moves = true;\n }\n } else {\n attacked_positions = attacked_positions.concat(piece.get_moves(this));\n }\n }\n }\n\n if (!has_valid_moves){\n if(this.in_check(this.get_curr_player())){\n // Checkmate\n if (this.get_curr_player() === Players.WHITE.COLOR) {\n return MoveStatus.BLACK_WIN;\n } else {\n return MoveStatus.WHITE_WIN;\n }\n }else{\n return MoveStatus.STALE_MATE;\n }\n }\n return MoveStatus.SUCCESS;\n }", "function pacDied() {\n for( let i=0; i<16; i++) {\n clearInterval(caughtIdOne)\n clearInterval(caughtIdTwo)\n clearInterval(caughtIdThree)\n clearInterval(caughtIdFour)\n }\n clearInterval(ghostMoveIdOne)\n clearInterval(ghostMoveIdTwo)\n clearInterval(ghostMoveIdThree)\n clearInterval(ghostMoveIdFour)\n pacIndex = null\n clearInterval(countUpid)\n }", "function handleConsequences () {\n if (!character.isAlive && lives >= 1) {\n // the character has died, but there are still enough lives to keep playing!\n lives -= 1;\n startGame();\n } else if (lives === 0) {\n // the character has died, and there are no more lives\n isGameRunning = false;\n drawGameOver();\n }\n\n if (flagpole.isFound) {\n // the character found the flagpole, good job!\n isGameRunning = false;\n drawLevelComplete();\n }\n\n // update the score\n score = coins.filter((c) => c.isFound).length;\n}", "function dead() {\r\n\t\tctx.clearRect(0, 0, cw, ch);\r\n\t\tctx.fillStyle = \"white\";\r\n\t\tctx.font = ch*2/15 + \"px Lucida Console\";\r\n\t\tctx.fillText(\"You are Dead!\", cw/6, ch/2, cw*2/3);\r\n\t\tctx.font = ch*1/25 + \"px Lucida Console\";\r\n\t\tctx.fillStyle = \"#ccc\";\r\n\t\tctx.fillText(\"History High Score:\" + highScore, cw*6.5/20, ch*5/8, cw*2/5);\r\n\t\tctx.fillText(\"Press \\\"Enter\\\" to Restart\", cw*3/10, 11*ch/15, cw*2/5);\r\n\t}", "function checkLetter()\n { \n //verify if the letter was an incorrect guess \n if (movie.indexOf(letter) === -1) {\n letter = event.key.toUpperCase();\n wrongGuesses.push(letter); \n //if incorrect guess join letter to wrongGuesses array \n document.getElementById('lettersWronglyGuessed').innerHTML = wrongGuesses.join(' ');\n //display number of guesses remaining and decrement allottedGuesses counter\n document.getElementById('guessesRemaining').innerHTML = allottedGuesses--\n } else {\n //if not incorrect check to see if it is a correct letter \n for (i = 0; i <movie.length; i++) {\n if (movie[i] === letter) {\n answerArray[i] = letter; \n }\n //if correct join the movie to the currentMovie span and display the letter\n document.getElementById(\"currentmovie\").innerHTML = answerArray.join(' ');\n } \n\n }\n //go to checkIfWon function to check if the player has won \n checkIfWon(); \n}", "function turn() {\nlet activeHomeCheck = document.querySelectorAll(\".pawn.\" + color[nextPlayer]).length;\nlet domantHomeCheck =document.querySelectorAll(\".pawn.domant.\" + color[nextPlayer]).length;\n if (die === 6 && activeHomeCheck!==domantHomeCheck ) {\n\n diceState = false;\n ludoBoardState = true;\n $(\".die\").addClass(\"domant\");\n\n // active=true;\n\n }\n // if the pawns at home are less than 4, it means one or more of them are outside.\n\n else if (document.querySelectorAll(\".pawn.\" + color[nextPlayer]).length< 4) {\n\n if(document.querySelectorAll(\".white-pane.\"+color[nextPlayer]).length===0){\n let quaterToSafe = document.querySelectorAll(\".square.safe.\"+color[nextPlayer]).length;\n let play = true;\n for(let i = 0; i<quaterToSafe; i++){\n let text = Number(document.querySelectorAll(\".square.safe.\"+color[nextPlayer])[i].innerText);\n if(text+die<=5){\n play= false;\n diceState = false;\n $(\".die\").addClass(\"domant\");\n break;\n }\n }\n if(play){\n playOn();\n }\n }else{\n diceState = false;\n $(\".die\").addClass(\"domant\");\n }\n}\n\n else {\n playOn();\n\n }\n\n\n}", "checkForWin() {\n //console.log('The phrases property: ', this.phrases);\n //const arrayActivePhrase = this.phrases.map(item => item.phrase);\n\n //select all the letters in the activePhrase with a class name 'hide'\n const phraseLetterDomNodes = document.querySelectorAll(\"div#phrase ul li\");\n\n const hiddenPhraseLettersDomNodes = [...phraseLetterDomNodes].filter(item => item.classList.contains(\"hide\"));\n\n const hiddenPhraseLetters = hiddenPhraseLettersDomNodes.map(hiddenNode => hiddenNode.textContent);\n \n // //selects all the letters in the activePhrase with a class name 'show'\n // const shownPhraseLettersDomNodes = [...phraseLetterDomNodes].filter(item => item.classList.contains(\"show\"));\n // const shownPhraseLetters = shownPhraseLettersDomNodes.map(hiddenNode => hiddenNode.textContent);\n\n\n console.log(\"The hidden list items: \", hiddenPhraseLettersDomNodes, hiddenPhraseLetters)\n //console.log(\"The shown list items: \", shownPhraseLettersDomNodes, shownPhraseLetters)\n //if the hidden letters length equals to the activePhrase letters length\n if (hiddenPhraseLetters.length > 0) {\n //keep the game going\n return false;\n //if the shown letters length equals to the activePhrase letters lenght\n } else {\n //stop the game, the usr has won\n return true;\n }\n }", "done() {\n for (let i = 0; i < this.players.length; i++) {\n if (!this.players[i].dead) {\n return false;\n }\n }\n return true;\n }", "function checkEnemyDeath(){\n if(enemyStamina[0].innerHTML<1){\n battleText.innerHTML += '<br>You won!'\n useLuck.removeEventListener('click',usingLuck)\n //remove defeated enemy from enemylist \n enemyList.shift()\n //remove first enemy element\n allEnemies.removeChild(allEnemies.firstElementChild)\n //check if theres enemies left\n if(enemyList.length<1){\n ingameText.innerHTML = ''\n //call win function when win\n win()\n }\n }\n}", "function getWormsAlive()\r\n{\r\n\twormsAlive = 0;\r\n\tfor(var i = 0; i < worms.length; i++)\r\n\t{\r\n\t\tif(players[i] && worms[i].alive)\r\n\t\t\twormsAlive++;\r\n\t}\r\n}", "canBeUsed(character) {\n return character.hasFlag(FLAGS.CHILLED_TURNS);\n }", "function checkForAdventurer () {\n if (monsters != []) { \n for (var i in monsters) {\n if (monsterEncounterRangeMarkers[i].getBounds().contains(pos)) {\n console.log('fight!');\n }\n }\n }\n}", "checkForWin() {\n //The player wins by \"showing\"/guessing all the letters, which means hidden letter count would be 0\n return (document.getElementsByClassName('hide').length ? 0 : true);\n }", "canBeUsed(character) {\n return character.hasFlag(FLAGS.POISONED_TURNS);\n }", "in_check(player){\n var row, col;\n var attacked_positions = [];\n var player_king;\n for (row = 0; row < this.board.length; row++) {\n for (col = 0; col < this.board[0].length; col++) {\n var piece = this.board[row][col];\n if(piece === null){\n // no piece\n continue;\n }\n if(piece.get_color() === player){\n if(piece instanceof King){\n player_king = piece;\n }\n }else{\n attacked_positions = attacked_positions.concat(piece.get_moves(this));\n }\n }\n }\n // If no king nothing to check, so false\n if(player_king === undefined){\n return false;\n }\n var i;\n for(i = 0; i < attacked_positions.length; i++){\n if(attacked_positions[i].isEqual(player_king.get_curr_loc())){\n return true;\n }\n }\n return false;\n }", "function removeinactive(key) {\r\n try {\r\n sendDebugMessage(\"Removing Inactive Players\", tourschan);\r\n var activelist = tours.tour[key].active;\r\n var playercycle = tours.tour[key].players.length;\r\n var currentround = tours.tour[key].round;\r\n for (var z=0;z<playercycle;z+=2) {\r\n var player1 = tours.tour[key].players[z];\r\n var player2 = tours.tour[key].players[z+1];\r\n var dq1 = true;\r\n var dq2 = true;\r\n if (tours.tour[key].winners.indexOf(player1) != -1) {\r\n sendDebugMessage(player1+\" won against \"+player2+\"; continuing\", tourschan);\r\n continue;\r\n }\r\n if (tours.tour[key].winners.indexOf(player2) != -1) {\r\n sendDebugMessage(player2+\" won against \"+player1+\"; continuing\", tourschan);\r\n continue;\r\n }\r\n if (tours.tour[key].battlers.hasOwnProperty(player1) || tours.tour[key].battlers.hasOwnProperty(player2)) {\r\n sendDebugMessage(player1+\" is battling against \"+player2+\"; continuing\", tourschan);\r\n continue;\r\n }\r\n if (player1 == \"~DQ~\" || player2 == \"~DQ~\" || player1 == \"~Bye~\" || player2 == \"~Bye~\") {\r\n sendDebugMessage(\"We don't need to check\", tourschan);\r\n continue;\r\n }\r\n if (activelist.hasOwnProperty(player1)) {\r\n if (activelist[player1] == \"Battle\" || (typeof activelist[player1] == \"number\" && activelist[player1]+tourconfig.activity >= parseInt(sys.time(), 10))) {\r\n sendDebugMessage(player1+\" is active; continuing\", tourschan);\r\n dq1 = false;\r\n }\r\n }\r\n else if (sys.id(player1) !== undefined && sys.id(player2) === undefined) {\r\n dq1 = false;\r\n sendDebugMessage(player1+\"'s opponent is offline; continuing\", tourschan);\r\n }\r\n else if (sys.hasTier(sys.id(player1), tours.tour[key].tourtype) && !sys.hasTier(sys.id(player2), tours.tour[key].tourtype)) {\r\n dq1 = false;\r\n sendDebugMessage(player1+\"'s opponent does not have a team; continuing\", tourschan);\r\n }\r\n else if (!sys.away(sys.id(player1)) && sys.away(sys.id(player2))) {\r\n dq1 = false;\r\n sendDebugMessage(player1+\"'s opponent is idle; continuing\", tourschan);\r\n }\r\n else {\r\n sendDebugMessage(player1+\" is not active; disqualifying\", tourschan);\r\n }\r\n if (activelist.hasOwnProperty(player2)) {\r\n if (activelist[player2] == \"Battle\" || (typeof activelist[player2] == \"number\" && activelist[player2]+tourconfig.activity >= parseInt(sys.time(), 10))) {\r\n sendDebugMessage(player2+\" is active; continuing\", tourschan);\r\n dq2 = false;\r\n }\r\n }\r\n else if (sys.id(player2) !== undefined && sys.id(player1) === undefined) {\r\n dq2 = false;\r\n sendDebugMessage(player2+\"'s opponent is offline; continuing\", tourschan);\r\n }\r\n else if (sys.hasTier(sys.id(player2), tours.tour[key].tourtype) && !sys.hasTier(sys.id(player1), tours.tour[key].tourtype)) {\r\n dq2 = false;\r\n sendDebugMessage(player2+\"'s opponent does not have a team; continuing\", tourschan);\r\n }\r\n else if (!sys.away(sys.id(player2)) && sys.away(sys.id(player1))) {\r\n dq2 = false;\r\n sendDebugMessage(player2+\"'s opponent is idle; continuing\", tourschan);\r\n }\r\n else {\r\n sendDebugMessage(player2+\" is not active; disqualifying\", tourschan);\r\n }\r\n if (dq1 && dq2) {\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player1))+flashtag+\" and \"+flashtag+html_escape(toCorrectCase(player2))+flashtag+\" are both disqualified for inactivity in the \"+html_escape(getFullTourName(key))+\" tournament!\", key);\r\n dqboth(player1, player2, key);\r\n }\r\n else if (dq2) {\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player2))+flashtag+\" was disqualified from the \"+html_escape(getFullTourName(key))+\" tournament for inactivity!\", key);\r\n disqualify(player2,key,false,false);\r\n }\r\n else if (dq1) {\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player1))+flashtag+\" was disqualified from the \"+html_escape(getFullTourName(key))+\" tournament for inactivity!\", key);\r\n disqualify(player1,key,false,false);\r\n }\r\n else if ((tours.tour[key].time-parseInt(sys.time(), 10))%60 === 0){\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player1))+flashtag+\" and \"+flashtag+html_escape(toCorrectCase(player2))+flashtag+\" are both active, please battle in the \"+html_escape(getFullTourName(key))+\" tournament ASAP!\", key);\r\n }\r\n // if the round advances due to DQ, don't keep checking :x\r\n if (!tours.tour.hasOwnProperty(key)) {\r\n break;\r\n }\r\n if (tours.tour[key].round !== currentround) {\r\n break;\r\n }\r\n }\r\n }\r\n catch (err) {\r\n sendChanAll(\"Error in process 'removeinactive': \"+err, tourserrchan);\r\n }\r\n}", "function isCharacterDead (character) {\n console.log('checking if player is dead')\n return character.health <= 0\n}", "function died() {\n if (lives == 0) {\n document.documentElement.style.setProperty('--blinkyAnimation', '0s');\n document.documentElement.style.setProperty('--pinkyAnimation', '0s');\n document.documentElement.style.setProperty('--inkyAnimation', '0s');\n document.documentElement.style.setProperty('--clydeAnimation', '0s');\n document.documentElement.style.setProperty('--ghostsWalking', '0s');\n hud.style.color = '#FE2502';\n hud.innerText = 'GAME OVER';\n siren.stopAudio();\n invincible.stopAudio();\n regenerating.stopAudio();\n } else {\n dotsBeforeExit = [\n [0, 0, 0],\n [7, 7, 7],\n [10, 10, 10],\n [15, 15, 15]\n ];\n pacmanGraphic.style.transform = 'scale(1)';\n initialize();\n }\n }", "checkCollision() {\n this.level.enemies.forEach((enemy, index) => {\n if (enemy.chickenAlive) {\n if (this.character.isColliding(enemy) && !this.character.isAboveGround()) {\n this.character.hit();\n this.statusBar.setPercentage(this.character.energy);\n } else if (this.character.isColliding(enemy) && this.character.isAboveGround()) {\n this.chickenDied(enemy);\n this.removeChicken(enemy);\n }\n }\n });\n }", "function shiftAvailableEnemies() {\n\tvar elementIdCounter = 1;\n\n\tfor(var i=0; i<_allCharacterObjects.length; i++) {\n\t\tvar currentObject = _allCharacterObjects[i];\n\n\t\t// Only work with characters that have not been defeated yet\n\t\tif(!currentObject.selectedAsDefender && !currentObject.selectedAsFighter && !currentObject.hasBeenDefeated) {\n\t\t\tvar elementId = '#available-enemies-' + elementIdCounter;\n\n\t\t\t$(elementId).append($(currentObject.id));\n\n\t\t\telementIdCounter++;\n\t\t}\n\t}\n\n\treturn;\n}", "function isDead(){\r\n\t\r\n\ti=1;\r\n\twhile(flag==0&&i<snake.length)\r\n {\r\n\t\t\r\n\t\tif( snake[0].x==snake[i].x && snake[0].y==snake[i].y)\r\n\t\t{\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t flag=1;\r\n dead.play();\r\n snake = [];\r\n food = [];\r\n ctx.clearRect(0,0,cvs.width,cvs.height);\r\n window.clearInterval(check1);\r\n window.clearInterval(check2);\r\n window.clearInterval(check3);\r\n setTimeout(gameOver,1000);\r\n break;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\ti++;\r\n\t\t}\r\n\t}\r\n}", "function hasPlayerWon() {\r\n if(gFlagsRemaining != 0) {\r\n return false;\r\n }\r\n return mBoard.allMinesFlagged();\r\n}", "game_won() {\n if (this.game_state !== \"alive\") {\n return;\n }\n\n for (let row = 0; row < this.visible_board.length; row++) {\n for (let col = 0; col < this.visible_board[0].length; col++) {\n if (this.game_board[row][col] === mine_value) {\n if (this.visible_board[row][col] === marked_value) {\n continue; // flagged correctly. Flag stays.\n }\n else {\n this.visible_board[row][col] = marked_value;\n }\n }\n else {\n this.visible_board[row][col] = this.game_board[row][col];\n }\n\n }\n } \n this.mine_counter = 0;\n this.stop_timer();\n this.game_state = \"won\";\n alert(\"You won!\");\n }", "function gameOver(){\n for (let i = 0; i < obstacles.length; i++){\n if (character.x < obstacles[i].x + obstacles[i].size &&\n character.x + character.width > obstacles[i].x &&\n ((character.y < 0 + obstacles[i].top && character.y + character.height > 0) ||\n (character.y > canvas.height - obstacles[i].bottom &&\n character.y + character.height < canvas.height))){\n ctx.font = 'bold 36px sans-serif';\n ctx.fillStyle = 'pink';\n ctx.fillText(\"GAME OVER\", 85, canvas.height/2);\n return true;\n }\n }\n}", "function whenUserGuesses () {\n if (currentWord.alreadyPressedLetters.includes(userKey) && userWon === false && userLost === false) {\n $(\".already-pressed\").empty().append('You already guessed \"' + userKey + '\"').fadeIn(\"slow\").fadeOut(\"slow\");\n } else if (keyCode > 64 && keyCode < 91 && remainingGuesses > 0 && userWon === false) {\n $(\".guessed-letters\").append(userKey + \" \"); \n remainingGuesses -= 1;\n $(\".remaining-guesses\").empty().append(remainingGuesses);\n currentWord.alreadyPressedLetters.push(userKey);\n } \n}", "function checkLetter(keyLetter) {\n let list = document.querySelectorAll('.letter');\n let correctLetter = false;\n \n for (let i = 0; i < list.length; i++) {\n \n let listLetter = list[i].textContent;\n \n if (listLetter === keyLetter) {\n correctLetter = true;\n list[i].classList.add('show');\n // CSS transistion added for exceed expectations\n list[i].style.transition = 'all 2s';\n } \n }\n \n if (correctLetter === false) {\n missed += 1;\n } if (missed == 1) {\n life[0].style.display = 'none';\n } if (missed == 2) {\n life[1].style.display = 'none';\n } if (missed == 3) {\n life[2].style.display = 'none';\n } if (missed == 4) {\n life[3].style.display = 'none';\n } if (missed == 5) {\n life[4].style.display = 'none';\n }\n \n return correctLetter;\n}", "function collision(){\r\n for (let enemy of allEnemies){\r\n let deltaX = player.x - enemy.x;\r\n let deltaY = player.y - enemy.y;\r\n if (deltaX < 70 && deltaX > -40 && deltaY < 55 && deltaY > -15){\r\n player.x = 350;\r\n player.y = 430;\r\n player.lives -- ;\r\n livesDisplayed[player.lives].classList.add('hidden');\r\n if(player.lives == 0){\r\n lost();\r\n }\r\n }\r\n }\r\n}", "checkAlive(){\n if (this.lifeTime > 1000){\n this.alive = false;\n this.lifeTime = 0;\n }\n\n }", "function checkCollisions(){\n var girl = 'image/char-pink-girl.png';\n for(var i = 0; i < allEnemies.length; i++){\n if(player.y == allEnemies[i].y && ((player.x >= allEnemies[i].x && player.x < (allEnemies[i].x +101) || (player.x+60 > allEnemies[i].x && player.x+60 <= allEnemies[i].x+101)))){\n //reset();\n player.x = 202;\n player.y = 392;\n console.log(\"Again!\");\n }else if(player.y === -23) {\n //reset();\n player.x = 101;\n player.y = -23;\n winCount = 1;\n console.log(\"Win!\");\n\n }\n }\n}", "function checkPlayerDie() {\n\tif (gameChar_y > height) {\n\t\tlives -= 1;\n\t\tstartGame();\n\t\tsplashSound.play();\n\t}\n}", "function checkPlayerDeath(){\n if(stamina.innerHTML<1){\n ingameText.style.display = 'block'\n ingameText.innerHTML = '<br>You are dead'\n useLuck.removeEventListener('click',usingLuck)\n fight.removeEventListener('click',fightOneAtATime)\n fight.removeEventListener('click',fightTogether)\n //remove otherPage buttons when dead\n hideElementByClass(otherPages)\n }\n}", "function checkChosen(letter) {\n console.log(\"Looking for \\\"\" + letter + \"\\\" in \" + solution)\n if (solution.indexOf(letter) > -1) {\n console.log(\"Found!\")\n for (let i = 0; i < solution.length; i++) {\n if (solution.charAt(i) == letter) {\n hiddenWord = replaceChar(hiddenWord, i, letter)\n } \n } if (hiddenWord == solution) {\n gamesWon++\n $(\".row.chatter\").empty()\n $(\".row.chatter\").append(`<p>You Won! The answer was: ${solution}. Try again!</p>`)\n $(\".row.game-count\").empty()\n $(\".row.game-count\").append(`<p>Wins: ${gamesWon} Losses: ${gamesLost}</p>`)\n setTimeout(function() { resetGame(); }, 2000);\n } \n } else {\n wrongAnswer();\n }\n $(\".row.solution\").empty()\n $(\".row.solution\").append(hiddenWord)\n}", "function newGame() {\n gameStart = true\n clearOut();\n ransomdomize();\n createSpan();\n \n //console.log(chosenWord); //CHEAT -- GET THE ANSWERS IN CONCOLE\n \n}", "enemyAlive() {\n for(let i = 0; i < enemies.length; i++) {\n if (enemies[i].health <= 0) {\n enemies[i].isEnemyAlive = false;\n }\n }\n }", "function checkColision() {\n if (target.X === player.X && target.Y === player.Y) {\n // console.log('celbaertel !');\n ['keyup', 'keydown'].forEach(ev => document.removeEventListener(ev, playerMoov));\n player.level += 1;\n countdown++;\n //alapbeallitasok nullazasa\n messageWrapper.innerHTML = '';\n gameField.innerHTML = '';\n bombsMaker = true;\n notTheSame = true;\n playerSquare = undefined;\n bombCounter = 1;\n countdown = 3;\n target = {};\n bombs = [];\n fields = [];\n startGame();\n\n } else {\n bombs.forEach(bomb => {\n if (bomb.offsetTop === player.Y && bomb.offsetLeft === player.X) {\n makeBoom(bomb);\n\n // if (gameOver) {\n // display.innerHTML = 'GAME OVER';\n // levelInfo.innerHTML = `You made ${player.stepCounter} moves`;\n // console.log('GAME OVER');\n // ['keyup', 'keydown'].forEach(ev => document.removeEventListener(ev, playerMoov));\n // gameField.innerHTML = '';\n // playInProgres = false;\n // restartBtn();\n // }\n }\n });\n }\n\n\n\n }", "function newGame() {\n\n printedWord = \"\"\n wordCheck = []\n newWord = {}\n countdown = 15,\n guessedLetters = []\n\n newHero()\n newWord = new Word(randomHero)\n // console.log(newWord)\n}", "function checkForWin () {\n for (var i = 0; i < board.cells.length; i++) {\n if (!board.cells[i].isMine && board.cells[i].hidden) {return}\n if (board.cells[i].isMine && !board.cells[i].isMarked) {return}\n }\nlib.displayMessage('no rabies for you!')\n }", "function checkSolved(selection) {\n notGuessed=0;\n selection.letters.forEach(function(element) {\n \n if(element.guessed===false) {\n notGuessed++\n }\n\n })\n}", "function zombieAttack() {\n for (let i = 0; i < zombies.length; i++) {\n zombies[i].detectObject();\n }\n}", "function live()\n{\n var nextCells = new Array;\n\n for (var y = 0; y < dimen; y++) {\n for (var x = 0; x < dimen; x++) {\n n = countNeighbors( cells, x, y );\n\n var lives;\n\n if ( isAlive( cells, x, y ) ) { // is currently alive\n lives = ( n >= 2 && n <= 3 );\n }\n else { // is currently empty\n lives = ( n == 3 );\n }\n\n // console.log( x + \" \" + y + \" = \" + n + \" \" + alive );\n\n setAlive( nextCells, x, y, lives );\n }\n }\n\n cells = nextCells;\n}", "walkAway() {\n console.clear();\n console.log(\"You turn your back to the waffle iron to escape.\");\n console.log(\"The waffle iron's anger grows.\");\n console.log(\"The waffle iron uses 'waffle throw!'\");\n\n this.answersPush(this.player, \"Just walk away.\");\n \n //Health && Check\n if(this.player.isDead(this.player.health)) {\n this.endGame(this.player);\n }\n \n }", "function checkWord() {\n\n for (var i = 0; i < userGuess.length; i++) {\n\n for (var j = 0; j < currentWord.length; j++) {\n\n if (userGuess[i].indexOf(currentWord[j]) >= 0) {\n console.log(\"Match!\", userGuess[i], currentWord[j]);\n placeHolder[j] = userGuess[i];\n pageUpdate();\n displayGuesses();\n winGame();\n console.log(placeHolder.join(\"\"));\n }\n else {\n console.log(\"no match\");\n displayGuesses();\n livesDecrease();\n winGame();\n // this code doesn't work. It doesn't console log properly, and it does not decrease the number of lives.\n // it does, however, correctly display the guesses you guess.\n }\n\n }\n\n }\n\n }", "function checkStatus() {\n if (guessesLeft === 0) {\n gameStart = false;\n loss++;\n failure.textContent = loss;\n guessedLetters.textContent = \"Sorry, the mighty sea got you this time. Try again\"\n\n\n } else if (word.toLowerCase() === chosenWordArray.join(\"\").toLowerCase()) {\n gameStart = false;\n win++;\n victory.textContent = win;\n guessedLetters.textContent = \"You are victorious! Your place in Valhalla is all but insured.\"\n }\n}", "function findEnemy(char) { \n\t\t\t\treturn char.varname === enemy.varname;\n\t\t\t}", "function checkForGameOver() {\n // Wenn das Kästchen, auf dem Pacman steht einen Geist ABER KEINEN scared Geist\n if (\n squares[pacmanCurrentIndex].classList.contains('ghost') &&\n !squares[pacmanCurrentIndex].classList.contains('scared-ghost')\n ) {\n // jeder Geist soll aufhören sich zu bewegen\n\n ghosts.forEach(ghost => clearInterval(ghost.timerId))\n //lösche eventListener von movePacman-Funktion\n document.removeEventListener('keyup', movePacman)\n // Zeigt GAME OVER an\n scoreDisplay.innerHTML = 'GAME OVER'\n }\n}", "function fighterMovement () { \n const movementId = setInterval(() => {\n cells.forEach(cell => {\n cell.classList.remove('fighter') \n })\n fighterIndex = fighterIndex.map(fighter => {\n if (cells.indexOf(cells[fighter]) > cells.length - (width)) {\n playerLoses()\n clearInterval(movementId)\n } else {\n cells[fighter].classList.add('fighter')\n return fighter + 1\n }\n })\n }, 1000)\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}", "checkForWin() {\n const phraseList = document.querySelector('#phrase').firstElementChild.children;\n let correctGuesses = 0;\n for (let i=0; i<phraseList.length; i++) {\n if (phraseList[i].className === 'show') {\n correctGuesses += 0;\n } else if (phraseList[i].className === 'hide space') {\n correctGuesses += 0;\n } else {\n correctGuesses -= 1;\n }\n }\n if (correctGuesses === 0) {\n this.gameOver('win');\n }\n }", "removeLife() {\n // Get the first element with the class \"tries\"\n const heart = document.getElementsByClassName('tries')[0];\n // Remove the heart\n heart.parentNode.removeChild(heart);\n // Increase the \"missed\" counter\n this.missed++;\n // Conditional to test if all \"lives\" have been used\n if (this.missed === 5) {\n // Call the gameOver method with the losing message\n this.gameOver(`Oh noes! No more lives left! The phrase was: \"${this.chosenPhrase.phrase}\"`);\n }\n }", "function sacrifice() {\n var index = Math.floor(Math.random() * Math.floor(wagon.characters.length))\n wagon.characters[index].health = 0\n $(\".ongoing-events\").prepend(wagon.characters[index].name + \" has been sacrificed, the rest of your party is free to go. <br>\")\n wagon.statusAdjuster()\n}", "function checkForGameOver() {\n //if the square pacman is in contains a ghost AND the square does NOT contain a scared ghost \n if (\n squares[pacmanCurrentIndex].classList.contains('ghost') && \n !squares[pacmanCurrentIndex].classList.contains('scared-ghost') \n ) {\n //for each ghost - we need to stop it moving\n ghosts.forEach(ghost => clearInterval(ghost.timerId))\n //remove eventlistener from our control function\n document.removeEventListener('keyup', control)\n squares[pacmanCurrentIndex].classList.remove('pacman','pacman-down', 'pacman-up', 'pacman-right', 'pacman-left')\n //tell user the game is over \n alert('You have lost!')\n restartGame()\n }\n}", "function checkGuessedLetters() {\n //This is checking that if users guess is in alailableLetters\n if(availableLetters.indexOf(this.event.key) > -1) {\n //Looping through guessed letters for the length of word\n for(var i = 0; i < word.length; i++) {\n //If the users guess has already been guessed then we will set guessed to true\n if(this.event.key === guessedLetters[i]) {\n guessed = true;\n }\n }\n }\n}", "function Game(params) {\n\n // pending/ongoing/checkmate/stalemate/forfeit\n this.status = 'pending';\n\n this.activePlayer = null; //Not needed now\n\n/*\n this.active = null;\n var outerScope = this;\n var activetimer = setInterval(function(){\n if(outerScope.active){\n outerScope.active = false;\n }\n else outerScope.active = true;\n console.log(\"set timer -\" + outerScope.active);\n }, 10000);\n */\n this.players = [\n {color: 'white', name: null, joined: false, inCheck: false, forfeited: false},\n {color: 'black', name: null, joined: false, inCheck: false, forfeited: false},\n {color: 'red', name: null, joined: false, inCheck: false, forfeited: false},\n {color: 'yellow', name: null, joined: false, inCheck: false, forfeited: false}\n ];\n\n this.board = {\n\n a9: null, b9: null, c9: null, d9: null, e9: null, f9: null, g9: null, h9: null,\n i9: null, j9: null, k9: null, l9: null, m9: null, n9: null, o9: null, p9: null,\n q9: null, r9: null, s9:null, t9: null, u9: null, v9: null, w9: null, x9: null,\n y9: null, z9: null,\n a8: null, b8: null, c8: null, d8: null, e8: null, f8:null, g8: null, h8: null,\n i8: null, j8: null, k8: null, l8: null, m8: null, n8: null, o8: null, p8: null,\n q8: null, r8: null, s8: null, t8: null, u8: null, v8: null, w8: null, x8: null,\n y8: null, z8: null,\n a7: null, b7: null, c7: null, d7: null, e7: null, f7: null, g7: null, h7: null,\n i7: null, j7: null, k7: null, l7: null, m7: null, n7: null, o7: null, p7: null,\n q7: null, r7: null, s7: null, t7: null, u7: null, v7: null, w7: null,x7: null,\n y7: null, z7: null,\n a6: null, b6: null, c6: null, d6: null, e6: null, f6: null, g6: null, h6: null,\n i6: null, j6: null, k6: null, l6: null, m6: null, n6: null, o6: null, p6: null,\n q6: null, r6: null, s6: null, t6: null, u6: null, v6: null, w6: null, x6: null,\n y6: null, z6: null,\n a5: null, b5: null, c5: null, d5: null, e5: null, f5: null, g5: null, h5: null,\n i5: null, j5:null, k5: null, l5: null, m5: null, n5: null, o5: null, p5: null,\n q5: null, r5: null, s5: null, t5: null, u5:null, v5: null, w5: null, x5: null,\n y5: null, z5: null,\n a4: null, b4: null, c4: null, d4: null, e4: null, f4: null, g4: null, h4: null,\n i4: null, j4: null, k4: null, l4: null, m4: null, n4: null, o4: null, p4: null,\n q4: null, r4: null, s4: null, t4: null, u4: null, v4: null, w4: null, x4: null,\n y4: null, z4: null,\n a3: null, b3: null, c3: null, d3: null, e3: null, f3: null, g3: null, h3: null,\n i3: null, j3: null, k3: null, l3: null, m3: null, n3: null, o3: null, p3: null,\n q3: null, r3: null, s3: null, t3: null, u3: null, v3: null, w3: null, x3: null,\n y3: null, z3: null,\n a2: null, b2: null, c2: null, d2: null, e2: null, f2: null, g2: null, h2: null,\n i2: null, j2: null, k2: null, l2: null, m2: null, n2: null, o2: null, p2: null,\n q2: null, r2: null, s2: null, t2: null, u2: null, v2: null, w2: null, x2: null,\n y2: null, z2: null,\n a1: null, b1: null, c1: null, d1: null, e1: null, f1: null, g1: null, h1:null,\n i1: null, j1: null, k1: null, l1: null, m1: null, n1: null, o1:null, p1: null,\n q1: null, r1: null, s1: null, t1: null, u1: null, v1: null, w1:null, x1:null,\n y1: null, z1: null,\n a0: null, b0: null, c0:null, d0: null, e0: null, f0:null, g0: null, h0: null,\n i0: null, j0: null, k0:null, l0: null, m0: null, n0: null, o0: null, p0: null,\n q0: null, r0: null, s0: null, t0: null, u0: null, v0: null, w0: null, x0: null,\n y0: null, z0: null };\n\n var pieces =[];\n var staticfactory = new StaticFactory();\n\n pieces.push(staticfactory.createPiece(\"Rook\"));\n console.log(pieces);\n // pieces.push(staticfactory.createPiece(\"Pawn\"));\n //console.log(pieces);\n pieces.push(staticfactory.createPiece(\"Bishop\"));\n console.log(pieces);\n pieces.push(staticfactory.createPiece(\"Queen\"));\n console.log(pieces);\n pieces.push(staticfactory.createPiece(\"Knight\"));\n console.log(pieces);\n var getpositionsforBishop=new GetpositionsforBishop();\n console.log(getpositionsforBishop.posit);\n var getpositionsforRook=new GetpositionsforRook();\n console.log(getpositionsforRook.posit);\n //var getpositionsforQueen=new GetpositionsforQueen();\n var getpositionsforPawn=new GetpositionsforPawn();\n console.log(getpositionsforPawn.posit);\n var getpositionsforKnight=new GetpositionsforKnight();\n console.log(getpositionsforKnight.posit);\n\nfor(var i=0;i<getpositionsforBishop.posit.length;i++)\n{\n this.board[getpositionsforBishop.posit[i]]= pieces[1].idhere;\n}\n\n for( i=0;i<getpositionsforKnight.posit.length;i++)\n {\n this.board[getpositionsforKnight.posit[i]]= pieces[3].idhere;\n }\n for( i=0;i<getpositionsforRook.posit.length;i++)\n {\n this.board[getpositionsforRook.posit[i]]= pieces[0].idhere;\n }\n for( i=0;i<getpositionsforPawn.posit.length;i++)\n {\n this.board[getpositionsforPawn.posit[i]]='sP';\n }\n\n/* for(var i=0;i<getpositionsforBishop.posit.length;i++)\n {\n this.board[getpositionsforBishop.posit[i]]= pieces[1].idhere;\n }\n console.log(getpositionsforBishop.posit);\n\n console.log(getpositionsforRook.posit);\n console.log(getpositionsforPawn.posit);\n console.log(getpositionsforKnight.posit);\n console.log(getpositionsforBishop.posit);*/\n // this.board['a0'] =\n // console.log(pieces);\n\n\n\n //var staticknight = piece.clone();\n\n\n this.capturedPieces = [];\n\n this.validMoves = [\n { type: 'move', pieceCode: 'wK', startSquare: 'a0', endSquare: 'a1' },\n { type: 'move', pieceCode: 'wK', startSquare: 'a0', endSquare: 'b0' },\n { type: 'move', pieceCode: 'wK', startSquare: 'a0', endSquare: 'b1' },\n { type: 'move', pieceCode: 'rK', startSquare: 'z0', endSquare: 'z1' },\n { type: 'move', pieceCode: 'rK', startSquare: 'z0', endSquare: 'y1' },\n { type: 'move', pieceCode: 'rK', startSquare: 'z0', endSquare: 'y0' },\n { type: 'move', pieceCode: 'yK', startSquare: 'a9', endSquare: 'b8' },\n { type: 'move', pieceCode: 'yK', startSquare: 'a9', endSquare: 'b9' },\n { type: 'move', pieceCode: 'yK', startSquare: 'a9', endSquare: 'a8' },\n { type: 'move', pieceCode: 'bK', startSquare: 'z9', endSquare: 'y8' },\n { type: 'move', pieceCode: 'bK', startSquare: 'z9', endSquare: 'y9' },\n { type: 'move', pieceCode: 'bK', startSquare: 'z9', endSquare: 'z8' }\n ];\n\n this.lastMove = null;\n\n this.modifiedOn = Date.now();\n\n // Set player colors\n // params.playerColor is the color of the player who created the game\n if (params.playerColor === 'white') {\n this.players[0].color = 'white';\n this.players[1].color = 'black';\n this.players[2].color = 'red';\n this.players[3].color = 'yellow';\n }\n else if (params.playerColor === 'black') {\n this.players[0].color = 'white';\n this.players[1].color = 'black';\n this.players[2].color = 'red';\n this.players[3].color = 'yellow';\n }\n}", "who(currentPlayer, channel){\n let map = this.maps[currentPlayer.position]\n let nearbyPlayers = new Array()\n this.players.forEach(player => {\n if(player !== currentPlayer && player.position === currentPlayer.position){\n nearbyPlayers.push(player)\n }\n })\n return nearbyPlayers\n }", "function __camPlayerDead()\n{\n\tvar dead = true;\n\tvar haveFactories = countStruct(\"A0LightFactory\") > 0;\n\tif (haveFactories)\n\t{\n\t\tdead = false;\n\t}\n\t//NOTE: Includes the construct droids in mission.apsDroidLists[selectedPlayer] and in a transporter.\n\tif (countDroid(DROID_CONSTRUCT) > 0)\n\t{\n\t\tdead = false;\n\t}\n\tif (__camWinLossCallback === \"__camVictoryTimeout\")\n\t{\n\t\t//Because countDroid() also counts trucks not on the map, we must also\n\t\t//make the mission fail if no units are alive on map while having no factories.\n\t\tvar droidCount = 0;\n\t\tenumDroid(CAM_HUMAN_PLAYER).forEach(function(obj) {\n\t\t\tdroidCount += 1;\n\t\t\tif (obj.droidType === DROID_TRANSPORTER)\n\t\t\t{\n\t\t\t\tdroidCount += enumCargo(obj).length;\n\t\t\t}\n\t\t});\n\t\tdead = droidCount <= 0 && !haveFactories;\n\t}\n\treturn dead;\n}", "checkLetter(letter) {\n let compareLetter = chosenWord.includes(letter)\n console.log('Chosen letter: ' + letter)\n if (compareLetter === true) {\n var numCorrectLetters = $('.spaceLetter[data-letter=\"' + letter + '\"]')\n .length\n this.correctLetters += numCorrectLetters\n\n if (this.correctLetters === chosenWord.length) {\n setTimeout(function() {\n alert('You won!')\n }, 300)\n setTimeout(function() {\n location.reload()\n }, 2000)\n }\n $('*[data-letter=\"' + letter + '\"]').removeClass('hidden')\n } else {\n this.turnsRemaining -= 1\n console.log('Turns Remaining:' + this.turnsRemaining)\n this.drawBodyPart()\n }\n }", "function hangMan() {\n document.onkeyup = function (event) { //when key pressed\n let userGuess = event.key.toLowerCase(); //assign the input to userGuess\n let resultVar = currentWord.search(userGuess);\n document.getElementById('directionsText').innerHTML = (''); //sets resultVar to if the letter is in word or not\n if (resultVar > -1) //if it is,\n {\n rightGuess++; //add one to rightguess\n for (i = 0; i <= cwLength; i++) //a for loop, should run for as long as the currentword, but it doesn't.\n {\n if (userGuess === currentWord.charAt(i)) //if the input is in current word,\n {\n wordArray[i] = currentWord.charAt(i);\n console.log(wordArray);\n let hiddenWord = document.getElementById(\"currentWord\");\n hiddenWord.innerHTML = 'your current word is ' + wordArray;\n }\n } if (wordArray.join(\"\") === currentWord) {\n document.getElementById('directionsText').innerHTML = ('<p>Congratulations! You have won. Press any key to begin again.</p>')\n winCount++\n //victory message\n document.onkeyup = function (event) //reload page on keyup\n {\n location.reload();\n }\n }\n }\n else { //runs if input is incorrect\n guessVar--; //minus one guess\n wrongGuess.push(userGuess); //add to empty array of wrong input\n document.getElementById('incorrectGuesses').innerHTML = ('Wrong letters guessed: ' + wrongGuess); //displays info\n document.getElementById('guessCount').innerHTML = ('Guesses left: ' + guessVar);\n if (guessVar === 0) { //if you run out of guesses\n document.getElementById('directionsText').innerHTML = (\"<p> I'm sorry, you have lost. Press any key to begin again.</p>\")\n lossCount++//loss screen\n document.onkeyup = function (event) {\n location.reload();\n }\n }\n }\n }\n}", "function fillEmptyLetter(){\n\n var underline= [];\n var checkWin = word.length;\n var firstLetterValue;\n for(var i= 0; i <= word.length; i++){\n //get the letter from indice\n firstLetterValue = word.charAt(i);\n //verify the word if contains \n if(firstLetterValue == letter()){\n underline[i]= firstLetterValue;\n //count until the lenght of the word to win\n win = win +1;\n //set goodwords with the good letter\n underline.forEach((value,x ) =>{\n if(value == firstLetterValue){\n goodwords[i]= firstLetterValue;\n }\n \n //if is the same lenght the game is finished\n if(win == checkWin){\n alert('you won the game congratulations!!!, the word was ' + word);\n document.getElementById('restart').click();\n }\n })\n \n }\n }\n}", "checkForWin(){\r\n if(show.length === letters.length){\r\n return true;\r\n }\r\n }", "function checkWord() {\n for (i = 0; i < answer.length; i++) {\n if (guess === answer[i] && letterInWord === false) {\n emptyWord[i] = String.fromCharCode(event.keyCode).toLowerCase();\n document.getElementById(\"empty-word\").innerHTML = emptyWord.join(\" \");\n countBlank -= 1;\n }\n }\n if (guess != answer[i]) {\n lives -= 1;\n }\n console.log(countBlank);\n }" ]
[ "0.63246936", "0.6119891", "0.60371554", "0.5934858", "0.5876498", "0.5866204", "0.5864736", "0.58546144", "0.58289", "0.57471704", "0.5743843", "0.5732753", "0.57269746", "0.569844", "0.5692737", "0.5687309", "0.5686708", "0.56828225", "0.5671355", "0.566985", "0.5665262", "0.5657911", "0.5655845", "0.564358", "0.5636407", "0.5623312", "0.561925", "0.5602342", "0.5601246", "0.5588565", "0.5567069", "0.5565666", "0.55562216", "0.5552849", "0.5537966", "0.5535904", "0.5526502", "0.55237347", "0.55226064", "0.55191445", "0.5518073", "0.5504148", "0.5499488", "0.5486751", "0.54809016", "0.54731625", "0.5471332", "0.54633355", "0.54627925", "0.54613453", "0.5460027", "0.54433495", "0.5442348", "0.5439286", "0.543713", "0.5429184", "0.5426918", "0.5422792", "0.5421226", "0.54191947", "0.5412019", "0.5411861", "0.53968054", "0.5396456", "0.53866553", "0.5383462", "0.53788394", "0.5378519", "0.5377716", "0.53738964", "0.5360177", "0.53571326", "0.5355645", "0.5355467", "0.53538644", "0.53521466", "0.53479", "0.53399616", "0.5338801", "0.53386617", "0.53351283", "0.5335025", "0.5333173", "0.5327035", "0.5320853", "0.5320633", "0.5319161", "0.5317745", "0.5317006", "0.5314291", "0.5313814", "0.5313339", "0.53077704", "0.5305663", "0.530099", "0.5297973", "0.52971375", "0.52963847", "0.5295706", "0.52949864" ]
0.6699116
0
Select player that are still alive for next turn
static selectRandomPlayer() { let newTeamPlayers = Character.instances.filter((player) => { player.state != LOSER; }); return newTeamPlayers.sort(() => Math.random() - 0.5); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextPlayer()\r\n{\r\n\t// check victory condition first\r\n\tif ( checkVictory() ) return;\r\n\r\n\t// if victory condition not met...\r\n\t// increment the current player id\r\n\tgame.cplayer = (game.cplayer+1)%game.players.length;\r\n\t\r\n\tUI_updateInfo();\r\n\t\t\r\n\t// start next players turn...\r\n\tstartTurn( current() );\r\n}", "function switchPlayers() {\n setTimeout(function() {\n $cards.removeClass('backside')\n $cards.removeClass('matched')\n $cards.off();\n }, exposeTime)\n if (currentPlayer == game.player1) {\n currentPlayer = game.player2\n } else {\n checkWinner();\n currentPlayer = game.player1\n }\n $('.start-game').html(currentPlayer.name)\n $('.start-game').one('click', startRound);\n matches = 0\n time = 0\n}", "static findPlayersStillAlive() {\n return Character.instances.filter((player) => {\n player.state === \"Playing\";\n });\n }", "function selectPlayer() {\n if (this == selectPlayers.onePlayer) {\n playerMode = 'one';\n }\n else if (this == selectPlayers.twoPlayer) {\n playerMode = 'two';\n }\n}", "function setPlayerNotReadyForNextRound() {\n GameLobby.unreadyPlayers();\n}", "function nextTurn() {\n //faire les modifications necessaire\n lastPlayer = lastPlayer < listPlayers.length - 1 ? lastPlayer + 1 : 0;\n modifyPlayerPanel();\n // var currentPlayer = document.getElementById(\"current-player\");\n // currentPlayer.innerHTML = \"Current player : \" + listPlayers[lastPlayer].name;\n listCheckbox.forEach((checkbox) => {\n document.getElementById(checkbox).checked = false;\n });\n saveListPlayers();\n if (is_victory().victory === true) {\n hideGame(true);\n endRanking = document.getElementById(\"end-ranking\");\n endRanking.innerHTML =\n \"This is the end of the game. Player \" +\n is_victory().player +\n \" won the match.\";\n }\n}", "switchPlayer() {\n for(let i=0; i<this.playerBoards.length; ++i){\n this.updateCurrentPlayer()\n if (!this.playerBoards[this.currentPlayer].isGameComplete()){\n this.gameComplete = false;\n return;\n } \n } \n this.gameComplete = true \n }", "player_is_active() {\n let player_field = Array.from(document.querySelectorAll('.player'));\n player_field.forEach(field => {\n field.classList.remove('active');\n })\n this.players.forEach((x, index) => {\n let pf = document.querySelectorAll(`.player${index + 1}`);\n if (x.myTurn == true) {\n pf[0].classList.add('active')\n pf[1].classList.add('active')\n\n }\n });\n }", "function nextPlayer(){\n\t\tif (isWinner()){\n\t\t\talert(\"CONGRATS, We have a winner!\"); \n\t\t\tclearButton.innerText = \"Play Again\"; \n\t\t\treturn;\n\t\t}\n\t\tif (turn === \"x\"){\n\t\t\tturn = \"o\";\n\t\t\tboxColor = \"DarkOrange\";\n\t\t}else {\n\t\t\tturn = \"x\";\n\t\t\tboxColor = \"DarkCyan\";\n\t\t}\n\t}", "function blockInactiveCheckers() {\n let inactivePlayer;\n game.player1 == game.whoMakesMove ? inactivePlayer = game.player2 : inactivePlayer = game.player1;\n for (let index = 1; index < 16; index++) {\n document.querySelector(`#${inactivePlayer}id${index}`).disabled = true;\n }\n}", "switchPlayers() {\n for (let player of this.players) {\n player.active = (player.active === true) ? false : true;\n }\n }", "function changeTurn(){\n\tif(activePlayer + 1 >= players.length){\n\t\tactivePlayer = 0;\n\t} else {\n\t\tactivePlayer++;\n\t}\n}", "function PendingPlayerState() { }", "function switchActivePlayer () {\n activePlayerIndex = players[activePlayerIndex].symbol === players[0].symbol ? 1 : 0;\n var activePlayer = players[activePlayerIndex];\n\n if (gameType === \"Computer\" && activePlayer.symbol === players[1].symbol) {\n setTimeout(getComputerMove, 500);\n }\n}", "function advancePlayerInTurn() {\r\n if (playerInTurn < players.length -1) {\r\n playerInTurn ++;\r\n }\r\n else {\r\n playerInTurn = 0;\r\n }\r\n}", "function switchToNextPlayer(){\n //ene toglogchiin eeljindee tsugluulsan onoog 0 bolgono.\n roundScore = 0;\n document.getElementById(\"current-\" + activePlayer).textContent = 0;\n\n //toglogchiin eeljiig ngo toglogch ruu shiljulne.\n activePlayer === 0 ? (activePlayer = 1) : (activePlayer = 0);\n\n //Ulaan tsegiig shiljuuulne\n document.querySelector(\".player-0-panel\").classList.toggle(\"active\");\n document.querySelector(\".player-1-panel\").classList.toggle(\"active\");\n\n //Shoog tur alga bolgono.\n diceDom.style.display = \"none\";\n}", "function checkActivePlayer(direction){\n var activePlayer;\n if(player1.active===true) {\n activePlayer = player1;\n }\n else {\n activePlayer = player2;\n }\n activePlayer.playerDirection(direction);\n}", "function nextPlayer(){\n\t\tactivePlayer === 0 ? activePlayer = 1 : activePlayer = 0/*if activePlayer equals to 0 then activePlayer change to 1 else activePlayer change to 0 isso se chama ternary operator*/\n\t\troundScore=0;\n\t\tdocument.getElementById('current-0').textContent='0';\n\t\tdocument.getElementById('current-1').textContent='0';\n\t\t/*document.querySelector('.player-0-panel').classList.remove('active');\n\t\tdocument.querySelector('.player-1-panel').classList.add('active');*/\n\t\tdocument.querySelector('.player-0-panel').classList.toggle('active');\n\t\tdocument.querySelector('.player-1-panel').classList.toggle('active');\n\t\tdocument.querySelector('.dice').style.display='none';\n}", "function nextTurn() {\n if (currentPlayer == player1) {\n currentPlayer = player2;\n } else {\n currentPlayer = player1;\n }\n}", "function nextPlayer(){\n if(activePlayer === 0){ // // kapag si Player 1 ay '0' active Player, tapos nextPlayer magiging Player 2 '1'\n activePlayer = 1; \n roundScore = 0; // removing this would pass the accumulated score to the next player\n \n } else {\n activePlayer = 0; // kapag si Player 2 ay '1' vice versa with Player 1 \n roundScore = 0; \n\n playerCurrentScore.textContent = '0'; // reset current score for the next player's turn \n\n // toggling \"active\" adding if absent; removing if present \n player0Panel.classList.toggle('active');\n player1Panel.classList.toggle('active'); \n }\n }", "function player1Turn() {\n var player1 = document.querySelector(\"#player1\");\n player1.classList.toggle(\"active\");\n }", "function playerNotActive(player){\r\n player.removeClass('active');\r\n }", "function playerswitch() {}", "function nextTurn(){\n\tchangeDiscard();\n\tplayerTurnIs();\n}", "function nextPlayer() {\r\n if (whichPlayer === 0) {\r\n whichPlayer++;\r\n\r\n document.getElementById(`attack-1`).disabled = false;\r\n document.getElementById(`attack-1`).addEventListener(\"click\", attack); // 2nd player attack button active\r\n\r\n document.getElementById(`player-1`).classList.add(`activePlayer`);\r\n document.getElementById(`player-0`).classList.remove(`activePlayer`);\r\n\r\n console.log(\r\n `nextPlayer() called, var whichPlayer = ${whichPlayer}. Output should be Player 2`\r\n );\r\n } else {\r\n whichPlayer--;\r\n\r\n document.getElementById(`attack-0`).disabled = false;\r\n document.getElementById(`attack-0`).addEventListener(\"click\", attack); // 1st player attack button active\r\n\r\n document.getElementById(`player-0`).classList.add(\"activePlayer\");\r\n document.getElementById(`player-1`).classList.remove(\"activePlayer\");\r\n\r\n console.log(\r\n `nextPlayer() called, var whichPlayer = ${whichPlayer}. Output should be Player 1`\r\n );\r\n }\r\n\r\n turnCount = 0;\r\n}", "function chooseTurn(playerNum) {\r\n\t$(\"#playerImage\" + playerNum).addClass('selectedPlayer');\r\n\tfor(var i = 0; i < 8; i++) {\r\n\t\tif($(\"#playerImage\" + i) !== undefined && i !== playerNum){\r\n\t\t\t$(\"#playerImage\" + i).removeClass('selectedPlayer');\r\n\t\t}\r\n\t}\r\n}", "pickAPlayer(playerIdx) {\n // if already picked cant pick again\n if (this.currentPlayer != undefined) {\n return false;\n }\n\n // pick player\n let audioPick = new Audio(this.audioPickStr);\n audioPick.play();\n\n if (this.characters[playerIdx].characterIsAlive) {\n this.characters[playerIdx].characterType = PLAYERTYPE;\n this.currentPlayer = this.characters[playerIdx];\n } else {\n console.log(\"cant pick \" + this.characters[playerIdx].characterName + \" they are dead\");\n return false;\n }\n\n this.displayGameStatus();\n\n return true;\n }", "function setActivePlayer(dice){\n if(dice!==6){\n document.querySelector(`.player-${activePlayer}-panel`).classList.remove('active')\n if(activePlayer){\n activePlayer=0\n }else{\n activePlayer=1\n }\n document.querySelector(`.player-${activePlayer}-panel`).classList.add('active')\n }\n}", "function p2SelectPhase() {\n if (playerNumber == 1) {\n // What Player 1 sees\n\n // Their own selection in Player 1 area\n\n // Waiting message in Player 2 area\n $(\"#player2Selection\").empty().text(\"Opponent is choosing\")\n } else if (playerNumber == 2) {\n // What Player 2 sees\n \n // Waiting message in Player 1 area\n $(\"#player1Selection\").empty().text(\"Opponent has chosen\")\n\n // Make buttons in Player 2 area\n makeRPSbuttons( $(\"#player2Selection\") )\n }\n\n}", "function playerCheckDialogueWalkAway(){\n if ((player.x > dialoguex + dialogueWalkAway) || (player.x < dialoguex - dialogueWalkAway)) {\n dialogueAlreadyEngaged = false; \n dialogueActive = false; \n npcDialogue.setText(''); \n currentDialogue = 0;\n clearDialogueBox();\n }\n}", "function checkForActive(thePlayer, theSecondPlayer) { //This function is called\n if (thePlayer.classList.contains('active')) { //on row 128 & 135\n thePlayer.classList.remove('active');\n theSecondPlayer.classList.add('active');\n }\n}", "function PKAttackNextPlayer() {\n Orion.Ignore(self);\n var target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red|innocent|blue\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n } else {\n Orion.IgnoreReset();\n Orion.Ignore(self);\n target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red|innocent|blue\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n }\n }\n}", "function nextPlayer() {\n\tif(gamePlaying) {\n\t\troundScore = 0;\n\t\tactivePlayer === 0 ? activePlayer = 1 : activePlayer = 0;\n\t\tdocument.querySelector(\"#current-0\").textContent = '0';\n\t\tdocument.querySelector(\"#current-1\").textContent = '0';\n\t\tdocument.querySelector(\".player-0-panel\").classList.toggle(\"active\");\n\t\tdocument.querySelector(\".player-1-panel\").classList.toggle(\"active\");\n\t}\n}", "function nextPlayer(){\r\n currentplayer === 0 ? currentplayer = 1 : currentplayer = 0;\r\n newscore = 0;\r\n document.querySelector('.player-0-panel').classList.toggle('active') ;\r\n document.querySelector('.player-1-panel').classList.toggle('active') ;\r\n \r\n}", "function AttackNextPlayer() {\n Orion.Ignore(self);\n var target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n } else {\n Orion.IgnoreReset();\n Orion.Ignore(self);\n target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n }\n }\n}", "startActivePlayerTurn() {\n setPlayerTurnText(this.activePlayer);\n\n if(this.isAITurn())\n performAITurn(this.activePlayer);\n else\n setPlayerPiecesSelectable(this.activePlayer, true);\n }", "function winnerFound() {\n hideDice();\n gamePlaying = false;\n //Change player name to winner\n document.getElementById(\"name-\" + activePlayer).textContent = \"Winner\";\n // Change classes to Winner\n document\n .querySelector(\".player-\" + activePlayer + \"-panel\")\n .classList.add(\"winner\");\n document\n .querySelector(\".player-\" + activePlayer + \"-panel\")\n .classList.remove(\"active\");\n }", "function p1SelectPhase() {\n if (playerNumber == 1) {\n // What Player 1 sees\n \n // Make buttons in Player 1 area\n makeRPSbuttons( $(\"#player1Selection\") )\n\n // Waiting message in Player 2 area\n $(\"#player2Selection\").empty().text(\"Opponent waiting on your selection\")\n } else if (playerNumber == 2) {\n // What Player 2 sees\n\n // Waiting message in Player 1 area\n $(\"#player1Selection\").empty().text(\"Opponent is choosing\")\n\n // Waiting message in Player 2 area\n $(\"#player2Selection\").empty().text(\"Waiting on opponent's selection\")\n }\n\n}", "function select_player(){\n \t\t//Right now just drafts the last player available, probably fine but could be based on rank or user preference\n \t\t//Figure out how to randomize that\n \t\t\n \t\tplayer_id = $('input:radio[name=player_id]').last().val()\n \t\t$.post('/bizarro/draft/{{draft_id}}/', {'player_id':player_id})\n \t\t}", "static giveAPlayerATurn() {\n for (let i = 0; i < this.players.length; i++) {\n if (!this.hasPlayerHadTurn(i)) {\n this.playTurn(i);\n return;\n }\n }\n }", "function switch_player(){\n player += 1;\n if (player >= squid.length){\n player = 0;\n }\n }", "checkForPlayer (id) {\n return this.turns.indexOf(id) >= 0\n }", "function changePlayer() {\n // console.log(`Count in changePlay: ${count}`);\n if (count > 8) {\n setTimeout(function() {\n gameOver();\n }, 500);\n } else {\n let pOne = document.getElementById(\"player1\");\n let pTwo = document.getElementById(\"player2\");\n if (document.getElementById(\"player1\").classList.contains(\"active\")) {\n document.getElementById(\"player1\").classList.remove(\"active\");\n document.getElementById(\"player2\").classList.add(\"active\");\n } else {\n document.getElementById(\"player1\").classList.add(\"active\");\n document.getElementById(\"player2\").classList.remove(\"active\");\n }\n if (\n document.getElementById(\"player2\").classList.contains(\"active\") &&\n gameType === \"PvCEasy\"\n ) {\n computerTurnEasy();\n }\n if (pTwo.classList.contains(\"active\") && gameType === \"PvCMedium\") {\n computerTurnMedium();\n }\n }\n} //changePlayer", "function whos_turn()\n{\n\tconsole.log(\"who's turn run\");\n\tif (player_index == 0){\n\t\t$(\".Xplayer\").addClass(\"playerTurn\");\n\t\t$(\".Oplayer\").removeClass(\"playerTurn\");\n\t}\n\telse {\n\t\t$(\".Xplayer\").removeClass(\"playerTurn\");\n\t\t$(\".Oplayer\").addClass(\"playerTurn\");\n\t}\n}", "function activePlayer(players) {\n return players.find(player => player.isActive === false).name; // === !player.isActive\n}", "function playerSelectedMove(playerInput) {\n playerSelection = playerInput;\n playRound(playerSelection, computerPlay());\n}", "selectSquare(currPlayer, color,nxtPlayer ){\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").innerHTML = '<p>'+currPlayer.toUpperCase()+'</p>';\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").style.color = color;\n this.choice = currPlayer;\n this.checkForWinner();\n this.checkForDraw();\n player = nxtPlayer;\n turn ++;\n }", "chooseNextChaser() {\n if (this.idsLeft === undefined) {\n this.idsLeft = this.players.map((p) => p.id);\n }\n return this.idsLeft.pop(Math.floor(Math.random()*this.idsLeft.length));\n }", "function nextGame() {\n // Hide selector\n const selector = document.getElementById(\"selector\");\n selector.style.display = \"none\";\n\n // Restart cards and start new match\n eraseQ = eraseQ.concat(matched);\n eraseAll();\n matched = [];\n playGame(randomLevel());\n}", "function nextPlayer(){\n activePLayer === 0 ? activePLayer = 1 : activePLayer = 0; //ternary operator\n roundScore = 0; //so that next player starts from zero\n \n document.getElementById('current-0').textContent=0;\n document.getElementById('current-1').textContent=0;\n \n //to change the active players\n document.querySelector('.player-0-panel').classList.toggle('active');\n document.querySelector('.player-1-panel').classList.toggle('active');\n \n document.getElementById('dice-1').style.display='none';\n document.getElementById('dice-2').style.display='none';\n \n \n}", "function nextPlayer() {\r\n\t\r\n\tactivePlayer === 0 ? activePlayer = 1 : activePlayer = 0;\r\n\t\troundscore = 0;\r\n\t\t\r\n\t\t\r\n\t\tdocument.getElementById('current-0').textContent = '0';\r\n\t\tdocument.getElementById('current-1').textContent = '0';\r\n\t\t\r\n\t\t//to change bored for active player the property used here was toggle\r\n\t\tdocument.querySelector('.player-0-panel').classList.toggle('active');\r\n\t\tdocument.querySelector('.player-1-panel').classList.toggle('active');\r\n\t\t\r\n\t\t\r\n\t\t//this also use but for reffrence and we did not archive 100%\r\n\t\t//document.querySelector('.player-0-panel').classList.remove('active');\r\n\t\t//document.querySelector('.player-1-panel').classList.add('active');\r\n\t\t\r\n\t\t\r\n\t\t//to hide dice if is the next players turn\r\n\t\t document.getElementById('dice-1').style.display = 'none';\r\n\t\t document.getElementById('dice-2').style.display = 'none';\r\n\t\t\r\n}", "selectSquare(currPlayer, color,nxtPlayer ){\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").innerHTML = '<p>'+currPlayer.toUpperCase()+'</p>';\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").style.color = color;\n this.choice = currPlayer;\n this.checkForWinner();\n this.checkForDraw();\n player = nxtPlayer\n turn ++;\n }", "function playerTurn() {\n if (player === 1) {\n player = 2;\n }else {\n player = 1;\n }\n}", "function PlayerTurn(selection)\n{\n //allow player to make a selection\n player_selection = selection;\n AttackPhrase(player_selection);\n //check wether selection was made and if it is possible\n //otherwise resets player selection phase\n if(player_selection === null || player_selection === undefined)\n {\n return;\n }\n else if(player_selection === quitGame)\n {\n EndGame();\n }\n else\n {\n //initiate computer selection phase\n if (games_played < 2)\n ComputerPlayCycle();\n else\n DComputerPlayCycle();\n }\n}", "function nextPlayer() {\r\n activePlayer === 0 ? activePlayer = 1 : activePlayer = 0;\r\n roundScore = 0;\r\n\r\n // Set all the current score of both 2 players to 0\r\n\r\n document.getElementById('current-0').textContent = '0';\r\n document.getElementById('current-1').textContent = '0';\r\n\r\n // add active Status to current player\r\n document.querySelector('.player-0-panel').classList.toggle('active');\r\n document.querySelector('.player-1-panel').classList.toggle('active');\r\n\r\n document.querySelector('.dice').style.display = 'none';\r\n}", "waitingState(){\n\n // If there are more than 1 player (DummyPlayer doesnt count) and the game isn't started or starting\n\n if(this.playerPool.activePlayers.length >2){\n\n this.gameState = STATE_COUNT_DOWN;\n console.log(\"Game starting.\");\n let game = this;\n this.gameStartTime = new Date().getTime();\n setTimeout(function(){\n game.lastTroopIncTime = new Date().getTime();\n game.gameState = STATE_RUNNING;\n game.gameSocket.emit('startGame');\n }, TIME_TILL_START, game);\n }\n }", "function setSinglePlayer() {\r\n twoPlayer = false\r\n resetGameBoard()\r\n $('#player-two').css('display', 'none')\r\n}", "function nextPlayer() {\n if (currentPlayer == 2) {\n currentPlayer = 1;\n } else {\n currentPlayer++;\n }\n}", "function removeinactive(key) {\r\n try {\r\n sendDebugMessage(\"Removing Inactive Players\", tourschan);\r\n var activelist = tours.tour[key].active;\r\n var playercycle = tours.tour[key].players.length;\r\n var currentround = tours.tour[key].round;\r\n for (var z=0;z<playercycle;z+=2) {\r\n var player1 = tours.tour[key].players[z];\r\n var player2 = tours.tour[key].players[z+1];\r\n var dq1 = true;\r\n var dq2 = true;\r\n if (tours.tour[key].winners.indexOf(player1) != -1) {\r\n sendDebugMessage(player1+\" won against \"+player2+\"; continuing\", tourschan);\r\n continue;\r\n }\r\n if (tours.tour[key].winners.indexOf(player2) != -1) {\r\n sendDebugMessage(player2+\" won against \"+player1+\"; continuing\", tourschan);\r\n continue;\r\n }\r\n if (tours.tour[key].battlers.hasOwnProperty(player1) || tours.tour[key].battlers.hasOwnProperty(player2)) {\r\n sendDebugMessage(player1+\" is battling against \"+player2+\"; continuing\", tourschan);\r\n continue;\r\n }\r\n if (player1 == \"~DQ~\" || player2 == \"~DQ~\" || player1 == \"~Bye~\" || player2 == \"~Bye~\") {\r\n sendDebugMessage(\"We don't need to check\", tourschan);\r\n continue;\r\n }\r\n if (activelist.hasOwnProperty(player1)) {\r\n if (activelist[player1] == \"Battle\" || (typeof activelist[player1] == \"number\" && activelist[player1]+tourconfig.activity >= parseInt(sys.time(), 10))) {\r\n sendDebugMessage(player1+\" is active; continuing\", tourschan);\r\n dq1 = false;\r\n }\r\n }\r\n else if (sys.id(player1) !== undefined && sys.id(player2) === undefined) {\r\n dq1 = false;\r\n sendDebugMessage(player1+\"'s opponent is offline; continuing\", tourschan);\r\n }\r\n else if (sys.hasTier(sys.id(player1), tours.tour[key].tourtype) && !sys.hasTier(sys.id(player2), tours.tour[key].tourtype)) {\r\n dq1 = false;\r\n sendDebugMessage(player1+\"'s opponent does not have a team; continuing\", tourschan);\r\n }\r\n else if (!sys.away(sys.id(player1)) && sys.away(sys.id(player2))) {\r\n dq1 = false;\r\n sendDebugMessage(player1+\"'s opponent is idle; continuing\", tourschan);\r\n }\r\n else {\r\n sendDebugMessage(player1+\" is not active; disqualifying\", tourschan);\r\n }\r\n if (activelist.hasOwnProperty(player2)) {\r\n if (activelist[player2] == \"Battle\" || (typeof activelist[player2] == \"number\" && activelist[player2]+tourconfig.activity >= parseInt(sys.time(), 10))) {\r\n sendDebugMessage(player2+\" is active; continuing\", tourschan);\r\n dq2 = false;\r\n }\r\n }\r\n else if (sys.id(player2) !== undefined && sys.id(player1) === undefined) {\r\n dq2 = false;\r\n sendDebugMessage(player2+\"'s opponent is offline; continuing\", tourschan);\r\n }\r\n else if (sys.hasTier(sys.id(player2), tours.tour[key].tourtype) && !sys.hasTier(sys.id(player1), tours.tour[key].tourtype)) {\r\n dq2 = false;\r\n sendDebugMessage(player2+\"'s opponent does not have a team; continuing\", tourschan);\r\n }\r\n else if (!sys.away(sys.id(player2)) && sys.away(sys.id(player1))) {\r\n dq2 = false;\r\n sendDebugMessage(player2+\"'s opponent is idle; continuing\", tourschan);\r\n }\r\n else {\r\n sendDebugMessage(player2+\" is not active; disqualifying\", tourschan);\r\n }\r\n if (dq1 && dq2) {\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player1))+flashtag+\" and \"+flashtag+html_escape(toCorrectCase(player2))+flashtag+\" are both disqualified for inactivity in the \"+html_escape(getFullTourName(key))+\" tournament!\", key);\r\n dqboth(player1, player2, key);\r\n }\r\n else if (dq2) {\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player2))+flashtag+\" was disqualified from the \"+html_escape(getFullTourName(key))+\" tournament for inactivity!\", key);\r\n disqualify(player2,key,false,false);\r\n }\r\n else if (dq1) {\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player1))+flashtag+\" was disqualified from the \"+html_escape(getFullTourName(key))+\" tournament for inactivity!\", key);\r\n disqualify(player1,key,false,false);\r\n }\r\n else if ((tours.tour[key].time-parseInt(sys.time(), 10))%60 === 0){\r\n sendAuthPlayers(flashtag+html_escape(toCorrectCase(player1))+flashtag+\" and \"+flashtag+html_escape(toCorrectCase(player2))+flashtag+\" are both active, please battle in the \"+html_escape(getFullTourName(key))+\" tournament ASAP!\", key);\r\n }\r\n // if the round advances due to DQ, don't keep checking :x\r\n if (!tours.tour.hasOwnProperty(key)) {\r\n break;\r\n }\r\n if (tours.tour[key].round !== currentround) {\r\n break;\r\n }\r\n }\r\n }\r\n catch (err) {\r\n sendChanAll(\"Error in process 'removeinactive': \"+err, tourserrchan);\r\n }\r\n}", "function playerSwitch(){\n\n\tif(gameOver() == false){\n\n\t\tcountDownTimer();\n\n\t\tif(currentPlayer == 0){\n\t\t\t\tcurrentPlayer = 1;\n\t\t\t\t$(\".playerOne\").css('color', 'black');\n\t\t\t\t$(\".playerTwo\").css('color', 'red');\n\t\t\t} \n\t\t\t\n\t\telse {\n\t\t\t\tcurrentPlayer = 0;\n\t\t\t\t$(\".playerTwo\").css('color', 'black');\n\t\t\t\t$(\".playerOne\").css('color', 'red');\n\t\t\t}\n\n\t\tsetTimeout(revert, 1000);\t\n\n\t\t}\n\n}", "get activePlayer() {\n return this.players.find(player => player.active === true);\n }", "function takeTurn()\r\n {\r\n player1 = !player1;\r\n\r\n if(currentPlayer() == 1)\r\n {\r\n $(\".turn\").html(\"<p>It is <span class=X>Player1</span>'s turn.</p>\");\r\n }\r\n else\r\n {\r\n $(\".turn\").html(\"<p>It is <span class=O>Player2</span>'s turn.</p>\");\r\n }\r\n }", "function switchCurrentPlayer() {\n\tcurrent = (current.id === 1) ? player2 : player1;\n}", "function MoreThanOnePlayerActive(players, owed)\n{\n\tlet active = 0;\n\t\n\tfor(let i = 0, n = players.length; i < n; i++)\n\t{\n\t\tif(players[i].hand.length > 0 || i == owed)\n\t\t{\n\t\t\tif(++active == 2)\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn false;\n}", "function nextPlayer() {\n diceDOM.style.display = 'none';\n roundScore=0;\n activePlayer === 0? activePlayer =1: activePlayer=0;\n\n document.getElementById('current-0').textContent=0;\n document.getElementById('current-1').textContent=0;\n document.querySelector('.player-0-panel').classList.toggle('active');\n document.querySelector('.player-1-panel').classList.toggle('active');\n\n}", "nextPlayer(){\r\n if (this.turn === 3){\r\n this.turn = 0;\r\n }\r\n else {\r\n this.turn += 1;\r\n }\r\n\r\n if(this.initialPlacementPhase === true){\r\n this.initialPlacementOverCheck();\r\n }\r\n\r\n this.currentPlayer = this.players.array[this.turn];\r\n this.renderPlayerImg();\r\n this.updateTurnOrder();\r\n\r\n if (this.territorySelectedInstance){\r\n this.territorySelectedInstance.tileElement.classList.remove(\"selected\");\r\n this.territorySelectedInstance = null;\r\n this.territorySelected = false;\r\n }\r\n if (this.initialPlacementPhase === false && this.claimTerritoryPhase === false && !this.button){\r\n this.addEndTurnButton();\r\n this.button.innerHTML = \"Place Units\";\r\n }\r\n if (this.placementPhase === true){\r\n this.turnPlaceable = this.currentPlayer.bonusUnits();\r\n this.turnPlaceableEvaluated = true;\r\n }\r\n\r\n this.updateInfoDisplay();\r\n }", "function cambiarTurno() {\n cantTiros = 0;\n deseleccionarDados();\n $(\"#botonTirar\").prop(\"disabled\",false);\n if (jugador === 1) {\n $(\"#player1\").removeClass(\"enJuego\");\n $(\"#player2\").addClass(\"enJuego\");\n jugador = 2;\n $(\"#Info\").html(\"Turno jugador: \" + jugador);\n\n } else {\n $(\"#player2\").removeClass(\"enJuego\");\n $(\"#player1\").addClass(\"enJuego\");\n jugador = 1;\n $(\"#Info\").html(\"Turno jugador: \" + jugador);\n }\n\n}", "function playOn() {\n\nif(slotLeft === color.length){\n $(\".die\").removeClass(color[nextPlayer]);\n\n if (nextPlayer === (color.length - 1)) {\n nextPlayer = 0;\n } else {\n nextPlayer++;\n\n }\n\n $(\".die\").addClass(color[nextPlayer]);\n $(\"h1\").text(`it's your turn ${players[nextPlayer]}`)\n}else{\n slotLeft = color.length;\n if (nextPlayer === (color.length)) {\n nextPlayer = 0;\n }\n $(\".die\").addClass(color[nextPlayer]);\n $(\"h1\").text(`it's your turn ${players[nextPlayer]}`)\n}\n}", "function Game(params) {\n\n // pending/ongoing/checkmate/stalemate/forfeit\n this.status = 'pending';\n\n this.activePlayer = null; //Not needed now\n\n/*\n this.active = null;\n var outerScope = this;\n var activetimer = setInterval(function(){\n if(outerScope.active){\n outerScope.active = false;\n }\n else outerScope.active = true;\n console.log(\"set timer -\" + outerScope.active);\n }, 10000);\n */\n this.players = [\n {color: 'white', name: null, joined: false, inCheck: false, forfeited: false},\n {color: 'black', name: null, joined: false, inCheck: false, forfeited: false},\n {color: 'red', name: null, joined: false, inCheck: false, forfeited: false},\n {color: 'yellow', name: null, joined: false, inCheck: false, forfeited: false}\n ];\n\n this.board = {\n\n a9: null, b9: null, c9: null, d9: null, e9: null, f9: null, g9: null, h9: null,\n i9: null, j9: null, k9: null, l9: null, m9: null, n9: null, o9: null, p9: null,\n q9: null, r9: null, s9:null, t9: null, u9: null, v9: null, w9: null, x9: null,\n y9: null, z9: null,\n a8: null, b8: null, c8: null, d8: null, e8: null, f8:null, g8: null, h8: null,\n i8: null, j8: null, k8: null, l8: null, m8: null, n8: null, o8: null, p8: null,\n q8: null, r8: null, s8: null, t8: null, u8: null, v8: null, w8: null, x8: null,\n y8: null, z8: null,\n a7: null, b7: null, c7: null, d7: null, e7: null, f7: null, g7: null, h7: null,\n i7: null, j7: null, k7: null, l7: null, m7: null, n7: null, o7: null, p7: null,\n q7: null, r7: null, s7: null, t7: null, u7: null, v7: null, w7: null,x7: null,\n y7: null, z7: null,\n a6: null, b6: null, c6: null, d6: null, e6: null, f6: null, g6: null, h6: null,\n i6: null, j6: null, k6: null, l6: null, m6: null, n6: null, o6: null, p6: null,\n q6: null, r6: null, s6: null, t6: null, u6: null, v6: null, w6: null, x6: null,\n y6: null, z6: null,\n a5: null, b5: null, c5: null, d5: null, e5: null, f5: null, g5: null, h5: null,\n i5: null, j5:null, k5: null, l5: null, m5: null, n5: null, o5: null, p5: null,\n q5: null, r5: null, s5: null, t5: null, u5:null, v5: null, w5: null, x5: null,\n y5: null, z5: null,\n a4: null, b4: null, c4: null, d4: null, e4: null, f4: null, g4: null, h4: null,\n i4: null, j4: null, k4: null, l4: null, m4: null, n4: null, o4: null, p4: null,\n q4: null, r4: null, s4: null, t4: null, u4: null, v4: null, w4: null, x4: null,\n y4: null, z4: null,\n a3: null, b3: null, c3: null, d3: null, e3: null, f3: null, g3: null, h3: null,\n i3: null, j3: null, k3: null, l3: null, m3: null, n3: null, o3: null, p3: null,\n q3: null, r3: null, s3: null, t3: null, u3: null, v3: null, w3: null, x3: null,\n y3: null, z3: null,\n a2: null, b2: null, c2: null, d2: null, e2: null, f2: null, g2: null, h2: null,\n i2: null, j2: null, k2: null, l2: null, m2: null, n2: null, o2: null, p2: null,\n q2: null, r2: null, s2: null, t2: null, u2: null, v2: null, w2: null, x2: null,\n y2: null, z2: null,\n a1: null, b1: null, c1: null, d1: null, e1: null, f1: null, g1: null, h1:null,\n i1: null, j1: null, k1: null, l1: null, m1: null, n1: null, o1:null, p1: null,\n q1: null, r1: null, s1: null, t1: null, u1: null, v1: null, w1:null, x1:null,\n y1: null, z1: null,\n a0: null, b0: null, c0:null, d0: null, e0: null, f0:null, g0: null, h0: null,\n i0: null, j0: null, k0:null, l0: null, m0: null, n0: null, o0: null, p0: null,\n q0: null, r0: null, s0: null, t0: null, u0: null, v0: null, w0: null, x0: null,\n y0: null, z0: null };\n\n var pieces =[];\n var staticfactory = new StaticFactory();\n\n pieces.push(staticfactory.createPiece(\"Rook\"));\n console.log(pieces);\n // pieces.push(staticfactory.createPiece(\"Pawn\"));\n //console.log(pieces);\n pieces.push(staticfactory.createPiece(\"Bishop\"));\n console.log(pieces);\n pieces.push(staticfactory.createPiece(\"Queen\"));\n console.log(pieces);\n pieces.push(staticfactory.createPiece(\"Knight\"));\n console.log(pieces);\n var getpositionsforBishop=new GetpositionsforBishop();\n console.log(getpositionsforBishop.posit);\n var getpositionsforRook=new GetpositionsforRook();\n console.log(getpositionsforRook.posit);\n //var getpositionsforQueen=new GetpositionsforQueen();\n var getpositionsforPawn=new GetpositionsforPawn();\n console.log(getpositionsforPawn.posit);\n var getpositionsforKnight=new GetpositionsforKnight();\n console.log(getpositionsforKnight.posit);\n\nfor(var i=0;i<getpositionsforBishop.posit.length;i++)\n{\n this.board[getpositionsforBishop.posit[i]]= pieces[1].idhere;\n}\n\n for( i=0;i<getpositionsforKnight.posit.length;i++)\n {\n this.board[getpositionsforKnight.posit[i]]= pieces[3].idhere;\n }\n for( i=0;i<getpositionsforRook.posit.length;i++)\n {\n this.board[getpositionsforRook.posit[i]]= pieces[0].idhere;\n }\n for( i=0;i<getpositionsforPawn.posit.length;i++)\n {\n this.board[getpositionsforPawn.posit[i]]='sP';\n }\n\n/* for(var i=0;i<getpositionsforBishop.posit.length;i++)\n {\n this.board[getpositionsforBishop.posit[i]]= pieces[1].idhere;\n }\n console.log(getpositionsforBishop.posit);\n\n console.log(getpositionsforRook.posit);\n console.log(getpositionsforPawn.posit);\n console.log(getpositionsforKnight.posit);\n console.log(getpositionsforBishop.posit);*/\n // this.board['a0'] =\n // console.log(pieces);\n\n\n\n //var staticknight = piece.clone();\n\n\n this.capturedPieces = [];\n\n this.validMoves = [\n { type: 'move', pieceCode: 'wK', startSquare: 'a0', endSquare: 'a1' },\n { type: 'move', pieceCode: 'wK', startSquare: 'a0', endSquare: 'b0' },\n { type: 'move', pieceCode: 'wK', startSquare: 'a0', endSquare: 'b1' },\n { type: 'move', pieceCode: 'rK', startSquare: 'z0', endSquare: 'z1' },\n { type: 'move', pieceCode: 'rK', startSquare: 'z0', endSquare: 'y1' },\n { type: 'move', pieceCode: 'rK', startSquare: 'z0', endSquare: 'y0' },\n { type: 'move', pieceCode: 'yK', startSquare: 'a9', endSquare: 'b8' },\n { type: 'move', pieceCode: 'yK', startSquare: 'a9', endSquare: 'b9' },\n { type: 'move', pieceCode: 'yK', startSquare: 'a9', endSquare: 'a8' },\n { type: 'move', pieceCode: 'bK', startSquare: 'z9', endSquare: 'y8' },\n { type: 'move', pieceCode: 'bK', startSquare: 'z9', endSquare: 'y9' },\n { type: 'move', pieceCode: 'bK', startSquare: 'z9', endSquare: 'z8' }\n ];\n\n this.lastMove = null;\n\n this.modifiedOn = Date.now();\n\n // Set player colors\n // params.playerColor is the color of the player who created the game\n if (params.playerColor === 'white') {\n this.players[0].color = 'white';\n this.players[1].color = 'black';\n this.players[2].color = 'red';\n this.players[3].color = 'yellow';\n }\n else if (params.playerColor === 'black') {\n this.players[0].color = 'white';\n this.players[1].color = 'black';\n this.players[2].color = 'red';\n this.players[3].color = 'yellow';\n }\n}", "function runPlayerTurn(currentPlayer, myPlayer, p1, p2, database) {\n\n //check if both players have made moves\n if (p1.move !== '' && p2.move !== '') {\n checkWinner(p1, p2, currentPlayer, database);\n } else if (currentPlayer.name === p1.name) {\n highLight('#playerOne', '#playerTwo');\n if (myPlayer.name === currentPlayer.name) {\n $('#message').text(\"It's your turn!\")\n } else {\n $('#message').text(\"Waiting for \" + p1.name + \" to choose\");\n }\n } else if (currentPlayer.name === p2.name) {\n highLight('#playerTwo', '#playerOne');\n if (myPlayer.name === currentPlayer.name) {\n $('#message').text(\"It's your turn!\")\n } else {\n $('#message').text(\"Waiting for \" + p2.name + \" to choose\");\n }\n\n }\n}", "function playerOneMadeChoice() {\n console.log(\"this is the player 1 choice: \", player1.choice);\n player1.choice ? true : false;\n }", "function nextPlayer() {\n activePlayer === 0 ? activePlayer = 1 : activePlayer = 0;\n roundScore = 0;\n\n document.getElementById('current-0').textContent = '0';\n document.getElementById('current-1').textContent = '0';\n\n document.querySelector('player-0-panel').classList.remove('active'); \n document.querySelector('player-1-panel').classList.add('active');\n\n document.querySelector('.dice').style.display = 'none';\n}", "function C101_KinbakuClub_RopeGroup_PlayerLockedAway() {\n\tC101_KinbakuClub_Slaves_CurrentStage = 116;\n\tSetScene(CurrentChapter, \"Slaves\");\n}", "function nextPlayer() {\n activePlayer === 0 ? activePlayer =1 : activePlayer = 0;\n roundScore = 0;\n //This is expanded version\n /* if(activePlayer ===0){\n activePlayer = 1;\n } else {\n activePlayer = 0;\n } */\n document.getElementById(\"current-0\").textContent = \"0\";\n document.getElementById(\"current-1\").textContent = \"0\";\n \n document.querySelector(\".player-0-panel\").classList.toggle(\"active\");\n document.querySelector(\".player-1-panel\").classList.toggle(\"active\");\n}", "async function selectTops(e) {\r\n //Will not let the player change cards once the game has started\r\n if (!game_started) {\r\n var this_value = $(e).attr(\"alt\");\r\n if (this_value !== \"deck\") {\r\n $(\".start-menu\").css(\"display\", \"none\");\r\n var temp = players[0].top.filter(val => val !== this_value);\r\n players[0].top = temp;\r\n players[0].hand.push(this_value);\r\n $(e).attr(\"src\", \"images/deck_01.svg\");\r\n $(e).attr(\"alt\", \"deck\");\r\n newCards();\r\n }\r\n }\r\n }", "function switchPlayer() {\n document.querySelector('.player-' + activePlayer + '-panel')\n .classList.toggle('active');\n // active player is being switched\n activePlayer === 0 ? activePlayer = 1 : activePlayer = 0;\n document.querySelector('.player-' + activePlayer + '-panel')\n .classList.toggle('active');\n}", "function chooseMove() {\n if (state.turnCount === 20) {\n alert('You win!');\n return reset();\n }\n var choice = getRandomInt(0, buttons.options.length - 1);\n state.moves.push(buttons.options[choice]);\n playBack(state.moves);\n state.turnCount++;\n if (state.turnCount >= 10) state.playbackSpeed -= 40;\n turnCount();\n state.playerCount = 0;\n }", "function get_result(){\n \n if(window.my_player == window.cur_player){\n \n $('#pass').removeAttr(\"disabled\"); \n }else{\n $('#pass').attr('disabled','disabled'); \n }\n \n $(\"#cur_player\").html(window.cur_player + ' Turn !');\n black_peices = $(\"div[player=black]\").length;\n red_peices = $(\"div[player=red]\").length;\n \n $(\"#result\").html(\"black : \" + black_peices + \" , red: \" + red_peices);\n \n if(black_peices == 0){\n if(window.my_player == 'black'){\n show_lose();\n }else{\n show_win(); \n }\n }\n \n \n if(red_peices == 0){\n if(window.my_player == 'red'){\n show_lose();\n }else{\n \n show_win();\n }\n }\n \n \n}", "function checkMultiplayer(){\n setTimeout(switchMultiplayerPlayer)\n setTimeout(checkMultiplayerVictory)\n cont=cont+1\n}", "function win1(val){ return setPlayer1.indexOf(val) >= 0; }", "function stay() {\r\n if (!gameInProgress) return alert(\"Game has finished, please start a new game\");\r\n //checking whether there are players left to act \r\n const check = utilFunctions.players.filter(player => player.isAlive)\r\n if (check.length >= 1){\r\n alert(`Player ${utilFunctions.determineCurrentPlayer().name} is next`);\r\n }\r\n else{\r\n // ending the game in case where everyone has acted\r\n utilFunctions.completeDealerCards()\r\n for (let player of utilFunctions.players){\r\n //checking who has won based on their regular and split cards result \r\n if (player.splitSum > 0) {\r\n player.isSplit = false\r\n utilFunctions.determineWinners(player, player.splitSum)\r\n }\r\n player.isAlive = false\r\n utilFunctions.determineWinners(player, player.sum)\r\n }\r\n utilFunctions.startOver()\r\n gameInProgress = false\r\n }\r\n}", "choosePlayer() {\n player.sprite = document.formular.player.value;\n player.moves = true;\n }", "function selectPlayer() {\n\t\t\t$('.hero_villain').remove();\n\t\t\tnewHtml = '<div id=\"player0\" class=\"player\"></div>';\n\t\t\tnewHtml = newHtml + '<div id=\"player1\" class=\"player\"></div>';\n\t\t\tnewHtml = newHtml + '<div id=\"player2\" class=\"player\"></div>';\n\t\t\t$(newHtml).insertAfter('article');\n\t\t\t$.each(playerCharacters, function (index) {\n\t\t\t\tcurrId = '#player'+index;\n\t\t\t\tnewHtml = '<image src=\"' + playerCharacters[index].characterPhoto + '\" alt = \"' + playerCharacters[index].characterName + '\">';\n\t\t\t\tnewHtml = newHtml + '<h3>' + playerCharacters[index].characterName + '</h3>';\n\t\t\t\tnewHtml = newHtml + '<p>Current Health: ' + playerCharacters[index].characterHealthPoints + '</p>';\n\t\t\t\t$(currId).html(newHtml); \n\t\t\t});\n\t\t\t$('#message').html('Click to choose your character.');\n\t\t}", "function playerWin() {\n game.isPlayersTurn = false;\n holdButtonFunctons = true;\n updateLED('WIN!');\n blinkLED(3);\n setTimeout(function() {\n holdButtonFunctons = false;\n startGame();\n }, 4000);\n}", "function randomStartingPlayer() {\n const possibleTurns = ['x', 'o'];\n let index = Math.floor(Math.random() * possibleTurns.length);\n let firstTurn = possibleTurns[index];\n if (firstTurn === playerOne.marker) {\n playerOne.playerTurn = true;\n return playerOne.nameText;\n } else {\n playerTwo.playerTurn = true;\n return playerTwo.nameText;\n }\n}", "function playerTurn() {\n currPlayer === player1\n ? $(\".p2\").addClass(\"lowOpacity\") &&\n $(\".p1\").removeClass(\"lowOpacity\")\n : $(\".p1\").addClass(\"lowOpacity\") &&\n $(\".p2\").removeClass(\"lowOpacity\");\n }", "checkIfPlayersTurn (playerId) {\n return playerId === this.currentTurn\n }", "function turnChange() {\n if (turnTracker === 1) {\n playerOneName[0].classList.remove(\"active\");\n playerTwoName[0].classList.add(\"active\");\n turnTracker = 2;\n }\n else {\n playerTwoName[0].classList.remove(\"active\");\n playerOneName[0].classList.add(\"active\");\n turnTracker = 1;\n }\n}", "function nextPlayer() {\n //next player\n activePlayer === 0 ? (activePlayer = 1) : (activePlayer = 0);\n roundScore = 0;\n document.getElementById(\"current-0\").textContent = \"0\";\n document.getElementById(\"current-1\").textContent = \"0\";\n document.querySelector(\".player-0-panel\").classList.toggle(\"active\");\n document.querySelector(\".player-1-panel\").classList.toggle(\"active\");\n // document.querySelector(\".dice\").style.cssText = \"display: none; \";\n}", "function determineStartingPlayer()\n{\n // @TODO: Random laten bepalen welke speler aan de beurt is of mag beginnen\n \n}", "function initializePlayer() {\n SPF_CurrentlySelectedItem = $gameParty.allItems()[0];\n }", "function switchPlayerTurn() {\r\n if ( $playerOne.hasClass('active') ) {\r\n $playerOne.removeClass(\"active\");\r\n $playerTwo.addClass(\"active\");\r\n $play1NameInput.removeClass('active');\r\n $play2NameInput.addClass('active');\r\n } else {\r\n $playerTwo.removeClass(\"active\");\r\n $playerOne.addClass(\"active\");\r\n $play2NameInput.removeClass('active');\r\n $play1NameInput.addClass('active');\r\n }\r\n }", "function updateActivePlayer() {\n activePlayer = (activePlayer == 0) ? (activePlayer = 1) : (activePlayer = 0);\n // console.log(\"active player = \" + activePlayer);\n displayActivePlayer();\n}", "function activePlayer(btn) {\n if (status === \"over\") {\n $(\"button.\" + btn).removeClass(\"active\");\n $(\"button.\" + btn).addClass(\"disabled\");\n $(\"p\").css(\"display\", \"none\");\n return;\n }\n if (count < 9) {\n if (btn === \"X\") {\n $(\"button.X\").removeClass(\"disabled\");\n $(\"button.X\").addClass(\"active\");\n $(\"button.O\").removeClass(\"active\");\n $(\"button.O\").addClass(\"disabled\");\n } else {\n $(\"button.O\").removeClass(\"disabled\");\n $(\"button.O\").addClass(\"active\");\n $(\"button.X\").removeClass(\"active\");\n $(\"button.X\").addClass(\"disabled\");\n }\n $(\"p\").text(\"Next move by : \" + btn);\n }\n}", "function checkTurn() {\n\n if (actingPlayer === turnOf && alreadyTakenTurn === true) {\n cycleTurn();\n } else if (actingPlayer === turnOf && alreadyTakenTurn === false) {\n alreadyTakenTurn = true;\n }\n}", "function ghostTargeting(){\r\n\t\tvar numberOfPlayersPlaying = 0;\r\n\t\t\r\n\t\tfor(var x=0;x< Players.length;x++)\r\n\t\t\tif(Players[x] != null && PlayersTables[Players[x].position].status == \"Still Playing\")\r\n\t\t\t\tnumberOfPlayersPlaying++;\r\n\t\t\t\r\n\t\tvar target= Math.floor(Math.random()*numberOfPlayersPlaying-1)+1;\r\n\t\tvar position = 0, count = 0;\t\t\r\n\t\t\r\n\t\tfor(var x=0;x< Players.length;x++)\r\n\t\t\tif(Players[x] != null && PlayersTables[Players[x].position].status == \"Still Playing\"){\r\n\t\t\t\tcount++;\r\n\t\t\t\t\r\n\t\t\t\tif(count == target) return Players[x].position\r\n\t\t\t\telse position = Players[x].position;\r\n\t\t\t}\r\n\t\treturn position;\r\n\t}", "function selectPlayer(id){\r\n $(\".single-player\").removeClass('active-player-1');\r\n $(\".single-player\").removeClass('active-player-2');\r\n if(player1){\r\n $(\"div[data-id='\" + id +\"']\").addClass(\"active-player-2\");\r\n }else{\r\n $(\"div[data-id='\" + id +\"']\").addClass(\"active-player-1\");\r\n }\r\n}", "switchPlayersTurn(){\n if (this.currPlayerTurn === 1)\n this.playerTurn = 2;\n else\n this.playerTurn = 1;\n }", "function changePlayer() {\n player = player + 1;\n }", "continueGame () {\n if (this.pauseTimer > 0) return\n if (this.lives > 0) {\n this.startGame(false)\n }\n }" ]
[ "0.65141547", "0.64890766", "0.64845914", "0.6436894", "0.6434149", "0.64063746", "0.6380243", "0.63558877", "0.6295079", "0.62878644", "0.6280197", "0.62646747", "0.6206114", "0.6193372", "0.6191427", "0.61905575", "0.61903226", "0.61745965", "0.61230934", "0.6122073", "0.61182505", "0.6112995", "0.60883576", "0.6084493", "0.6081211", "0.60783654", "0.6056293", "0.60483396", "0.6028694", "0.60282105", "0.6016939", "0.6015946", "0.5997855", "0.59922457", "0.5991532", "0.5991438", "0.5989534", "0.59868747", "0.5985243", "0.5978967", "0.5976766", "0.5976544", "0.59765166", "0.59706354", "0.5970308", "0.5965537", "0.5953657", "0.5953582", "0.5951209", "0.59497", "0.5940037", "0.59368443", "0.59363985", "0.5932724", "0.59201306", "0.5912558", "0.5910222", "0.59080595", "0.5898665", "0.5897413", "0.58923554", "0.587572", "0.5871856", "0.58682144", "0.58673984", "0.5866741", "0.58666533", "0.5862595", "0.586127", "0.5858798", "0.5854817", "0.5849659", "0.58485514", "0.5845889", "0.58387744", "0.5837019", "0.58353585", "0.58330387", "0.58329266", "0.5823667", "0.582059", "0.58199084", "0.5819279", "0.5818386", "0.5818359", "0.5816825", "0.5814774", "0.5812659", "0.5812487", "0.58052516", "0.580478", "0.5800013", "0.57992655", "0.5798398", "0.5797247", "0.5792368", "0.5791561", "0.57909775", "0.57900673", "0.5781214" ]
0.61681527
18
Define the verticies of our quad We'll never change our attribute buffer.
function CreateVertexBuffer(gl, a_vertexLoc) { var data = [ 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0 ]; var buffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.STATIC_DRAW); gl.vertexAttribPointer(a_vertexLoc, 2, gl.FLOAT, false, 0, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set Quad(value) {}", "function Quad() { return [-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0] }", "function Quad() { return [-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0] }", "function initQuad() {\n VertexPositionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, VertexPositionBuffer);\n vertices = [\n 1.0, 1.0, 0.0,\n -1.0, 1.0, 0.0,\n 1.0, -1.0, 0.0,\n -1.0, -1.0, 0.0\n ];\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n VertexPositionBuffer.itemSize = 3;\n VertexPositionBuffer.numItems = 4;\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, VertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);\n\tgl.enableVertexAttribArray(0);\n}", "function Quad() { return [\n -1.0, -1.0,\n 1.0, -1.0,\n -1.0, 1.0,\n\n -1.0, 1.0,\n 1.0, 1.0,\n 1.0, -1.0]\n }", "function Quad() { return [\n -1.0, -1.0,\n 1.0, -1.0,\n -1.0, 1.0,\n\n -1.0, 1.0,\n 1.0, 1.0,\n 1.0, -1.0]\n }", "function initQuad() {\n quad.texBuffer = bufferData(2, quad.tex);\n quad.centerBuffer = bufferData(3, quad.center);\n }", "get Quad() {}", "initBuffers() {\n let tmp;\n const gl = this.gl;\n\n // Create vertex position buffer.\n this.quadVPBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quadVPBuffer);\n tmp = [1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, -1.0, -1.0, 0.0];\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(tmp), gl.STATIC_DRAW);\n this.quadVPBuffer.itemSize = 3;\n this.quadVPBuffer.numItems = 4;\n\n /*\n +--------------------+\n | -1,1 (1) | 1,1 (0)\n | |\n | |\n | |\n | |\n | |\n | -1,-1 (3) | 1,-1 (2)\n +--------------------+\n */\n\n const scaleX = 1.0;\n const scaleY = 1.0;\n\n // Create vertex texture coordinate buffer.\n this.quadVTCBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quadVTCBuffer);\n tmp = [scaleX, 0.0, 0.0, 0.0, scaleX, scaleY, 0.0, scaleY];\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(tmp), gl.STATIC_DRAW);\n }", "constructor() // etc) smaller and more cache friendly.\n { super( \"positions\", \"normals\", \"texture_coords\" );\n var size = 0.8; // Name the values we'll define per each vertex.\n this.positions .push( ...Vec.cast( [-size,-size,0], [size,-size,0], [-size,size,0], [size,size,0] ) ); // Specify the 4 square corner locations.\n this.normals .push( ...Vec.cast( [0,0,1], [0,0,1], [0,0,1], [0,0,1] ) ); // Match those up with normal vectors.\n this.texture_coords.push( ...Vec.cast( [0,0], [1,0], [0,1], [1,1] ) ); // Draw a square in texture coordinates too.\n this.indices .push( 0, 1, 2, 1, 2, 3 ); // Two triangles this time, indexing into four distinct vertices.\n }", "constructor() // etc) smaller and more cache friendly.\r\n { super( \"positions\", \"normals\", \"texture_coords\" ); // Name the values we'll define per each vertex.\r\n this.positions .push( ...Vec.cast( [-1,-1,0], [1,-1,0], [-1,1,0], [1,1,0] ) ); // Specify the 4 square corner locations.\r\n this.normals .push( ...Vec.cast( [0,0,1], [0,0,1], [0,0,1], [0,0,1] ) ); // Match those up with normal vectors.\r\n this.texture_coords.push( ...Vec.cast( [0,0], [1,0], [0,1], [1,1] ) ); // Draw a square in texture coordinates too.\r\n this.indices .push( 0, 1, 2, 1, 3, 2 ); // Two triangles this time, indexing into four distinct vertices.\r\n }", "function quad(a, b, c, d, color) {\n pointsArray.push(vertices[a]);\n colorsArray.push(vertexColors[color]);\n pointsArray.push(vertices[b]);\n colorsArray.push(vertexColors[color]);\n pointsArray.push(vertices[c]);\n colorsArray.push(vertexColors[color]);\n pointsArray.push(vertices[a]);\n colorsArray.push(vertexColors[color]);\n pointsArray.push(vertices[c]);\n colorsArray.push(vertexColors[color]);\n pointsArray.push(vertices[d]);\n colorsArray.push(vertexColors[color]);\n numVertices += 6;\n}", "function drawQuad() {\n setMV();\n Quad.draw();\n}", "function quad(a, b, c, d) \n{\n\n\n var indices = [ a, b, c, a, c, d ];\n\n for ( var i = 0; i < indices.length; ++i ) {\n points.push( vertices[indices[i] + v0] );\n // for solid colored faces use\n colors.push(vertexColors[a + v0]); //** CORRECTED\n }\n\n numPoints += indices.length;\n //console.log(\" \");\n //console.log(numPoints);\n //console.log(points.length);\n}", "constructor() {\n super(\"position\", \"normal\", \"texture_coord\");\n // Specify the 4 square corner locations, and match those up with normal vectors:\n this.arrays.position = Vec.cast(\n [-1, -1, 0],\n [1, -1, 0],\n [-1, 1, 0],\n [1, 1, 0]\n );\n this.arrays.normal = Vec.cast([0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1]);\n // Arrange the vertices into a square shape in texture space too:\n this.arrays.texture_coord = Vec.cast([0, 0], [1, 0], [0, 1], [1, 1]);\n // Use two triangles this time, indexing into four distinct vertices:\n this.indices.push(0, 1, 2, 1, 3, 2);\n }", "function quad(vertices, points, vertex, v1, v2, v3, v4, coordinate){\n if(coordinate == 0)\n {\n\t vertex.push(vec2(0,0));\n\t vertex.push(vec2(1,0));\n\t vertex.push(vec2(1,1));\n\t vertex.push(vec2(0,0));\n\t vertex.push(vec2(1,1));\n\t vertex.push(vec2(0,1));\n\t}\n\telse\n\t{\n\t vertex.push(vec2(0.5-coordinate,0.5-coordinate));\n\t vertex.push(vec2(1.5+coordinate,0.5-coordinate));\n\t vertex.push(vec2(1.5+coordinate,1.5+coordinate));\n\t vertex.push(vec2(0.5-coordinate,0.5-coordinate));\n\t vertex.push(vec2(1.5+coordinate,1.5+coordinate));\n\t vertex.push(vec2(0.5-coordinate,1.5+coordinate));\n\t}\n\t\n\t// push points\n points.push(vertices[v1]);\n points.push(vertices[v3]);\n points.push(vertices[v4]);\n points.push(vertices[v1]);\n points.push(vertices[v4]);\n points.push(vertices[v2]);\n}", "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 }", "function QuadIndices() {\n\n /**\n * The list of quadrilateral indices.\n * @private\n * @type {Array}\n */\n this._indicesQuads = [];\n }", "function pushQuad(v, p1, p2, p3, p4) {\n v.push(p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9], p1[10], p1[11]);\n v.push(p2[0], p2[1], p2[2], p2[3], p2[4], p2[5], p2[6], p2[7], p2[8], p2[9], p2[10], p2[11]);\n v.push(p3[0], p3[1], p3[2], p3[3], p3[4], p3[5], p3[6], p3[7], p3[8], p3[9], p3[10], p3[11]);\n \n v.push(p3[0], p3[1], p3[2], p3[3], p3[4], p3[5], p3[6], p3[7], p3[8], p3[9], p3[10], p3[11]);\n v.push(p4[0], p4[1], p4[2], p4[3], p4[4], p4[5], p4[6], p4[7], p4[8], p4[9], p4[10], p4[11]);\n v.push(p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8], p1[9], p1[10], p1[11]);\n}", "_createMesh() {\n var element = this._element;\n var w = element.calculatedWidth;\n var h = element.calculatedHeight;\n\n var r = this._rect;\n\n // Note that when creating a typed array, it's initialized to zeros.\n // Allocate memory for 4 vertices, 8 floats per vertex, 4 bytes per float.\n var vertexData = new ArrayBuffer(4 * 8 * 4);\n var vertexDataF32 = new Float32Array(vertexData);\n\n // Vertex layout is: PX, PY, PZ, NX, NY, NZ, U, V\n // Since the memory is zeroed, we will only set non-zero elements\n\n // POS: 0, 0, 0\n vertexDataF32[5] = 1; // NZ\n vertexDataF32[6] = r.x; // U\n vertexDataF32[7] = r.y; // V\n\n // POS: w, 0, 0\n vertexDataF32[8] = w; // PX\n vertexDataF32[13] = 1; // NZ\n vertexDataF32[14] = r.x + r.z; // U\n vertexDataF32[15] = r.y; // V\n\n // POS: w, h, 0\n vertexDataF32[16] = w; // PX\n vertexDataF32[17] = h; // PY\n vertexDataF32[21] = 1; // NZ\n vertexDataF32[22] = r.x + r.z; // U\n vertexDataF32[23] = r.y + r.w; // V\n\n // POS: 0, h, 0\n vertexDataF32[25] = h; // PY\n vertexDataF32[29] = 1; // NZ\n vertexDataF32[30] = r.x; // U\n vertexDataF32[31] = r.y + r.w; // V\n\n var vertexDesc = [\n { semantic: SEMANTIC_POSITION, components: 3, type: TYPE_FLOAT32 },\n { semantic: SEMANTIC_NORMAL, components: 3, type: TYPE_FLOAT32 },\n { semantic: SEMANTIC_TEXCOORD0, components: 2, type: TYPE_FLOAT32 }\n ];\n\n var device = this._system.app.graphicsDevice;\n var vertexFormat = new VertexFormat(device, vertexDesc);\n var vertexBuffer = new VertexBuffer(device, vertexFormat, 4, BUFFER_STATIC, vertexData);\n\n var mesh = new Mesh(device);\n mesh.vertexBuffer = vertexBuffer;\n mesh.primitive[0].type = PRIMITIVE_TRIFAN;\n mesh.primitive[0].base = 0;\n mesh.primitive[0].count = 4;\n mesh.primitive[0].indexed = false;\n mesh.aabb.setMinMax(Vec3.ZERO, new Vec3(w, h, 0));\n\n this._updateMesh(mesh);\n\n return mesh;\n }", "initBuffers() {\n var geometry = this.geometry;\n var dynamicOffset = 0;\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer_1.Buffer(WebGLSettings_1.WebGLSettings.createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n this.dynamicStride = 0;\n for (var i = 0; i < this.dynamicProperties.length; ++i) {\n var property = this.dynamicProperties[i];\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer_1.Buffer(this.dynamicData, false, false);\n // static //\n var staticOffset = 0;\n this.staticStride = 0;\n for (var i$1 = 0; i$1 < this.staticProperties.length; ++i$1) {\n var property$1 = this.staticProperties[i$1];\n property$1.offset = staticOffset;\n staticOffset += property$1.size;\n this.staticStride += property$1.size;\n }\n var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer_1.Buffer(this.staticData, true, false);\n for (var i$2 = 0; i$2 < this.dynamicProperties.length; ++i$2) {\n var property$2 = this.dynamicProperties[i$2];\n geometry.addAttribute(property$2.attributeName, this.dynamicBuffer, 0, property$2.type === WebGLSettings_1.WebGLSettings.TYPES.UNSIGNED_BYTE, property$2.type, this.dynamicStride * 4, property$2.offset * 4);\n }\n for (var i$3 = 0; i$3 < this.staticProperties.length; ++i$3) {\n var property$3 = this.staticProperties[i$3];\n geometry.addAttribute(property$3.attributeName, this.staticBuffer, 0, property$3.type === WebGLSettings_1.WebGLSettings.TYPES.UNSIGNED_BYTE, property$3.type, this.staticStride * 4, property$3.offset * 4);\n }\n }", "function t$b(t,d){1===d.attributeTextureCoordinates&&(t.attributes.add(\"uv0\",\"vec2\"),t.varyings.add(\"vuv0\",\"vec2\"),t.vertex.code.add(t$i`void forwardTextureCoordinates() {\nvuv0 = uv0;\n}`)),2===d.attributeTextureCoordinates&&(t.attributes.add(\"uv0\",\"vec2\"),t.varyings.add(\"vuv0\",\"vec2\"),t.attributes.add(\"uvRegion\",\"vec4\"),t.varyings.add(\"vuvRegion\",\"vec4\"),t.vertex.code.add(t$i`void forwardTextureCoordinates() {\nvuv0 = uv0;\nvuvRegion = uvRegion;\n}`)),0===d.attributeTextureCoordinates&&t.vertex.code.add(t$i`void forwardTextureCoordinates() {}`);}", "function quad(a, b, c, d) {\n var t1 = subtract(vertices[b], vertices[a]);\n var t2 = subtract(vertices[c], vertices[b]);\n var normal = vec4(cross(t1, t2), 0);\n\n pointsArray.push(vertices[a]); \n normalsArray.push(normal); \n pointsArray.push(vertices[b]); \n normalsArray.push(normal); \n pointsArray.push(vertices[c]); \n normalsArray.push(normal); \n pointsArray.push(vertices[a]); \n normalsArray.push(normal); \n pointsArray.push(vertices[c]); \n normalsArray.push(normal); \n pointsArray.push(vertices[d]); \n normalsArray.push(normal); \n}", "function pushQuad(v, p1, p2, p3, p4) {\n v.push(p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8]);\n v.push(p2[0], p2[1], p2[2], p2[3], p2[4], p2[5], p2[6], p2[7], p2[8]);\n v.push(p3[0], p3[1], p3[2], p3[3], p3[4], p3[5], p3[6], p3[7], p3[8]);\n\n v.push(p3[0], p3[1], p3[2], p3[3], p3[4], p3[5], p3[6], p3[7], p3[8]);\n v.push(p4[0], p4[1], p4[2], p4[3], p4[4], p4[5], p4[6], p4[7], p4[8]);\n v.push(p1[0], p1[1], p1[2], p1[3], p1[4], p1[5], p1[6], p1[7], p1[8]);\n}", "updateTexCoords() \n {\n this.quad.updateTexCoords(this.texCoords);\n }", "build() {\n var points = this.points;\n if (!points) {\n return;\n }\n var vertexBuffer = this.getAttribute('aVertexPosition');\n var uvBuffer = this.getAttribute('aTextureCoord');\n var indexBuffer = this.getIndex();\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1) {\n return;\n }\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length) {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n var uvs = uvBuffer.data;\n var indices = indexBuffer.data;\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n // indices[0] = 0;\n // indices[1] = 1;\n var total = points.length; // - 1;\n for (var i = 0; i < total; i++) {\n // time to do some smart drawing!\n var index = i * 4;\n var amount = i / (total - 1);\n uvs[index] = amount;\n uvs[index + 1] = 0;\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n var indexCount = 0;\n for (var i$1 = 0; i$1 < total - 1; i$1++) {\n var index$1 = i$1 * 2;\n indices[indexCount++] = index$1;\n indices[indexCount++] = index$1 + 1;\n indices[indexCount++] = index$1 + 2;\n indices[indexCount++] = index$1 + 2;\n indices[indexCount++] = index$1 + 1;\n indices[indexCount++] = index$1 + 3;\n }\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n this.updateVertices();\n }", "constructor(_shader) {\n this.shader = _shader;\n // Creating vertex buffers.\n let vertices = new Float32Array([\n 1.0, 1.0, 0.0, // top right\n -1.0, 1.0, 0.0, // top left\n -1.0,-1.0, 0.0, // bottom left\n 1.0,-1.0, 0.0, // bottom right\n ]);\n let uvs = new Float32Array([\n 1.0, 0.0, \n 0.0, 0.0,\n 0.0, 1.0, \n 1.0, 1.0,\n ]);\n let indices = new Int8Array([\n 0,1,2,\n 0,2,3,\n ]);\n\n this.vertexBuffer = gl.createBuffer();\n this.uvBuffer = gl.createBuffer();\n this.indexBuffer = gl.createBuffer();\n\n // Create and bind new VAO\n this.vao = gl.createVertexArray();\n gl.bindVertexArray(this.vao);\n\n // Load indice data\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW, 0);\n\n // Load vertice data\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW, 0);\n let posLoc = this.shader.attribSpecs[\"a_Pos\"].location;\n gl.vertexAttribPointer(posLoc, 3, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(posLoc);\n\n // Load UV data\n gl.bindBuffer(gl.ARRAY_BUFFER, this.uvBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, uvs, gl.STATIC_DRAW, 0);\n let uvLoc = this.shader.attribSpecs[\"a_Texcoord\"].location;\n gl.vertexAttribPointer(uvLoc, 2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(uvLoc);\n\n gl.bindVertexArray(null);\n }", "function quad(a, b, c, d)\r\n{\r\n var verts = [];\r\n\r\n var vertices = [\r\n vec4(-0.5, -0.5, 0.5, 1.0),\r\n vec4(-0.5, 0.5, 0.5, 1.0),\r\n vec4(0.5, 0.5, 0.5, 1.0),\r\n vec4(0.5, -0.5, 0.5, 1.0),\r\n vec4(-0.5, -0.5, -0.5, 1.0),\r\n vec4(-0.5, 0.5, -0.5, 1.0),\r\n vec4(0.5, 0.5, -0.5, 1.0),\r\n vec4(0.5, -0.5, -0.5, 1.0)\r\n ];\r\n\r\n var indices = [a, b, c, a, c, d];\r\n\r\n for (var i = 0; i < indices.length; ++i) {\r\n verts.push(vertices[indices[i]]);\r\n }\r\n\r\n return verts;\r\n}", "function quad(a, b, c, d) {\r\n\t//calcoliamo info normali\r\n var t1 = m4.subtractVectors(vertices_floor[b], vertices_floor[a]);\r\n var t2 = m4.subtractVectors(vertices_floor[c], vertices_floor[b]);\r\n var normal=[];\r\n normal = normalize(m4.cross(t1, t2, normal));\r\n\t\r\n\t//Il calcolo dei vettori tangenti non è così semplice come il vettore normale\r\n\t//Sostanzialmente possiamo osservare che la direzione del vettore tangente si allinea con la direzione in cui definiamo le coordinate della texture di una superficie\r\n\t//possiamo calcolare tangenti e bitangenti dai vertici di un triangolo e le sue coordinate texture (poiché le coordinate uv sono nello stesso spazio dei vettori tangenti) \r\n\t\r\n\ttangent1 = new Array();\r\n\ttangent2 = new Array();\r\n\t\r\n\tdeltaUV1 = new Array();\r\n\tdeltaUV2 = new Array();\r\n\t\r\n\tedge1=new Array();\r\n\tedge2=new Array();\r\n\r\n\t\r\n\t//triangle 1\r\n\tedge1[0]=vertices_floor[b][0]-vertices_floor[c][0];\r\n\tedge1[1]=vertices_floor[b][1]-vertices_floor[c][1];\r\n\tedge1[2]=vertices_floor[b][2]-vertices_floor[c][2];\r\n\tedge2[0]=vertices_floor[a][0]-vertices_floor[c][0];\r\n\tedge2[1]=vertices_floor[a][1]-vertices_floor[c][1];\r\n\tedge2[2]=vertices_floor[a][2]-vertices_floor[c][2];\r\n\t\r\n\tdeltaUV1[0]= uv2[0]-uv1[0];\r\n deltaUV1[1]= uv2[1]-uv1[1];\r\n\tdeltaUV2[0]= uv3[0]-uv1[0];\r\n\tdeltaUV2[1]= uv3[1]-uv1[1];\r\n\t\r\n\tf = 1.0 / (deltaUV1[0] * deltaUV2[1]- deltaUV2[0]* deltaUV1[1]);\r\n\t\r\n\t//calcoliamo informazione tangente per i vertici primo triangolo\r\n tangent1[0] = f * (deltaUV2[1] * edge1[0] - deltaUV1[1] * edge2[0]);\r\n tangent1[1] = f * (deltaUV2[1] * edge1[1] - deltaUV1[1] * edge2[1]);\r\n tangent1[2] = f * (deltaUV2[1] * edge1[2] - deltaUV1[1] * edge2[2]);\r\n\ttangent1=normalize(tangent1);\r\n\t\r\n vertices_floor_array.push(vertices_floor[a],vertices_floor[b],vertices_floor[c]);\r\n\ttexcoord2D_floor_array.push(uv_floor[a],uv_floor[b],uv_floor[c])\r\n normals_floor_array.push(normal,normal,normal); \r\n\ttangent_floor_array.push(tangent1,tangent1,tangent1);\r\n\r\n\t//triangle 2\r\n\tedge1[0]=vertices_floor[a][0]-vertices_floor[c][0];\r\n\tedge1[1]=vertices_floor[a][1]-vertices_floor[c][1];\r\n\tedge1[2]=vertices_floor[a][2]-vertices_floor[c][2];\r\n\tedge2[0]=vertices_floor[d][0]-vertices_floor[c][0];\r\n\tedge2[1]=vertices_floor[d][1]-vertices_floor[c][1];\r\n\tedge2[2]=vertices_floor[d][2]-vertices_floor[c][2];\r\n\t\r\n\tdeltaUV1[0]= uv3[0]-uv1[0];\r\n deltaUV1[1]= uv3[1]-uv1[1];\r\n\tdeltaUV2[0]= uv4[0]-uv1[0];\r\n\tdeltaUV2[1]= uv4[1]-uv1[1];\r\n\t\r\n\tf = 1.0 / (deltaUV1[0] * deltaUV2[1]- deltaUV2[0]* deltaUV1[1]);\r\n\r\n\t//calcoliamo informazione tangente per i vertici secondo triangolo\r\n tangent2[0] = f * (deltaUV2[1] * edge1[0] - deltaUV1[1] * edge2[0]);\r\n tangent2[1] = f * (deltaUV2[1] * edge1[1] - deltaUV1[1] * edge2[1]);\r\n tangent2[2] = f * (deltaUV2[1] * edge1[2] - deltaUV1[1] * edge2[2]);\r\n\ttangent2=normalize(tangent2);\r\n\t\r\n vertices_floor_array.push(vertices_floor[a],vertices_floor[c],vertices_floor[d]);\r\n\ttexcoord2D_floor_array.push(uv_floor[a],uv_floor[c],uv_floor[d])\r\n normals_floor_array.push(normal,normal,normal); \r\n\ttangent_floor_array.push(tangent2,tangent2,tangent2); \r\n}", "function make_quad_index_buffer(len) {\n let index = (4*len < 65536 ? new Uint16Array(6*len)\n : new Uint32Array(6*len));\n const vert_order = [0, 1, 2, 0, 2, 3];\n for (let i = 0; i < len; i++) {\n for (let j = 0; j < 6; j++) {\n index[6*i+j] = 4*i + vert_order[j];\n }\n }\n return new BufferAttribute(index, 1);\n}", "static setQV_xyzw(qv, x, y, z, w) {\nqv[0] = x;\nqv[1] = y;\nqv[2] = z;\nqv[3] = w;\nreturn qv;\n}", "constructor(w, h, d) {\n this.w = w;\n this.h = h;\n this.d = d;\n\n // Colors are hardcoded\n quadBG[0] = color(0);\n quadBG[1] = color(51);\n quadBG[2] = color(102);\n quadBG[3] = color(153);\n quadBG[4] = color(204);\n quadBG[5] = color(255);\n\n velocity = random3D();\n // Random rotation\n rotation = (random(40, 100), random(40, 100), random(40, 100));\n\n // cube composed of 6 quads\n //front\n vertices[0] = (-w / 2, -h / 2, d / 2);\n vertices[1] = (w / 2, -h / 2, d / 2);\n vertices[2] = (w / 2, h / 2, d / 2);\n vertices[3] = (-w / 2, h / 2, d / 2);\n //left\n vertices[4] = (-w / 2, -h / 2, d / 2);\n vertices[5] = (-w / 2, -h / 2, -d / 2);\n vertices[6] = (-w / 2, h / 2, -d / 2);\n vertices[7] = (-w / 2, h / 2, d / 2);\n //right\n vertices[8] = (w / 2, -h / 2, d / 2);\n vertices[9] = (w / 2, -h / 2, -d / 2);\n vertices[10] = (w / 2, h / 2, -d / 2);\n vertices[11] = (w / 2, h / 2, d / 2);\n //back\n vertices[12] = (-w / 2, -h / 2, -d / 2);\n vertices[13] = (w / 2, -h / 2, -d / 2);\n vertices[14] = (w / 2, h / 2, -d / 2);\n vertices[15] = (-w / 2, h / 2, -d / 2);\n //top\n vertices[16] = (-w / 2, -h / 2, d / 2);\n vertices[17] = (-w / 2, -h / 2, -d / 2);\n vertices[18] = (w / 2, -h / 2, -d / 2);\n vertices[19] = (w / 2, -h / 2, d / 2);\n //bottom\n vertices[20] = (-w / 2, h / 2, d / 2);\n vertices[21] = (-w / 2, h / 2, -d / 2);\n vertices[22] = (w / 2, h / 2, -d / 2);\n vertices[23] = (w / 2, h / 2, d / 2);\n }", "constructor(x, y, w, h) {\n this.minimumSize = {w: 128, h: 128};\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n this.quads = [\n [], // 0: top left\n [], // 1: top right\n [], // 2: bottom left\n [] // 3: bottom right\n ];\n }", "constructor() {\r\n super(\"positions\", \"normals\"); // Name the values we'll define per each vertex. They'll have positions and normals.\r\n\r\n // First, specify the vertex positions -- just a bunch of points that exist at the corners of an imaginary cube.\r\n this.positions.push(...Vec.cast(\r\n [-1, -1, -1], [1, -1, -1], [-1, -1, 1], [1, -1, 1], [1, 1, -1], [-1, 1, -1], [1, 1, 1], [-1, 1, 1],\r\n [-1, -1, -1], [-1, -1, 1], [-1, 1, -1], [-1, 1, 1], [1, -1, 1], [1, -1, -1], [1, 1, 1], [1, 1, -1],\r\n [-1, -1, 1], [1, -1, 1], [-1, 1, 1], [1, 1, 1], [1, -1, -1], [-1, -1, -1], [1, 1, -1], [-1, 1, -1]));\r\n // Supply vectors that point away from eace face of the cube. They should match up with the points in the above list\r\n // Normal vectors are needed so the graphics engine can know if the shape is pointed at light or not, and color it accordingly.\r\n this.normals.push(...Vec.cast(\r\n [0, -1, 0], [0, -1, 0], [0, -1, 0], [0, -1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0],\r\n [-1, 0, 0], [-1, 0, 0], [-1, 0, 0], [-1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0],\r\n [0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, -1], [0, 0, -1], [0, 0, -1], [0, 0, -1]));\r\n\r\n // Those two lists, positions and normals, fully describe the \"vertices\". What's the \"i\"th vertex? Simply the combined\r\n // data you get if you look up index \"i\" of both lists above -- a position and a normal vector, together. Now let's\r\n // tell it how to connect vertex entries into triangles. Every three indices in this list makes one triangle:\r\n this.indices.push(0, 1, 2, 1, 3, 2, 4, 5, 6, 5, 7, 6, 8, 9, 10, 9, 11, 10, 12, 13, 14, 13, 15, 14, 16, 17, 18, 17, 19, \r\n 18, 20, 21, 22, 21, 23, 22);\r\n // It stinks to manage arrays this big. Later we'll show code that generates these same cube vertices more automatically.\r\n }", "function setGeometry(gl) {\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array([\n -15, -15,\n 15, -15,\n -15, 15,\n 15, -15,\n -15, 15,\n 15, 15,\n ]),\n gl.STATIC_DRAW);\n}", "function createQuad(bounds) {\n const positions = new Float64Array(12);\n // [[minX, minY], [minX, maxY], [maxX, maxY], [maxX, minY]]\n for (let i = 0; i < bounds.length; i++) {\n positions[i * 3 + 0] = bounds[i][0];\n positions[i * 3 + 1] = bounds[i][1];\n positions[i * 3 + 2] = bounds[i][2] || 0;\n }\n\n return {\n vertexCount: 6,\n positions,\n indices: DEFAULT_INDICES,\n texCoords: DEFAULT_TEX_COORDS,\n };\n}", "function v(x,y,z){ \n\t return new THREE.Vertex(new THREE.Vector3(x,y,z)); \n\t }", "bufferVertexAttributes(){\r\n super.bufferVertexAttributes();\r\n this.GLext.vertexAttribDivisorANGLE(this.attributeLocation.offset, 1);\r\n // We repeat our offset data only once (1) per instance (Each jellyfish has different offset)\r\n // If we had set it to (2), then the first two jellyfish would have shared the offset, and so on...\r\n }", "function n$9(e,i){i.instanced&&i.instancedDoublePrecision&&(e.attributes.add(\"modelOriginHi\",\"vec3\"),e.attributes.add(\"modelOriginLo\",\"vec3\"),e.attributes.add(\"model\",\"mat3\"),e.attributes.add(\"modelNormal\",\"mat3\")),i.instancedDoublePrecision&&(e.vertex.include(r$b,i),e.vertex.uniforms.add(\"viewOriginHi\",\"vec3\"),e.vertex.uniforms.add(\"viewOriginLo\",\"vec3\"));const n=[t$i`\n vec3 calculateVPos() {\n ${i.instancedDoublePrecision?\"return model * localPosition().xyz;\":\"return localPosition().xyz;\"}\n }\n `,t$i`\n vec3 subtractOrigin(vec3 _pos) {\n ${i.instancedDoublePrecision?t$i`\n vec3 originDelta = dpAdd(viewOriginHi, viewOriginLo, -modelOriginHi, -modelOriginLo);\n return _pos - originDelta;`:\"return vpos;\"}\n }\n `,t$i`\n vec3 dpNormal(vec4 _normal) {\n ${i.instancedDoublePrecision?\"return normalize(modelNormal * _normal.xyz);\":\"return normalize(_normal.xyz);\"}\n }\n `,t$i`\n vec3 dpNormalView(vec4 _normal) {\n ${i.instancedDoublePrecision?\"return normalize((viewNormal * vec4(modelNormal * _normal.xyz, 1.0)).xyz);\":\"return normalize((viewNormal * _normal).xyz);\"}\n }\n `,i.vertexTangets?t$i`\n vec4 dpTransformVertexTangent(vec4 _tangent) {\n ${i.instancedDoublePrecision?\"return vec4(modelNormal * _tangent.xyz, _tangent.w);\":\"return _tangent;\"}\n\n }\n `:t$i``];e.vertex.code.add(n[0]),e.vertex.code.add(n[1]),e.vertex.code.add(n[2]),2===i.output&&e.vertex.code.add(n[3]),e.vertex.code.add(n[4]);}", "function BirdGeometry() {\n\n const triangles = BIRDS * 3;\n const points = triangles * 3;\n\n THREE.BufferGeometry.call(this);\n\n const vertices = new THREE.BufferAttribute(new Float32Array(points * 3), 3);\n const birdColors = new THREE.BufferAttribute(new Float32Array(points * 3), 3);\n const references = new THREE.BufferAttribute(new Float32Array(points * 2), 2);\n const birdVertex = new THREE.BufferAttribute(new Float32Array(points), 1);\n\n this.setAttribute('position', vertices);\n this.setAttribute('birdColor', birdColors);\n this.setAttribute('reference', references);\n this.setAttribute('birdVertex', birdVertex);\n\n // this.setAttribute( 'normal', new Float32Array( points * 3 ), 3 );\n\n let v = 0;\n function verts_push() {\n for (let i = 0; i < arguments.length; i++) {\n vertices.array[v++] = arguments[i];\n }\n }\n\n const wingsSpan = 20;\n for (let f = 0; f < BIRDS; f++) {//BIRDS = 32\n // Body\n verts_push(\n 0, -0, -20,\n 0, 4, -20,\n 0, 0, 30\n );\n // Left Wing\n verts_push(\n 0, 0, -15,\n -wingsSpan, 0, 0,\n 0, 0, 15\n );\n // Right Wing\n verts_push(\n 0, 0, 15,\n wingsSpan, 0, 0,\n 0, 0, -15\n );\n }\n\n for (let v = 0; v < triangles * 3; v++) {//triangles = BIRDS * 3. BIRDS = 32(texture size)\n\n const i = ~~(v / 3);//~~ is a a faster substitute for Math.floor() for positive numbers. not for negative numbers.\n const x = (i % WIDTH) / WIDTH;\n const y = ~~(i / WIDTH) / WIDTH;\n\n const c = new THREE.Color(\n 0x444444 +\n ~~(v / 9) / BIRDS * 0x666666\n );\n\n birdColors.array[v * 3 + 0] = c.r;\n birdColors.array[v * 3 + 1] = c.g;\n birdColors.array[v * 3 + 2] = c.b;\n\n references.array[v * 2] = x;\n references.array[v * 2 + 1] = y;\n\n birdVertex.array[v] = v % 9;\n\n }\n\n this.scale(0.2, 0.2, 0.2);\n}", "push(x, y, u, v, tint) {\n let offset = this.vertexCount * this.vertexSize;\n\n if (this.vertexCount >= this.maxVertex) {\n this.resize(this.vertexCount);\n }\n\n this.bufferF32[offset] = x;\n this.bufferF32[++offset] = y;\n\n if (typeof u !== \"undefined\") {\n this.bufferF32[++offset] = u;\n this.bufferF32[++offset] = v;\n }\n\n if (typeof tint !== \"undefined\") {\n this.bufferU32[++offset] = tint;\n }\n\n this.vertexCount++;\n\n return this;\n }", "drawEdges(){\n \n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexPositionBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, this.VertexPositionBuffer.itemSize, \n gl.FLOAT, false, 0, 0);\n\n // Bind normal buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexNormalBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexNormalAttribute, \n this.VertexNormalBuffer.itemSize,\n gl.FLOAT, false, 0, 0); \n \n //Draw \n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.IndexEdgeBuffer);\n gl.drawElements(gl.LINES, this.IndexEdgeBuffer.numItems, gl.UNSIGNED_INT,0); \n }", "drawEdges(){\n \n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexPositionBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, this.VertexPositionBuffer.itemSize, \n gl.FLOAT, false, 0, 0);\n\n // Bind normal buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexNormalBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexNormalAttribute, \n this.VertexNormalBuffer.itemSize,\n gl.FLOAT, false, 0, 0); \n \n //Draw \n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.IndexEdgeBuffer);\n gl.drawElements(gl.LINES, this.IndexEdgeBuffer.numItems, gl.UNSIGNED_INT,0); \n }", "drawEdges(){\n \n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexPositionBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, this.VertexPositionBuffer.itemSize, \n gl.FLOAT, false, 0, 0);\n\n // Bind normal buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexNormalBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexNormalAttribute, \n this.VertexNormalBuffer.itemSize,\n gl.FLOAT, false, 0, 0); \n \n //Draw \n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.IndexEdgeBuffer);\n gl.drawElements(gl.LINES, this.IndexEdgeBuffer.numItems, gl.UNSIGNED_INT,0); \n }", "buildWireGeometry() {\n let wireGeometry = new THREE.Geometry();\n for ( let y = 0; y < VERTS_TALL; y++) {\n for ( let x = 0, x2 = precision; x < VERTS_WIDE; x += precision, x2 += precision ) {\n /*wireGeometry.vertices.push(\n new THREE.Vector3((-640 + x * 5), (480 -y * 5) , 0 ) );*/\n wireGeometry.vertices.push( new THREE.Vector3( x, y, 0 ) );\n wireGeometry.vertices.push( new THREE.Vector3( x2, y, 0 ) );\n }\n }\n return wireGeometry;\n }", "vertex(x, y) {\n this.currentShape.vertex({ x, y });\n }", "set Wireframe(value) {}", "function v(x,y,z){\n return new THREE.Vertex(new THREE.Vector3(x,y,z));\n }", "render()\n {\n let prg = this.prg;\n let indices = this.indices;\n let pointSize = this.size;\n\n glContext.bindBuffer(glContext.ARRAY_BUFFER, this.normalsBuffer);\n glContext.vertexAttribPointer(prg.vertexNormalAttribute, 3, glContext.FLOAT, false, 0, 0);\n\n glContext.bindBuffer(glContext.ARRAY_BUFFER, this.verticesBuffer);\n glContext.vertexAttribPointer(prg.vertexPositionAttribute, 3, glContext.FLOAT, false, 0, 0);\n glContext.bindBuffer(glContext.ARRAY_BUFFER, this.colorsBuffer);\n glContext.vertexAttribPointer(prg.colorAttribute, 4, glContext.FLOAT, false, 0, 0);\n glContext.bindBuffer(glContext.ELEMENT_ARRAY_BUFFER, this.indicesBuffer);\n glContext.uniform1f(prg.pointSize, pointSize);\n glContext.drawElements(glContext.LINE_STRIP, indices.length, glContext.UNSIGNED_SHORT,0);\n }", "_bindVertices() {\n let gl = this.context.context;\n\n // bind vertices\n let position = this.attributes[POS_ATTRIBUTE_NAME].location;\n gl.enableVertexAttribArray(position);\n\n var vertexBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\n // define a square that covers the screen\n var vertices = [-1.0, -1.0, 0.0,\t// bottom left\n 1.0, -1.0, 0.0,\t// bottom right\n 1.0, 1.0, 0.0,\t// top right\n -1.0, 1.0, 0.0];\t// top left\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n gl.vertexAttribPointer(position, /*item size*/3, gl.FLOAT, false, 0, 0);\n\n\n // bind texture cords\n var texture = this.attributes[TEX_ATTRIBUTE_NAME].location;\n var texCoords = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, texCoords);\n var textureCoords = [0.0, 0.0,\n 1.0, 0.0,\n 1.0, 1.0,\n 0.0, 1.0];\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoords), gl.STATIC_DRAW);\n gl.vertexAttribPointer(texture, /*item size*/2, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(texture);\n\n // index to vertices\n var indices = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indices);\n // tesselate square into triangles\n // indeces into vertex array creating triangles, with counter-clockwise winding\n var vertexIndices = [0, 1, 2,\t// bottom right triangle\n 0, 2, 3];\t// top left triangle\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(vertexIndices), gl.STATIC_DRAW);\n }", "function quad(a, b, c, d)\n {\n var vertices = [\n vec4( -0.5, -0.5, 0.5, 1.0 ),\n vec4( -0.5, 0.5, 0.5, 1.0 ),\n vec4( 0.5, 0.5, 0.5, 1.0 ),\n vec4( 0.5, -0.5, 0.5, 1.0 ),\n vec4( -0.5, -0.5, -0.5, 1.0 ),\n vec4( -0.5, 0.5, -0.5, 1.0 ),\n vec4( 0.5, 0.5, -0.5, 1.0 ),\n vec4( 0.5, -0.5, -0.5, 1.0 )\n ];\n\n\n // We need to parition the quad into two triangles in order for\n // WebGL to be able to render it. In this case, we create two\n // triangles from the quad indices\n\n //vertex color assigned by the index of the vertex\n\n var indices = [ a, b, c, a, c, d ];\n\n for ( var i = 0; i < indices.length; ++i ) {\n points.push( vertices[indices[i]] );\n }\n }", "initBuffers() \n\t{\n\n\t\tthis.vertices = [\n\t\t\tthis.vCoords[0][0], this.vCoords[0][1], this.vCoords[0][2],\n\t\t\tthis.vCoords[1][0], this.vCoords[1][1], this.vCoords[1][2],\n\t\t\tthis.vCoords[2][0], this.vCoords[2][1], this.vCoords[2][2],\n\t\t\tthis.vCoords[0][0], this.vCoords[0][1], this.vCoords[0][2],\n\t\t\tthis.vCoords[1][0], this.vCoords[1][1], this.vCoords[1][2],\n\t\t\tthis.vCoords[2][0], this.vCoords[2][1], this.vCoords[2][2]\n\t\t];\n\n\t\tthis.indices = [\n\t\t\t0, 1, 2,\n\t\t\t3, 5, 4\n\t\t];\n\n\t\tvar vecAB = [this.vCoords[1][0] - this.vCoords[0][0], this.vCoords[1][1] - this.vCoords[0][1], this.vCoords[1][2] - this.vCoords[0][2]];\n\t\tvar vecAC = [this.vCoords[2][0] - this.vCoords[0][0], this.vCoords[2][1] - this.vCoords[0][1], this.vCoords[2][2] - this.vCoords[0][2]];\n\t\tvar vecBC = [this.vCoords[2][0] - this.vCoords[1][0], this.vCoords[2][1] - this.vCoords[1][1], this.vCoords[2][2] - this.vCoords[1][2]];\n\n\t\tvar normalVector = [\n\t\t\tvecAB[1] * vecAC[2] - vecAB[2] * vecAC[1],\n\t\t\tvecAB[2] * vecAC[0] - vecAB[0] * vecAC[2],\n\t\t\tvecAB[0] * vecAC[1] - vecAB[1] * vecAC[0]\n\t\t];\n\n\t\tthis.normals = [\n\t\t\tnormalVector[0], normalVector[1], normalVector[2],\n\t\t\tnormalVector[0], normalVector[1], normalVector[2],\n\t\t\tnormalVector[0], normalVector[1], normalVector[2],\n\t\t\t-normalVector[0], -normalVector[1], -normalVector[2],\n\t\t\t-normalVector[0], -normalVector[1], -normalVector[2],\n\t\t\t-normalVector[0], -normalVector[1], -normalVector[2]\n\t\t];\n\n\t\t//based on the file given\n\t\tvar b = Math.sqrt(vecAC[0] ** 2 + vecAC[1] ** 2 + vecAC[2] ** 2);\n\t\tvar a = Math.sqrt(vecBC[0] ** 2 + vecBC[1] ** 2 + vecBC[2] ** 2);\n\t\tvar c = Math.sqrt(vecAB[0] ** 2 + vecAB[1] ** 2 + vecAB[2] ** 2);\n\n\t\tvar d = (a ** 2 - b ** 2 - c ** 2) / (-2 * c);\n\t\tvar sinAlfa = Math.sqrt(1 - (d / b) ** 2);\n\t\tvar h = b * sinAlfa;\n\n\t\tthis.c = c;\n\t\tthis.d = d;\n\t\tthis.h = h;\n\n\t\tthis.texCoords = [\n\t\t\t0, 1,\n\t\t\tthis.c, 1,\n\t\t\tthis.d, 1 - (this.h),\n\t\t\t0, 1,\n\t\t\tthis.c, 1,\n\t\t\tthis.d, 1 - (this.h)\n\t\t];\n\n\t\tthis.primitiveType = this.scene.gl.TRIANGLES;\n\t\tthis.initGLBuffers();\n\t}", "constructor() \n { super( \"position\", \"color\" );\n this.arrays.position = [ Vec.of(0,0,0), Vec.of(1,0,0), Vec.of(0,1,0), Vec.of(0,1,0), Vec.of(1,0,0), Vec.of(1,1,0) ]; // Describe the where the points of a triangle are in space.\n this.arrays.color = [ Color.of(1,0,0,1), Color.of(0,1,0,1), Color.of(0,0,1,1), Color.of(0,0,1,1), Color.of(0,1,0,1), Color.of(1,1,0,1) ]; // Besides a position, vertices also have a color. \n }", "function grid( _size, _segment ) {\n\n\tgridGeom = new THREE.BufferGeometry();\n\tvar size = _size;\n\tvar segment = _segment;\n\tvar initialHeight = 0;\n\tvar hs = size * 0.5;\n\tvar spc = size / segment;\n\n\tvar i, r, c;\n\t// arrange vertices like a grid\n\tvar vertexPositions = [];\n\tfor ( r = 0; r <= segment; r++ ) {\n\t\tfor ( c = 0; c <= segment; c++ ) {\n\n\t\t\tvertexPositions.push( [ -hs + spc * c, -hs + spc * r, 0 ] );\n\t\t\tvertexPositions.push( [ -hs + spc * c, -hs + spc * r, initialHeight ] );\n\n\t\t}\n\t}\n\n\t// transfer to typed array\n\tvar buffVerts = new Float32Array( vertexPositions.length * 3 );\n\tfor ( i = 0; i < vertexPositions.length; i++ ) {\n\n\t\tbuffVerts[ i * 3 + 0 ] = vertexPositions[ i ][ 0 ];\n\t\tbuffVerts[ i * 3 + 1 ] = vertexPositions[ i ][ 1 ];\n\t\tbuffVerts[ i * 3 + 2 ] = vertexPositions[ i ][ 2 ];\n\n\t}\n\n\t/* store reference position when sampling a texel in a shader\n\t * UV (1,1)\n\t *\t ┌─────────┐\n\t *\t │ / │\n\t *\t │ / │\n\t *\t │ / │\n\t *\t │ / │\n\t *\t └─────────┘\n\t * (0,0)\n\t */\n\n\tvar vertexHere = [];\n\tvar normalizedSpacing = 1.0 / segment;\n\tfor ( r = 0; r <= segment; r++ ) {\n\t\tfor ( c = 0; c <= segment; c++ ) {\n\n\t\t\tvertexHere.push( [ normalizedSpacing * c, normalizedSpacing * r, 0 ] );\n\t\t\tvertexHere.push( [ normalizedSpacing * c, normalizedSpacing * r, 1.0 ] ); // flag a vertex to displace in a shader\n\n\t\t}\n\t}\n\n\t// transfer to typed array\n\tvar buffHere = new Float32Array( vertexHere.length * 3 );\n\n\tfor ( i = 0; i < vertexHere.length; i++ ) {\n\n\t\tbuffHere[ i * 3 + 0 ] = vertexHere[ i ][ 0 ];\n\t\tbuffHere[ i * 3 + 1 ] = vertexHere[ i ][ 1 ];\n\t\tbuffHere[ i * 3 + 2 ] = vertexHere[ i ][ 2 ];\n\n\t}\n\n\n\n\t// vertex color\n\tvar vcolor = [];\n\tfor ( r = 0; r <= segment; r++ ) {\n\t\tfor ( c = 0; c <= segment; c++ ) {\n\n\t\t\tvcolor.push( [ 1.0, 0.0, 0.0 ] );\n\t\t\tvcolor.push( [ 0.0, 0.0, 1.0 ] );\n\t\t}\n\t}\n\n\tvar buffColor = new Float32Array( vcolor.length * 3 );\n\n\tfor ( i = 0; i < vcolor.length; i++ ) {\n\n\t\tbuffColor[ i * 3 + 0 ] = vcolor[ i ][ 0 ];\n\t\tbuffColor[ i * 3 + 1 ] = vcolor[ i ][ 1 ];\n\t\tbuffColor[ i * 3 + 2 ] = vcolor[ i ][ 2 ];\n\n\t}\n\n\n\tgridGeom.addAttribute( 'position', new THREE.BufferAttribute( buffVerts, 3 ) );\n\tgridGeom.addAttribute( 'here', new THREE.BufferAttribute( buffHere, 3 ) );\n\tgridGeom.addAttribute( 'color', new THREE.BufferAttribute( buffColor, 3 ) );\n\n\tgridGeom.attributes.position.needsUpdate = true;\n\tgridGeom.attributes.here.needsUpdate = true;\n\tgridGeom.attributes.color.needsUpdate = true;\n\n\n\tgridShader = new THREE.ShaderMaterial( {\n\n\t\tuniforms: {\n\t\t\theightMap: {\n\t\t\t\ttype: 't',\n\t\t\t\tvalue: null\n\t\t\t},\n\t\t},\n\n\t\tattributes: {\n\t\t\there: {\n\t\t\t\ttype: 'v3',\n\t\t\t\tvalue: null\n\t\t\t} // need to specify attributes .addAttribute won't add in here\n\t\t},\n\n\t\tvertexShader: SHADER_CONTAINER.vectorFieldVert,\n\t\tfragmentShader: SHADER_CONTAINER.vectorFieldFrag,\n\t\t// transparent: true,\n\t\t// blending: THREE.AdditiveBlending,\n\t\t// depthWrite: false\n\t\t// depthTest: false,\n\t\t// side: THREE.DoubleSide,\n\n\t} );\n\n\tgridMesh = new THREE.Line( gridGeom, gridShader, THREE.LinePieces );\n\n\tscene.add( gridMesh );\n\n}", "function drawSphere(){\n gl.bindBuffer(gl.ARRAY_BUFFER, sphereVertexPositionBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, sphereVertexPositionBuffer.itemSize, \n gl.FLOAT, false, 0, 0);\n\n // Bind normal buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, sphereVertexNormalBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexNormalAttribute, \n sphereVertexNormalBuffer.itemSize,\n gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLES, 0, sphereVertexPositionBuffer.numItems); \n}", "function drawSphere(){\n gl.bindBuffer(gl.ARRAY_BUFFER, sphereVertexPositionBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, sphereVertexPositionBuffer.itemSize, \n gl.FLOAT, false, 0, 0);\n\n // Bind normal buffer\n gl.bindBuffer(gl.ARRAY_BUFFER, sphereVertexNormalBuffer);\n gl.vertexAttribPointer(shaderProgram.vertexNormalAttribute, \n sphereVertexNormalBuffer.itemSize,\n gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLES, 0, sphereVertexPositionBuffer.numItems); \n}", "function initVertexBuffer() {\n models[SPHERE] = new Sphere();\n models[HELICOPTERBODY] = new HelicopterBody();\n models[BRICK] = new Brick();\n models[CYLINDER] = new Cylinder();\n models[TORUS] = new Torus();\n models[GROUNDGRID] = new GroundGrid();\n\n var vSiz = Object.keys(models).reduce((result, key) => result + models[key].getVertices().length, 0);\n\n console.log('Number of vertices is', vSiz / floatsPerVertex, ', point per vertex is', floatsPerVertex);\n\n verticesArrayBuffer = new ArrayBufferFloat32Array(vSiz);\n Object.keys(models).map(key => verticesArrayBuffer.appendObject(key, models[key].getVertices()));\n\n var nSiz = vSiz;\n normalVectorsArrayBuffer = new ArrayBufferFloat32Array(nSiz);\n Object.keys(models).map(key => normalVectorsArrayBuffer.appendObject(key, models[key].getNormalVectors()));\n\n var modelIndices = [models[SPHERE], models[HELICOPTERBODY], models[BRICK]]\n .reduce((array, m) => {\n array.push(m.getVerticesIndices());\n return array;\n }, []);\n var iSiz = modelIndices.reduce((result, mi) => result + mi.length, 0);\n console.log('iSiz is', iSiz);\n\n indiceArrayBuffer = new ArrayBufferUint8Array(iSiz);\n var hlcIndexIncr = verticesArrayBuffer.getObjectStartPosition(HELICOPTERBODY) / floatsPerVertex;\n var brkIndexIncr = verticesArrayBuffer.getObjectStartPosition(BRICK) / floatsPerVertex;\n indiceArrayBuffer.appendObject(SPHERE, modelIndices[0]);\n indiceArrayBuffer.appendObject(HELICOPTERBODY,\n modelIndices[1].map(idx => idx + hlcIndexIncr));\n indiceArrayBuffer.appendObject(BRICK,\n modelIndices[2].map(idx => idx + brkIndexIncr));\n\n // We create two separate buffers so that you can modify normals if you wish.\n if (!initGLArrayBuffer('a_Position', verticesArrayBuffer.getArray(), gl.FLOAT, floatsPerVertex)) return -1;\n if (!initGLArrayBuffer('a_Normal', normalVectorsArrayBuffer.getArray(), gl.FLOAT, floatsPerVertex)) return -1;\n\n // Unbind the buffer object\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n\n // Write the indices to the buffer object\n var indexBuffer = gl.createBuffer();\n if (!indexBuffer) {\n console.log('Failed to create the buffer object');\n return -1;\n }\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indiceArrayBuffer.getArray(), gl.STATIC_DRAW);\n\n return indiceArrayBuffer.getArray().length;\n }", "function QuadNode(bound, maxChildren, maxLevel, level, parent) {\n if (!level) level = 0;\n if (!parent) parent = null;\n var halfWidth = (bound.maxx - bound.minx) / 2;\n var halfHeight = (bound.maxy - bound.miny) / 2;\n \n this.level = level;\n this.parent = parent;\n this.bound = {\n minx: bound.minx, \n miny: bound.miny,\n maxx: bound.maxx,\n maxy: bound.maxy,\n halfWidth: halfWidth,\n halfHeight: halfHeight,\n cx: bound.minx + halfWidth,\n cy: bound.miny + halfHeight\n };\n this.maxChildren = maxChildren;\n this.maxLevel = maxLevel;\n this.childNodes = [];\n this.items = [];\n}", "function makeQuad(gl) {\n \n var vertices = new Float32Array([\n 0, 0, 0,\n 0, -1, 0, \n 1, 0, 0,\n 1, -1, 0 \n \n ]);\n \n var texCoords = new Float32Array([\n 0, 1,\n \n 0, 0, \n 1, 1,\n 1, 0 \n \n \n ]);\n \n var indices = new Uint16Array([1, 0, 2, 3]);\n \n var createBuffer = function(type, data, size) {\n var buffer = gl.createBuffer();\n gl.bindBuffer(type, buffer);\n gl.bufferData(type, data, gl.STATIC_DRAW);\n buffer.itemSize = size;\n buffer.numItems = data.length\n return buffer;\n };\n \n return {\n texCoordObject: createBuffer(gl.ARRAY_BUFFER, texCoords, 2),\n vertexObject: createBuffer(gl.ARRAY_BUFFER, vertices, 3),\n indexObject: createBuffer(gl.ELEMENT_ARRAY_BUFFER, indices, 1)\n };\n \n }", "function square(){\r\n\t\treturn {\r\n\t\t\tvertex: [\r\n\t\t\t\t-1.0, 1.0, 0.0,\r\n\t\t\t\t 1.0, 1.0, 0.0,\r\n\t\t\t\t-1.0, -1.0, 0.0,\r\n\t\t\t\t 1.0, -1.0, 0.0\r\n\t\t\t],\r\n\t\t\tindex: [\r\n\t\t\t\t0, 2, 1,\r\n\t\t\t\t1, 2, 3\r\n\t\t\t],\r\n\t\t\tuv: [\r\n\t\t\t\t0.0, 0.0,\r\n\t\t\t\t1.0, 0.0,\r\n\t\t\t\t0.0, 1.0,\r\n\t\t\t\t1.0, 1.0\r\n\t\t\t]\r\n\t\t}\r\n\t}", "function drawQuad(x0, y0, x1, y1, x2, y2, x3, y3) {\n\tbeginShape();\n\tvertex(x0, y0);\n\tvertex(x1, y1);\n\tvertex(x2, y2);\n\tvertex(x3, y3);\n\tendShape(CLOSE);\n}", "function Component_Quad() {\n Component_Quad.__super__.constructor.apply(this, arguments);\n\n /**\n * The native quad-object to display a colored rectangle on screen.\n * @property quad\n * @type gs.Quad\n * @protected\n */\n this.quad = null;\n }", "function Component_Quad() {\n Component_Quad.__super__.constructor.apply(this, arguments);\n\n /**\n * The native quad-object to display a colored rectangle on screen.\n * @property quad\n * @type gs.Quad\n * @protected\n */\n this.quad = null;\n }", "function quad(a, b, c, d) \n {\n\tvar vertices = [\n vec3( -0.5, -0.5, 0.5 ),\n vec3( -0.5, 0.5, 0.5 ),\n vec3( 0.5, 0.5, 0.5 ),\n vec3( 0.5, -0.5, 0.5 ),\n vec3( -0.5, -0.5, -0.5 ),\n vec3( -0.5, 0.5, -0.5 ),\n vec3( 0.5, 0.5, -0.5 ),\n vec3( 0.5, -0.5, -0.5 )\n\t];\n\n\tvar vertexColors = [\n [ 0.0, 0.0, 0.0, 1.0 ], // black\n [ 1.0, 0.0, 0.0, 1.0 ], // red\n [ 1.0, 1.0, 0.0, 1.0 ], // yellow\n [ 0.0, 1.0, 0.0, 1.0 ], // green\n [ 0.0, 0.0, 1.0, 1.0 ], // blue\n [ 1.0, 0.0, 1.0, 1.0 ], // magenta\n [ 1.0, 1.0, 1.0, 1.0 ], // white\n [ 0.0, 1.0, 1.0, 1.0 ] // cyan\n\t];\n\n\t// We need to partition the quad into two triangles in order for\n\t// WebGL to be able to render it. In this case, we create two\n\t// triangles from the quad indices\n\t\n\t// Vertex color assigned by the index of the vertex\n\t\n\tvar indices = [ a, b, c, a, c, d ];\n\n\tfor ( var i = 0; i < indices.length; ++i ) {\n points.push( vertices[indices[i]] );\n colors.push( vertexColors[indices[i]] );\n\t}\n }", "function dn(){Object.defineProperty(this,\"id\",{value:hn+=2}),this.uuid=bt.generateUUID(),this.name=\"\",this.type=\"BufferGeometry\",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}", "function __draw() {\n\n mat4.multiply(__modelMatrix, __translationMatrix, __rotationMatrix);\n mat4.multiply(__modelMatrix, __modelMatrix, __scaleMatrix);\n\n // calculate the inverse transformation that will remove caused by transforming the 3D surface\n mat3.normalFromMat4(__normalMatrix, __modelMatrix);\n\n mat4.multiply(__PVMMatrix, _glProgram.customAttribs.viewMatrix, __modelMatrix);\n mat4.multiply(__PVMMatrix, _glProgram.customAttribs.perspectiveMatrix, __PVMMatrix);\n\n __shouldUpdateMatrices = false;\n\n _gl.uniformMatrix3fv(_glProgram.customAttribs.u_NormalMatrixRef, false, __normalMatrix);\n _gl.uniformMatrix4fv(_glProgram.customAttribs.u_PVMMatrixRef, false, __PVMMatrix);\n\n _gl.bindBuffer(_gl.ARRAY_BUFFER, __quadVertexPositionBuffer);\n _gl.vertexAttribPointer(_glProgram.customAttribs.a_PositionRef, __quadVertexPositionBuffer.itemSize, _gl.FLOAT, false, 0, 0);\n _gl.enableVertexAttribArray(_glProgram.customAttribs.a_PositionRef);\n\n _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, __quadVertexIndexBuffer);\n\n _gl.bindBuffer(_gl.ARRAY_BUFFER, __quadVertexNormalBuffer);\n _gl.vertexAttribPointer(_glProgram.customAttribs.a_VertexNormalRef, __quadVertexNormalBuffer.itemSize, _gl.FLOAT, false, 0, 0);\n _gl.enableVertexAttribArray(_glProgram.customAttribs.a_VertexNormalRef);\n\n _gl.uniform4f(_glProgram.customAttribs.u_FragColourRef, __colour.r, __colour.g, __colour.b, __colour.a);\n\n _gl.drawElements(_gl.TRIANGLES, __quadVertexIndexBuffer.numItems, _gl.UNSIGNED_SHORT, 0);\n\n }", "setPoints (pointCoords) {\n let gl = this.renderer.gl;\n // Step1 - render points to texture\n // Bind the shaders\n this.scatterPlotShader = new glCore.GLShader(gl, this.vertexKdeSrc, this.fragmentKdeSrc);\n this.scatterPlotShader.bind();\n // set any uniforms in the shader(s) here\n //this.scatterPlotShader.uniforms.positions = 0;\n this.scatterPlotShader.uniforms.uSampler = 0;\n\n // Create a buffer for the drawing the point coordinates\n this.pointCoords = pointCoords;\n this.numPoints = pointCoords.length/2;\n let pointBuffer = new glCore.GLBuffer.createVertexBuffer(gl, pointCoords);\n // And index these (simply 0->n-1)\n let indices = new Uint16Array(pointCoords.length/2);\n for (let i = 0; i < indices.length; i++) {\n indices[i] = i;\n }\n let indexBuffer = new glCore.GLBuffer.createIndexBuffer(gl, indices);\n //Control everything via a Vertex Array Object\n this.vao = new glCore.VertexArrayObject(gl);\n // set the attributes\n this.vao.addAttribute(pointBuffer, this.scatterPlotShader.attributes.aVertexPosition);\n this.vao.addIndex(indexBuffer);\n\n // Step 1.5 - extract a single color from the float\n this.floatPackShader = new glCore.GLShader(gl, this.vertexFloatPackSrc, this.fragmentFloatPackSrc);\n this.floatPackShader.bind();\n\n\n let verts = new glCore.GLBuffer.createVertexBuffer(gl, this.vertCoords);\n let tex = new glCore.GLBuffer.createVertexBuffer(gl, this.texCoords);\n let inds = new glCore.GLBuffer.createVertexBuffer(gl, this.quadIndices);\n\n // Buffer for drawing the Quad to render th texture created in Step1\n this.vaoPackQuad = new glCore.VertexArrayObject(gl);\n this.vaoPackQuad.addAttribute(verts, this.floatPackShader.attributes.aVertexPosition);\n this.vaoPackQuad.addAttribute(tex, this.floatPackShader.attributes.aTextureCoord);\n this.vaoPackQuad.addIndex(inds);\n\n // Step2 - render texture to Quad\n this.declippingShader = new glCore.GLShader(gl, this.vertexDeclipSrc, this.fragmentDeclipSrc);\n this.declippingShader.bind();\n this.declippingShader.uniforms.uSampler = 0; // the texture number to sample\n\n let qverts = new glCore.GLBuffer.createVertexBuffer(gl, this.vertCoords);\n let qtex = new glCore.GLBuffer.createVertexBuffer(gl, this.texCoords);\n let qinds = new glCore.GLBuffer.createVertexBuffer(gl, this.quadIndices);\n\n // Buffer for drawing the Quad to render th texture created in Step1\n this.vaoQuad = new glCore.VertexArrayObject(gl);\n this.vaoQuad.addAttribute(qverts, this.declippingShader.attributes.aVertexPosition);\n this.vaoQuad.addAttribute(qtex, this.declippingShader.attributes.aTextureCoord);\n this.vaoQuad.addIndex(qinds);\n }", "drawEdges(){\r\n \r\n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexPositionBuffer);\r\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, this.VertexPositionBuffer.itemSize, \r\n gl.FLOAT, false, 0, 0);\r\n\r\n // Bind normal buffer\r\n gl.bindBuffer(gl.ARRAY_BUFFER, this.VertexNormalBuffer);\r\n gl.vertexAttribPointer(shaderProgram.vertexNormalAttribute, \r\n this.VertexNormalBuffer.itemSize,\r\n gl.FLOAT, false, 0, 0); \r\n \r\n //Draw \r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.IndexEdgeBuffer);\r\n gl.drawElements(gl.LINES, this.IndexEdgeBuffer.numItems, gl.UNSIGNED_INT,0); \r\n }", "constructor(using_flat_shading) {\n super(\"position\", \"normal\", \"texture_coord\");\n var a = 1 / Math.sqrt(3);\n if (!using_flat_shading) {\n // Method 1: A tetrahedron with shared vertices. Compact, performs better,\n // but can't produce flat shading or discontinuous seams in textures.\n this.arrays.position = Vec.cast(\n [0, 0, 0],\n [1, 0, 0],\n [0, 1, 0],\n [0, 0, 1]\n );\n this.arrays.normal = Vec.cast(\n [-a, -a, -a],\n [1, 0, 0],\n [0, 1, 0],\n [0, 0, 1]\n );\n this.arrays.texture_coord = Vec.cast([0, 0], [1, 0], [0, 1], [1, 1]);\n // Notice the repeats in the index list. Vertices are shared\n // and appear in multiple triangles with this method.\n this.indices.push(0, 1, 2, 0, 1, 3, 0, 2, 3, 1, 2, 3);\n } else {\n // Method 2: A tetrahedron with four independent triangles.\n this.arrays.position = Vec.cast(\n [0, 0, 0],\n [1, 0, 0],\n [0, 1, 0],\n [0, 0, 0],\n [1, 0, 0],\n [0, 0, 1],\n [0, 0, 0],\n [0, 1, 0],\n [0, 0, 1],\n [0, 0, 1],\n [1, 0, 0],\n [0, 1, 0]\n );\n\n // The essence of flat shading: This time, values of normal vectors can\n // be constant per whole triangle. Repeat them for all three vertices.\n this.arrays.normal = Vec.cast(\n [0, 0, -1],\n [0, 0, -1],\n [0, 0, -1],\n [0, -1, 0],\n [0, -1, 0],\n [0, -1, 0],\n [-1, 0, 0],\n [-1, 0, 0],\n [-1, 0, 0],\n [a, a, a],\n [a, a, a],\n [a, a, a]\n );\n\n // Each face in Method 2 also gets its own set of texture coords (half the\n // image is mapped onto each face). We couldn't do this with shared\n // vertices since this features abrupt transitions when approaching the\n // same point from different directions.\n this.arrays.texture_coord = Vec.cast(\n [0, 0],\n [1, 0],\n [1, 1],\n [0, 0],\n [1, 0],\n [1, 1],\n [0, 0],\n [1, 0],\n [1, 1],\n [0, 0],\n [1, 0],\n [1, 1]\n );\n // Notice all vertices are unique this time.\n this.indices.push(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);\n }\n }", "function qh(a, b) {\n this.g = [];this.v = a;this.u = b || null;this.f = this.a = !1;this.c = void 0;this.m = this.w = this.i = !1;this.h = 0;this.b = null;this.l = 0;\n }", "vertArray () { return this._vert }", "constructor() {\n this.vIndex = -1;\n this.tCoordIndex = -1;\n this.nIndex = -1;\n }", "function initVertexBuffers(gl) {\r\n // Coordinates(Cube which length of one side is 1 with the origin on the center of the bottom)\r\n var vertices = new Float32Array([\r\n 0.5, 1.0, 0.5, -0.5, 1.0, 0.5, -0.5, 0.0, 0.5, 0.5, 0.0, 0.5, // v0-v1-v2-v3 front\r\n 0.5, 1.0, 0.5, 0.5, 0.0, 0.5, 0.5, 0.0,-0.5, 0.5, 1.0,-0.5, // v0-v3-v4-v5 right\r\n 0.5, 1.0, 0.5, 0.5, 1.0,-0.5, -0.5, 1.0,-0.5, -0.5, 1.0, 0.5, // v0-v5-v6-v1 up\r\n -0.5, 1.0, 0.5, -0.5, 1.0,-0.5, -0.5, 0.0,-0.5, -0.5, 0.0, 0.5, // v1-v6-v7-v2 left\r\n -0.5, 0.0,-0.5, 0.5, 0.0,-0.5, 0.5, 0.0, 0.5, -0.5, 0.0, 0.5, // v7-v4-v3-v2 down\r\n 0.5, 0.0,-0.5, -0.5, 0.0,-0.5, -0.5, 1.0,-0.5, 0.5, 1.0,-0.5 // v4-v7-v6-v5 back\r\n ]);\r\n\r\n // Normal\r\n var normals = new Float32Array([\r\n 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, // v0-v1-v2-v3 front\r\n 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, // v0-v3-v4-v5 right\r\n 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // v0-v5-v6-v1 up\r\n -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, // v1-v6-v7-v2 left\r\n 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, // v7-v4-v3-v2 down\r\n 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0, 0.0, 0.0,-1.0 // v4-v7-v6-v5 back\r\n ]);\r\n\r\n // Indices of the vertices\r\n var indices = new Uint8Array([\r\n 0, 1, 2, 0, 2, 3, // front\r\n 4, 5, 6, 4, 6, 7, // right\r\n 8, 9,10, 8,10,11, // up\r\n 12,13,14, 12,14,15, // left\r\n 16,17,18, 16,18,19, // down\r\n 20,21,22, 20,22,23 // back\r\n ]);\r\n\r\n // Write the vertex property to buffers (coordinates and normals)\r\n if (!initArrayBuffer(gl, 'a_Position', vertices, gl.FLOAT, 3)) return -1;\r\n if (!initArrayBuffer(gl, 'a_Normal', normals, gl.FLOAT, 3)) return -1;\r\n\r\n // Unbind the buffer object\r\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\r\n\r\n // Write the indices to the buffer object\r\n var indexBuffer = gl.createBuffer();\r\n if (!indexBuffer) {\r\n console.log('Failed to create the buffer object');\r\n return -1;\r\n }\r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);\r\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);\r\n\r\n return indices.length;\r\n}", "function render() {\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n if (params.polygonOffset) {\n gl.polygonOffset(1, 1);\n }\n gl.uniform3fv(uColor, [1.0, 0.0, 0.0]);\n gl.drawArrays(gl.TRIANGLES, 0, 3);\n\n\n if (params.polygonOffset) {\n gl.polygonOffset(0, 1);\n }\n gl.uniform3fv(uColor, [0.0, 0.0, 1.0]);\n gl.drawArrays(gl.TRIANGLES, 3, 3);\n}", "constructor({ length = .5, height = .5, width = .5}) {\n super();\n\n /* Bottom front left */\n this.vertices.push([width, length, 2]);\n\n /* 1) Bottom front right */\n this.vertices.push([width, length * 2, 2]);\n\n /* 2) top front right */\n this.vertices.push([width, length * 2, height + 2]);\n\n /* 3) top front left */\n this.vertices.push([width, length, height + 2]);\n\n /* 4) Bottom back right */\n this.vertices.push([0, length * 2, 2]);\n\n /* 5) Bottom back left */\n this.vertices.push([0, length, 2]);\n\n /* 6) top back right */\n this.vertices.push([0, length * 2, height + 2]);\n\n /* 7) top back left */\n this.vertices.push([0, length, height + 2]);\n\n // Pushing the triangles\n // Triangle 1 front bottom\n this.triangles.push([0, 1, 2]);\n\n //Triangle 2 front top\n this.triangles.push([0, 2, 3]);\n\n // Triangle 3 right bottom\n this.triangles.push([1, 4, 6]);\n\n // Triangle 4 right top\n this.triangles.push([1, 6, 2]);\n\n // Triangle 5 back bottom\n this.triangles.push([4, 5, 7]);\n\n // Triangle 6 back top\n this.triangles.push([4, 7, 6]);\n\n // Triangle 7 left bottom\n this.triangles.push([5, 0, 3]);\n\n // Triangle 8 left top\n this.triangles.push([5, 3, 7]);\n\n // Triangle 9 top bottom\n this.triangles.push([3, 2, 6]);\n\n // Triangle 10 top top\n this.triangles.push([3, 6, 7]);\n\n // Triangle 11 bottom bottom\n this.triangles.push([1, 0, 5]);\n\n // Triangle 12 bottom top\n this.triangles.push([1, 5, 4]);\n }", "constructor(name,radius,latitudeBands,longitudeBands,uu,vv){\n\t\tsuper(name);\n\n\t\t// size\n\t\tthis.radius\t= radius;\n\t\tthis.latitudeBands \t= latitudeBands;\n\t\tthis.longitudeBands\t= longitudeBands;\n\n\t\t// textures\n\t\tthis.scaleUV = [uu,vv];\n\n\t // build the vertices\n\t\tthis.build();\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 setupVAO(gl, info) {\n info.vao = gl.createVertexArray();\n gl.bindVertexArray(info.vao);\n\n const num = 2; // pull out 2 values per iteration\n const type = gl.FLOAT; // the data in the buffer is 32bit floats\n const normalize = false; // don't normalize\n const stride = 0; // how many bytes to get from one set of values to the next\n // 0 = use type and numComponents above\n const offset = 0; // how many bytes inside the buffer to start from\n\n // Create and bind position buffer\n const positionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);\n const positions = [\n 1.0, 1.0,\n -1.0, 1.0,\n 1.0, -1.0,\n -1.0, -1.0,\n ];\n gl.bufferData(gl.ARRAY_BUFFER,\n new Float32Array(positions),\n gl.STATIC_DRAW);\n\n gl.vertexAttribPointer(\n info.attribLocations.vertexPosition, num, type, normalize, stride, offset);\n gl.enableVertexAttribArray(info.attribLocations.vertexPosition);\n\n if(info.attribLocations.textureCoord != -1) {\n // Create and bind texture buffer\n const textureCoordBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n const textureCoordinates = [\n // Main Square\n 1.0, 1.0,\n 0.0, 1.0,\n 1.0, 0.0,\n 0.0, 0.0,\n ];\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoordinates),\n gl.STATIC_DRAW);\n gl.vertexAttribPointer(\n info.attribLocations.textureCoord, num, type, normalize, stride, offset);\n gl.enableVertexAttribArray(info.attribLocations.textureCoord);\n }\n}", "function box_model() {\n var points = [];\n\n /*\n This code is derived from the code for chapter 4 in the text.\n */\n function quad(a, b, c, d)\n {\n var vertices = [\n vec4( -0.5, -0.5, 0.5, 1.0 ),\n vec4( -0.5, 0.5, 0.5, 1.0 ),\n vec4( 0.5, 0.5, 0.5, 1.0 ),\n vec4( 0.5, -0.5, 0.5, 1.0 ),\n vec4( -0.5, -0.5, -0.5, 1.0 ),\n vec4( -0.5, 0.5, -0.5, 1.0 ),\n vec4( 0.5, 0.5, -0.5, 1.0 ),\n vec4( 0.5, -0.5, -0.5, 1.0 )\n ];\n\n\n // We need to parition the quad into two triangles in order for\n // WebGL to be able to render it. In this case, we create two\n // triangles from the quad indices\n\n //vertex color assigned by the index of the vertex\n\n var indices = [ a, b, c, a, c, d ];\n\n for ( var i = 0; i < indices.length; ++i ) {\n points.push( vertices[indices[i]] );\n }\n }\n\n quad( 1, 0, 3, 2 );\n quad( 2, 3, 7, 6 );\n quad( 3, 0, 4, 7 );\n quad( 6, 5, 1, 2 );\n quad( 4, 5, 6, 7 );\n quad( 5, 4, 0, 1 );\n\n return points;\n}", "constructor() {\n super(\"position\", \"normal\", \"texture_coord\");\n\n this.arrays.position.push(Vec.of(0, 0, 0));\n for (let i = 0; i < 11; i++) {\n const spin = Mat4.rotation(i * 2 * Math.PI / 10, Vec.of(0, 0, -1));\n\n const radius = i % 2 ? 4 : 7;\n const new_point = spin.times(Vec.of(0, radius, 0, 1)).to3();\n\n this.arrays.position.push(new_point);\n if (i > 0)\n this.indices.push(0, i, i + 1)\n }\n\n this.arrays.normal = this.arrays.position.map(p => Vec.of(0, 0, -1));\n this.arrays.texture_coord = this.arrays.position.map(p => Vec.of((p[0] + 7) / 14, (p[1] + 7) / 14));\n }", "static makeQV(x, y, z, w) {\nreturn new Float32Array([x, y, z, w]);\n}", "constructor(num_blades) {\n super(\"position\", \"normal\", \"texture_coord\");\n // A for loop to automatically generate the triangles:\n for (let i = 0; i < num_blades; i++) {\n // Rotate around a few degrees in the XZ plane to place each new point:\n const spin = Mat4.rotation(\n (i * 2 * Math.PI) / num_blades,\n Vec.of(0, 1, 0)\n );\n // Apply that XZ rotation matrix to point (1,0,0) of the base triangle.\n const newPoint = spin.times(Vec.of(1, 0, 0, 1)).to3();\n const triangle = [\n newPoint, // Store that XZ position as point 1.\n newPoint.plus([0, 1, 0]), // Store it again but with higher y coord as point 2.\n Vec.of(0, 0, 0)\n ]; // All triangles touch this location -- point 3.\n\n this.arrays.position.push(...triangle);\n // Rotate our base triangle's normal (0,0,1) to get the new one. Careful! Normal vectors are not\n // points; their perpendicularity constraint gives them a mathematical quirk that when applying\n // matrices you have to apply the transposed inverse of that matrix instead. But right now we've\n // got a pure rotation matrix, where the inverse and transpose operations cancel out, so it's ok.\n var newNormal = spin.times(Vec.of(0, 0, 1).to4(0)).to3();\n // Propagate the same normal to all three vertices:\n this.arrays.normal.push(newNormal, newNormal, newNormal);\n this.arrays.texture_coord.push(...Vec.cast([0, 0], [0, 1], [1, 0]));\n // Procedurally connect the 3 new vertices into triangles:\n this.indices.push(3 * i, 3 * i + 1, 3 * i + 2);\n }\n }", "function setTexcoords( gl ) {\n const W = 853;\n const H = 606;\n\n gl.bufferData(\n gl.ARRAY_BUFFER,\n new Float32Array( [\n\n\n // FRONT X/W Y/H\n\n\n\n 0 / W, 395 / H,\n 408 / W, 600 / H,\n 408 / W, 395 / H,\n\n\n\n 0 / W, 600 / H,\n 408 / W, 600 / H,\n 0 / W, 395 / H,\n\n\n\n\n\n\n // TOP FACE\n 0 / W, 0 / H,\n\n 408 / W, 395 / H,\n 408 / W, 0 / H,\n\n 0 / W, 395 / H,\n\n 408 / W, 395 / H,\n 0 / W, 0 / H,\n\n\n // LEFT\n 408 / W, 395 / H,\n 834 / W, 600 / H,\n 834 / W, 395 / H,\n\n 408 / W, 600 / H,\n 834 / W, 600 / H,\n 408 / W, 395 / H,\n\n // right\n 408 / W, 395 / H,\n 834 / W, 600 / H,\n 834 / W, 395 / H,\n\n 408 / W, 600 / H,\n 834 / W, 600 / H,\n 408 / W, 395 / H,\n\n // back\n 408 / W, 395 / H,\n 834 / W, 600 / H,\n 834 / W, 395 / H,\n\n 408 / W, 600 / H,\n 834 / W, 600 / H,\n 408 / W, 395 / H,\n\n // bottom\n 408 / W, 0 / H,\n 834 / W, 395 / H,\n 834 / W, 0 / H,\n\n 408 / W, 395 / H,\n 834 / W, 395 / H,\n 408 / W, 0 / H,\n\n\n ] ),\n gl.STATIC_DRAW );\n}", "vertex_glsl_code() {\n // ********* VERTEX SHADER *********\n return this.shared_glsl_code() + `\n varying vec2 f_tex_coord;\n attribute vec3 position, normal, offset; \n // Position is expressed in object coordinates.\n attribute vec2 texture_coord;\n \n uniform mat4 model_transform;\n uniform mat4 projection_camera_model_transform;\n \n void main(){ \n // The vertex's final resting place (in NDCS):\n vec3 temp = offset;\n temp[1] = mod(temp[1], 5.0);\n gl_Position = projection_camera_model_transform * vec4(position + temp, 1.0 );\n // The final normal vector in screen space.\n N = normalize( mat3( model_transform ) * normal / squared_scale);\n vertex_worldspace = ( model_transform * vec4( position, 1.0 ) ).xyz;\n // Turn the per-vertex texture coordinate into an interpolated variable.\n f_tex_coord = texture_coord;\n } `;\n }", "function initArrow(s, tsize = 0.05, hsize = 0.5){\n VertexPositionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, VertexPositionBuffer);\n vertices = [\n 0.5*hsize, s, 0.0,\n 0.0, s+hsize, 0.0,\n -0.5*hsize, s, 0.0,\n\n -1.*tsize, s, 0.0,\n tsize, s, 0.0,\n -1.*tsize, 0.0, 0.0,\n\n tsize, 0.0, 0.0,\n tsize, s, 0.0,\n -1.*tsize, 0.0, 0.0,\n\n ];\n\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n VertexPositionBuffer.itemSize = 3;\n VertexPositionBuffer.numItems = 9;\n gl.vertexAttribPointer(shaderProgram.vertexPositionAttribute, VertexPositionBuffer.itemSize, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(0);\n\n}", "static setQV(qv, qq) {\nvar w, x, y, z;\n//-------\n[x, y, z, w] = qq;\nqv[0] = x;\nqv[1] = y;\nqv[2] = z;\nqv[3] = w;\nreturn qv;\n}", "initBuffer () {\n gl.useProgram(program);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.verticesVBO);\n\n // TODO: Übergebe hier sowohl das Mesh, als auch die Normalen an das VBO\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.mesh.concat(this.normals).concat(this.textureCoordinates)), gl.STATIC_DRAW);\n gl.uniformMatrix4fv(modelMatrixLoc, false, new Float32Array(this.modelMatrix));\n gl.uniformMatrix4fv(normalMatrixLoc, false, new Float32Array(this.normalMatrix));\n }", "function v( args )\n {\n // Initialize some of our member data\n this._canvas = args.canvas;\n this._context = this._canvas[0].getContext( gl_3D );\n this._m = { s : [] };\n\n if( !this._context )\n {\n this._context = this._canvas[0].getContext( EX_WEBGL );\n if( !this._context )\n throw new Error( 'WebGL is unsupported on this browser' );\n }\n\n // Set our default state\n // TODO: Make the background color customizable\n var gl = this._context;\n gl.clearColor( 0.34, 0.32, 0.31, 1 ); // Dark tan\n gl.clearDepth( 1 ); // Clear everything\n gl.enable( gl.DEPTH_TEST ); // No Z fighting please\n gl.depthFunc( gl.LEQUAL );\n this.clear();\n\n // Get and attach a default shader\n this.attachShader( Shader.getDefault() );\n\n // Update the size information about the viewport and initialize our\n // draw buffers.\n this.resize();\n this._initBuffers();\n }", "function t$8(t){t.vertex.code.add(t$i`const float PI = 3.141592653589793;`),t.fragment.code.add(t$i`const float PI = 3.141592653589793;\nconst float LIGHT_NORMALIZATION = 1.0 / PI;\nconst float INV_PI = 0.3183098861837907;\nconst float HALF_PI = 1.570796326794897;`);}", "draw() {\n // TODO\n let vPosition = gl.getAttribLocation( program, \"vPosition\");\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vBuffer);\n gl.vertexAttribPointer(vPosition, 4, gl.FLOAT, false, 0, 0);\n gl.enableVertexAttribArray(vPosition);\n\n let vColor = gl.getAttribLocation( program, \"vColor\" );\n gl.bindBuffer(gl.ARRAY_BUFFER, this.cBuffer);\n \tgl.vertexAttribPointer( vColor, 4, gl.FLOAT, false, 0, 0 );\n \tgl.enableVertexAttribArray( vColor );\n\n \n\n let location = gl.getUniformLocation(program, \"mat\");\n gl.uniformMatrix4fv(location, false, flatten(this.mat));\n gl.drawArrays( gl.TRIANGLES, 0, this.numVertices);\n\n\n }", "function setUpBuffers(){\r\n \"use strict\";\r\n\r\n\r\n var vertices = [\r\n //Pos X, Y, Z\r\n 0, 0, 0,\r\n 1, 0, 0,\r\n 1, 1, 0,\r\n 0, 1, 0,\r\n\r\n 0, 0, 1,\r\n 1, 0, 1,\r\n 1, 1, 1,\r\n 0, 1, 1,\r\n ];\r\n\r\n vertexBuffer = gl.createBuffer();\r\n gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\r\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\r\n\r\n var vertexIndices = [ //Welche vertices sind mit welchen anderen vertices verbunden?\r\n 0, 1,\r\n 0, 3,\r\n 0, 4,\r\n 1, 2,\r\n 1, 5,\r\n 2, 3,\r\n 2, 6,\r\n 3, 7,\r\n 4, 5,\r\n 4, 7,\r\n 5, 6,\r\n 6, 7,\r\n ];\r\n edgeBuffer = gl.createBuffer();\r\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, edgeBuffer);\r\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(vertexIndices), gl.STATIC_DRAW);\r\n\r\n\r\n\r\n}", "function WireFrameCube(gl, color) {\n function defineVertices(gl) {\n // define the vertices of the cube\n var vertices = [\n // X, Y, Z R, G, B U, V,\n // bottom\n -0.5, 0.5, -0.5, /* V0 / 0 */ 1.0, 0.0, 0.0, 0.0, 1.0,\n -0.5, -0.5, -0.5, /* V1 / 1 */ 1.0, 0.0, 0.0, 1.0, 1.0,\n 0.5, -0.5, -0.5, /* V2 / 2 */ 1.0, 0.0, 0.0, 1.0, 0.0,\n 0.5, 0.5, -0.5, /* V3 / 3 */ 1.0, 0.0, 0.0, 0.0, 0.0,\n\n // top\n 0.5, 0.5, 0.5, /* V4 / 4 */ 0.0, 1.0, 0.0, 0.0, 1.0,\n -0.5, 0.5, 0.5, /* V5 / 5 */ 0.0, 1.0, 0.0, 1.0, 1.0,\n -0.5, -0.5, 0.5, /* V6 / 6 */ 0.0, 1.0, 0.0, 1.0, 0.0,\n 0.5, -0.5, 0.5, /* V7 / 7 */ 0.0, 1.0, 0.0, 0.0, 0.0,\n\n // front\n -0.5, -0.5, -0.5, /* V1 / 8 */ 0.0, 0.0, 1.0, 0.0, 1.0,\n 0.5, -0.5, -0.5, /* V2 / 9 */ 0.0, 0.0, 1.0, 1.0, 1.0,\n 0.5, -0.5, 0.5, /* V7 / 10 */ 0.0, 0.0, 1.0, 1.0, 0.0,\n -0.5, -0.5, 0.5, /* V6 / 11 */ 0.0, 0.0, 1.0, 0.0, 0.0,\n\n // back\n -0.5, 0.5, -0.5, /* V0 / 12 */ 1.0, 1.0, 0.0, 0.0, 1.0,\n 0.5, 0.5, -0.5, /* V3 / 13 */ 1.0, 1.0, 0.0, 1.0, 1.0,\n 0.5, 0.5, 0.5, /* V4 / 14 */ 1.0, 1.0, 0.0, 1.0, 0.0,\n -0.5, 0.5, 0.5, /* V5 / 15 */ 1.0, 1.0, 0.0, 0.0, 0.0,\n\n // left\n -0.5, 0.5, -0.5, /* V0 / 16 */ 1.0, 0.0, 1.0, 0.0, 1.0,\n -0.5, -0.5, -0.5, /* V1 / 17 */ 1.0, 0.0, 1.0, 1.0, 1.0,\n -0.5, -0.5, 0.5, /* V6 / 18 */ 1.0, 0.0, 1.0, 1.0, 0.0,\n -0.5, 0.5, 0.5, /* V5 / 19 */ 1.0, 0.0, 1.0, 0.0, 0.0,\n\n // right\n 0.5, -0.5, -0.5, /* V2 / 20 */ 0.0, 1.0, 1.0, 0.0, 1.0,\n 0.5, 0.5, -0.5, /* V3 / 21 */ 0.0, 1.0, 1.0, 1.0, 1.0,\n 0.5, 0.5, 0.5, /* V4 / 22 */ 0.0, 1.0, 1.0, 1.0, 0.0,\n 0.5, -0.5, 0.5, /* V7 / 23 */ 0.0, 1.0, 1.0, 0.0, 0.0,\n ];\n\n var buffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n return buffer;\n }\n\n\n function defineEdges(gl) {\n // define the edges for the cube, there are 12 edges in a cube\n var vertexIndices = [\n // bottom\n 2, 1, 0,\n 0, 3, 2,\n\n // top\n 4, 5, 6,\n 6, 7, 4,\n\n // front\n 8, 9, 10,\n 10, 11, 8,\n\n // back\n 14, 13, 12,\n 12, 15, 14,\n\n // left\n 16, 17, 18,\n 18, 19, 16,\n\n // right\n 20, 21, 22,\n 22, 23, 20,\n ];\n var buffer = gl.createBuffer();\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(vertexIndices), gl.STATIC_DRAW);\n return buffer;\n }\n\n return {\n bufferVertices: defineVertices(gl),\n bufferEdges: defineEdges(gl),\n color: color,\n\n draw: function(gl, aVertexPositionId, aVertexColorId, aVertexTexCoordId) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.bufferVertices);\n gl.vertexAttribPointer(aVertexPositionId, 3, gl.FLOAT, false, 8 * Float32Array.BYTES_PER_ELEMENT, 0);\n gl.enableVertexAttribArray(aVertexPositionId);\n\n gl.vertexAttribPointer(aVertexColorId, 3, gl.FLOAT, false, 8 * Float32Array.BYTES_PER_ELEMENT, 3 * Float32Array.BYTES_PER_ELEMENT);\n gl.enableVertexAttribArray(aVertexColorId);\n\n gl.vertexAttribPointer(aVertexTexCoordId, 2, gl.FLOAT, false, 8 * Float32Array.BYTES_PER_ELEMENT, 6 * Float32Array.BYTES_PER_ELEMENT);\n gl.enableVertexAttribArray(aVertexTexCoordId);\n\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.bufferEdges);\n gl.drawElements(gl.TRIANGLES, 36 /* Anzahl Indices */ , gl.UNSIGNED_SHORT, 0);\n }\n }\n}", "constructor() {\n super(\"position\", \"color\");\n // Describe the where the points of a triangle are in space, and also describe their colors:\n this.arrays.position = [Vec.of(0, 0, 0), Vec.of(1, 0, 0), Vec.of(0, 1, 0)];\n this.arrays.color = [\n Color.of(1, 0, 0, 1),\n Color.of(0, 1, 0, 1),\n Color.of(0, 0, 1, 1)\n ];\n }", "function vertexCallback(data, polyVertArray) {\n // console.log(data[0], data[1]);\n polyVertArray[polyVertArray.length] = data[0];\n polyVertArray[polyVertArray.length] = data[1];\n polyVertArray[polyVertArray.length] = currentColor[0];\n polyVertArray[polyVertArray.length] = currentColor[1];\n polyVertArray[polyVertArray.length] = currentColor[2];\n polyVertArray[polyVertArray.length] = 1.0;\n \n }", "function init_equator(gl) {\n let vertices = [];\n let color = [1, 0, 1];\n // push 36 vertices to make a circle\n for (var i = 0; i <= 360; i += 10) {\n // Degree to radian\n let j = (i * Math.PI) / 180;\n let vert = [R * Math.cos(j), 0, R * Math.sin(j)]; // drawing a circle at the XZ plane since it has to be an equator for the cube...\n vertices.push(vert[0], vert[1], vert[2]); // push the vertices\n vertices.push(color[0], color[1], color[2]); // set the color\n }\n\n // VAO first\n let vao = gl.createVertexArray();\n // Bind VAO\n gl.bindVertexArray(vao);\n // Make VBO for the vertices and colors\n let vbo = gl.createBuffer();\n\n // Bind and upload the data.\n gl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);\n\n\n // takes 3 elements and the whole data set is sizeof(float) * the size of vertices array(6)\n // stride is 6, 3 for positions and 3 for the color\n // pass data to the shader program.\n gl.vertexAttribPointer(loc_aPosition, 3, gl.FLOAT, false, 4 * 6, 0); \n gl.enableVertexAttribArray(loc_aPosition);\n \n // takes 3 elements and the whole data set is sizeof(float) * the size of vertices array(6)\n // stride is 6, offset is 3 this is because 3 color elements are located after 3 position elements..\n gl.vertexAttribPointer(loc_aColor, 3, gl.FLOAT, false, 4 * 6, 4 * 3); \n gl.enableVertexAttribArray(loc_aColor);\n\n // Unbind VAO\n gl.bindVertexArray(null);\n // Unbind VBO\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n\n return { vao, n: vertices.length / 6 }; // since it has three coordinates and three color values so devide by 6\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 createVao(gl, geom, program) {\n let self = {\n\t\tid: gl.createVertexArray(),\n geom: geom,\n program: program,\n\n indexType: gl.UNSIGNED_SHORT,\n\n setGeom(geom) {\n this.bind();\n if (geom) {\n if (!geom.vertexComponents) geom.vertexComponents = 3;\n\n if (geom.vertices) {\n if (!this.vertexBuffer) {\n let buffer = gl.createBuffer();\n this.vertexBuffer = buffer;\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_position\") : 0;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of buffer (ARRAY_BUFFER)\n let size = geom.vertexComponents; // how many components per vertex (e.g. 2D, 3D geometry)\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n }\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.vertices, gl.DYNAMIC_DRAW);\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n }\n if (geom.normals) {\n if (!this.normalBuffer) {\n let buffer = gl.createBuffer();\n this.normalBuffer = buffer;\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_normal\") : 1;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of buffer (ARRAY_BUFFER)\n let size = 3; // 2 components per iteration\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n }\n gl.bindBuffer(gl.ARRAY_BUFFER, this.normalBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.normals, gl.DYNAMIC_DRAW);\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n }\n if (geom.texCoords) {\n if (!this.normalBuffer) {\n let buffer = gl.createBuffer();\n this.texCoordBuffer = buffer;\n // Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = positionBuffer)\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_texCoord\") : 2;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of positionBuffer (ARRAY_BUFFER)\n let size = 2; // 2 components per iteration\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n }\n gl.bindBuffer(gl.ARRAY_BUFFER, this.texCoordBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.texCoords, gl.DYNAMIC_DRAW);\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n }\n if (geom.colors) {\n if (!this.colorBuffer) {\n let buffer = gl.createBuffer();\n this.colorBuffer = buffer;\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_color\") : 3;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of buffer (ARRAY_BUFFER)\n let size = 4; // components per iteration\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n }\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.colors, gl.DYNAMIC_DRAW);\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n }\n if (geom.indices) {\n if (!this.indexBuffer) {\n let buffer = gl.createBuffer();\n this.indexBuffer = buffer;\n }\n this.indexType = (geom.indices.constructor == Uint32Array) ? gl.UNSIGNED_INT : gl.UNSIGNED_SHORT;\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, geom.indices, gl.DYNAMIC_DRAW);\n }\n }\n this.unbind()\n },\n\n init(program) {\n this.bind();\n if (geom) {\n if (!geom.vertexComponents) geom.vertexComponents = 3;\n if (geom.vertices) {\n let buffer = gl.createBuffer();\n // Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = positionBuffer)\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.vertices, gl.STATIC_DRAW);\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_position\") : 0;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of buffer (ARRAY_BUFFER)\n let size = geom.vertexComponents; // how many components per vertex (e.g. 2D, 3D geometry)\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n // done with buffer:\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n this.vertexBuffer = buffer;\n }\n if (geom.normals) {\n let buffer = gl.createBuffer();\n // Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = positionBuffer)\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.normals, gl.STATIC_DRAW);\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_normal\") : 1;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of buffer (ARRAY_BUFFER)\n let size = 3; // 2 components per iteration\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n // done with buffer:\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n this.normalBuffer = buffer;\n }\n if (geom.texCoords) {\n let buffer = gl.createBuffer();\n // Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = positionBuffer)\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.texCoords, gl.STATIC_DRAW);\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_texCoord\") : 2;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of positionBuffer (ARRAY_BUFFER)\n let size = 2; // 2 components per iteration\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n // done with buffer:\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n this.texCoordBuffer = buffer;\n }\n if (geom.colors) {\n let buffer = gl.createBuffer();\n // Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = positionBuffer)\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.colors, gl.STATIC_DRAW);\n // look up in the shader program where the vertex attributes need to go.\n let attrLoc = program ? gl.getAttribLocation(program, \"a_color\") : 3;\n // Turn on the attribute\n gl.enableVertexAttribArray(attrLoc);\n // Tell the attribute how to get data out of buffer (ARRAY_BUFFER)\n let size = 4; // components per iteration\n let type = gl.FLOAT; // the data is 32bit floats\n let normalize = false; // don't normalize the data\n let stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position\n let offset = 0; // start at the beginning of the buffer\n gl.vertexAttribPointer(attrLoc, size, type, normalize, stride, offset);\n // done with buffer:\n gl.bindBuffer(gl.ARRAY_BUFFER, 0);\n this.colorBuffer = buffer;\n }\n if (geom.indices) {\n // check type: \n if (geom.indices.constructor == Uint32Array) this.indexType = gl.UNSIGNED_INT \n\n let buffer = gl.createBuffer();\n // Bind it to ARRAY_BUFFER (think of it as ARRAY_BUFFER = positionBuffer)\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, geom.indices, gl.DYNAMIC_DRAW);\n this.indexBuffer = buffer;\n }\n }\n this.unbind();\n },\n\n // assumes vao and buffer are already bound:\n setAttributes(buffer, bytestride, bufferFields, instanced) {\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n for (let field of bufferFields) {\n const attrLoc = gl.getAttribLocation(this.program, field.name);\n const normalize = false;\n const bytesize = field.bytesize / field.components;\n // watch out: if field.componnents > 4, it occupies several attribute slots\n // need to enable and bind each of them in turn:\n for (let i=0; i<field.components; i+=4) {\n const loc = attrLoc + i/4; \n const byteoffset = field.byteoffset + (i * bytesize);\n const components = Math.min(4, field.components - i);\n gl.enableVertexAttribArray(loc);\n gl.vertexAttribPointer(loc, components, field.type, normalize, bytestride, byteoffset);\n if (instanced) {\n gl.vertexAttribDivisor(loc, 1);\n } else {\n gl.vertexAttribDivisor(loc, 0);\n }\n //console.log(\"set attr\", field.name, loc, components, instanced, bytestride, byteoffset)\n }\n }\n return this;\n },\n\n bind() {\n gl.bindVertexArray(this.id);\n return this;\n },\n unbind() {\n gl.bindVertexArray(this.id, null);\n return this;\n },\n\t\t// bind first:\n\t\tsubmit() {\n //gl.bufferData(gl.ARRAY_BUFFER, this.data, gl.DYNAMIC_DRAW);\n if (geom.vertices) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.vertices, gl.DYNAMIC_DRAW);\n }\n if (geom.colors) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.colorBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.colors, gl.DYNAMIC_DRAW);\n }\n if (geom.normals) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.normalBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.normals, gl.DYNAMIC_DRAW);\n }\n if (geom.texCoords) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.texCoordBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, geom.texCoords, gl.DYNAMIC_DRAW);\n }\n if (geom.indices) {\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, geom.indices, gl.DYNAMIC_DRAW);\n }\n\t\t\treturn this;\n\t\t},\n draw(count=0, offset=0) {\n\t\t\tif (geom.indices) gl.drawElements(gl.TRIANGLES, count ? count : geom.indices.length, this.indexType, offset);\n\t\t\telse gl.drawArrays(gl.TRIANGLES, offset, count ? count : geom.vertices.length/geom.vertexComponents);\n\t\t\treturn this;\n },\n drawLines(count=0, offset=0) {\n\t\t\tif (geom.indices) gl.drawElements(gl.LINES, count ? count : geom.indices.length, this.indexType, offset);\n\t\t\telse gl.drawArrays(gl.LINES, offset, count ? count : geom.vertices.length/geom.vertexComponents);\n\t\t\treturn this;\n },\n drawPoints(count=0, offset=0) {\n if (geom.indices) gl.drawElements(gl.POINTS, count ? count : geom.indices.length, this.indexType, offset);\n\t\t\telse gl.drawArrays(gl.POINTS, offset, count ? count : geom.vertices.length/geom.vertexComponents);\n\t\t\treturn this;\n },\n drawInstanced(instanceCount=1, primitive=gl.TRIANGLES) {\n if (geom.indices) gl.drawElementsInstanced(primitive, geom.indices.length, this.indexType, 0, instanceCount);\n else gl.drawArraysInstanced(primitive, 0, geom.vertices.length/geom.vertexComponents, instanceCount)\n\t\t\treturn this;\n },\n drawInstancedRange(instanceStart=0, instanceCount=1, primitive=gl.TRIANGLES) {\n if (geom.indices) gl.drawElementsInstanced(primitive, geom.indices.length, this.indexType, instanceStart, instanceCount);\n else gl.drawArraysInstanced(primitive, instanceStart, geom.vertices.length/geom.vertexComponents, instanceCount)\n\t\t\treturn this;\n },\n\n\n dispose() {\n if(this.indexBuffer) gl.deleteBuffers(this.indexBuffer)\n if(this.texCoordBuffer) gl.deleteBuffers(this.texCoordBuffer)\n if(this.normalBuffer) gl.deleteBuffers(this.normalBuffer)\n if(this.colorBuffer) gl.deleteBuffers(this.colorBuffer)\n if(this.vertexBuffer) gl.deleteBuffers(this.vertexBuffer)\n gl.deleteVertexArrays(this.id)\n },\n }\n self.init(program);\n\n return self;\n}", "vertex_glsl_code() {\n // ********* VERTEX SHADER *********\n return this.shared_glsl_code() + `\n varying vec2 f_tex_coord;\n attribute vec3 position, normal, offset; \n // Position is expressed in object coordinates.\n attribute vec2 texture_coord;\n \n uniform mat4 model_transform;\n uniform mat4 projection_camera_model_transform;\n \n void main(){ \n // The vertex's final resting place (in NDCS):\n vec3 temp = offset;\n temp[1] = mod(temp[1], 1.5);\n gl_Position = projection_camera_model_transform * vec4(position + temp, 1.0 );\n // The final normal vector in screen space.\n N = normalize( mat3( model_transform ) * normal / squared_scale);\n vertex_worldspace = ( model_transform * vec4( position, 1.0 ) ).xyz;\n // Turn the per-vertex texture coordinate into an interpolated variable.\n f_tex_coord = texture_coord;\n } `;\n }", "vertex_glsl_code() {\n // ********* VERTEX SHADER *********\n return this.shared_glsl_code() + `\n varying vec2 f_tex_coord;\n attribute vec3 position, normal, offset; \n // Position is expressed in object coordinates.\n attribute vec2 texture_coord;\n \n uniform mat4 model_transform;\n uniform mat4 projection_camera_model_transform;\n \n void main(){ \n // The vertex's final resting place (in NDCS):\n vec3 temp = offset;\n temp[1] = mod(temp[1], 0.7);\n gl_Position = projection_camera_model_transform * vec4(position + temp, 1.0 );\n // The final normal vector in screen space.\n N = normalize( mat3( model_transform ) * normal / squared_scale);\n vertex_worldspace = ( model_transform * vec4( position, 1.0 ) ).xyz;\n // Turn the per-vertex texture coordinate into an interpolated variable.\n f_tex_coord = texture_coord;\n } `;\n }", "function setGeometry(gl) {\n\n var f32Arr = initializeGrid(4, 3);\n gl.bufferData(gl.ARRAY_BUFFER, f32Arr, gl.STATIC_DRAW);\n\n}", "function initBuffers() {\n // 3 stk 3D vertekser:\n let trianglePositions = new Float32Array([ //NB! ClockWise!!\n -10, -10, 0, //0\n 0, -5, 0,\n 10, -8, 0,\n -1, -8, 0,\n 3, 4, 0,\n 7, -6, 0,\n -15, -10, 0,\n 0, 5, 0,\n 10, -7, -5,\n 2, 5, 0,\n 5, -7, -5, //10\n\n -25, 9, 0, //11 triangle\n -25, -15, 0,\n -10, 8, -2,\n\n -26, 11, 0, //14 line\n -29, -16, 0,\n\n -30, -25, 0, //16 line\n 6, -20, 0,\n\n -15, -25, 0, //18 LINE_STRIP\n 6, -10, 0,\n 8, -15, 0,\n -15, -25, 0,\n\n -8, -25, 0, //22 TRIANGLE_STRIP\n -6, -10, 0,\n -9, -15, 0,\n\n -15, -20, 0,\n -12, -22, 0,\n\n -9, -30, 0,\n -15, -29, 0,\n\n -12, -18, 0,\n -12, -17, 0, //30\n\n\n ]);\n\n // Verteksbuffer:\n positionBuffer = gl.createBuffer();\n gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);\n gl.bufferData(gl.ARRAY_BUFFER, trianglePositions, gl.STATIC_DRAW);\n\n positionBuffer.itemSize = 3; // NB!!\n positionBuffer.numberOfItems = 3; // NB!!\n\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n}" ]
[ "0.7096406", "0.6933232", "0.6933232", "0.6859379", "0.6772175", "0.6772175", "0.66159856", "0.6610996", "0.655981", "0.6474144", "0.6464176", "0.6403607", "0.6381805", "0.6355871", "0.6343511", "0.62973905", "0.62324405", "0.622852", "0.61815244", "0.6123148", "0.6118742", "0.61083853", "0.6083982", "0.60723525", "0.60668856", "0.6050416", "0.6025423", "0.6013731", "0.59870154", "0.5982738", "0.5978386", "0.5974259", "0.5963205", "0.5962955", "0.59529436", "0.593214", "0.5929736", "0.591983", "0.59094524", "0.59093815", "0.5908477", "0.58722156", "0.58722156", "0.58722156", "0.5867428", "0.58323973", "0.5804476", "0.5786556", "0.5772251", "0.5761787", "0.5756032", "0.575036", "0.5748489", "0.5743047", "0.5735995", "0.5735995", "0.57138073", "0.57091874", "0.5706439", "0.57060295", "0.5693478", "0.5685828", "0.5685828", "0.5685194", "0.56841856", "0.5677887", "0.56656986", "0.56650937", "0.5654676", "0.56386334", "0.5630065", "0.56293654", "0.5626277", "0.5616146", "0.5607508", "0.559988", "0.55964863", "0.5590427", "0.55782837", "0.5576384", "0.55604184", "0.555834", "0.55576926", "0.55565506", "0.55535537", "0.5551185", "0.55492485", "0.55491984", "0.55487484", "0.55485547", "0.5543899", "0.5543269", "0.5539588", "0.55369717", "0.55332774", "0.5530383", "0.55284786", "0.55283415", "0.5528002", "0.5525024", "0.55193883" ]
0.0
-1
Load all of our pictures and dynamically create a "spritesheet"
function CreateTextureSheet() { Game.ImagesLoading = 0; for (var k = 0; k < 10; k++) { LoadImage(k); } }
{ "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 loadImages() {\n bsImage = new Image();\n bsImage.src = \"resources/resources/images/spritesheets/buttons_1.png\";\n wallImag = new Image();\n wallImag.src = \"resources/resources/images/spritesheets/jungle_wall.png\";\n ssImage = new Image();\n ssImage.src = \"resources/resources/images/spritesheets/sprites_final.png\";\n window.setTimeout(setup, 1500);\n aImage = new Image();\n aImage.src = \"resources/resources/images/spritesheets/uparr.png\"\n}", "function buildSpriteSheet() {\n\t// load the image\n\tspriteImage.onload = imgReady;\n\tspriteImage.onerror = imgLoadError;\n\tspriteImage.src = \"img/spritesheet.png\";\n}", "function loadImages() {\n floor = new Image();\n background = new Image();\n ring = new Image();\n platform = new Image();\n\n floor.src = './tile-images/floorpath.png';\n background.src = './tile-images/plainbackgroundtile.png';\n ring.src = './tile-images/ring.png';\n platform.src = './tile-images/platform.png';\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 }", "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}", "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}", "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_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 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}", "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}", "loadSpriteSheet(){\n this.spriteSheet = loadImage('assets/sprites.png');\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}", "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 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}", "function loadImages() {\r\n new Image('(\"Robot\") Bag','/images/bag.jpg', 0);\r\n new Image('Bathroom Phone Holder','/images/bathroom.jpg', 0);\r\n new Image('Breakfast Maker','/images/breakfast.jpg', 0);\r\n new Image('Meatball Bubblegum','/images/bubblegum.jpg', 0);\r\n new Image('Chair','/images/chair.jpg', 0);\r\n new Image('Cthulhu','/images/cthulhu.jpg', 0);\r\n new Image('Duck Mask','/images/dog-duck.jpg', 0);\r\n new Image('Dragon','/images/dragon.jpg', 0);\r\n new Image('U-Pensils','/images/pen.jpg', 0);\r\n new Image('Pet Sweep','/images/pet-sweep.jpg', 0);\r\n new Image('Pizza Scissors','/images/scissors.jpg', 0);\r\n new Image('Shark Blanket','/images/shark.jpg', 0);\r\n new Image('Baby Sweep','/images/sweep.png', 0);\r\n new Image('TaunTaun Sleepingbag','/images/tauntaun.jpg', 0);\r\n new Image('Unicorn Meat','/images/unicorn.jpg', 0);\r\n new Image('USB','/images/usb.gif', 0);\r\n new Image('Water Can','/images/water-can.jpg', 0);\r\n new Image('Wine Glass','/images/wine-glass.jpg', 0);\r\n new Image('boots', '/images/boots.jpg', 0);\r\n new Image('banana','/images/banana.jpg', 0);\r\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 loadAssets() {\n PIXI.loader\n .add([\n \"./assets/tileset10.png\",\n ])\n .load(gameCreate);\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 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 }", "initSpritesheets() {\n this.spritesheets = new Map(); // Map that stores spritesheets by ID\n\n for (let [id, spritesheet] of this.graph.spritesheets) {\n let ss = new MySpriteSheet(this, spritesheet.path, spritesheet.sizeM, spritesheet.sizeN);\n this.spritesheets.set(id, ss);\n }\n }", "function loadImages(image, name, xPos, yPos, cursor, rot, container,scale){\n var _bitmap = new createjs.Bitmap(image).set({});\n if (name == 'grating_table' || name == 'vernier_table') {\n \n _bitmap.regX = _bitmap.image.width/2;\n _bitmap.regY = _bitmap.image.height/2;\n \n }\n _bitmap.x = xPos;\n _bitmap.y = yPos;\n _bitmap.scaleX=_bitmap.scaleY=scale;\n _bitmap.name = name;\n _bitmap.alpha = 1;\n _bitmap.rotation = rot; \n _bitmap.cursor = cursor; \n container.addChild(_bitmap); /** Adding bitmap to the container */ \n stage.update();\n}", "function preload_sprites(){\n\t\n\timg1 = new Image();\n\t\n\timg1.src = \"../images/system/bg/versionSprites.png\";\n}", "function createPictures(glyphSequence, loadInto) {\n\n let array = $.map(glyphSequence, function (el) {\n return el;\n });\n\n array = shuffleArray(array);\n\n $.each(array, function () {\n let p = $(\"<p>\");\n p.html(this.name + \"<br/>\");\n let img = $(\"<img>\");\n img.attr(\"src\", \"images/glyph/\" + this.src);\n let str = \"100px\"; // TODO Better CSS\n img.css(\"width\", str).css(\"height\", str);\n img.addClass(\"glyphPictures\");\n img.data(\"order\", this.order);\n img.data(\"name\", this.name);\n img.after();\n p.append(img);\n loadInto.append(p);\n });\n }", "function loadPiecesPng(){\n wPawn = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_plt60.png\")\n wBishop = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_blt60.png\")\n wRook = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_rlt60.png\")\n wKnight = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_nlt60.png\")\n wQueen = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_qlt60.png\")\n wKing = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_klt60.png\") \n \n bPawn = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_pdt60.png\")\n bBishop = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_bdt60.png\")\n bRook = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_rdt60.png\")\n bKnight = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_ndt60.png\")\n bQueen = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_qdt60.png\")\n bKing = loadImage(\"/Project-Archive/FreeTime/Assets/PiecesPng/Chess_kdt60.png\")\n}", "preloadImages(doload, callback) {\n\t\tconst paths = this.getImagePaths();\n\t\tfor (let i = 0; i < paths.length; i++) {\n\t\t\tgraphics.add(paths[i]);\n\t\t}\n\t\tif (doload) {\n\t\t\tgraphics.load(callback);\n\t\t}\n\t}", "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() {\n\timages[0] = loadImage('AssetsHouse/opening.png');\n\timages[1] = loadImage('AssetsHouse/bedroom.png');\n\timages[2] = loadImage('AssetsHouse/bedroomBathroom.png');\n\timages[3] = loadImage('AssetsHouse/dining.png');\n\timages[4] = loadImage('AssetsHouse/dressing.png');\n\timages[5] = loadImage('AssetsHouse/hallway.png');\n\timages[6] = loadImage('AssetsHouse/kitchen.png');\n\timages[7] = loadImage('AssetsHouse/laundry.png');\n\timages[8] = loadImage('AssetsHouse/living.png');\n\timages[9] = loadImage('AssetsHouse/livingBathroom.png');\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 }", "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 for(let i = 0; i<10; i++){\n this.load.image(`card${i+1}`, `../static/Clovers_${i+1}_white.png`);\n }\n this.load.image(`back-card`, '../static/Clovers_King_black.png');\n }", "function loadImages() {\n testPattern = new Image();\n testPattern.src = \"testpattern.gif\";\n }", "function preload(){\n images[0] = loadImage('assets/house.png');\n images[1] = loadImage('assets/hallway.png');\n images[2] = loadImage('assets/livingroom.png');\n images[3] = loadImage('assets/diningroom.png');\n images[4] = loadImage('assets/kitchen.png');\n images[5] = loadImage('assets/bathroom.png');\n images[6] = loadImage('assets/bedroom.png');\n}", "function beginLoadingImage(arrayIndex, fileName, isGamePic) {\n if (isGamePic) {\n gamePics[arrayIndex] = document.createElement(\"img\");\n gamePics[arrayIndex].onload = countLoadedImageAndLaunchIfReady;\n gamePics[arrayIndex].src = \"images/\" + fileName;\n } else {\n worldPics[arrayIndex] = document.createElement(\"img\");\n worldPics[arrayIndex].onload = countLoadedImageAndLaunchIfReady;\n worldPics[arrayIndex].src = \"images/\" + fileName;\n }\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 init()\n{\n //assets loaded in, main scene\n this.load.image('sky', 'assets/sky.png');\n this.load.image('ground', 'assets/concrete.png');\n this.load.image('star', 'assets/star.png');\n this.load.spritesheet('dude', 'assets/dude.png', { frameWidth: 32, frameHeight: 48 });\n //24, 48\n this.load.spritesheet('placeholder', 'assets/prototype_sprites.png', {frameWidth: 24, frameHeight: 48});\n}", "function preload() {\n //level one, acorns to collet\n nbHeart.image = loadImage(\"assets/images/NB_heart.png\");\n supportToken.image = loadImage(\"assets/images/supportToken.png\");\n supportToken2.image = loadImage(\"assets/images/supportToken2.png\");\n\n for (let i = 0; i < 11; i++) {\n agroImages[i] = loadImage(`assets/images/agro-${i}.png`);\n }\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}", "function preloadImages() {\n for (var i = 0; i < numberOfGifsToPreload; i++) {\n popThenAddImage(fileNamesArray);\n }\n }", "function initReels() {\n // iterate through all canvas elements, create context and new image\n canvases.forEach(function (canvas) {\n let ctx = canvas.getContext('2d');\n let img = new Image();\n img.src = 'images/Symbol_1.png';\n\n img.onload = function () {\n ctx.drawImage(\n img,\n spriteObject.sourceX, spriteObject.sourceY, spriteObject.sourceWidth, spriteObject.sourceHeight,\n spriteObject.x, spriteObject.y, spriteObject.width, spriteObject.height\n )\n };\n })\n }", "initPlayerImage() {\n this.img = new Image();\n this.img.src = this.spriteSheetPath;\n this.img.onload = this.onImageLoaded();\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 }", "function createPlayerSheet()\n{\n let sheet = new PIXI.BaseTexture.from(app.loader.resources[\"human\"].url);\n let w = 80;\n let h = 80;\n \n playerSheet[\"stand\"] = [\n new PIXI.Texture(sheet, new PIXI.Rectangle(0, 0, w, h))\n ];\n\n playerSheet[\"walk\"] = [\n new PIXI.Texture(sheet, new PIXI.Rectangle(0 * w, h, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(1 * w, h, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(2 * w, h, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(3 * w, h, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(4 * w, h, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(5 * w, h, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(6 * w, h, w, h))\n ];\n playerSheet[\"shoot\"] = [\n new PIXI.Texture(sheet, new PIXI.Rectangle(0 * w, h * 2, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(1 * w, h * 2, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(2 * w, h * 2, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(3 * w, h * 2, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(4 * w, h * 2, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(5 * w, h * 2, w, h)),\n new PIXI.Texture(sheet, new PIXI.Rectangle(6 * w, h * 2, w, h))\n ];\n playerSheet[\"jump\"] = [\n new PIXI.Texture(sheet, new PIXI.Rectangle(1 * w, h, w, h)),\n ];\n}", "function preload() {\n pics.push(loadImage(\"./Pics/DGS-01.png\"));\n pics.push(loadImage(\"./Pics/DGS-02.png\"));\n pics.push(loadImage(\"./Pics/DGS-03.png\"));\n pics.push(loadImage(\"./Pics/DGS-04.png\"));\n}", "function load_images() {\n data.each(function(frame) {\n var imgs = []\n frame.images.each(function(imgstr) {\n var img = new Image(IMG_WIDTH, IMG_HEIGHT);\n img.src = \"/img/\" + imgstr;\n img.style.float = \"left\";\n imgs.push(img); \n });\n frame['imageobjs'] = imgs;\n }) \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 preload() {\n println(\"loading images\")\n img = [loadImage(\"./assets/AmericaFirst.png\"), loadImage(\"./assets/AuditTheVote.png\"), loadImage(\"./assets/Hillary.png\"), loadImage(\"./assets/MAGA.png\"), loadImage(\"./assets/TrumpTrain.png\")];\n\n}", "function preload(){\r\n\r\n\tboy = loadImage(\"images/boy.png\");\r\n\r\n\ttreeObj = loadImage(\"images/tree.png\");\r\n\r\n }", "function preload(){\r\n\r\n\tboy = loadImage(\"images/boy.png\");\r\n\r\n\ttreeObj = loadImage(\"images/tree.png\");\r\n\r\n }", "function doneLoading(e)\n{\n // Create all sprite sheets\n createPlayerSheet();\n createEnemySheet();\n createBackgroundSheet()\n createTileSheet();\n createWaveSheet();\n createDoorSheet();\n createBulletSheet();\n\n // Place the background\n for(let i = 0; i < 8; i++)\n {\n createBackground(i * 600, 0);\n }\n\n // Load in the level\n loadLevel();\n\n\n\n // Start the game loop\n app.ticker.add(gameLoop);\n \n}", "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}", "function onload()\n{\n console.log('Page loaded.');\n canvas = document.getElementById('canvas');\n canvas.addEventListener(\"click\", canvasClick, false);\n spritesheet = new Image();\n // spritesheet.src = 'spritesheet.png';\n // the image above has been turned into a data url\n // so that no external files are required for\n // this web page - useful for included in a\n // \"gist\" or \"jsfiddle\" page\n spritesheet.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAgCAYAAACVf3P1AAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAIN0lEQVR42mJMWaLzn4FEoCrxC86+/YINRQzER2aj68GmnhDgOx6EV/6T5Tqy7S9zvsnIMAoGDAAEEGPnHrX/6IkAFDm4EgZy4kNPhMSaQUgdTAyW8Oz1pMC0sAw7irq3T36C6YOXnqEkRlLsnx19eTQBDiAACCAWWImBHFnEJD7kkgYbICbykc1Btx+U+NATnqKhBpruG2AySEYRniAPAvWBEiGx9sNzYiQj3prg//L/jLQ0b72zN171gXu3kmQ/qebZiEv9/8fwn+E/UNdfIPEXyPsHpMEYKH/53RuS7CfWPIAA7JXhCoBACIPn9Crq/d83VncghEf0O0GQ4eafD2T1qmbgjf0xVyDOAK1glSfDN+oJ361lXaDKJ7/67f2/gCMadg+s7licaCRoBlN/zLsyI7Apkw63npn2TgHEQqhahEUivioNW7uL2CoQHbxcH4GS+NCrXWRw//wNDDGQelCJCC4NgWbxoVXNhACpJR2p5hAqGUkt6Ug1B1fJyM3KyvDn3z+GTY/uUcX+nU8fYjXHWETs/z8kPkAAsWBrvBPqfOBLiKRWwej2v8SS8LCVftgSH6q6GxhVMykJcaQBHmBJ9evfP5rbAyoF//7/C+cDBBALsaUeMYmP0o4HrPTD1eZDTnTIcjDxM5svgvUiV80gOZRSEZgQxQNXkFU6D2cAShgMDPRIgKhVMEAAseArydBLNPQSktjOC6HqnRgAS2S42oIweVAie/vkIrwURU+I9gxS4KqZAWnoZhQwMPz4+weI/9J+2AWc+hBJECCAmEjtscISDjmRh6wH21giPoDe4cCWOLG1F9ETLkzNaOJDBT+B1S8oEdIaMKF1aQACiAm5tMOVQEgZiiGlR4zRo75/H2V8j1gAS5wgbOKrj7NdiJ6AR6thBPj+5w/DdzokQHQAEEAsuEo4QpGDa/CZmMRHbFsRVHrhKvVwqYVVtbiqa1zup1bvl9zeMbV6v+T2jrc/eUAX+4+8fIZiD0AAMWFLIPgSB7ocKe05UmZXYKUgKEFh6/EiJzyYPHJ1S2zCHQUDCwACiAm5x0ssIGYYBlcbD1vvF109qARDb8+hJ0JsCZNQwsOXkEfBwACAAGIhp2ok1HNGb0sit/UIlbD4hmCQq2RSSzjkxAdqa4pb4lTqAMT5QCwAxI1ArADE8UjyF4C4EMpeD8QTgfgAlL8fSh+A6k3Ao5dYUADE/kD8AaoXRPdD3QWyewNUHcgufSTzDaB4wWBOgAABxIStQ0CNXiJyQiTGrCN95gyqiop4OxrklmIk6qkH4kQgdgTiB9AIdITKOSJFcAA0QcWj6XeEJg4HPHqJBf1IehOREt9CqFg8NJExQBOpANRuBihbnqapJ9T5PxhTAAACiAk94SGXWsTOjBDSi88sZPvR538pBeilJnLb8uHG3/i0wkrAB3jU+ENLIAMkMQFowlMgoJdYADJ7AlJpBhODlbgToe6A2XcQmjFoD5ATHgWJECCAmHAlKmJLQFxjgrg6K5QAUjoX+AauCQBQyfIQiOdDqzVsAFbSfIAmhgAk8Xyo2AMqRrcBtGQ2gNqJLcNshFbH8UOpDQgQQEy4SjRsJSOpHRRizSBQGmEkKljJhq1qRRbHVW2DqnqOr2b47F0ArfJwRWYANLHthyYKf6g4KNEFIslTK/EtQCr1GJDM9oeWeg7QBLoerRqmHVi9lxErm0QAEEAs+Hqx2PjI4qTM/xIDQAtLYQsI0KtO9KEWQu07CoZh9iOxG/FUv4FIpdx5NPmJ0FKpkcIgKYSWxLBSbyNUDJbQDkDlLkAzDKwzAmufJkATJwNSW5Q2iZBMABBAjLiW5GNLgPiqVGwJlFjwcpkhvAOCvBiB2GoZW2LEVfqBFyRAV1CDesObti4aXRE9gAAggJiwtf3IGRskpB5XhwVWDSJ3QPBNxcHk8LUH8SU+WnR2RgH5ACCAmHD1VPENNhMq4YiZH8Ymhi9hQFa5/ERZ4ULFoZdRMEAAIICY8HUkiF0LiCyPa6YDVzUO6gzgG/9DBrCqGV/iQl+aRUypCm6LRDL+J7RamRoAlz2glcqE9nFQA+CyR19I5L8uENPafnR7AAKIhZg1faQuTCCmDYisBrndhy2hYBPDNcwCEsemHt18kJ2w1TejgAG8V+P///90twcggFiQOxCkdh4IdThw7R9GZr9ESmTY5oBJqWrREx6ubZywHvcoQE0Y/wbAHoAAYsG3rIrYxIUvYRKzegaUGLC1/0hdF4gr8WEzB1T6sYueGE15UIC+V4Ne9gAEEAs1Eh+uZfbEVN3iUecZbi+DClzC3ylBTkj4SjdCiQ9W+gm4so+mPHjCIG/7JaX2AAQQyathCPVwYb1pUk5XQE6EyOOB6AkG21ANriob26kJmKXfaAKEAdBe4L//mWhuD/qeEIAAYsHXeSB2TR+lnRZYIgSNCd6+j0gkyAkSX1WNXvXiSnwwM39wn2IQx1H64eoJU/tkBHy9VGzi1D4ZAR1wMbOCaUsxyf/UOBkhSEHlPzsTEwMHMwvYrC9//jB8/f0bY08IQACxkNrGo8a0G67SUd4fFAiQhMjP9Q+aaJD0ETFcg574kHu6oIQHAjCzRwECcLKwgA7SACaPvwx/gAnmDzCIfv8DHa4BzExk9I4hpyEwMbAwARPcPyac1TtAAOGdikOuUolJfLgSFq5pPWLamXtmMsITzM/XFvCEiH56AmyKDX1oBZToQPo/fkNULy7p/+H2jx5ONLAAIIBwno6Fq0rGt3EJ37Fo6ImZmKofmzgoQYIGr3EBUNsOObHBEq9pLCNW+0ePZxtYABBgAEdytom0/RTgAAAAAElFTkSuQmCC';\n spritesheet.onload = loaded;\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 loadImages(image, name, xPos, yPos, cursor, rot, container,scale){\n var _bitmap = new createjs.Bitmap(image).set({});\n _bitmap.x = xPos;\n _bitmap.y = yPos;\n _bitmap.scaleX=_bitmap.scaleY=scale;\n _bitmap.name = name;\n _bitmap.alpha = 1;\n _bitmap.rotation = rot; \n _bitmap.cursor = cursor; \n if ( name == \"thread_falling_anim\" ) {\n _bitmap.mask = thread_anim_rect; /** Adding mask to thread animation */ \n } \n container.addChild(_bitmap); /** Adding bitmap to the container */ \n stage.update();\n}", "function preload() {\n dragonPic = loadImage(\"assets/images/dragonPic.png\");\n lionPic = loadImage(\"assets/images/lion.png\");\n tigerPic = loadImage(\"assets/images/tiger.png\");\n preyPic = loadImage(\"assets/images/prey.png\");\n}", "function preloadGameImages() { \r\n gameImage = new preloadImages()\r\n \r\n /*Add image that needs to be preloaded*/\r\n for (i = 0; i < imgSrc.length; i++) {\r\n gameImage.setImageAry(imgSrc[i]);\r\n }\r\n}", "function preloadImages() {\n var images = [\n 'btn_action_active.png',\n\t'btn_focus_active.png',\n 'btn_up_active.png',\n 'btn_right_active.png',\n 'btn_left_active.png',\n 'btn_down_active.png',\n 'prybar.png',\n 'machete.png',\n 'sample_dna.png',\n 'pickaxe.png',\n 'fuel.png',\n 'fire_extinguisher.png',\n 'dynamite.png',\n 'dna_sampler.png'\n ];\n $(images).each(function() {\n $('<img/>')[0].src = this;\n (new Image()).src = this;\n });\n}", "function preload() {\n\n // image for the player\n spriteImg = loadImage(\"assets/images/boy.png\");\n\n // images for the toys\n bearImg = loadImage(\"assets/images/bear.png\");\n ponyImg = loadImage(\"assets/images/pony.jpeg\");\n wheelImg = loadImage(\"assets/images/wheel.png\");\n\n // images for bad info\n violenceImg = loadImage(\"assets/images/violence.jpg\");\n gunfightImg = loadImage(\"assets/images/gunfight.jpg\");\n coolImg = loadImage(\"assets/images/cool.jpg\");\n\n // image of box for platform\n platformImg = loadImage(\"assets/images/box.png\");\n\n // images of background\n violentBg = loadImage(\"assets/images/violentBG.jpg\");\n backgroundKid = loadImage(\"assets/images/backgroundKid.jpg\");\n\n}", "function preload() {\n socialMediaGirl.image = loadImage(\"assets/images/matrixgirlsocialmedia.png\");\n societyGirl.image = loadImage(\"assets/images/matrixgirlsociety.png\");\n othernessGirl.image = loadImage(\"assets/images/matrixgirlfinalstep.png\");\n originalGirl.image = loadImage(\"assets/images/matrixgirlalmostfree.png\");\n almostFreeGirl.image = loadImage(\"assets/images/matrixgirlfree.png\");\n matrixEntry.image = loadImage(\"assets/images/matrixentry.jpg\");\n matrixFail.image = loadImage(\"assets/images/matrixsucked.jpg\");\n instagram.image = loadImage(\"assets/images/IG.png\");\n youtube.image = loadImage(\"assets/images/yt.png\");\n facebook.image = loadImage(\"assets/images/fb.png\");\n pinterest.image = loadImage(\"assets/images/pinterest.png\");\n twitter.image = loadImage(\"assets/images/twitter.png\");\n snapchat.image = loadImage(\"assets/images/sc.png\");\n society1.image = loadImage(\"assets/images/societyblue.png\");\n society2.image = loadImage(\"assets/images/societyred.png\");\n freedom.image = loadImage(\"assets/images/freedom.jpg\");\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 preload() {\n spritesheet = loadImage('images/Flakes1.png');\n font = loadFont('font/Freeride.otf');\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}", "function preload() {\n // preload() runs once\n img1 = loadImage('assets/Earth.gif');\n img2 = loadImage('assets/Jupiter.gif');\n img3 = loadImage('assets/Sun.gif');\n img4 = loadImage('assets/Player Ship.gif');\n}", "function createTileSheet()\n{\n let sheet = new PIXI.BaseTexture.from(app.loader.resources[\"tiles\"].url);\n let crateSheet = new PIXI.BaseTexture.from(app.loader.resources[\"crate\"].url);\n let spikeSheet = new PIXI.BaseTexture.from(app.loader.resources[\"spikes\"].url);\n let w = 80;\n let h = 80;\n \n tileSheet[\"platform\"] = [\n new PIXI.Texture(sheet, new PIXI.Rectangle(0, 0, w, h))\n ];\n tileSheet[\"crate\"] = [\n new PIXI.Texture(crateSheet, new PIXI.Rectangle(0, 0, w, h))\n ];\n\n tileSheet[\"spikes\"] = [\n new PIXI.Texture(spikeSheet, new PIXI.Rectangle(0, 0, w, 20))\n ];\n}", "function loadImg() {\n var im = new Image();\n if (dw.project == 0)\n im.src = IMGMAP['wrld_small'];\n else if (dw.project == 101)\n im.src = IMGMAP['wrld_small_merc'];\n else if (dw.project == 102)\n im.src = IMGMAP['wrld_small_mill'];\n else if (dw.project == 204)\n im.src = IMGMAP['wrld_small_moll'];\n else {\n scaleheight();\n draw();\n }\n im.onload = function () {\n if (dw.project == 0)\n dw.loadCarta([{0: '.Image', 1: 'wrld', 2: [[-180, 90], [180, -90]], 6: this}]);\n else if (dw.project == 101)\n dw.loadCarta([{0: '.Image', 1: 'wrld', 2: [[-179.99, 168], [179.99, -168]], 6: this}]);\n else if (dw.project == 102)\n dw.loadCarta([{0: '.Image', 1: 'wrld', 2: [[-179.99, 132], [179.99, -132]], 6: this}]);\n else if (dw.project == 204)\n dw.loadCarta([{0: '.Image', 1: 'wrld', 2: [[-162, 81], [162, -81]], 6: this}]);\n dw.m.bgimg = dw.mflood['.Image_wrld']; // mark as bg\n draw();\n };\n}", "function loadResources() {\n // Load images\n imgBow = new SpriteSheet(\"img/bow.png\", 420, 360, 6, 4, 1.5);\n imgArrow = new Img(\"img/horizontal_arrow.png\", 128, 40);\n imgTarget = new Img(\"img/crosshair_red_small.png\", 42);\n imgBoard = new Img(\"img/target_colored_outline.png\", 142);\n\n skyTop = new Img(\"img/skybox_top.png\", HEIGHT / 2);\n skyBackground = new Img(\"img/skybox_sideHills.png\", HEIGHT / 2);\n\n grass = new Img(\"img/stone_grass.png\", GRASS_SIZE);\n stone = new Img(\"img/stone.png\", GRASS_SIZE);\n gold = new Img(\"img/stone_gold.png\", GRASS_SIZE);\n\n grassBlades = [];\n for (var i = 1; i <= 4; i++) {\n grassBlade = new Img(\"img/grass\" + i + \".png\", GRASS_SIZE);\n grassBlades.push(grassBlade);\n }\n\n grassBladePositions = {};\n for (var i = 0; i < 10; i++) {\n pos = Math.floor(Math.random() * WIDTH / GRASS_SIZE)\n grassBlade = grassBlades[Math.floor(Math.random() * grassBlades.length)];\n grassBladePositions[pos] = grassBlade;\n }\n\n // Set variables based on image dimensions\n boardHeight = imgBoard.height;\n boardWidth = 10;\n boardBuffer = 200;\n board = new Projectile(boardWidth, boardHeight, false, true, false);\n\n board.vx = 0;\n board.vy = 1;\n board.x = WIDTH - boardWidth - boardBuffer;\n board.y = 0;\n}", "function preload()\n{\n dogImage=loadImage(\"images/dogImg.png\")\n happyDog=loadImage(\"images/Happy.png\")\n //bedroomImg=loadImage(\"images/Bed Room.png\")\n//gardenImg=loadImage(\"images/Garden.png\")\n//washroomImg=loadImage(\"images/Wash Room.png\")\n\t//load images here\n}", "function preload() {\n\tmoonMap = loadImage(\"moon.jpg\");\n\tearthMap = loadImage(\"earthmap.jpg\");\n\tmilkyWay = loadImage(\"eso0932a.jpg\");\n}", "function loadImages(image, name, xPos, yPos, cursor, rot) {\n\tvar _bitmap = new createjs.Bitmap(image).set({});\n _bitmap.x = xPos;\n _bitmap.y = yPos;\n _bitmap.scaleX = _bitmap.scaleY = 1;\n _bitmap.name = name;\n\t/** Setting registration point for switch */\n\tif ( name == \"switch\" ) {\n _bitmap.regX = image.width/4.5;\n _bitmap.regY = image.height;\n }\n _bitmap.rotation = rot;\n _bitmap.cursor = cursor;\n electrogravimetric_stage.addChild(_bitmap); /** Adding bitmap to the stage */\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 preloadImages() {\n var starfieldImg = new Image('images/starfield.png');\n var earthImg = new Image('images/earth.png');\n var lunaImg = new Image('images/luna.png');\n var venusImg = new Image('images/venus.png');\n var marsImg = new Image('images/mars.png');\n var ceresImg = new Image('images/ceres.png');\n var jupiterImg = new Image('images/jupiter.png');\n var saturnImg = new Image('images/saturn.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 images[0] = loadImage('assets/allday.png');\n images[1] = loadImage('assets/sleep.png');\n images[2] = loadImage('assets/eat.png');\n images[3] = loadImage('assets/goout.png');\n images[4] = loadImage('assets/splash.png');\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 for (let i = 0; i < NUM_ANIMAL_IMAGES; i++){\n let animalImage = loadImage(`assets/images/animal${i}.png`); //${_} allows for a variables to be used in call, must be ``(one with ~)\n animalImages.push(animalImage);\n }\n //load other images\n sausageDogImage = loadImage(\"assets/images/sausage-dog.png\");\n bark = loadSound(\"assets/sounds/bark.wav\");\n titleImage = loadImage(\"assets/images/title.png\");\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 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}", "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 clownImage = loadImage(\"assets/images/clown.png\");\n dogImage = loadImage(\"assets/images/dog-image.png\");\n ballImage = loadImage(\"assets/images/ball.png\");\n candyImage = loadImage(\"assets/images/candy.png\");\n feltTextureImage = loadImage(\"assets/images/black-felt-texture.png\");\n}", "function preload() {\n game.load.image('sky', 'assets/sky.png');\n game.load.image('ground', 'assets/platform.png');\n game.load.image('star', 'assets/star.png');\n game.load.spritesheet('dude', 'assets/dude.png', 32, 48);\n}", "function preload() {\n // load the boat images\n boatImages.right = loadImage('img/boat-right.png');\n boatImages.left = loadImage('img/boat-left.png');\n\n // load the mount images into an array\n mountainImages.push(loadImage('img/mountain1.png'));\n mountainImages.push(loadImage('img/mountain2.png'));\n mountainImages.push(loadImage('img/mountain3.png'));\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 loadImages() {\n var files = [ 'outer_light.png', 'layer_down_light.png',\n 'layer_up_light.png', 'angle_prev_light.png',\n 'angle_next_light.png', 'linked_data_light.png',\n 'raw_scan_light.png', 'dig_positive_light.png',\n 'text_view_light.png', 'vector_view_light.png',\n 'overlays_light.png', 'thumbnails_light.png',\n '3d_view_light.png', 'step_back_light.png',\n 'step_fwd_light.png', 'minimize_light.png' ];\n\n var i = 0;\n for (i = 0; i < files.length; i++) {\n btnImages[i] = new Image(); btnImages[i].src = files[i];\n }\n}", "function preload() {\n clownImage = loadImage(\"assets/images/clown.png\");\n feltTextureImage = loadImage(\"assets/images/black-felt-texture.png\");\n elephantImage = loadImage(\"assets/images/elephant.png\");\n pigeonImage = loadImage(\"assets/images/pigeon.png\");\n nudibranchImage = loadImage(\"assets/images/nudibranch.png\");\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 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}", "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 preload() {\n clownImage = loadImage(\"assets/images/clown.png\");\n feltTextureImage = loadImage(\"assets/images/black-felt-texture.png\");\n imgAdded = loadImage(\"assets/images/bloobros2(1).png\");\n imgAdded2 = loadImage(\"assets/images/doggo.png\");\n imgSin = loadImage(\"assets/images/grumpycat.png\");\n}", "function preload() {\n images[0] = loadImage('assets/one.png');\n images[1] = loadImage('assets/two.png');\n images[2] = loadImage('assets/three.png');\n images[3] = loadImage('assets/four.png');\n images[4] = loadImage('assets/five.png');\n}", "function load_img() {\n fabric.Image.fromURL('golf-h.png', function (img) {\n hole = img;\n hole.scaleToWidth(60);\n hole.scaleToHeight(60);\n hole.set({\n top: holey,\n left: holex\n });\n canvas.add(hole);\n });\n\n fabric.Image.fromURL('ball.png', function (img) {\n ball = img;\n ball.scaleToWidth(ballw);\n ball.scaleToHeight(ballh);\n ball.set({\n top: bally,\n left: ballx\n });\n canvas.add(ball);\n });\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}", "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 }", "function loadImages(image, name, xPos, yPos, cursor, rot, alpha_value, container) {\n\tregistration_point_y = 21.5;\n var _bitmap = new createjs.Bitmap(image).set({});\n _bitmap.x = xPos;\n _bitmap.y = yPos;\n _bitmap.name = name;\n _bitmap.alpha = alpha_value;\n _bitmap.rotation = rot;\n _bitmap.cursor = cursor;\n\tif ( name == \"scale\" ) {\n\t\t_bitmap.regX = _bitmap.image.width/2.5;\n\t\t_bitmap.regY = registration_point_y; //initial registration point\n\t}\n container.addChild(_bitmap); /** Adding bitmap to the stage */\n}", "function preload() {\n turboImage = loadImage(\"TurboImage.png\");\n enzoImage = loadImage(\"EnzoImage.png\");\n gallardoImage = loadImage(\"GallardoImage.png\");\n viperImage = loadImage(\"ViperImage.png\");\n}", "function initSprites() {\n function drawBallImage(r, colorStops, label) {\n var canvas = document.createElement(\"canvas\");\n canvas.width = canvas.height = r * 2;\n var ctx = canvas.getContext(\"2d\");\n \n var grad = ctx.createRadialGradient((3/4) * r, (1/2) * r, (1/16) * r,\n r, r, r);\n for (i in colorStops) {\n grad.addColorStop.apply(grad, colorStops[i]);\n }\n ctx.fillStyle = grad;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n \n if (label) {\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(label, r, r);\n }\n \n return canvas.toDataURL();\n }\n\n function sprite(type, role) {\n if (!role)\n role = type;\n var radius = Config.radius[type];\n var colors = Config.gradientStops[Config.color[role]];\n if (Config.reverseGradient[role])\n colors.reverse();\n var label = Config.label[role];\n var key = role.substr(0, 1).toUpperCase() + role.substr(1) + \"Sprite\";\n var map = {};\n map[key] = [ 0, 0 ];\n Crafty.sprite(radius * 2, drawBallImage(radius, colors, label), map);\n }\n \n sprite(\"rocket\");\n sprite(\"smallBall\");\n sprite(\"smallBall\", \"accelerate\");\n sprite(\"smallBall\", \"increaseMass\");\n sprite(\"smallBall\", \"thief\");\n sprite(\"smallBall\", \"thiefToolkit\");\n sprite(\"smallBall\", \"goodie\");\n sprite(\"applePolisher\");\n sprite(\"inspector\");\n sprite(\"lunatic\");\n sprite(\"bigBall\");\n sprite(\"blackHole\");\n sprite(\"magneticHole\");\n}", "function preload() {\n for (var i = 0; i < assets.length; i++) {\n images[i] = loadImage('assets/' + assets[i]);\n }\n for (var i = 0; i < fish.length; i++) {\n fishimg[i] = loadImage('assets/' + fish[i] + '.png');\n }\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 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 }", "function initSprites(img){\n\ts_player = [\n\t\tnew Sprite(img, 977, 0, 1035-975, 100),\n\t\tnew Sprite(img, 860, 0, 918-860, 100),\n\t\tnew Sprite(img, 918, 0, 975-918, 100)\n\t];\n\ts_star = [\n\t\tnew Sprite(img, 120, 800, 160, 260),\n\t\tnew Sprite(img, 490, 800, 160, 260)\n\t];\n\ts_background = new Sprite(img, 20, 0, 814, 600);\n\t\n\ts_pumpkin = [\n\t \tnew Sprite(img, 860, 126, 120, 100),\n\t \tnew Sprite(img, 1024, 114, 140, 112),\n\t \tnew Sprite(img, 1174, 96, 142, 181),\n\t \tnew Sprite(img, 1364, 96, 239, 248)\n\t];\n\n\ts_bat = [\n\t \tnew Sprite(img, 18, 646, 150, 82),\n\t \tnew Sprite(img, 196, 614, 130, 100),\n\t \tnew Sprite(img, 342, 618, 132, 102),\n\t \tnew Sprite(img, 500, 660, 143, 78),\n\t \tnew Sprite(img, 670, 666, 97, 123),\n\t \tnew Sprite(img, 790, 666, 64, 126),\n\t \tnew Sprite(img, 854, 674, 66, 126),\n\t \tnew Sprite(img, 934, 668, 125, 107),\n\t \tnew Sprite(img, 1080, 642, 160, 70)\n\n\t];\n\n\ts_demon = [\n\t\tnew Sprite(img, 1346, 802, 125, 85),\n\t \tnew Sprite(img, 1500, 796, 130, 100),\n\t \tnew Sprite(img, 1632, 816, 118, 70),\n\t \tnew Sprite(img, 1784, 808, 128, 74),\n\t \tnew Sprite(img, 1342, 930, 126, 83),\n\t \tnew Sprite(img, 1490, 926, 108, 93),\n\t \tnew Sprite(img, 1640, 920, 130, 65),\n\t \tnew Sprite(img, 1780, 936, 123, 75),\n\t];\n}", "function preload(){\r\n bg =loadImage(\"cityImage.png\");\r\n balloonImage1=loadAnimation(\"hotairballoon1.png\");\r\n balloonImage2=loadAnimation(\"hotairballoon1.png\",\"hotairballoon1.png\",\r\n \"hotairballoon1.png\",\"hotairballoon2.png\",\"hotairballoon2.png\",\r\n \"hotairballoon2.png\",\"hotairballoon3.png\",\"hotairballoon3.png\",\"hotairballoon3.png\");\r\n }" ]
[ "0.7913093", "0.7898924", "0.7677867", "0.76309574", "0.7600437", "0.7583754", "0.752579", "0.7466247", "0.74287003", "0.74211764", "0.7367024", "0.72622496", "0.7253688", "0.72454304", "0.7243055", "0.72299415", "0.7176738", "0.71087354", "0.7082836", "0.7068529", "0.70594275", "0.69595826", "0.69538605", "0.6925828", "0.69147456", "0.6909039", "0.69078743", "0.690715", "0.6888063", "0.6885586", "0.68773943", "0.68751734", "0.68734735", "0.68683374", "0.6867669", "0.6858437", "0.68555224", "0.68527174", "0.68490285", "0.6844344", "0.68440896", "0.68231046", "0.6821542", "0.6814907", "0.68024033", "0.6795358", "0.6790868", "0.67897975", "0.67897975", "0.6789612", "0.677556", "0.67740875", "0.67641747", "0.6762883", "0.6760332", "0.67588836", "0.6756814", "0.6753807", "0.6751805", "0.67488676", "0.67435867", "0.6741554", "0.6739971", "0.67393726", "0.67329735", "0.67264855", "0.6726017", "0.6721085", "0.6712614", "0.67117506", "0.670254", "0.6693265", "0.6678727", "0.6677725", "0.6676498", "0.66727924", "0.6670562", "0.6669767", "0.6669319", "0.6668706", "0.6667709", "0.6666766", "0.6665717", "0.6664094", "0.66633713", "0.66621375", "0.66526496", "0.6652289", "0.6652125", "0.6651822", "0.6649698", "0.66463214", "0.66452515", "0.6641462", "0.66385245", "0.66383404", "0.6628411", "0.66242546", "0.6623417", "0.6619313" ]
0.73749536
10
computes scores from the current state and updates this.state.gameState.scores
computeRoundScores() { //the only score guaranteed to match the gameState (which may have changed) is the latest one const roundNumber = this.state.gameState.roundNumber; const threshold42 = this.state.gameState.threshold42 || 999; for (var playerNumber in this.state.players) { var game = this.state.gameState[this.props.players[playerNumber].playerName]; var score = getCurrentScore(game.bids, game.takes, game.scores, roundNumber-1); game.scores[roundNumber-1] = score; this.state.players[playerNumber].currentScore = score; this.state.players[playerNumber].isPerfect = countArrayPrefix(game.bids, game.takes, roundNumber) === roundNumber; this.state.players[playerNumber].deny42 = countArrayPrefix(game.bids, game.takes, roundNumber, threshold42) !== roundNumber; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScores() {\n dealerScore = getScore(dealerCards);\n playerScore = getScore(playerCards);\n}", "updateTotalScore() {\n this.score =\n this.calculatedRedScore +\n this.calculatedYellowScore +\n this.calculatedGreenScore +\n this.calculatedBlueScore -\n this.penaltyScore;\n this.displayCurrentScore();\n }", "updateScore() {\n if(Dashboard.candyMachted.length) {\n this.score += 1;\n this.levelUp();\n this.scoreUpdateView();\n Dashboard.candyMachted.pop();\n }\n }", "function updateScores(){\n currentScore = currentGame.length;\n if (bestScore <= 0){\n //update best score from storage.\n var prevScore = scorestorage.getRecord(KEY_BEST_SCORE); \n if (prevScore){\n bestScore = prevScore;\n }\n scoreboard.updateBestScore(bestScore );\n }\n if (bestScore < currentScore ){\n scoreboard.updateBestScore(bestScore = currentScore );\n scorestorage.setRecord(KEY_BEST_SCORE, bestScore);\n }\n scoreboard.updateCurrentScore(currentScore);\n }", "function ScoreManager_Percentage_CalculateScore()\n{\n\t//set current score as 0;\n\tvar currentScore = 0;\n\t//loop through each State\n\tfor (var stateId in this.States_List)\n\t{\n\t\t//we dont count current State\n\t\tif (stateId == this.States_Current)\n\t\t\tcontinue;\n\t\t//get the State itself\n\t\tvar state = this.States_List[stateId];\n\t\t//if we requested playback on this State or used the slider\n\t\tif (state.Requests_Cameras > 0 || state.Slider_Used > 0)\n\t\t{\n\t\t\t//you get nothing for this State-> 0!\n\t\t\tcontinue;\n\t\t}\n\t\t//now you get 100 points for the State IF YOU HAVE A CORRECT ACTION (or if it was auto camera)\n\t\tvar stateScore = (state.Actions_Correct || state.AutoPlayCamera) > 0 ? 100 : 0;\n\t\t//but I remove 50 for each error\n\t\tstateScore -= 50 * state.Count_Errors;\n\t\t//no score left?\n\t\tif (stateScore <= 0)\n\t\t{\n\t\t\t//you get nothing for this State-> 0!\n\t\t\tcontinue;\n\t\t}\n\t\t//now if you asked for hints \n\t\tif (state.Requests_Hints > 0)\n\t\t{\n\t\t\t//you get half score! sorry\n\t\t\tstateScore = stateScore / 2;\n\t\t}\n\t\t//finally add this to our current score\n\t\tcurrentScore += stateScore;\n\t}\n\t//raw score is the current score\n\tthis.Score_Raw = currentScore;\n\t//update final score to a percentage (dont count current State)\n\tthis.Score_Calculated = currentScore / (this.States_Count - 1);\n}", "function updateScore(state, action) {\n const tempState = {\n ...state,\n game: state.game.map((basket) => {\n if (basket.basketNum === action.basketNumber) {\n const newPlayers = basket.players.map((p) => {\n if (p.id === action.playerID) {\n const newP = { ...p, score: action.score };\n return newP;\n }\n return p;\n });\n return { ...basket, players: newPlayers };\n }\n return basket;\n }),\n };\n\n const results = updateResults(tempState);\n return { ...tempState, results };\n}", "function gameScore(context, payload) {\n const { score } = payload;\n const { game } = context.getState();\n\n if (!game) {\n return;\n }\n\n game.teams = game.teams.map((team, index) => {\n team.score = score[index];\n return team;\n });\n\n context.setState({ game });\n}", "calcScore() {\n this.score = 0;\n this.choices.forEach(c => { this.score -= c; });\n }", "updateScore() {\n this.timeleft = TIME_LEFT;\n var d = new Date();\n var t = d.getTime();\n this.gameStart2 = t;\n this.state = STATES.READY_TO_PICK_PIECE;\n /*\n document.getElementById('score1').innerHTML = this.score1;\n document.getElementById('score2').innerHTML = this.score2;\n */\n if (!this.score1) {\n this.state = STATES.GAMEOVER;\n this.gameOver = true;\n this.winner = this.otherColour;\n }\n }", "updateScore() {\n\t\tthis.score++;\n\t\tthis.drawScore();\n\t\tif (this.score >= this.highestScore) {\n\t\t\tthis.highestScore = this.score;\n\t\t\tlocalStorage.setItem(STORAGE_KEY, this.highestScore);\n\t\t}\n\t}", "evaluateScore({p1, p2}) {\n let score1 = this.state.p1\n let score2 = this.state.p2\n if(p1 && !p2) {\n if(this.state.p2Select === 'MINES') {\n this.setState({\n p1: this.state.prevCard === this.state.cardOfTheRound ?\n score1 + 2 : score1 + 1,\n p2: score2 - 1\n })\n }\n else {\n this.setState({\n p1: this.state.prevCard === this.state.cardOfTheRound ?\n score1 + 2 : score1 + 1,\n })\n }\n }\n if (p2 && !p1) {\n if(this.state.p1Select === 'MINES') {\n this.setState({\n p2: score2 + 1,\n p1: this.state.prevCard === this.state.cardOfTheRound ?\n score1 - 2 : score1 - 1\n })\n }\n if(this.state.prevCard === this.state.cardOfTheRound) {\n this.setState({\n p1: score1 - 2,\n })\n }\n else {\n this.setState({\n p2: score2 + 1,\n })\n }\n }\n if (!p1 && !p2) {\n if(this.state.prevCard === 'MINES' && this.state.p2Select === 'MINES') {\n this.setState({\n p2: score2 - 1,\n p1: this.state.prevCard === this.state.cardOfTheRound ?\n score1 - 2 : score1 - 1\n })\n }\n }\n this.setState({\n gameStatus: {\n p1: p1,\n p2: p2,\n },\n seconds: 5,\n isIdle: true,\n })\n if(!this.checkWhoWins()) {\n setTimeout(() => {\n this.setState({\n p1Select: \"\",\n p2Select: \"\",\n prev: \"\",\n })\n this.timer = 0\n this.startTimer()\n }, 4000);\n }\n }", "function calculateScore() {\n\tscore = winCount * 100 + loseCount * -50 + (coveredTileCount * 2) + (100 - time) + (50 - moves) * 2 + (bonus * 15);\n}", "getScores() {\n return getScores(this);\n }", "updateScore(score) {\n score = +score;\n const { currentFrameTotal, isEndOfFrame, isGameOver } = this.state;\n let mapping = isEndOfFrame && currentFrameTotal + score === this.MAX_TOTALS_LENGTH ? '/' : score === this.MAX_TOTALS_LENGTH ? 'X' : score;\n\n if (!this.determineIsGameOver()) {\n this.updateFrameScore(score, mapping);\n } else if (!isGameOver) {\n this.setState({\n isGameOver: true\n });\n }\n }", "function updateScore(value) {\n gState.score += value;\n document.querySelector('header > h3 > span').innerText = gState.score;\n displayVictory();\n}", "computeScore() {\n const all_scores = [];\n\n GameTree.walkTree(\n this.state.gameTree,\n (node) => {\n if ('cost' in node.data.board) {\n all_scores.push(node.data.board.cost);\n }\n }\n );\n\n return all_scores.reduce((a, b) => (a + b), 0);\n }", "computeScore() {\n this.score++\n return this.score\n }", "function updateScore(scores) {\n if (scores[0].score <= score) {\n scores[0].score = score;\n scores[0].name = playerName;\n console.log(chalk.green.bold('Hurray!! you Got the First Place on the scoreBoard. \\n'));\n } else if (scores[1].score <= score) {\n scores[1].score = score;\n scores[1].name = playerName;\n console.log(chalk.green.bold('Hurray!! you Got the Second Place on the scoreBoard. \\n'));\n } else if (scores[2].score <= score) {\n scores[2].score = score;\n scores[2].name = playerName;\n console.log(chalk.bgBlack.green.bold('Hurray!! you Got the Third Place on the scoreBoard. \\n'));\n }else {\n console.log(chalk.bgBlack.green.bold('Sorry!! you Got no place on the scoreBoard. \\n'));\n }\n\n \n}", "function score(state)\n{\n var score = 0;\n\n loop:\n for (var i = 0; i < wins.length; i++) {\n var win = wins[i];\n\n var user_count = 0;\n var comp_count = 0;\n for (var j = 0; j < win.length; j++) {\n switch (state[win[j]]) {\n case 'x': \n\tuser_count++;\n\tbreak;\n\n case 'o': \n\tcomp_count++;\n\tbreak;\n }\n }\n\n if (user_count == 0)\n score += scores[comp_count];\n else if (comp_count == 0) \n score -= scores[user_count];\n }\n\n return score;\n}", "function calculateFinalScore() {\n finalScore = Crafty(\"Score\")._score; // Accesses the Score entity. This requires there to be only one score entity at a time. \n metrics.set(\"finalScore\", finalScore);\n}", "function updateScores () {\n document.querySelector(\"#wins\").innerHTML = wins;\n document.querySelector(\"#losses\").innerHTML = losses;\n document.querySelector(\"#guessLeft\").innerHTML = guessLeft;\n document.querySelector(\"#guessSoFar\").innerHTML = guessSoFar;\n}", "calculateScore () {\n this.allCorrectAnswers = {};\n this.allSelectedAnswers = readFromCache('selectedAnswers');\n this.quizData.map((qA) => {\n const correctAnswers = [];\n for (const [key, value] of Object.entries(qA.correct_answers)) {\n if (value == 'true') {\n const correctAnswer = helpers.splitter(key, '_', 2);\n correctAnswers.push(correctAnswer);\n }\n }\n this.allCorrectAnswers[qA.id] = correctAnswers;\n });\n for (const [key, value] of Object.entries(this.allSelectedAnswers)) {\n if (value.sort().join(',') === this.allCorrectAnswers[key].sort().join(',')) {\n this.score++;\n }\n }\n this.score = this.score / Object.keys(this.allSelectedAnswers).length * 100;\n this.score = this.score.toFixed(2);\n let allScores = readFromCache('scores');\n allScores = allScores || {};\n allScores[new Date().toLocaleString()] = this.score;\n writeToCache('scores', allScores);\n }", "function updateScore() {\n score += questions[currentQuestionId - 1].worth;\n scoreElement.textContent = score;\n}", "function updateScores() {\n scope.$el.find('.js-score-value').text(model.prediction[team])\n }", "function updateScores() {\n lastScore.innerText = 'Last score: ' + score;\n if (score > bestScore) {\n bestScore = score;\n displayBestScore.innerText = 'Best Score: ' + bestScore;\n }\n}", "function updateScore() {\n document.querySelector(\"#wins\").innerHTML = \"Score: \" + score;\n }", "async changeScore(){\n var tempScore = 0;\n if(this.state.turn){\n tempScore = this.state.scorePlayer1 + 1;\n await this.setState({scorePlayer1: tempScore});\n this.updateMineFieldChange();\n }\n else{\n tempScore = this.state.scorePlayer2 + 1;\n await this.setState({scorePlayer2: tempScore});\n this.updateMineFieldChange();\n }\n }", "function updateScore(value) {\n gState.score += value;\n document.querySelector('header > h3 > span').innerText = gState.score;\n}", "function updateScore(value) {\n gState.score += value;\n document.querySelector('header > h3 > span').innerText = gState.score;\n}", "function updateScore(value) {\n gState.score += value;\n document.querySelector('header > h3 > span').innerText = gState.score;\n}", "calculateScore() {\n if (this.timeRemaining >= '90') {\n $(\"#live-score, #victory-score\").each(function () {\n $(this).text(parseInt($(this).text(), 10) + 100);\n });\n this.score += 100;\n } else if (this.timeRemaining >= '80') {\n $(\"#live-score, #victory-score\").each(function () {\n $(this).text(parseInt($(this).text(), 10) + 90);\n });\n this.score += 90;\n } else if (this.timeRemaining >= '70') {\n $(\"#live-score, #victory-score\").each(function () {\n $(this).text(parseInt($(this).text(), 10) + 80);\n });\n this.score += 80;\n } else if (this.timeRemaining >= '60') {\n $(\"#live-score, #victory-score\").each(function () {\n $(this).text(parseInt($(this).text(), 10) + 70);\n });\n this.score += 70;\n } else if (this.timeRemaining >= '50') {\n $(\"#live-score, #victory-score\").each(function () {\n $(this).text(parseInt($(this).text(), 10) + 60);\n });\n this.score += 60;\n } else if (this.timeRemaining >= '0') {\n $(\"#live-score, #victory-score\").each(function () {\n $(this).text(parseInt($(this).text(), 10) + 50);\n });\n this.score += 50;\n }\n }", "componentDidUpdate(){\n if(!this.state.gameOver){\n const t1 = Object.values(this.props.score[1]);\n const t2 = Object.values(this.props.score[2]);\n\n const t1Score = t1.pop();\n const t2Score = t2.pop();\n\n const t1Closed = t1.every((hit) => hit >= 3);\n const t2Closed = t2.every((hit) => hit >= 3);\n\n if (t1Closed && (t1Score >= t2Score)) {\n // before the game is over we want to submit the scores to db\n this.setState({gameOver: true})\n this.setState({winner: 1})\n }\n\n if(t2Closed && (t2Score >= t1Score)) {\n this.setState({gameOver: true})\n this.setState({winner: 2})\n }\n }\n }", "updateScore( score ){\n this.score += score;\n this.playerDB.update(this.props());\n }", "UpdateScore(newScore){\n this.currentScore += newScore;\n }", "updateScore() {\n\t\tthis.score += 1;\n\t\tthis.gameinfoElement.childNodes[0].innerHTML = \"<h1>Score: \" + this.score + \"</h1>\";\n\t}", "_updateScore() {\n\t\tthis._$scoreBoard.textContent= this._score+'';\n\t}", "function updateScore(result) {\n\tif (result === 'won') {\n\t\t++totalWins;\n\t} else if (result === 'lose') {\n\t\t++totalLost;\n\t} else {\n\t\t++totalDraw;\n\t}\n\n\t++totalMatches;\n\n\tupdateBoard(totalMatches, totalWins, totalLost, totalDraw);\n}", "function updateScore() {\n score++;\n}", "increaseScore(){\n let oldScore = this.state.score\n let newScore = oldScore + 1\n this.setState({score : newScore})\n ScoreManager.saveAppScore(newScore.toString())\n }", "function updateScore() {\n store.score++;\n}", "constructor() {\n super();\n this.state = {\n score:0\n };\n }", "function trackScore() {\n if (totalScore === goalNum) {\n wins++;\n console.log(\"wins\");\n award();\n reset();\n\n\n }\n else if (totalScore > goalNum) {\n losses++;\n console.log(\"losses\");\n award();\n reset();\n \n }\n }", "_updateScore () {\n this._scoreBoard.innerHTML = this._score;\n }", "function initGame() {\n\n game.scores[PLAYER] = scorePlayer(PLAYER);\n game.scores[DEALER] = scorePlayer(DEALER);\n\n updateGameDisplay();\n}", "function calculateScores(){\n\n\t//Loop for each player\n\tfor(var player=1; player<=2; player++){\n\t\n\t\tvar tempScore = 0; //Temporary score whilst calculating\n\t\tvar currentTile;\n\n\t\tfor (var x=0;x<hexmap._mapWidth;x++){\n\t\t\tfor (var y=0;y<hexmap._mapHeight;y++){\n\n\t\t\t\t//Check if the tile is currently owned by current player\n\t\t\t\tcurrentTile = hexmap.getTile(x,y);\n\t\t\t\tif( currentTile && currentTile._owner == player ){\n\t\t\t\t\ttempScore += currentTile.value;\n\t\t\t\t};\n\n\t\t\t\tplayerScores[player] = tempScore;\n\n\n\t\t\t}\n\t\t} //End hexmap loop\n\n\t}\n\t//Now update the scoreboard\n\tCrafty(\"Player1Score\").each(function () { \n \tthis.text(\"Your score: \" + playerScores[1]);\n });\n\n Crafty(\"Player2Score\").each(function () { \n \tthis.text(\"Enemy score: \" + playerScores[2]);\n });\n\n}", "function renderScoreUpdateLogic () {\n scoreUpdateDelta++;\n \n if (scoreUpdateDelta >= SI.res.ResourceLoader.getResources().game.properties.HUDScoreUpdateMaxDelta) {\n scoreUpdateDelta = 0;\n \n if (score != finalScore) {\n if (score < finalScore) {\n score += SI.res.ResourceLoader.getResources().game.properties.HUDScoreUpdateSpeed;\n \n if (score > finalScore) {\n score = finalScore;\n }\n } else {\n score -= SI.res.ResourceLoader.getResources().game.properties.HUDScoreUpdateSpeed;\n \n if (score < finalScore) {\n score = finalScore;\n }\n }\n }\n }\n }", "function calcScore() {\n players[turn].score += roundScore;\n document.getElementById(\"p1score\").innerHTML = players[0].score;\n document.getElementById(\"p2score\").innerHTML = players[1].score;\n endGame();\n changeTurn();\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 }", "updateScoresBasic(lastRound) {\n switch (lastRound.p2) {\n case 'W':\n this.adjustMapValueBy(this.scores, 'D', 1);\n break;\n case 'D':\n this.enemyDynamite--;\n this.adjustMapValueBy(this.scores, 'W', -1);\n this.adjustMapValueBy(this.scores, 'D', 1);\n break;\n default:\n\n }\n if (lastRound.p1 === lastRound.p2) {this.adjustMapValueBy(this.scores, 'D', 1)};\n this.scores.forEach((value, key) => {\n if (value<0) {this.scores.set(key, 0)}\n });\n if (this.prevOpponentMove === lastRound.p2) {\n\n }\n if (this.dynamiteCount <= 0) {this.scores.set('D', 0);}\n }", "calculateWinner() {\n let cWinningPlayerIndex = 0;\n let cLastPlayerScore = '9999';\n console.log(`Starting Player Hand Score: ${this.state.evaluateHandCollection[cWinningPlayerIndex].name} = Score ${cLastPlayerScore}`)\n for (let playerIndex = 0; playerIndex < this.state.evaluateHandCollection.length; playerIndex++) {\n if (this.state.evaluateHandCollection[playerIndex].score < cLastPlayerScore) {\n cLastPlayerScore = this.state.evaluateHandCollection[playerIndex].score;\n cWinningPlayerIndex = playerIndex;\n }\n console.log(`Player: ${this.state.evaluateHandCollection[cWinningPlayerIndex].name} = Card Score ${cLastPlayerScore}`)\n }\n this.setState({ winningPlayerIndex: cWinningPlayerIndex, lastPlayerScore: cLastPlayerScore, winnerSelected: true });\n console.log(`Winner: ${this.state.evaluateHandCollection[cWinningPlayerIndex].name} = Score ${cLastPlayerScore}`)\n }", "handleScoreUpdate(index, val) {\n\t\tlet newPlayers = this.state.players.slice();\n\t\tnewPlayers[index].score += val;\n\t\t// sort the players based on score\n\t\tnewPlayers.sort((a, b) => b.score - a.score);\n\t\tthis.setState({ players: newPlayers });\n\t}", "updateScore() {\n const points = splitNumber(this.points);\n\n this.scoreClass(3, points[3]);\n this.scoreClass(2, points[2]);\n\n if (this.points < 0) {\n this.scoreClass(1, '-minus');\n } else {\n this.scoreClass(1, points[1]);\n }\n }", "function updateScore(winner) {\n if (winner === 'human') {\n humanScore += 1;\n } else if (winner === 'computer'){\n computerScore += 1;\n }\n}", "function updateScores() {\r\n var scores = $('table#round-' + roundNumber + ' input[type=number]'),\r\n i = 0;\r\n scores.each(function() {\r\n var score = $(this),\r\n name = score.data('playername'),\r\n mu;\r\n for (i = 0; i < matchUps.length; i++) {\r\n if (matchUps[i].p1.name === name || matchUps[i].p2.name === name) {\r\n mu = matchUps[i];\r\n break;\r\n }\r\n }\r\n\r\n var amt = parseInt(score.val());\r\n if (!mu.score) {\r\n mu.score = [0, 0, 0];\r\n }\r\n\r\n if (score.hasClass('draws')) {\r\n mu.score[1] += amt;\r\n } else { //wins\r\n if (mu.p1.name === name) {\r\n mu.score[0] += amt;\r\n } else {\r\n mu.score[2] += amt;\r\n }\r\n }\r\n });\r\n for (i = 0; i < matchUps.length; i++) {\r\n var mu = matchUps[i],\r\n p1Wins = mu.score[0],\r\n p2Wins = mu.score[2];\r\n if (p1Wins > p2Wins) {\r\n mu.p1.wins++;\r\n mu.p2.losses++;\r\n } else if (p2Wins > p1Wins) {\r\n mu.p2.wins++;\r\n mu.p1.losses++;\r\n } else {\r\n mu.p1.draws++;\r\n mu.p2.draws++;\r\n }\r\n }\r\n\r\n scoresSaved = true;\r\n }", "function updateScore(winner) {\n if (winner === 'human') {\n humanScore += 1;\n } else {\n computerScore += 1;\n }\n}", "function resetScores () {\n console.log(state.players);\n for (var player in state.players) {\n state.players[player].score = 0;\n state.players[player].bonus = false;\n }\n console.log(state.players);\n}", "resetScore() {\n this.score = INITIAL_SCORE;\n }", "function updateScore(newCurrentScore) {\n currentScore = newCurrentScore;\n currentScoreTag.innerText = currentScore;\n\n if (highScore >= 0) {\n highScore = (currentScore >= highScore) ? currentScore : highScore;\n } else {\n highScore = 0;\n }\n highScoreTag.innerText = highScore;\n }", "function updateScore() {\n currentScore = ansArray.length;\n $('#currentScore').text(`Current Score = ${currentScore}`);\n\n if (parseInt(highScore) === 0) {\n highScore = currentScore;\n $('#highScore').text(`High Score = ${highScore}`);\n } else if (parseInt(currentScore) > parseInt(highScore)) {\n highScore = currentScore;\n $('#highScore').text(`High Score = ${highScore}`);\n }\n }", "function updateScores() {\n var i;\n redScore = blueScore = 0;\n for (i = 0; i < tiles.length; i++) {\n var tile = tiles[i];\n if (tile.color === colors.blue || tile.color === colors.darkBlue)\n blueScore++;\n if (tile.color === colors.red || tile.color === colors.darkRed)\n redScore++;\n }\n //console.log(blueScore + \" : \" + redScore);\n}", "getScore() {\n let score = 0;\n //loop through all the data and get total score\n _.map(this.state.tileData, function (key, value) {\n score += key['count'];\n });\n return score;\n }", "function update()\n {\n\n\n if(currentScore < targetScore) {\n $(\"#State\").text(\"Scoreboard\");\n }\n if (currentScore > targetScore) {\n losses++;\n $(\"#State\").text(\"You Lose!\")\n Start();\n\n }\n\n \n\n if (currentScore == targetScore) {\n wins++;\n $(\"#State\").text(\"You Win!\")\n Start();\n }\n\n \n}", "function getGamesWithScores() {\n\n for (let i = 0; i < gameData.length; i++) {\n gameData[i].score = gameStateData[i];\n }\n\n return gameData;\n}", "function calculateScore(state, level) {\n var num = 0;\n num += check(state.board[0], state.board[1], state.board[2]);\n num += check(state.board[3], state.board[4], state.board[5]);\n num += check(state.board[6], state.board[7], state.board[8]);\n num += check(state.board[0], state.board[3], state.board[6]);\n num += check(state.board[1], state.board[4], state.board[7]);\n num += check(state.board[2], state.board[5], state.board[8]);\n num += check(state.board[0], state.board[4], state.board[8]);\n num += check(state.board[2], state.board[4], state.board[6]);\n if (level == -1) {\n return num;\n }\n if (num > 0) {\n return num + level;\n }\n else if (num < 0) {\n return num - level;\n }\n else {\n if (state.isCompleted == false) {\n return null;\n }\n else {\n return 0;\n }\n }\n}", "function updateScore() {\n document.querySelector(\"#score\").innerHTML = \"Score: \" + score;\n }", "function updateScore(){\n score++\n if(score === 10){\n result.textContent = 'Wow! 10/10 You are the snake genius!'\n } else if(score === 9 ){\n result.textContent= '9/10 Amazing!'\n } else if( score === 8){\n result.textContent = '8/10 Great job!'\n } else if( score === 7){\n result.textContent= '7/10 Good job!'\n }else if(score === 6){\n result.textContent = '6/10 Good Job!'\n }else if(score === 5){\n result.textContent = '5/10 Looks like you need to learn!'\n }else if(score === 4){\n result.textContent = '4/10 Looks like you need to learn!'\n }else if(score === 3){\n result.textContent = '3/10 Looks like you need to learn!'\n }else if(score === 2){\n result.textContent= '2/10 Looks like you need to learn!'\n }else if(score === 1){\n result.textContent = '1/10 Looks like you need to learn!'\n }else if(score === 0){\n result.textContent = '0/10 FAIL!'\n }\n}", "function score(){\n\tif(gameStart){\n\t\tvar s = document.getElementById(\"score\");\n\t\ts.innerText++;\n\t\tremoveClick();\n\t\tresetAll();\n\t}\n}", "get totalScores() {\n return {\n home: {\n runs: _.sum(this.bottomHalfInnings.map(hi => hi.runs)),\n hits: _.sum(this.bottomHalfInnings.map(hi => hi.hits)),\n // errors charged to the home team happened when the away team was batting\n errors: _.sum(this.topHalfInnings.map(hi => hi.errors))\n },\n away: {\n runs: _.sum(this.topHalfInnings.map(hi => hi.runs)),\n hits: _.sum(this.topHalfInnings.map(hi => hi.hits)),\n // errors charged to the away team happened when the home team was batting\n errors: _.sum(this.bottomHalfInnings.map(hi => hi.errors))\n }\n }\n }", "updateScore(){\n this.score += 10;\n CURRENT_SCORE.innerHTML = `Score: ${this.score}`;\n }", "function updateScore() {\n totalScore = totalScore + 10; // add 10 points to the score\n $score.text(totalScore); // displays the new score on the screen\n console.log(totalScore); // logs the new score in the console\n }", "_computeScores(definition) {\n return {\n licensedScore: this._computeLicensedScore(definition),\n describedScore: this._computeDescribedScore(definition)\n }\n }", "function scores(){\r\n \t//score\r\n scoreString = 'Score : ';\r\n scoreText = game.add.text(10, 10, scoreString + score, { font: '34px Arial', fill: '#0f0' });\r\n\r\n //lives\r\n lives = game.add.group();\r\n game.add.text(game.world.width - 100, 10, 'Lives : ', { font: '34px Arial', fill: '#0f0' });\r\n\r\n //text\r\n stateText = game.add.text(game.world.centerX,game.world.centerY,' ', { font: '84px Arial', fill: '#0f0' });\r\n stateText.anchor.setTo(0.5, 0.5);\r\n stateText.visible = false;\r\n\r\n for (var i = 0; i < 3; i++) \r\n {\r\n var ship = lives.create(game.world.width - 100 + (30 * i), 60, 'ship');\r\n ship.anchor.setTo(0.5, 0.5);\r\n ship.angle = 90;\r\n ship.alpha = 0.4;\r\n }\r\n }", "function scoring() {\n\tif (inRow === 3) {\n\t\tscore += 30;\n\t} else if (inRow === 2) {\n\t\tscore += 20;\n\t} else if (inRow === 1) {\n\t\tscore += 10;\n\t}\n}", "function calcScore(scores) {\n\tvar sumscore = 0;\n\tfor (var i = 0; i < boardsize + 1; ++i) {\n\t\tswitch(scores[i]) {\n\t\t\tcase 2:\n\t\t\t\t// 10x the value of this card\n\t\t\t\tsumscore += 10 * i;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\t// Value of the card\n\t\t\t\tsumscore += i;\n\t\t\tdefault:\n\t\t\t\t// If it's 3 or more, add in a flat 100\n\t\t\t\t// Otherwise, do nothin'\n\t\t\t\tif (scores[i] > 2) sumscore += 100;\n\t\t\t\tbreak;\n\t\t} // switch(curscore[i])\n\t} // for (var i = 0; i < boardsize + 1; ++i)\n\treturn sumscore;\n} // function calcScore(scores)", "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score.toString().length * assets.scoreboard.width) / 2);\n\n for (let i = 0; i < scoreAsString.length; i++) {\n scoreboardGroup.create(initialPosition, 30, assets.scoreboard.base + scoreAsString[i]).setDepth(10);\n initialPosition += assets.scoreboard.width;\n }\n }\n}", "function update_scores(move, move_id) {\r\n var point = (move == \"X\") ? 1:-1;\r\n var scores = global_scores;\r\n var rc = parse_move_id(move_id);\r\n var r = rc[0];\r\n var c = rc[1];\r\n\r\n scores[r - 1] += point;\r\n scores[grid_size + (c - 1)] += point;\r\n if (r == c) scores[2 * grid_size] += point;\r\n if (grid_size - 1 - (c - 1) == (r - 1)) scores[2 * grid_size + 1] += point;\r\n send_message('userscores', '{ \"scores\":\"' + scores + '\" }');\r\n}", "function setCurrentScore () {\n $(\"#current-score\").html(crystal.currentval);\n }", "function updateScore() {\n scoreElement.textContent = `Score: ${score}`;\n}", "function updateScore() {\n scoreElement.textContent = `Score: ${score}`;\n}", "getAggregateScore(scores) {\n // this adds a weighted score to each score object\n var scoresMultiplied = scores.map((item) => {\n item.weightedScore = item.score * item.weight\n return item\n })\n\n // get the sum of all weighted scores\n var sumOfWeightedScores = 0\n scores.map((item) => {\n sumOfWeightedScores = sumOfWeightedScores + item.weightedScore\n })\n\n // get the sum of all weights\n var sumOfWeights = 0\n scores.map((item) => {\n sumOfWeights = sumOfWeights + item.weight\n })\n\n // just return 50 if all the sliders are switched off\n if (sumOfWeights === 0) return 50\n else return Math.round(sumOfWeightedScores/sumOfWeights)\n }", "function updateScore(value) {\n addScore(value);\n displayScore();\n}", "function setScore() {\n\n console.log('setScore()');\n\n // do we have all the Base selections?\n if (!(vm.baseSelect.isReady())) {\n vm.showAlert = true; // show alert message stating Base selections must be made\n return;\n }\n\n // We are ready to compute scores\n // clear all model values, hide the alert message\n clearScores();\n vm.showAlert = false;\n\n var vectorStr;\n // compute Base scores\n var result = BaseCalcService.calculateScores();\n var debugStr = result.debugStr;\n // set model vars from calculation results\n vm.impactScore = toFixed1(result.impactScore);\n vm.exploitScore = toFixed1(result.exploitScore);\n vm.baseScore = toFixed1(result.baseScore);\n vectorStr = vm.baseSelect.getVector();\n\n vm.overallScore = vm.baseScore; // overall will be Base score for now\n\n // compute Temporal scores, IF selections have been made\n result.temporalProduct = 1; // default if there are no Temporal selections, used by Environ calculation\n if(vm.temporalSelect.hasSelections())\n {\n result = TemporalCalcService.calculateScores(vm.baseScore);\n vm.temporalScore = toFixed1(result.temporalScore);\n vectorStr += vm.temporalSelect.getVector();\n debugStr += result.debugStr;\n\n vm.overallScore = vm.temporalScore; // temporal will be overall\n }\n\n // compute Environ scores, IF selections have been made\n if(vm.environSelect.hasSelections())\n {\n result = EnvironCalcService.calculateScores(result.temporalProduct);\n vm.environScore = toFixed1(result.environScore);\n vm.modImpactScore = toFixed1(result.mimpactScore);\n vectorStr += vm.environSelect.getVector();\n debugStr += result.debugStr;\n\n vm.overallScore = vm.environScore; // environ will be overall\n }\n\n // set the CVSS vector string, will be displayed as a link\n var href = '/vuln-metrics/cvss/v3-calculator?vector=' + vectorStr;\n var link = '<a href=\"' + href + '\" target=\"_blank\">' + vectorStr + '</a>';\n vm.cvssString = $sce.trustAsHtml(link);\n\n updateBarCharts(); // update the page charts\n }", "function ls_after_update_scores() {\n if (ls_includeProjections) ls_projections_html();\n ls_format_score();\n if (ls_includeProjections) ls_update_projections();\n ls_check_if_final();\n ls_check_if_bye_final();\n ls_scoring_run();\n ls_update_nfl_box();\n}", "function updateScore(who) {\n\tvar score = AWAY_SCORE;\n\tif(who == HOME) \n\t\tscore = HOME_SCORE;\n\n\tvar one = score % 10;\n\tvar ten = Math.floor(score / 10) % 10;\n\n\t$('#' + who + ' .one')\n\tonLED('#' + who + '_score .tens', LARGE_NUMBERS[ten]);\n\tonLED('#' + who + '_score .ones', LARGE_NUMBERS[one]);\n}", "function update_final_score(Strokes){\r\n\tif(Strokes > final_score)\r\n\t\tfinal_score = Strokes;\r\n}", "async updateGameState(lives, gold, score, highScore, turn, level) {\n const storage_state = localStorage.getItem(\"game\");\n this.rep_container.innerHTML = '';\n this.rep_container.appendChild(await this.requestReputation());\n if (storage_state) {\n const current_state = JSON.parse(storage_state);\n if (lives || (lives >= 0)) {\n current_state[\"lives\"] = lives;\n this.updateLives(lives);\n }\n if (gold) {\n current_state[\"gold\"] = gold;\n this.updateGold(gold);\n }\n if (score) {\n current_state[\"score\"] = score;\n this.updateScoreBar(score)\n }\n if (highScore) {\n current_state[\"highscore\"] = highScore;\n }\n if (turn) {\n current_state[\"turn\"] = turn;\n }\n if (level) {\n current_state[\"level\"] = level;\n }\n this.game = current_state;\n localStorage.setItem(\"game\", JSON.stringify(current_state));\n }\n }", "updateScore(num) {\n if (num === 0) {\n this.scoreCounter = num; // Reset the score to 0\n } else {\n this.scoreCounter += 1; // Increment the score by 1\n }\n // Show the updated score on the page\n this.scoreBoard.textContent = this.scoreCounter;\n }", "function calcScores() {\n\t// Use a negative value for first score for safety's sake\n\tvar lowscore = -1;\n\tvar lowid = '';\n\tvar scores, sumscore;\n\tfor (var i = 0; i < boardsize; ++i) {\n\t\t// Observe the cards in the rows\n\t\tscores = getScoringArray();\n\t\t$('li.square[id^=square_'+i+']').each(function(){\n\t\t\tif (this.innerHTML != '') {\n\t\t\t\tscores[parseInt(this.innerHTML)]++;\n\t\t\t}\n\t\t});\n\t\t// Calculate the score\n\t\tsumscore = calcScore(scores);\n\t\t$('li#score_row_'+i).text(sumscore);\n\t\t// Check it for lowest value\n\t\tif (sumscore < lowscore || lowscore < 0) {\n\t\t\t// Store the score\n\t\t\tlowscore = sumscore;\n\t\t\t// Remember where we are\n\t\t\tlowid = 'row_'+i;\n\t\t} // if (sumscore < lowscore || lowscore < 0)\n\n\t\t// Observe the cards in the columns\n\t\tscores = getScoringArray();\n\t\t$('li.square[id$=_'+i+']').each(function(){\n\t\t\tif (this.innerHTML != '') {\n\t\t\t\tscores[parseInt(this.innerHTML)]++;\n\t\t\t}\n\t\t});\n\t\t// Calculate the score\n\t\tsumscore = calcScore(scores);\n\t\t$('li#score_col_'+i).text(sumscore);\n\t\t// Check it for lowest value\n\t\tif (sumscore < lowscore || lowscore < 0) {\n\t\t\t// Store the score\n\t\t\tlowscore = sumscore;\n\t\t\t// Remember where we are\n\t\t\tlowid = 'col_'+i;\n\t\t} // if (sumscore < lowscore || lowscore < 0)\n\n\t\t// Set the score, identify the low notch\n\t\t$('li#score_current').text(lowscore);\n\t\t$('li.score').removeClass('lowest');\n\t\t$('li#score_'+lowid).addClass('lowest');\n\t} // for (var i = 0; i < boardsize; ++i)\n} // function calcScores()", "function change_score(round_score) {\n num_correct += round_score;\n num_total += 1;\n }", "function updateScore (winner) {\n if (winner === 'human') {\n humanScore += 1;\n }\n else {\n computerScore += 1;\n }\n}", "function initialScore () {\n score = 0;\n $(\"#current-score\").text(score);\n}", "function updateGameState() {\n // FIRST PIECE -> RUNNING\n if (m_gameState == GameState.FIRST_PIECE && m_firstPieceDelay == 0) {\n m_gameState = GameState.RUNNING;\n }\n // LINE CLEAR -> ARE\n else if (m_gameState == GameState.LINE_CLEAR && m_lineClearFrames == 0) {\n m_gameState = GameState.ARE;\n }\n // ARE -> RUNNING\n else if (m_gameState == GameState.ARE && m_ARE == 0) {\n // Add pending score to score total and refresh score UI\n m_score += m_pendingPoints;\n m_pendingPoints = 0;\n refreshScoreHUD();\n\n saveSnapshotToHistory();\n\n // Draw the next piece, since it's the end of ARE (and that's how NES does it)\n m_canvas.drawCurrentPiece();\n drawNextBox(m_nextPiece);\n m_canvas.drawPieceStatusDisplay(m_pieceSelector.getStatusDisplay());\n\n // Checked here because the game over condition depends on the newly spawned piece\n if (isGameOver()) {\n m_gameState = GameState.GAME_OVER;\n refreshPreGame();\n refreshHeaderText();\n\n // debugging\n console.log(\n \"Average:\",\n (m_totalMsElapsed / m_numFrames).toFixed(3),\n \"Max:\",\n m_maxMsElapsed.toFixed(3)\n );\n } else {\n m_gameState = GameState.RUNNING;\n }\n } else if (m_gameState == GameState.RUNNING) {\n // RUNNING -> LINE CLEAR\n if (m_lineClearFrames > 0) {\n m_gameState = GameState.LINE_CLEAR;\n }\n // RUNNING -> ARE\n else if (m_ARE > 0) {\n m_gameState = GameState.ARE;\n }\n }\n // Otherwise, unchanged.\n}", "function update_score(value){\n playerInstance.score = Math.max(0, playerInstance.score + value);\n score_tracker.innerText = playerInstance.score;\n }", "get scoring () {\n\t\treturn this._scoring;\n\t}", "function updateScore(board) {\r\n\tvar blackScore = 0;\r\n\tvar whiteScore = 0;\r\n\tfor (var i = 0; i < 8; i++) {\r\n\t\tfor (var j = 0; j < 8; j++) {\r\n\t\t\tif (state.board[i][j] === 'w') {\r\n\t\t\t\twhiteScore++;\r\n\t\t\t} else if (state.board[i][j] === 'b') {\r\n\t\t\t\tblackScore++;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t$(\"#white-score\").text(whiteScore);\r\n\t$(\"#black-score\").text(blackScore);\r\n}", "function compScore() {\n\t\tif(randomNum === total) {\n\t\t\t\n\t\t\t$(\"#winlossmessage\").html(\"You win!!\");\n\t\t\t\n\t\t\twin++;\n\t\t\t\n\t\t\t$(\"#wins\").html(win);\n\t\t\t\n\t\t\trestart();\n\t\t\t\n\t\t}\n\t\telse if(randomNum < total){\n\t\t\t\n\t\t\t$(\"#winlossmessage\").html(\"You lose.\");\n\t\t\t\n\t\t\tloss++;\n\t\t\t\n\t\t\t$(\"#losses\").html(loss);\n\t\t\t\n\t\t\trestart();\n\n\t\t}\n\t\t}", "function GameState() {\n\t//constants\n\tGameState.MIN_INTENSITY = 1;\n\tGameState.MAX_INTENSITY = 4;\n\tGameState.DEFAULT_SCROLLSPEED = -200;\n\t\n\tGameState.STATE_ATTRACT = 1; //no obstacles spawn, the player moves automatically\n\tGameState.STATE_GAMESTART = 2; //spawning is turned on, gameplay intro plays, the player moves automatically\n\tGameState.STATE_GAMEPLAY = 3; //normal gameplay\n\tGameState.STATE_GAMEOVER = 4; //the player crashed, scrolling and spawning are stopped\n\tGameState.STATE_TIMEOVER = 5; //the player ran out of time... the player automatically flies quickly up and off the side of the screen. spawning is stopped\n\tGameState.STATE_SHOWSCORES = 6; //shows player score and stats\n\t\n\t//variables\n\tthis.state = 0;\n\tthis.stateStartTime = 0;\n\tthis.stateStartDistance = 0;\n\tthis.stateTime = 0;\n\t\n\tthis.scrollSpeed = GameState.DEFAULT_SCROLLSPEED;\n\tthis.scrollDX = this.scrollSpeed * g_FRAMETIME_S;\n\tthis.scrollDistance = 0;\n\tthis.intensity = 1.0;\n\tthis.intensityClamped = 0.0; //value in range 0-1 set using (this.intensity - GameState.MIN_INTENSITY) / (GameState.MAX_INTENSITY - GameState.MIN_INTENSITY);\n\tthis.gravity = new Vector2(0, 7.5);\n\n\tthis.score = 0;\n\tthis.multiplier = 0;\n\tthis.combo = 0;\n\tthis.comboMax = 0;\n\tthis.comboLast = 0;\n\tthis.comboMiss = 0;\n\tthis.stars = 0;\n\tthis.distance = 0; //distance travelled this game as opposed to scrollDistance\n\tthis.deliveries = 0;\n\tthis.deliveriesMissed = 0;\n\tthis.timeLeft = 60000; //1 min starting time\n\t\n\tdocument.getElementById('ui_score').innerHTML = \"<b>Score</b>: 0\"\n\tdocument.getElementById('ui_time').innerHTML = \"<b>Time</b>: 0\";\n}", "function countScore(){\r\n\tlevel.score+=1;\r\n\t}", "function updateScore (winner) {\n if (winner === 'human' ){\n humanScore++;\n } else if ( winner === 'computer' ){\n computerScore++;\n }\n}", "function check_score(){\n\t\tif (app.score >= app.base * 50){\n\t\t\tfor (i = 0; i < allStars.length; i++){\n\t\t\t\tallStars[i].render();\n\t\t\t\tallStars[i].update();\n\t\t\t}\n\t\t}\n\t\tif (allStars[0].pos_Y == 500){\n\t\t\tfor (i = 0; i < allStars.length; i++){\n\t\t\t\tallStars[i].reset();\n\t\t\t}\n\t\t\tapp.base = Math.round(app.score / 50) + 1;\n\t\t}\n\t}" ]
[ "0.7241206", "0.7224311", "0.72017896", "0.718606", "0.7126581", "0.69735664", "0.6927754", "0.690783", "0.6812681", "0.67217547", "0.666672", "0.66367966", "0.663598", "0.66267884", "0.6622281", "0.6618694", "0.66118103", "0.66113436", "0.66086674", "0.66013217", "0.6596887", "0.65957844", "0.6557857", "0.6557193", "0.6507092", "0.64988655", "0.6487415", "0.6481016", "0.6481016", "0.6481016", "0.64752495", "0.6464361", "0.6461796", "0.64555085", "0.64538133", "0.64434874", "0.64389896", "0.6438985", "0.64308083", "0.64175856", "0.641746", "0.6405437", "0.6395954", "0.6393138", "0.6389598", "0.6379843", "0.6374749", "0.63491106", "0.63438445", "0.633058", "0.6320838", "0.6307651", "0.6299377", "0.6290852", "0.6276652", "0.62718797", "0.62659174", "0.62658525", "0.6252909", "0.62437034", "0.62414795", "0.62409216", "0.6240337", "0.62394875", "0.62374866", "0.62368417", "0.6226666", "0.62152284", "0.6213436", "0.6210973", "0.6208861", "0.62047493", "0.6204408", "0.6202028", "0.6197447", "0.6189602", "0.6188842", "0.6187723", "0.6187723", "0.618186", "0.6181416", "0.6164647", "0.61623484", "0.61620694", "0.61515194", "0.61491376", "0.61485654", "0.6140052", "0.61400205", "0.6139687", "0.6138596", "0.6136545", "0.612927", "0.6129119", "0.61262345", "0.6124421", "0.61197937", "0.6118661", "0.611777", "0.6112836" ]
0.7748322
0
Almost the same logic as the bid page. Have each one RecordTrick component per player be responsible for updating the number of tricks they've taken. Once the round ends, do some processing to compute scores, then send it to Firebase.
render() { const gameState = this.state.gameState; const players = this.state.players; const numPlayers = players.length; const dealerNumber = (gameState.roundNumber -1) % numPlayers; let firstLeader = -1; let highestBid = -1; for(let i = 0; i < numPlayers; i++) { const playerNum = (dealerNumber + i + 1) % numPlayers; //if a trick was taken, don't show the first leader anymore if(gameState[players[playerNum].playerName].takes[gameState.roundNumber-1] > 0) { firstLeader = -1; break; } const bid = gameState[players[playerNum].playerName].bids[gameState.roundNumber-1]; if (bid > highestBid) { highestBid = bid; firstLeader = playerNum; } } const takeTrickButtons = players.map((player) => ( <div key={player.playerNumber}> <hr /> <RecordTricks updateTake={this.updateTake.bind(this)} playerName={player.playerName} currentScore={gameState[player.playerName].scores[gameState.roundNumber-2]} currentBid={gameState[player.playerName].bids[gameState.roundNumber-1]} currentTake={gameState[player.playerName].takes[gameState.roundNumber-1]} isFirstLeader={firstLeader === player.playerNumber} isPerfect={player.isPerfect} deny42={player.deny42} roundNumber={gameState.roundNumber} /> </div> )); const totalBids = players.map(p => gameState[p.playerName].bids[gameState.roundNumber-1] || 0).reduce((a,b)=>a+b, 0); const totalTricks = players.map(p => gameState[p.playerName].takes[gameState.roundNumber-1]).reduce((a,b)=>a+b, 0); const roundBalance = totalBids - gameState.roundNumber; const numRounds = getNumberOfRounds(this.props.players.length); const canEndRound = gameState.roundNumber != numRounds && totalTricks === gameState.roundNumber; const canEndGame = gameState.roundNumber == numRounds && totalTricks === gameState.roundNumber; const debugMessage = gameState.isDebug ? "(DEBUG)" : ":"; return ( <div> <div> {roundBalance < 0 && <div className='roundBalance roundBalance-under'>{-roundBalance} under</div>} {roundBalance > 0 && <div className='roundBalance roundBalance-over'>{roundBalance} over</div>} <h2> Round: {gameState.roundNumber} {debugMessage} </h2> <div className="vertDivider"/> {takeTrickButtons} <hr /> <div className="vertDivider"/> { canEndRound && <button onClick={this.endRound.bind(this)}> End Round </button> } { canEndGame && <button onClick={this.endGame.bind(this)}> End Game </button> } <button onClick={this.showGameSummaryModal.bind(this)}> Summary </button> </div> <div className="game-summary-modal"> <GameSummaryModal players = {this.state.players} gameState={this.state.gameState} show={this.state.showGameSummaryModal} onClose={this.hideGameSummaryModal.bind(this)} /> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "increment(event) {\n let minutesBooked = 0;\n let minutesBookedElement = null;\n\n this.minutesBookedTargets.forEach((element) => {\n // storing data on the parent element so that actions and targets could get access to it\n if (element.parentNode.dataset.gameId == event.currentTarget.parentNode.dataset.gameId) {\n minutesBooked = parseInt(element.textContent) + 1;\n minutesBookedElement = element;\n }\n });\n\n // this should be checked on the ActiveRecord and the database level\n if (minutesBooked > 90) return;\n\n const formData = new FormData();\n formData.append(\"game[minutes_booked]\", minutesBooked);\n\n // storing data on the parent element to avoid duplication\n this.sendData(event.currentTarget.parentNode.dataset.updateUrl, formData);\n /*\n * this is the most naïve way of displaying a number of minutes booked\n *\n * this will fly out of the window if someone (or something) else\n * will modify the value in the interim (think race condition)\n *\n * a slightly better way of doing it would be to fetch the value from the database\n * by defining a :show action on the GameController\n *\n * the most \"real-time\" way of doing it would be using WebSockets (ActionCable)\n */\n minutesBookedElement.textContent = minutesBooked;\n\n this.calculateFinalPrice();\n }", "computeRoundScores() {\n //the only score guaranteed to match the gameState (which may have changed) is the latest one\n const roundNumber = this.state.gameState.roundNumber;\n const threshold42 = this.state.gameState.threshold42 || 999;\n for (var playerNumber in this.state.players) {\n var game = this.state.gameState[this.props.players[playerNumber].playerName];\n var score = getCurrentScore(game.bids, game.takes, game.scores, roundNumber-1);\n game.scores[roundNumber-1] = score;\n this.state.players[playerNumber].currentScore = score;\n this.state.players[playerNumber].isPerfect = countArrayPrefix(game.bids, game.takes, roundNumber) === roundNumber;\n this.state.players[playerNumber].deny42 = countArrayPrefix(game.bids, game.takes, roundNumber, threshold42) !== roundNumber;\n }\n }", "function RPSPlayer() {\n // Initialize the RPS player object\n this.initialize = function () {\n this.myId = null;\n this.reqId = null;\n this.opponentId = null;\n this.lockSent = false;\n this.lockReceived = false;\n this.checksumReceived = null;\n this.myChoiceObject = \"\";\n this.opponentChoiceObject = \"\";\n this.timerId = null;\n this.myScore = { W : 0, L : 0, T : 0 };\n this.opponentScore = { W : 0, L : 0, T : 0 };\n this.setState(\"INITIAL\");\n };\n\n // We got a name for this player\n this.nameOk = function (name) {\n // console.log(\"nameOK name: [\" + name + \"]\");\n this.myId = new PlayerId(name);\n this.startDB();\n\n // Now we have a name, so we can do this\n $(\"#new-game-button\").prop(\"disabled\", false);\n }\n\n // Start the DB\n this.startDB = function () {\n // Initialize database and create a refernce to it.\n firebase.initializeApp(MY_FB_CONFIG);\n this.database = firebase.database();\n\n // Where NEW GAME requests are sent and received\n this.newGameRef = this.database.ref(\"RPS_NEW_GAME_REQUEST\");\n\n // Where we receive requests\n this.receiveRef = this.database.ref(this.myId.receive_ref);\n\n // New game request callback\n this.newGameRef.on(\"value\", RPS.newGameRequest);\n this.receiveRef.on(\"value\", RPS.receive);\n };\n \n // Determine if you won, lost, or tied\n this.judge = function(p1, p2) {\n let R = \"rock\";\n let P = \"paper\";\n let S = \"scissors\";\n let W = \"Won\";\n let L = \"Lost\";\n let T = \"Tied\";\n // p1 p2 p1-result\n wlt = { R : { R : T ,\n P : L ,\n S : W },\n P : { R : W ,\n P : T ,\n S : L },\n S : { R : L ,\n P : W ,\n S : T }\n };\n let s1 = p1.charAt().toUpperCase();\n let s2 = p2.charAt().toUpperCase();\n return wlt[s1][s2];\n };\n\n this.addScore = function(p1, p2, scoreObj) {\n let key = this.judge(p1, p2).charAt(0);\n scoreObj[key] = scoreObj[key] + 1;\n return scoreObj;\n };\n\n // Sent my choice, and received opponents choice.\n // Now compare them\n this.compareChoices = function () {\n let myChoice = this.myChoiceObject.choice;\n let opponentChoice = this.opponentChoiceObject.choice;\n // console.log(\"===== You chose \" + myChoice + \" =====\");\n // console.log(\"===== Opponent chose \" + opponentChoice + \" =====\");\n\n $(\"#opponent-rock\").html(\"&nbsp;\");\n $(\"#opponent-paper\").html(\"&nbsp;\");\n $(\"#oppenent-scissors\").html(\"&nbsp;\");\n let oppId = \"#opponent-\" + opponentChoice;\n $(oppId).html(opponentChoice.toUpperCase());\n $(oppId).addClass(\"chosen-one\");\n\n let youDid = this.judge(myChoice, opponentChoice);\n this.myScore = this.addScore(myChoice, opponentChoice, this.myScore);\n this.opponentScore = this.addScore(opponentChoice, myChoice, this.opponentScore);\n\n $(\"#your-result\").text(`You ${youDid}!`);\n $(\"#my-score\").text(`${this.myScore.W}-${this.myScore.L}-${this.myScore.T}`)\n $(\"#opponent-score\").text(`${this.opponentScore.W}-${this.opponentScore.L}-${this.opponentScore.T}`)\n\n this.setState(\"END_OF_ROUND\");\n };\n\n this.newRound = function() {\n // Ensure the timer is cleared\n if (this.timerId != null) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n\n // Start a new round\n this.setState(\"CONNECTED\");\n };\n\n this.setState = function(state) {\n this.state = state;\n // console.log(\"Setting state to \" + state);\n if (state === \"INITIAL\") {\n // Until we have a name\n $(\"#new-game-button\").prop(\"disabled\", true);\n } else if (state === \"CONNECTED\") {\n // Re-initialize these values\n this.lockSent = false;\n this.lockReceived = false;\n this.checksumReceived = null;\n this.myChoiceObject = \"\";\n this.opponentChoiceObject = \"\";\n \n // Show/hide/enable as needed\n $(\"#my-name\").text(this.myId.name);\n $(\"#opponent-name\").text(this.opponentId.name);\n $(\"#connection-container\").hide();\n $(\"#play-container\").show();\n\n $(\"#new-game-button\").prop(\"disabled\", true);\n $(\".active-request-button\").prop(\"disabled\", true);\n\n $(\"#your-result\").html(\"&nbsp\");\n $(\"#opponent-rock\").html(\"&nbsp;\");\n $(\"#opponent-paper\").html(\"?\");\n $(\"#opponent-scissors\").html(\"&nbsp;\");\n\n $(\".choice-text\").removeClass(\"chosen-one\");\n \n } else if (state === \"LOCKING\") {\n $(\".my-choice-text\").prop(\"disabled\", true);\n } else if (state === \"CHOICE_SENT\") {\n //\n } else if (state === \"END_OF_ROUND\") {\n // Set a timer to keep display for a few seconds\n // Then go to state \"CONNECTED\" and do another round...\n if (this.timerId != null) {\n clearTimeout(this.timerId);\n this.timerId = null;\n }\n // console.log(\"Setting newRoundTimerCB\");\n this.timerId = setTimeout(newRoundTimerCB, 5000);\n }\n }\n\n // Called when another players sends me a message\n this.receive = function (snapshot) {\n values = snapshot.val();\n for (let reqId in values) {\n // console.log(\"<==== Received message reqId: \" + reqId);\n msg = values[reqId];\n // console.log(msg);\n\n // Request\n if (msg.type === \"request\") {\n\n // Someone has accepted my new game request\n if (msg.purpose === \"ACCEPT\") {\n // Save the oppenent's ID\n RPS.opponentId = msg.sent_by;\n\n // Send them a reply\n response = new Message(\"reply\", \"ACCEPT\", RPS.myId);\n response.response_to = msg;\n // console.log(\"Attempt ref to: \" + msg.sent_by.receive_ref);\n\n // Where we send requests/responses\n RPS.sendRef = RPS.database.ref(msg.sent_by.receive_ref);\n\n // console.log(\"===> Sending reply to ACCEPT (on next line:\");\n // console.log(response);\n RPS.sendRef.push(response);\n\n // Connected...\n RPS.setState(\"CONNECTED\");\n\n // Delete the NEW_GAME request after we've replied to an ACCEPT\n // console.log(\"removing id \" + msg.new_game_req_ref_id);\n RPS.newGameRef.child(msg.new_game_req_ref_id).remove(function () {\n // console.log(\"remove complete\");\n })\n .then(function () {\n // console.log(\"Remove succeeded.\" + msg.new_game_req_ref_id);\n })\n .catch(function (error) {\n // console.log(\"Remove failed: \" + error.message);\n });\n }\n\n // We received a CHECKSUM (a lock on the choice)\n else if (msg.purpose === \"CHECKSUM\") {\n RPS.checksumReceived = msg.checksum;\n // Send them a reply\n response = new Message(\"reply\", \"CHECKSUM\", RPS.myId);\n response.response_to = msg;\n // console.log(response);\n\n // console.log(\"===> Sending reply to CHECKSUM (on next line:\");\n // console.log(response);\n RPS.sendRef.push(response);\n\n RPS.lockReceived = true;\n\n // console.log(\"lockSent: \" + RPS.lockSent + \" lockReceived: \" + RPS.lockReceived);\n if (RPS.lockSent && RPS.lockReceived) {\n RPS.sendChoice();\n }\n }\n\n else if (msg.purpose === \"CHOICE\") {\n // Validate the checksum hasn't changed\n if (RPS.checksumReceived != msg.choice.checksum) {\n alert(\"Checksums don't match\");\n }\n else {\n let newHash = RPS.hashCode(msg.choice.date, msg.choice.choice);\n if (newHash !== RPS.checksumReceived) {\n alert(\"It appears the choice has been changed\");\n }\n }\n RPS.opponentChoiceObject = msg.choice;\n RPS.compareChoices();\n }\n }\n\n // Reply\n else {\n // console.log(\"Reply\")\n // console.log(msg);\n if (msg.purpose === \"ACCEPT\") {\n if (parseInt(msg.status) === 0) {\n // All went well..\n // Save the oppenent's ID\n RPS.opponentId = msg.sent_by;\n\n RPS.setState(\"CONNECTED\");\n }\n else {\n alert(\"Your ACCEPT request went wong somewhere\");\n }\n }\n }\n // Delete the message after having received it.\n // console.log(\"removing id \" + reqId);\n RPS.receiveRef.child(reqId).remove(function () {\n // console.log(\"remove complete\");\n })\n .then(function () {\n // console.log(\"Remove succeeded.\" + reqId);\n })\n .catch(function (error) {\n // console.log(\"Remove failed: \" + error.message);\n });\n }\n };\n\n // Called when RPS_NEW_GAME_REQUEST gets a new value\n // (Or when DB is first started)\n this.newGameRequest = function (snapshot) {\n // console.log(snapshot.val());\n // console.log(\"newGameRequest state: \" + RPS.state);\n values = snapshot.val();\n // console.log(values);\n for (let reqId in values) {\n // console.log(\"reqId: \" + reqId);\n let sent_by = values[reqId].sent_by;\n if (sent_by.id === RPS.myId.id) {\n // console.log(\"Found a request sent by me\");\n this.reqId = reqId;\n $(\"#new-game-button\").prop(\"disabled\", true); // don't allow more requests\n }\n let alreadyGotButton = false;\n $(\".active-request-button\").each(function () {\n // console.log(\"button child: \" + $(this).data(\"sent-by-id\"));\n if ($(this).data(\"sent-by-id\") === sent_by.id) {\n // Already got a button for this request\n // console.log(\"already got button for \" + sent_by.id);\n alreadyGotButton = true;\n }\n });\n\n if (!alreadyGotButton) {\n let name = values[reqId].sent_by.name;\n // console.log(\"active request by [\" + name + \"]\" + \" id \" + sent_by.id);\n let btn = $(\"<button>\");\n btn.addClass(\"btn btn-secondary btn-sm active-request-button\");\n btn.text(name);\n btn.data(\"name\", name);\n btn.data(\"sent-by-id\", sent_by.id);\n btn.data(\"request-ref\", sent_by.receive_ref);\n btn.data(\"new-game-req-ref-id\", reqId);\n if (sent_by.id === RPS.myId.id) {\n // This is my request, so I should not be able to click it.\n btn.prop(\"disabled\", true);\n }\n $(\"#active-request-group\").append(btn);\n }\n }\n if (RPS.state !== \"INITIAL\") {\n // All these buttons are enabled only until CONNECTED\n $(\"#new-game-button\").prop(\"disabled\", true);\n $(\".active-request-button\").prop(\"disabled\", true);\n }\n };\n\n // Player clicked \"Request a new game\"\n // Send a new game request\n this.newGame = function () {\n // console.log(\"this.newGame this: \" + this.FLAG);\n // console.log(\"this.myId \" + this.myId);\n msg = new Message(\"request\", \"NEW_GAME\", this.myId);\n\n // console.log(\"===> Sending request NEW_GAME\");\n // console.log(msg);\n this.newGameRef.push(msg);\n };\n\n // Player clicked on active request button\n // Send \"ACCEPT\"\n this.activeRequest = function (name, reqRef, newGameReqRefId) {\n // console.log(\"this.activeRequest(\" + name + \")\");\n msg = new Message(\"request\", \"ACCEPT\", this.myId);\n msg.new_game_req_ref_id = newGameReqRefId;\n this.sendRef = this.database.ref(reqRef);\n\n // console.log(\"===> Sending request ACCEPT\");\n // console.log(msg);\n this.sendRef.push(msg);\n }\n\n this.hashCode = function (date, choice) {\n let str = date + choice;\n let hash = 0;\n if (str.length == 0) return hash;\n for (i = 0; i < str.length; i++) {\n char = str.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n }\n\n // A choice was made\n this.makeChoice = function (choice) {\n // If not in state CONNECTED, ignore mouse clicks here\n if (this.state !== \"CONNECTED\") {\n // console.log(this.state + \" Ignoring click on \" + choice);\n return;\n }\n $(\"#\"+choice).addClass(\"chosen-one\");\n\n // We've made our choice, disable the buttons now\n\n // First we will create a checksum and send it\n // This locks us (and our opponent) in to this choice\n // preventing either of us from making the choice\n // *after* the opponent's choice is received.\n date = (new Date()).getTime();\n checksum = this.hashCode(date.toString(), choice);\n // console.log(\"date: \" + date + \" choice: \" + choice + \" checksum: \" + checksum);\n this.myChoiceObject = {\n date: date,\n choice: choice,\n checksum: checksum,\n };\n\n // Now send just the checksum\n msg = new Message(\"request\", \"CHECKSUM\", this.myId);\n msg.checksum = checksum;\n\n // console.log(\"===> Sending request CHECKSUM\");\n // console.log(msg);\n this.sendRef.push(msg);\n\n this.setState(\"LOCKING\");\n this.lockSent = true;\n\n // console.log(\"lockSent: \" + RPS.lockSent + \" lockReceived: \" + RPS.lockReceived);\n if (this.lockSent && this.lockReceived) {\n this.sendChoice();\n }\n }\n\n this.sendChoice = function () {\n msg = new Message(\"request\", \"CHOICE\", this.myId);\n msg.choice = this.myChoiceObject;\n\n // console.log(\"===> Sending request CHOICE\");\n // console.log(msg);\n this.sendRef.push(msg);\n\n this.setState(\"CHOICE_SENT\");\n }\n}", "submitScores(){\n const winner = this.props.teams[this.state.winner];\n const id = Math.random().toString(36).substring(7);\n firebase.database().ref('stats/' + winner + '/' + id).set(this.props.score[winner]);\n }", "function trackScore() {\n if (totalScore === goalNum) {\n wins++;\n console.log(\"wins\");\n award();\n reset();\n\n\n }\n else if (totalScore > goalNum) {\n losses++;\n console.log(\"losses\");\n award();\n reset();\n \n }\n }", "begin_hand(){\n var smallblind = this.state.smallblind;\n //show back of all cards at the begginning of the hand\n this.resetBoard();\n this.dealPlayers();\n fire.database().ref(\"/Root/GameID/\").update({\n cur_bet: 0\n })\n /*\n if (this.state.cur_bet == 0){\n document.getElementById('bet amount').style.visibility='hidden';\n document.getElementById('Fold').style.visibility='hidden';\n document.getElementById('Raise').style.visibility='hidden';\n } else {\n document.getElementById('bet amount').style.visibility='visible';\n document.getElementById('Fold').style.visibility='visible';\n document.getElementById('Raise').style.visibility='visible';\n }\n */\n this.state.Ca1 = \"back\";\n this.state.Ca2 = \"back\";\n this.state.Ca3 = \"back\";\n this.state.Ca4 = \"back\";\n this.state.Ca5 = \"back\";\n this.state.where_in_game = \"start\";\n this.update_where_in_game();\n this.state.num_checks = 0;\n this.update_num_checks();\n this.state.num_call = 0;\n this.update_num_call();\n //switch blinds\n if (smallblind == \"P1\"){\n smallblind = \"P2\";\n } else {\n smallblind = \"P1\";\n }\n //remove blinds from players: 25 for small blind, 50 for big blind\n if (smallblind == \"P1\"){\n //update on display\n this.state.P1chips -= 25;\n this.update_P1chips();\n\n this.state.P2chips -= 50;\n this.update_P2chips();\n } else {\n //update on display\n this.state.P1chips -= 50;\n this.update_P1chips();\n this.state.P2chips -= 25;\n this.update_P2chips();\n }\n //add blinds to the pot\n this.state.pot = 75;\n this.update_pot();\n //update values from firebase\n fire.database().ref(\"/Root/GameID/\").on('value', snapshot => {\n var currUser = fire.auth().currentUser.uid;\n var P2Chips = snapshot.child(\"P2chips\").val()\n var P1Chips = snapshot.child(\"P1chips\").val()\n var current_bet = snapshot.child(\"cur_bet\").val()\n var where = snapshot.child(\"where_in_game\").child(\"where_in_game\").val()\n var sPOT = snapshot.child(\"pot\").val()\n var ncall = snapshot.child(\"num_call\").child(\"num_call\").val()\n var nchecks = snapshot.child(\"num_checks\").child(\"num_checks\").val()\n var Nturn = snapshot.child(\"turn\").child(\"currTurn\").val()\n var Car1 = snapshot.child(\"C1\").val()\n var Car2 = snapshot.child(\"C2\").val()\n var Car3 = snapshot.child(\"C3\").val()\n var Car4 = snapshot.child(\"C4\").val()\n var Car5 = snapshot.child(\"C5\").val()\n var P1Ca1 = snapshot.child(currUser).child(\"C1\").val()\n var P1Ca2 = snapshot.child(currUser).child(\"C2\").val()\n var mChips = 0;\n var tChips = 0;\n \n if ( this.state.Me == \"Player1\" ){\n \t\tconsole.log(\"Player1\")\n mChips = P1Chips\n tChips = P2Chips\n }else{\n \tconsole.log(\"Player2\")\n mChips = P2Chips\n tChips = P1Chips\n }\n\n this.setState({\n Ca1: Car1,\n Ca2: Car2,\n Ca3: Car3,\n Ca4: Car4,\n Ca5: Car5,\n P1C1: P1Ca1,\n P1C2: P1Ca2,\n P2chips: P2Chips,\n P1chips: P1Chips,\n myChips: mChips,\n theirChips: tChips,\n where_in_game: where,\n pot: sPOT,\n num_call: ncall,\n num_checks: nchecks,\n currTurn: Nturn,\n cur_bet: current_bet\n })\n }) \n}", "record(count) {\n\t\tvar score = acc_helper(global.barCoords[this.state.target_index].rot, this.state.user_rotation);\n\t\tvar url = 'https://filtergraph.com/aiw/default/log_scores?';\n\t\turl += 'score=' + String(score) + '&';\n\t\turl += 'test_name=' + this.state.test_name + '&';\n\t\turl += 'user_ID=' + global.user_ID + '&';\n\t\turl += 'test_ID=' + global.test_ID + '&';\n\t\turl += 'key=' + global.key;\n\t\tfetch(url)\n\t\t\t.then((response) => response.text())\n\t\t\t.then((responseText) => {\n\t\t\t\tconsole.log(\"backend receipt: \" + this.state.test_name + \", screen \"\n\t\t\t\t+ String(count) + \", score \" + String(score) + ': ' + responseText);\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tconsole.error(error);\n\t\t\t\tAlert(\"Something went wrong. Please check your connection.\");\n\t\t\t});\n\t\treturn score;\n\t}", "function updateScores() {\r\n var scores = $('table#round-' + roundNumber + ' input[type=number]'),\r\n i = 0;\r\n scores.each(function() {\r\n var score = $(this),\r\n name = score.data('playername'),\r\n mu;\r\n for (i = 0; i < matchUps.length; i++) {\r\n if (matchUps[i].p1.name === name || matchUps[i].p2.name === name) {\r\n mu = matchUps[i];\r\n break;\r\n }\r\n }\r\n\r\n var amt = parseInt(score.val());\r\n if (!mu.score) {\r\n mu.score = [0, 0, 0];\r\n }\r\n\r\n if (score.hasClass('draws')) {\r\n mu.score[1] += amt;\r\n } else { //wins\r\n if (mu.p1.name === name) {\r\n mu.score[0] += amt;\r\n } else {\r\n mu.score[2] += amt;\r\n }\r\n }\r\n });\r\n for (i = 0; i < matchUps.length; i++) {\r\n var mu = matchUps[i],\r\n p1Wins = mu.score[0],\r\n p2Wins = mu.score[2];\r\n if (p1Wins > p2Wins) {\r\n mu.p1.wins++;\r\n mu.p2.losses++;\r\n } else if (p2Wins > p1Wins) {\r\n mu.p2.wins++;\r\n mu.p1.losses++;\r\n } else {\r\n mu.p1.draws++;\r\n mu.p2.draws++;\r\n }\r\n }\r\n\r\n scoresSaved = true;\r\n }", "function player2Action(enteredGameId)\n{ \n\n var kutilTrackerData = database.ref(\"util_id_trackerNew\")\n kutilTrackerData.orderByChild(\"gameid\").equalTo(enteredGameId).once(\"value\", function(snapshot){\n \n console.log('key found. Good to go. ')\n })\n\n kutilTrackerData.once('value',function(snapshot)\n {\n var test = 0\n snapshot.forEach(function(childsnapshot)\n {\n var childKey = childsnapshot.key;\n var childData = childsnapshot.val()\n if (childData.gameid == enteredGameId)\n {\n test = 1 \n gameid = enteredGameId\n var gameIndexName = 'gameIndex_'+enteredGameId\n var gametrackerIndexRef = database.ref().child(gameIndexName)\n gametrackerIndexRef.update({player2: player2_score+1})\n gameid = enteredGameId \n var gameIndexName = 'gameIndex_'+enteredGameId\n var gametrackerIndexRef = database.ref().child(gameIndexName)\n gametrackerIndexRef.update({player2: player2_score})\n $('.card-heading').hide()\n $('.seconddiv').show()\n $('.gameid').text(gameid)\n $(\"button\").prop(\"disabled\", true)\n $(\".p1drawcnt\").text(p1DrawingLeft)\n $(\".p2drawcnt\").text(p2DrawingLeft)\n $(\"player2\").prop(\"disabled\", true) \n $(\"#player2\").prop(\"disabled\", false)\n $(\".drawbutton\").on(\"click\", function(){\n p2DrawingLeft--;\n var drawCounterRef = database.ref().child(\"draw_counter_\"+gameid)\n drawCounterRef.update({p2_count: p2DrawingLeft});\n database.ref(\"draw_counter_\"+gameid).on(\"value\", function(snapshot){\n valueof = snapshot.val()\n $(\".p1drawcnt\").text(snapshot.val().p1_count)\n $(\".p2drawcnt\").text(snapshot.val().p2_count)\n if(p2DrawingLeft <=0 || snapshot.val().p2_count <= snapshot.val().p1_count )\n $(\"#player2\").prop(\"disabled\", true)\n else \n {$(\"#player2\").prop(\"disabled\", false)}\n\n p1_indexcounter=snapshot.val().p1_count\n p2_indexcounter=snapshot.val().p2_count\n compareCard(p1_indexcounter, p2_indexcounter, gameid, 2);\n });\n clkcntr++;\n });\n \n }\n });\n if(test == 0)\n {\n alert('No game found')\n }\n });\n\n \n}", "function updateTrackers(){\n //Stops the game at 0 dollars or 25 fish caught\n if(money <= 0 || numberCaught==15){\n if(numberCaught == 15){\n gameScore = gameScore+10;\n }\n switchScreen();\n resetRod;\n manageFish(); \n if(money<=0){\n setText(\"moneyTracker\", \"$$$: 0\");\n console.log(\"You ran out of money\");\n }\n else if(numberCaught == 15){\n console.log(\"You caught 15 fish- a good day's work!\");\n }\n \n }\n //Gives appropiate amount of money/score based on specific fish caught\n else if(isCaught == true &&isReeling == true){\n gameScore = gameScore+10;\n setText(\"scoreTracker\", \"SCORE: \" + gameScore);\n if(typeCaught == \"blueFish\"){\n money = money+5;\n setText(\"moneyTracker\", \"$$$: \" + money);\n }\n else if(typeCaught == \"yellowFish\"){\n money = money+10;\n setText(\"moneyTracker\", \"$$$: \" + money);\n }\n else if(typeCaught == \"redFish\"){\n money = money+15;\n setText(\"moneyTracker\", \"$$$: \" + money);\n }\n }\n //Deducts money if the line breaks. More money lost after 10th fish caught\n else if(lineCondition == \"broken\" && isReeling == true){\n if(numberCaught<= 10){\n isReeling = false;\n money = money-10;\n setText(\"moneyTracker\", \"$$$: \" + money);\n updateTrackers();\n }\n else{\n isReeling = false;\n money = money-20;\n setText(\"moneyTracker\", \"$$$: \" + money);\n console.log(\"You now lose 20 dollars if the line breaks!\");\n updateTrackers();\n }\n }\n //Deducts money and reels in the hook if reeled to the ground\n else if((isCast==true) && (getXPosition(\"hook\")>=190) && (isReeling == false)){\n isReeling = true;\n reelHook = timedLoop(10,function(){\n if(getYPosition(\"hook\")>150){\n setPosition(\"hook\",getXPosition(\"hook\"),getYPosition(\"hook\")-2);\n setSize(\"line\",getXPosition(\"castFishingRod\")- getXPosition(\"hook\")+120,getYPosition(\"hook\")- getYPosition(\"castFishingRod\")-70);\n }\n });\n reelHook;\n setTimeout(function(){\n stopTimedLoop(reelHook); \n money = money-10;\n resetRod(); \n updateTrackers();\n },1000);\n }\n //Otherwise, continue to update the score(redundant or used if money goes negative)\n else{\n if(money == 0){\n setText(\"moneyTracker\",\"$$$: 0\");\n }\n else{\n setText(\"moneyTracker\", \"$$$: \" + money);\n setText(\"scoreTracker\", \"SCORE: \" + gameScore);\n }\n \n }\n}", "function generateCountBack() { \n for(let roundNumber in compFactory.rounds){\n const round = compFactory.rounds[roundNumber];\n for(let gameNumber in round.games){\n const game = round.games[gameNumber];\n const player1 = players.getPlayerById(game.player1);\n const player2 = players.getPlayerById(game.player2);\n switch (game.result) {\n case 'Player 1 win':\n player1.countBack += player2.score;\n break;\n case 'Player 2 win':\n player2.countBack += player1.score;\n break;\n case 'Draw':\n player1.countBack += player2.score/2;\n player2.countBack += player1.score/2;\n break;\n default:\n }\n }\n }\n }", "incrementAfterRound() {\n this.leader_idx++;\n if (this.leader_idx === this.num_players) {\n this.leader_idx = 0;\n }\n this.round++;\n this.players_selected = [];\n this.players_voted_round = [];\n this.player_to_excalibur = null;\n this.player_given_excalibur = null;\n }", "function saveThumbs(thumb_type, div_thumb, div_score, story_score, ref_id, ref_type_id){\n\tvar pars;\n\n\t// User gives this score a thumbs up\n\tif(thumb_type == 'Up'){\n\t\tvar new_score = parseFloat(story_score) + 5;\n\t\t$(div_thumb).innerHTML = '<b style=\\\"color:green;\\\">Thumbs Up!</a>';\n\t\t$(div_score).innerHTML = '<b>Scoring News</b>';\n\t\tpars = 'type=38&action=score_news&score_action=1&ref_id='+ref_id+'&ref_type_id='+ref_type_id;\n\t}\n\t// User gives this score a thumbs down\n\telse{\n\t\tvar new_score = parseFloat(story_score) - 5;\n\t\t$(div_thumb).innerHTML = '<b style=\\\"color:red;\\\">Thumbs Down!</a>';\n\t\t$(div_score).innerHTML = '<b>Scoring News</b>';\n\t\tpars = 'type=38&action=score_news&score_action=0&ref_id='+ref_id+'&ref_type_id='+ref_type_id;\n\t}\n\n\t// AJAX > Insert score into the USER_NEWS_SCORES table\n\tvar myAjax = new Ajax.Updater(\n\t\t\t\t\t div_score,\n\t\t\t\t\t base_url, {\n\t\t\t\t\t \tmethod: 'get',\n\t\t\t\t\t \tparameters: pars,\n\t\t\t\t\t \tonComplete:function(){\n\t\t\t\t\t \t\t//$(div_to_update).innerHTML += $(div_to_update).innerHTML+'\"'+unesc_comment+'\"';\n\t\t\t\t\t \t\t//$(submit_link_div).innerHTML = '<a href=\"javascript:postModComment(\\'new_comment_'+artist_id+'\\', \\''+artist_id+'\\', \\'submit_link_'+artist_id+'\\');\" style=\"font-size:12px;color:#006666;\"><b>[submit]</b></a>';\n\t\t\t\t\t \t}\n\t\t\t\t\t });\n}", "function handleRubrics(data) {\n // Rubrics listeners\n $(document).change('.asq-rubric-elem input', function udpateRubricScores(e) {\n var $panel = $(e.target).closest('.panel')\n var maxScore = parseInt($panel.attr('data-asq-maxScore'));\n var val = 0;\n if ($(e.target).attr('type') === 'radio') {\n val = parseInt(e.target.value);\n } else if ($(e.target).attr('type') === 'checkbox') {\n console.log('checkbox score')\n $(e.target).closest('.asq-rubric-list')\n .find('.asq-rubric-elem > input[type=checkbox]:checked').each(function getRubricScore() {\n val += parseInt(this.value);\n });\n }\n console.log('val', val);\n var deduct = $panel.attr('data-asq-deduct-points');\n val = deduct ? maxScore + val : val;\n $panel.attr('data-asq-score', val);\n $panel.find('span.label.asq-rubric-grade').html(val + '/' + maxScore);\n var totalScore = 0;\n var totalMaxScore = 0;\n var $group = $panel.closest('.panel-group');\n $group.children('.panel').each( function getAllRubricScores() {\n totalScore += parseInt($(this).attr('data-asq-score'));\n totalMaxScore += parseInt($(this).attr('data-asq-maxScore'));\n });\n $group.siblings('.pull-right').find('.asq-rubrics-grade').html(totalScore + '/' + totalMaxScore);\n });\n var exercises = data.exercises;\n var rubrics = data.rubrics;\n var i = exercises.length;\n var done = [], toRemove = [];\n var j, k, len, exercise, question;\n // This usually happens in ASQ with the DB\n // Don't bother understanding it, just consider it as magic.\n // except if you change the parsing of exercises, question or rubrics\n // then update it to keep it working\n while (i--) {\n exercise = exercises[i];\n j = exercise.questions.length;\n while (j--) {\n question = exercise.questions[j];\n question.rubrics = [];\n for (k = 0, len = rubrics.length; k < len; k++) {\n if (rubrics[k].question === question.id) {\n question.rubrics.push(rubrics[k]);\n }\n }\n if (question.rubrics.length === 0) {\n exercise.questions.splice(j, 1);\n }\n }\n if (exercise.questions.length === 0) {\n exercises.splice(i, 1);\n }\n }\n\n if (exercises.length > 0) {\n i = exercises.length;\n var $slide;\n while (i--) {\n\n $slide = $('#' + exercise.htmlId).parent('.step');\n if ($slide.length !== 1 || done.indexOf($slide[0].id) > -1) {\n exercises.splice(i, 1);\n }\n // Add open modal button to slide\n //$slide.prepend('<a href=\"#\" class=\"ap-rubric-show\" style=\"position:fixed;top:0;right:0;display:block;background:#ccc;border-bottom-left-radius:4px;font-size: 0.6em;padding:5px;\">Show Rubrics</a>');\n }\n if (exercises.length > 0) {\n // Modal show handler with fetching of exercises\n var currentExs = [];\n var i, len;\n for (i = 0, len = exercises.length; i < len; i++) {\n exercise = exercises[i];\n j = exercise.questions.length;\n while(j--) {\n question = exercise.questions[j];\n if ('multi-choice' === question.questionType) {\n question.submission = Array.apply(null,\n new Array(question.questionOptions.length))\n .map(Boolean.prototype.valueOf, false);\n var correct = Math.floor(Math.random() * (question.questionOptions.length));\n question.submission[correct] = true;\n } else if ('text-input' === question.questionType) {\n question.submission = 'Text Input Answer';\n }\n else if ('code-input' === question.questionType) {\n question.submission = 'Code Input Answer';\n }\n question.confidence = Math.floor(Math.random() * (5 - 1 + 1) + 1);\n }\n currentExs.push(exercises[i]);\n }\n // Handler to close modal\n // $(document).on('click', '#ap-rubric-hide', function closeModal(evt) {\n // evt.preventDefault();\n // $('#asq-modal-container').fadeOut();\n // });\n return currentExs;\n } else {\n return [];\n }\n }\n}", "function updateScores() {\n dealerScore = getScore(dealerCards);\n playerScore = getScore(playerCards);\n}", "function updateScore() {\r\n shots--;\r\n trackCorrect ++;\r\n $('.shots').text(shots);\r\n}", "function collectAndSubmitPerformanceRatings(){\n \n let ratingsList = [];\n \n $(\".good, .average, .poor, .skip\").click(function() {\n \n let thisPlayer = {};\n let playerData = $(this).closest('div[class^=\"player\"]');\n let add\n \n if(this.className === \"good click-shrink hover-effect-green\"){\n rating = 5;\n add = true\n } else if (this.className === \"average click-shrink hover-effect-amber\"){\n rating = 3;\n add = true\n } else if (this.className === \"poor click-shrink hover-effect-red\"){\n rating = 1;\n add = true\n } else if (this.className === \"skip click-shrink hover-effect-blue\"){\n add = false\n playerData.remove();\n }\n \n if(add){\n thisPlayer[\"username\"] = playerData.children(\".player-username\").text();\n thisPlayer[\"rating\"] = rating;\n thisPlayer[\"matchid\"] = $('#match-id').text();\n thisPlayer[\"date-of-match\"] = $('#date-of-match').text();\n \n ratingsList.push(thisPlayer);\n \n playerData.remove();\n }\n });\n \n $(\".submit-perform-ratings\").click(function() {\n preventClick = true;\n preparePostData(\"submit-performance-ratings\", ratingsList);\n });\n\n}", "function rpsCompare() {\n if (player1.choice === \"Rock\") {\n if (player2.choice === \"Rock\") { \n db.ref().child(\"/score/\").set(\"Tie game!\");\n db.ref().child(\"/players/player1/tie\").set(player1.tie + 1);\n db.ref().child(\"/players/player2/tie\").set(player2.tie + 1);\n } else if (player2.choice === \"Paper\") { \n db.ref().child(\"/score/\").set(\"Paper wins!\");\n db.ref().child(\"/players/player1/loss\").set(player1.loss + 1);\n db.ref().child(\"/players/player2/win\").set(player2.win + 1);\n } else { \n db.ref().child(\"/score/\").set(\"Rock wins!\");\n db.ref().child(\"/players/player1/win\").set(player1.win + 1);\n db.ref().child(\"/players/player2/loss\").set(player2.loss + 1);\n }\n } else if (player1.choice === \"Paper\") {\n if (player2.choice === \"Rock\") { \n db.ref().child(\"/score/\").set(\"Paper wins!\");\n db.ref().child(\"/players/player1/win\").set(player1.win + 1);\n db.ref().child(\"/players/player2/loss\").set(player2.loss + 1);\n } else if (player2.choice === \"Paper\") { \n db.ref().child(\"/score/\").set(\"Tie game!\");\n db.ref().child(\"/players/player1/tie\").set(player1.tie + 1);\n db.ref().child(\"/players/player2/tie\").set(player2.tie + 1);\n } else { \n db.ref().child(\"/score/\").set(\"Scissors win!\");\n db.ref().child(\"/players/player1/loss\").set(player1.loss + 1);\n db.ref().child(\"/players/player2/win\").set(player2.win + 1);\n } \n } else if (player1.choice === \"Scissors\") {\n if (player2.choice === \"Rock\") {\n db.ref().child(\"/score/\").set(\"Rock wins!\");\n db.ref().child(\"/players/player1/loss\").set(player1.loss + 1);\n db.ref().child(\"/players/player2/win\").set(player2.win + 1);\n } else if (player2.choice === \"Paper\") { \n db.ref().child(\"/score/\").set(\"Scissors win!\");\n db.ref().child(\"/players/player1/win\").set(player1.win + 1);\n db.ref().child(\"/players/player2/loss\").set(player2.loss + 1);\n } else {\n db.ref().child(\"/score/\").set(\"Tie game!\");\n db.ref().child(\"/players/player1/tie\").set(player1.tie + 1);\n db.ref().child(\"/players/player2/tie\").set(player2.tie + 1);\n } \n }\n turn = 1;\n db.ref().child(\"/turn\").set(1);\n }", "function doSomeWorkOnClick() {\n\n //console.log(\"Do some work on click\");\n\n let cheeseHarvested =\n\n 1\n +\n clickUpgrades['shovel'].quantity * clickUpgrades['shovel'].harvest\n +\n\n clickUpgrades['excavator'].quantity * clickUpgrades['excavator'].harvest;\n\n player.currentCheeseBricks += cheeseHarvested;\n players[0].currentCheeseBricks = player.currentCheeseBricks;\n\n //console.log(`total cheeseBricks in doSomeWorkOnClick is ${player.cheeseBricks}`);\n\n document.getElementById('input-tc').value = player.currentCheeseBricks;\n\n turnButtonsOnOff();\n savePlayer();\n\n\n}", "function comparePhase() {\n // Determine winner\n let winner = determineWinner()\n console.log(\"WINNER: \"+winner)\n\n // Increment wins if player won, losses if player lost, nothing if tie\n if (winner != 0) {\n if (winner==playerNumber) {\n // Add 1 to wins and push to database\n wins++\n database.ref(\"/players/player\"+playerNumber).update({wins: wins})\n\n // Update notification text\n $(\"#winDisplay\").text(\"You Won!\")\n } else {\n // Add 1 to losses and push to database\n losses++\n database.ref(\"/players/player\"+playerNumber).update({losses: losses})\n \n // Update notification text\n $(\"#winDisplay\").text(\"You Lost!\")\n }\n } else {\n // Update notification text\n $(\"#winDisplay\").text(\"It's a tie!\")\n }\n\n \n // Go to next phase\n // Determine if match won (3 wins) or if more games need to be played\n if (wins>=3) {\n // Display victory screen\n console.log(\"Won the match!\")\n } else {\n // Play another round\n makeRPSbuttons( $(\"#player1Selection\") )\n database.ref().update({state: S_P1_SELECT})\n}\n}", "function Prank(props) {\n const [clicked, setClick] = useState(null);\n const [h2h, setH2h] = useState([0,1])\n const [b2b, setB2b] = useState([2,3])\n const [display, setDisplay] = useState([\"show\", \"noshow\"])\n // updating the rating after the vote\n function giveRating(event,prankArr, h2h, setIndex){\n console.log(clicked);\n setClick(\"active\");\n setDisplay(display.reverse());\n //first we need to identify the index that won and the index of gif that lost\n console.log(event);\n let winIndex = event.target.attributes['prankindex'].value\n let loseIndex;\n h2h.forEach((item) => {\n if(item != winIndex){\n loseIndex = item;\n }\n }\n )\n //get the new ratings in the form [winner score, loser score]\n let newRatings = ELOrank(props.prankArr, [winIndex, loseIndex])\n\n //Obtaining the id's of the pranks for which the rating needs to be \n //updated\n //update the oldRatings with the new ones\n let winId = props.prankArr[winIndex].id;\n let loseId = props.prankArr[loseIndex].id;\n\n // console.log(winId, loseId)\n let winningPrank = db.collection(\"pranks\").doc(`${winId}`);\n let losingPrank = db.collection(\"pranks\").doc(`${loseId}`);\n // Set the \"rating\" field to the \"newratings\"\n winningPrank.update({\n rating: newRatings[0]\n })\n losingPrank.update({\n rating: newRatings[1]\n })\n .then(() => {\n let minIndex = Math.min(h2h[0], h2h[1])\n if(minIndex + 3 < prankArr.length){\n setIndex([minIndex + 2, minIndex + 3]);\n }\n else{\n \n db.collection(\"pranks\").get().then((querySnapshot) => {\n let updatedArr = querySnapshot.docs.map((doc) => {\n // doc.data() is never undefined for query doc snapshots\n return doc.data();\n });\n props.updateArr(shuffle(updatedArr));\n props.setIndex([0,1]);\n // console.log('This is the shuffled array:' , props.prankArr);\n });\n \n }\n setClick(null)\n })\n\n //now we have to load the next two indices into the arena\n //if we have exhausted the list we need to start at h2h = [0,1]\n // again after shuffling the array\n\n \n\n }\n return (\n <div className= {`image-container ${clicked}`}>\n <div className = {`prank-image ${display[0]}`}>\n <img className = \"prank-gif\"\n src = {props.prankArr[h2h[props.side]].link} \n alt =\"\"\n prankindex = {props.prankArr[h2h[props.side]].index} \n height = \"200\" \n width = \"250\"\n onClick = {(event)=>(giveRating(event, props.prankArr, b2b, setB2b))}\n />\n </div>\n <div className = {`prank-image ${display[1]}`}>\n <img className = \"prank-gif\"\n src = {props.prankArr[b2b[props.side]].link} \n alt =\"\"\n prankindex = {props.prankArr[b2b[props.side]].index} \n height = \"200\" \n width = \"250\"\n onClick = {(event)=>(giveRating(event, props.prankArr, h2h, setH2h))}\n />\n </div> \n {/* <div className= \"icon-Container\">\n <img className = \"like-icon\" src = \"https://svgshare.com/i/Y5h.svg\" alt = \"joker\"/>\n </div> */}\n </div>\n )\n}", "calculateCustomMatchScore(){\n for(let i = 2; i > 0; i--){\n localStorage.setItem('nQuestionsCustom_' + (i + 1), localStorage.getItem('nQuestionsCustom_' + i));\n localStorage.setItem('categoryCustom_' + (i + 1), localStorage.getItem('categoryCustom_' + i));\n localStorage.setItem('difficultyCustom_' + (i + 1), localStorage.getItem('difficultyCustom_' + i));\n localStorage.setItem('questionTypeCustom_' + (i + 1), localStorage.getItem('questionTypeCustom_' + i));\n localStorage.setItem('pointsCustom_' + (i + 1), localStorage.getItem('pointsCustom_' + i));\n localStorage.setItem('timeCustom_' + (i + 1), localStorage.getItem('timeCustom_' + i));\n }\n localStorage.setItem('nQuestionsCustom_1', this.props.nQuestions);\n localStorage.setItem('categoryCustom_1', this.props.category);\n localStorage.setItem('difficultyCustom_1', this.props.difficulty);\n localStorage.setItem('questionTypeCustom_1', this.props.questionType);\n localStorage.setItem('pointsCustom_1', this.props.points);\n localStorage.setItem('timeCustom_1', this.props.time);\n }", "recordScore(testName){\n const {score} = this.state;\n const user = firebase.auth().currentUser;\n if(score === ''){\n window.alert(\"Please do not leave this field blank!\");\n }\n else if(score > 1600 || score < 400 || isNaN(score)) {\n window.alert(\"Please enter a valid score.\");\n } \n else { \n firebase.firestore().collection(\"users\").doc(user.uid).collection(\"scores\").doc(testName).get().then((scoresDoc) => {\n if (scoresDoc.exists){\n const scoreAsInt = Number.parseInt(score);\n firebase.firestore().collection(\"users\").doc(user.uid).get().then((userDoc) => {\n const targetScoreInt = Number.parseInt(userDoc.data()[\"target\"]);\n var trueDiff;\n if ((targetScoreInt - scoreAsInt) < 0 || (targetScoreInt - scoreAsInt) === 0){\n trueDiff = 0;\n } else {\n trueDiff = targetScoreInt - scoreAsInt;\n }\n firebase.firestore().collection(\"users\").doc(user.uid).collection(\"scores\").doc(testName).update({\n testScore: score,\n difference: trueDiff,\n targetReached: ((targetScoreInt - scoreAsInt) < 0 || (targetScoreInt - scoreAsInt) === 0)\n });\n window.alert(\"Success! Head over to Home to get an overview of this data.\");\n })\n } else {\n // If the user has not taken this test before, create a new set of data\n const scoreAsInt = Number.parseInt(score);\n firebase.firestore().collection(\"users\").doc(user.uid).get().then((userDoc) => {\n const targetScoreInt = Number.parseInt(userDoc.data()[\"target\"]);\n var trueDiff;\n if ((targetScoreInt - scoreAsInt) < 0 || (targetScoreInt - scoreAsInt) === 0){\n trueDiff = 0;\n } else {\n trueDiff = targetScoreInt - scoreAsInt;\n }\n firebase.firestore().collection(\"users\").doc(user.uid).collection(\"scores\").doc(testName).set({\n testScore: score,\n difference: trueDiff,\n targetReached: ((targetScoreInt - scoreAsInt) < 0 || (targetScoreInt - scoreAsInt) === 0)\n });\n window.alert(\"Success! Head over to Home to get an overview of this data.\");\n })\n }\n })\n }\n this.setState({\n score: ''\n });\n }", "judgeHolds(delta, currentAudioTime, beat, tickCounts) {\n\n\n this.activeHolds.cumulatedHoldTime += delta ;\n\n\n this.activeHolds.timeCounterJudgmentHolds += delta ;\n\n const secondsPerBeat = 60 / this.composer.bpmManager.getCurrentBPM() ;\n\n const secondsPerKeyCount = secondsPerBeat/ tickCounts ;\n\n const numberOfHits = Math.floor(this.activeHolds.timeCounterJudgmentHolds / secondsPerKeyCount ) ;\n\n\n // console.log(numberOfPerfects) ;\n\n\n if ( numberOfHits > 0 ) {\n\n\n let aux = this.activeHolds.timeCounterJudgmentHolds ;\n const remainder = this.activeHolds.timeCounterJudgmentHolds % secondsPerKeyCount;\n this.activeHolds.timeCounterJudgmentHolds = 0 ;\n\n\n const difference = Math.abs((this.activeHolds.lastAddedHold.beginHoldTimeStamp) - currentAudioTime) ;\n // case 1: holds are pressed on time\n if (this.areHoldsBeingPressed()) {\n\n this.composer.judgmentScale.animateJudgement('p', numberOfHits);\n this.composer.animateTapEffect(this.activeHolds.asList());\n // case 2: holds are not pressed. we need to give some margin to do it\n } else if (this.activeHolds.beginningHoldChunk && difference < this.accuracyMargin ) {\n\n this.activeHolds.timeCounterJudgmentHolds += aux -remainder ;\n\n // case 3: holds are not pressed and we run out of the margin\n } else {\n // TODO: misses should not be in the same count.\n this.composer.judgmentScale.miss() ;\n this.activeHolds.beginningHoldChunk = false ;\n }\n\n\n this.activeHolds.timeCounterJudgmentHolds += remainder;\n\n }\n\n\n }", "applyQuestionGrades() {\n let grades = this.question.gradePlayers();\n for (let uid in grades) {\n this.players[uid].updateScore(grades[uid]);\n }\n }", "async applyRateControl() {\n await this.recordedRateController.applyRateControl();\n this.records[this.stats.getTotalSubmittedTx()] = Date.now() - this.stats.getRoundStartTime();\n }", "prepareScoring() {\n let plants = [], plantModels = {};\n for (const id in this.imagesMapping) {\n const plantView = this.imagesMapping[id];\n const plant = plantView.getPlant();\n plants.push(plantView.toJSON());\n if (!(plant.id in plantModels)) {\n plantModels[plant.id] = plant;\n }\n }\n const scoreInput = new ScoreInput(plants, plantModels, {\n sizeMeter: this.grid.sizeMeter\n });\n // Call score process by dispatching save event with plants data\n this.actionDispatcher.dispatch({type: actions.SCORE, data: {\n input: scoreInput,\n }});\n }", "function giveRating(event,prankArr, h2h, setIndex){\n console.log(clicked);\n setClick(\"active\");\n setDisplay(display.reverse());\n //first we need to identify the index that won and the index of gif that lost\n console.log(event);\n let winIndex = event.target.attributes['prankindex'].value\n let loseIndex;\n h2h.forEach((item) => {\n if(item != winIndex){\n loseIndex = item;\n }\n }\n )\n //get the new ratings in the form [winner score, loser score]\n let newRatings = ELOrank(props.prankArr, [winIndex, loseIndex])\n\n //Obtaining the id's of the pranks for which the rating needs to be \n //updated\n //update the oldRatings with the new ones\n let winId = props.prankArr[winIndex].id;\n let loseId = props.prankArr[loseIndex].id;\n\n // console.log(winId, loseId)\n let winningPrank = db.collection(\"pranks\").doc(`${winId}`);\n let losingPrank = db.collection(\"pranks\").doc(`${loseId}`);\n // Set the \"rating\" field to the \"newratings\"\n winningPrank.update({\n rating: newRatings[0]\n })\n losingPrank.update({\n rating: newRatings[1]\n })\n .then(() => {\n let minIndex = Math.min(h2h[0], h2h[1])\n if(minIndex + 3 < prankArr.length){\n setIndex([minIndex + 2, minIndex + 3]);\n }\n else{\n \n db.collection(\"pranks\").get().then((querySnapshot) => {\n let updatedArr = querySnapshot.docs.map((doc) => {\n // doc.data() is never undefined for query doc snapshots\n return doc.data();\n });\n props.updateArr(shuffle(updatedArr));\n props.setIndex([0,1]);\n // console.log('This is the shuffled array:' , props.prankArr);\n });\n \n }\n setClick(null)\n })\n\n //now we have to load the next two indices into the arena\n //if we have exhausted the list we need to start at h2h = [0,1]\n // again after shuffling the array\n\n \n\n }", "function roundsPlayed(){ //Function to calculate the total amount of rounds\n rounds++; //rounds increased by one everytime the Done-button is clicked.\n}", "function updateTotals(){\n //resets roll count back to 0 (3 rolls left)\n rollCount = 0;\n submitCount--;\n console.log(submitCount);\n\n //Displays roll button\n $(\"#roll-button\").show();\n //Updates the bonus score\n $(\"#result-bonus\").text(bonus(onesTotal, twosTotal, threesTotal, foursTotal, fivesTotal, sixesTotal));\n bonusTotal = parseInt($(\"#result-bonus\").text());\n //updates the left score\n $(\"#result-left-total\").text(leftTotal(onesTotal, twosTotal, threesTotal, foursTotal, fivesTotal, sixesTotal, bonusTotal));\n //updates the right score\n $(\"#result-right-total\").text(rightTotal(threeKindTotal, fourKindTotal, fullHouseTotal, smallStraightTotal, largeStraightTotal, yahtzeeTotal,extraYahtzeeTotal, chanceTotal));\n //updates the total score\n $(\"#result-overall-total\").text(grandTotal(parseInt($(\"#result-left-total\").text()), parseInt($(\"#result-right-total\").text())));\n //updates the dot image on roll button\n $(\"#dots\").html('<img class=\"dots-img\" src=\"img/' + rollCount + 'dots.png\">');\n\n //Sets each dice back to 0 and removes any holds on the dice\n diceOne.amount = \"\";\n diceOne.hold = false;\n $(\"#dice-one\").text(diceOne.amount);\n\n diceTwo.amount = \"\";\n diceTwo.hold = false;\n $(\"#dice-two\").text(diceTwo.amount);\n\n diceThree.amount = \"\";\n diceThree.hold = false;\n $(\"#dice-three\").text(diceThree.amount);\n\n diceFour.amount = \"\";\n diceFour.hold = false;\n $(\"#dice-four\").text(diceFour.amount);\n\n diceFive.amount = \"\";\n diceFive.hold = false;\n $(\"#dice-five\").text(diceFive.amount);\n\n //subit buttons are disabled\n $(\".btn-submit\").attr('disabled', 'disabled');\n\n //if no more submit buttons are left (all turns have been played) the game over overlay is displayed\n if (submitCount === 0 ) {\n $(\".end\").show();\n }\n }", "function bust() {\n roundscore = 0;\n dice = 0;\n document.querySelector('.dice').style.display = 'none'\n updateCurrentScoreUI(roundscore, activePlayer) // update current score, switch players and then toggle the activePlayer styling\n updateScoreUI(0, activePlayer);\n scores[activePlayer] = 0; // reset players\n activePlayer === 0 ? activePlayer = 1 : activePlayer = 0;\n toggleActive();\n}", "function gameAfterPlay() {\n countCurrentBalance();\n let shuffledCards = shuffleCards();\n addCroupierCardsToCroupierArea(shuffledCards, 2);\n addPlayerCardsToPlayerArea(shuffledCards,2);\n checkIfBlackJack(playerCardsTable, 'Player');\n countResultPlayer();\n getButtonHit(shuffledCards);\n getButtonStand(shuffledCards);\n\n}", "handleHintsSubmitted() {\n super.sendGameData({\n event: \"decryption\",\n state: this.gameState,\n redHints: this.redHints[this.currentRound],\n blueHints: this.blueHints[this.currentRound],\n });\n }", "function storeWinner(){\n \n var isBest=false;\n var currWinner;\n \n currWinner={\n Name:Player1Name,\n min:m,\n sec:s,\n millis:ms,\n };\n \n var isNameMatched=false;\n for(var i=0;i<PlayerList.length;i++){\n \n if(PlayerList[i].Name==currWinner.Name){\n isNameMatched=true;\n var time=PlayerList[i].Time\n var totalspoints;\n if(pointsScored!=-1){\n totalspoints= (parseInt(PlayerList[i].points)+pointsScored).toString();\n }else{\n totalspoints=PlayerList[i].points;\n }\n var totalScore=(parseInt(PlayerList[i].score)+parseInt(setTotalScore())).toString();\n var min,sec,milli;\n if(checkBestTime(time,currWinner)){\n isBest=true;\n sec=currWinner.sec<10?\"0\"+currWinner.sec:currWinner.sec; \n min=currWinner.min<10?\"0\"+currWinner.min:currWinner.min; \n milli=currWinner.millis<10?\"0\"+currWinner.millis:currWinner.millis;\n displayBestTime=min+\":\"+sec+\":\"+milli; \n }else{\n sec=time.sec; \n min=time.min; \n milli=time.millis; \n displayBestTime=min+\":\"+sec+\":\"+milli; \n }\n //update\n fetch(`/${PlayerList[i]._id}`,{\n method : \"put\",\n headers : {\n \"Content-Type\" : \"application/json; charset=utf-8\" \n },\n body : JSON.stringify({\"Time\":{min:min,sec:sec,millis:milli},\"score\":totalScore,\"points\":totalspoints})\n }).then((response)=>{\n return response.json();\n }).then((data)=>{\n if(data.ok == 1){\n \n }else{\n console.log(\"Error updating\");\n }\n });\n \n }\n }\n if(isNameMatched==false){\n var sec=currWinner.sec<10?\"0\"+currWinner.sec:currWinner.sec; \n var min=currWinner.min<10?\"0\"+currWinner.min:currWinner.min; \n var milli=currWinner.millis<10?\"0\"+currWinner.millis:currWinner.millis; \n displayBestTime=min+\":\"+sec+\":\"+milli;\n if(pointsScored!=-1){\n totalspoints= pointsScored.toString();\n }else{\n totalspoints=(0).toString();\n }\n var currScore=setTotalScore();\n fetch('/',{\n method : 'post',\n body : JSON.stringify({\"Name\":currWinner.Name,\"Time\":{\"min\":min,\"sec\":sec,\"millis\":milli},\"score\":currScore,\"points\":totalspoints}),\n headers : {\n \"Content-Type\" : \"application/json; charset=utf-8\"\n }\n }).then((response)=>{\n return response.json();\n }).then((data)=>{\n if(!data.error){\n if(data.result.ok == 1 && data.result.n == 1){\n console.log(\"success\"); \n } \n }\n else\n console.log(\"was not able to add data\"); \n });\n }\n }", "function shootGame() {\n\n // Player details from the database\n var playerOne = database.ref('players/1/');\n var playerTwo = database.ref('players/2/');\n\n // Player 1 details from the database\n playerOne.on('value', function(snapshot) {\n var data = snapshot.val();\n var playerOneName = data.name;\n var playerOneWins = data.wins;\n var playerOneLosses = data.losses;\n\n if (player_1 === 1) {\n \n $('#waiting').delay(1000).fadeOut('slow'); \n $('.game-info').show();\n $('#chat-box').show();\n $('#player-1').html('PLAYER 1: ' + playerOneName + ' ');\n $('#score-1').html('Losses: ' + playerOneLosses + ' ' + \"<br>\");\n $('#score-1').append('Wins: ' + playerOneWins + ' ');\n \n }\n })\n \n // Player 2 details from the database\n playerTwo.on('value', function(snapshot) {\n var data = snapshot.val();\n var playerTwoName = data.name;\n var playerTwoWins = data.wins;\n var playerTwoLosses = data.losses;\n \n if (player_2 === 2) {\n $('#waiting-for-player-1').show(); \n $('#player-2').html('PLAYER 2: ' + playerTwoName + ' ');\n $('#score-2').html('LOSSES: ' + playerTwoLosses + ' ' + \"<br>\");\n $('#score-2').append('WINS: ' + playerTwoWins + ' ');\n } \n });\n\n // Clears player details when a player disconnects\n if (playerOne.onDisconnect().remove()) {\n playerCount.set(totalPlayers - 1); // Updates player count\n choice = null; // Clears choices\n }\n // Clears player details when a player disconnects\n if (playerTwo.onDisconnect().remove()) {\n playerCount.set(totalPlayers - 1); // Updates player count\n choice = null; // Clears choices\n }\n\n // Player turns \n database.ref('turn').set(1); // Sets turn count to 1 \n database.ref('turn').on('value', function(snapshot) {\n var turn = snapshot.val();\n\n if (turn === null || turn === 1){\n playerOne.on('value', function(snapshot) {\n var data = snapshot.val();\n var playerOneName = data.name;\n $('#status-1').html(playerOneName + '\\'S TURN!');\n $('#status-2').html(playerOneName + '\\'S TURN!');\n console.log(\"please update to: \" + playerOneName + \"\\\"s turn\");\n if(turn === 1){\n $('.choice-1').show();\n $('#waiting-for-player-2').hide();\n } else {\n $('.choice-1').hide();\n }\n })\n console.log(\"it is player 1's turn\");\n } else if (turn === 2){\n playerTwo.on('value', function(snapshot) {\n var data = snapshot.val();\n var playerTwoName = data.name;\n $('.choice-2').show();\n\n $('#waiting-for-player-1').hide();\n $('#status-2').html(playerTwoName + '\\'S TURN!');\n $('#status-1').html(playerTwoName + '\\'S TURN!');\n console.log(\"please update to: \" + playerTwoName + \"\\\"s turn\");\n \n })\n console.log(\"it is player 2's turn\");\n }\n \n })\n }", "function checkScore() {\n dealerScore = addCardValues(dealerHand);\n playerScore = addCardValues(playerHand);\n\n if (playerScore === 21) {\n setTimeout(winTwentyOne, 800);\n disableHitHold();\n winGamesTwentyOne++;\n } else if (playerScore > 21) {\n setTimeout(bust, 800);\n disableHitHold();\n lostGames++;\n } else if (dealerScore === 21) {\n setTimeout(dealerTwentyOne, 800);\n disableHitHold();\n lostGames++;\n } else if (dealerScore > 21) {\n setTimeout(dealerBust, 800);\n disableHitHold();\n winGames++;\n }\n\n dealerCardTotal.className += \" score\";\n dealerCardTotal.innerText = dealerScore;\n\n playerCardTotal.className += \" score\";\n playerCardTotal.innerText = playerScore;\n\n document.getElementById(\"wins-twenty-one\").innerHTML = winGamesTwentyOne;\n document.getElementById(\"wins\").innerHTML = winGames;\n document.getElementById(\"losses\").innerHTML = lostGames;\n document.getElementById(\"draws\").innerHTML = drawGames;\n}", "function recordAttempt() {\r\n var temp_now = window.performance.now();\r\n\r\n data.task5.drawings.push({\r\n Id: fbID,\r\n attempt: attempt,\r\n startTime: timer1,\r\n endTime: temp_now,\r\n RT: temp_now - timer1,\r\n //lines: line\r\n })\r\n\r\n attempt++;\r\n }", "function Dashboard(){\n const [balls, setBalls] = useState(0) //okclick \n const [strikes, setStrikes] = useState(0) //okclick\n const [hits, setHits] = useState(0) //hitclick //DONE\n const [fouls, setFouls] = useState(0) //badclick\n\n const scores = {balls, strikes, hits, fouls}\n\n //-[] balls and strikes reset to 0 when a `hit` is recorded\n const handleHitClick = () => {\n setHits(hits + 1)\n setStrikes(0)\n setBalls(0)\n console.log('hit was clicked')\n }\n\n // -[] balls reset to 0 when a player reaches4 balls.\n const handleBallClick = () => {\n if( balls < 4){\n setBalls(balls + 1)\n } else{\n setBalls(0)}\n console.log('Ball was clicked')\n }\n\n // -[] strikes reset to 0 when a player reaches 3 strikes.\n const handleStrikeClick = () => {\n if (strikes < 3) {\n setStrikes(strikes + 1);\n } else {\n setStrikes(0);}\n //const newStrikeValue = strikes.strikeCounter + 1\n console.log('strike was clicked')\n }\n\n //With no strikes, a foul makes it 1 strike. \n //With 1 strike, a foul makes it 2 strikes. \n //With two strikes a foul has no effect, count stays at 2 strikes\n const handleBadClick = () => {\n if(strikes === 0){\n setStrikes(strikes + 1)\n setFouls(fouls + 1)}\n else if(strikes === 1){\n setStrikes(strikes + 2)\n setFouls(fouls + 1)}\n else{\n setFouls(fouls + 1)}\n console.log('foul was clicked')\n }\n\n\n return (\n <>\n <button onClick={()=>handleStrikeClick()} className='button' > Strike </button>\n <button onClick={()=>handleBallClick()} className='button'> Ball </button>\n <button onClick={()=>handleBadClick()} lassName='button'> Foul </button> \n <button onClick={()=>handleHitClick()} className='button'> Hit </button>\n \n \n </>\n )\n\n}", "function startHand(){\n currentBid = 240,\n userIsBidding = true, \n oneCPUIsBidding = true, \n partnerIsBidding = true, \n twoCPUIsBidding = true,\n passCounter = 0,\n lastBid = false,\n trumpSuit;\n\n shuffleDeck();\n dealDeck();\n sortUserHand();\n \n turn = dealer;\n \n //Selects a dealer and displays which user has been selected\n switch(dealer){\n case 0:\n staticCompMsg.innerHTML = \"It's your deal.\";\n staticCompMsg.style.left = \"45%\";\n dealer = 1;\n break;\n case 1:\n staticCompMsg.innerHTML = \"It's CPU #1's deal.\";\n staticCompMsg.style.left = \"43%\";\n dealer = 2;\n break;\n case 2:\n staticCompMsg.innerHTML = \"It's your partner's deal.\";\n staticCompMsg.style.left = \"41%\"; \n dealer = 3;\n break;\n case 3:\n staticCompMsg.innerHTML = \"It's CPU #2's deal.\";\n staticCompMsg.style.left = \"43%\"; \n dealer = 0;\n }\n\n //Undisplays player messages\n userMessage.style.display = \"none\";\n oneCPUMessage.style.display = \"none\";\n partnerMessage.style.display = \"none\";\n twoCPUMessage.style.display = \"none\";\n\n //Displays player name tags\n userNameTag.style.display = \"block\";\n oneCPUNameTag.style.display = \"block\";\n partnerNameTag.style.display = \"block\";\n twoCPUNameTag.style.display = \"block\";\n\n //Displays score table\n scoreTable.style.display = \"block\";\n\n //Displays and adds an eventListener to the continue switch\n activeCompMsg.style.display = \"block\";\n activeCompMsg.innerHTML = \"Click to deal cards.\";\n activeCompMsg.addEventListener(\"click\", clickToDeal);\n\n function clickToDeal(){\n activeCompMsg.removeEventListener(\"click\", clickToDeal);\n \n staticCompMsg.style.display = \"none\";\n\n //Displays all the hands\n displayuserHand();\n document.getElementById(\"partnerHand\").style.display = \"block\";\n document.getElementById(\"oneCPUHand\").style.display = \"block\";\n document.getElementById(\"twoCPUHand\").style.display = \"block\";\n\n //Displays who has first bid (based on who the dealer was)\n switch(turn){\n case 0:\n oneCPUMessage.innerHTML = \"It's my bid first.\";\n oneCPUMessage.style.display = \"block\";\n break;\n case 1:\n partnerMessage.innerHTML = \"It's my bid first.\";\n partnerMessage.style.left = \"45%\";\n partnerMessage.style.display = \"block\"; \n break;\n case 2:\n twoCPUMessage.innerHTML = \"It's my bid first.\";\n twoCPUMessage.style.display = \"block\";\n break;\n case 3:\n userMessage.innerHTML = \"It's my bid first.\";\n userMessage.style.left = \"45%\";\n userMessage.style.display = \"block\";\n }\n activeCompMsg.style.display = \"none\";\n\n //Starts the bidding process\n setTimeout(bid, 1000);\n }\n}", "function attachRating(){\n var startKey = 'vote_'+groupNumber;\n db.allDocs({\n include_docs: true,\n attachements: true,\n startkey: startKey,\n endkey: startKey+'\\uffff'\n }).then(function(votes){\n var rating1=0, rating2=0, rating3=0;\n for(var i = 0; i < votes.rows.length; i++) {\n var player = votes.rows[i].doc.player;\n switch(player){\n case 1:\n rating1++;\n break;\n case 2:\n rating2++;\n break;\n case 3:\n rating3++;\n break;\n }\n }\n $( \"#progressbar1\" ).progressbar({\n value: rating1\n });\n $( \"#progressbar2\" ).progressbar({\n value: rating2\n });\n $( \"#progressbar3\" ).progressbar({\n value: rating3\n });\n var progressbarText = $('.player p');\n $(progressbarText[0]).text(rating1 + '/8 Emplacements');\n $(progressbarText[1]).text(rating2 + '/8 Emplacements');\n $(progressbarText[2]).text(rating3 + '/8 Emplacements');\n });\n}", "function holdScore(){\n \n // Assigning variables to target classes and id from html \n let currentPlayerGlobalScore = document.querySelector(`#score-${activePlayer}`); \n let currentPlayerScore = document.querySelector(`#current-${activePlayer}`); \n let currentPlayerName = document.querySelector(`#name-${activePlayer}`); \n let currentPlayerPanel = document.querySelector(`.player-${activePlayer}-panel`); \n\n if(gamePlay){\n globalScores[activePlayer] += roundScore; // mag add yung roundScore at yung globalScores \n currentPlayerGlobalScore.textContent = globalScores[activePlayer]; // ididisplay yung globalScores ni active player \n\n if(globalScores[activePlayer] >= threshold.value){\n currentPlayerName.textContent = \"Winner!\"; // papalitan name into \"Winner!\" text\n currentPlayerScore.textContent = '0'; // reset to '0' current score \n imgDice.style.display = \"none\"; \n\n // Stop the game \n currentPlayerPanel.classList.remove('active'); \n currentPlayerPanel.classList.add('winner'); \n gamePlay = false; \n\n } else {\n nextPlayer(); // another game will begin \n }\n }\n }", "function playOneWin(){\n oneScore++\n hasPicked = false;\n bannerText.text(\"Player One Wins\")\n bannerText.show();\n setTimeout(bannerhide,1000);\n database.ref(\"playerOne\").set({\n oneState: hasPicked,\n ScoreOne: oneScore\n });\n database.ref(\"playerTwo\").set({\n twoState: hasPicked,\n ScoreTwo: twoScore\n });\n}", "function actionAfterClickPlay() {\n // @todo checkin rate (alert if none or too high)\n createButtonAfterPlay();\n createResultsArea();\n createRateArea();\n createCardArea();\n gameAfterPlay();\n removeElementsAfterPlay();\n\n}", "function processWinner(winnerData) {\n\n //Update the score.\n if (winnerData.playerNumber === 1) {\n span_player1Score.innerText = player1Score.toString();\n }\n else if (winnerData.playerNumber === 2) {\n span_player2Score.innerText = player2Score.toString();\n }\n else if (winnerData.playerNumber === \"Tie\") {\n\n }\n else\n return;\n\n\n //Update and display winner/round-over screen\n updateAndDisplayRoundScreen(winnerData);\n\n //If the game is over or if the maximum rounds have been reached, restart the game\n if (winnerData.gameOver) {\n currentRound = 1;\n restartGame();\n }\n else\n currentRound++;\n\n\n\n roundRefresh(winnerData);\n\n span_roundIndicator.innerText = currentRound.toString();\n}", "function Gambling () {\n if (global.commons.isSystemEnabled(this) && global.commons.isSystemEnabled('points')) {\n this.current = {\n duel: {\n '_total': 0,\n '_timestamp': null\n }\n }\n\n global.parser.register(this, '!gamble', this.gamble, constants.VIEWERS)\n global.parser.register(this, '!seppuku', this.seppuku, constants.VIEWERS)\n global.parser.register(this, '!roulette', this.roulette, constants.VIEWERS)\n global.parser.register(this, '!duel', this.duel, constants.VIEWERS)\n\n global.configuration.register('seppukuTimeout', 'gambling.seppuku.timeout', 'number', 10)\n global.configuration.register('rouletteTimeout', 'gambling.roulette.timeout', 'number', 10)\n\n const self = this\n setInterval(function () {\n if (_.isNil(self.current.duel._timestamp)) return true\n\n if (new Date().getTime() - self.current.duel._timestamp > 1000 * 60 * 5) {\n let winner = _.random(0, parseInt(self.current.duel._total, 10) - 1, false)\n const total = self.current.duel._total\n\n delete self.current.duel._total\n delete self.current.duel._timestamp\n\n let winnerArray = []\n _.each(self.current.duel, function (v, k) {\n for (let i = 0; i < v; i++) {\n winnerArray.push(k)\n }\n })\n\n const username = winnerArray[winner]\n const tickets = parseInt(self.current.duel[username], 10)\n const probability = tickets / (parseInt(total, 10) / 100)\n\n global.commons.sendMessage(global.translate((_.size(self.current.duel) === 1) ? 'gambling.duel.noContestant' : 'gambling.duel.winner')\n .replace('(pointsName)', global.systems.points.getPointsName(total))\n .replace('(points)', total)\n .replace('(probability)', _.round(probability, 2))\n .replace('(tickets)', tickets)\n .replace('(ticketsName)', global.systems.points.getPointsName(tickets))\n .replace('(winner)', (global.configuration.getValue('atUsername') ? '@' : '') + username), { username: username }, { force: true })\n\n // give user his points\n const user = global.users.get(username)\n user.points = parseInt(_.isNil(user.points) ? 0 : user.points, 10) + parseInt(total, 10)\n global.users.set(username, { points: user.points })\n\n // reset duel\n self.current.duel = {}\n self.current.duel._timestamp = null\n self.current.duel._total = 0\n }\n }, 30000)\n }\n}", "function checkRecycling(){\n if(currentID.includes('trash')){\n playAudio(wrongAudio);\n points--;\n wrong++;\n checkWrong();\n displayMessage(incorrect);\n }\n else if(currentID.includes('rec')){\n playAudio(correctAudio);\n points++;\n displayMessage(motivation);\n }\n $('#points').text(points);\n }", "handleNewGame() {\n this.redTurnOrder.forEach((player) => {super.updatePlayerScore(player, \"\")});\n this.blueTurnOrder.forEach((player) => {super.updatePlayerScore(player, \"\")});\n this.teams = {};\n this.redTurnOrder = [];\n this.blueTurnOrder = [];\n this.redHints = [];\n this.blueHints = [];\n this.redNum = 0;\n this.blueNum = 0;\n this.currentRound = 0;\n this.redSel = [\"0\", \"0\", \"0\", \"0\", \"0\", \"0\"];\n this.blueSel = [\"0\", \"0\", \"0\", \"0\", \"0\", \"0\"];\n this.redWords = this.generateWords();\n this.blueWords = this.generateWords();\n this.redCode = [\"?\", \"?\", \"?\"];\n this.blueCode = [\"?\", \"?\", \"?\"];\n this.redGuessHistory = [];\n this.blueGuessHistory = [];\n this.redHistory = [];\n this.blueHistory = [];\n this.redScore = [0, 0];\n this.blueScore = [0, 0];\n this.gameState = 0;\n super.sendGameData({ event: \"reset-game\" });\n }", "function populateDataScorePage() {\n finalTime = timePlayed + penaltyTime; \n finalTimeEl.textContent = `${finalTime.toFixed(1)}s`; \n baseTimeEl.textContent = `Temps : ${timePlayed.toFixed(1)}s`; \n penaltyTimeEl.textContent = `Penalité : ${penaltyTime}s`;\n saveScoreToLocalStorage();\n showScorePage();\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 roundsSetup() {\n const playingContainer = document.querySelector('.playingContainer');\n const tl = new TimelineMax();\n tl.addCallback(() => {\n tl.to('.playingContainer', 1, {\n top: '25%'\n });\n playingContainer.classList.remove('visuallyhidden');\n });\n tl.to('.scoreBoard', 1, {\n top: 5\n });\n\n // get the value from the form field for rounds\n rounds = document.querySelector('#rounds').value;\n const roundsToPlay = document.querySelector('#totalRounds');\n const messageBox = document.querySelector('.messageBox');\n // put the number of rounds to play into the rounds box\n roundsToPlay.innerHTML = rounds;\n // clear out the message box\n messageBox.innerHTML = '';\n // call the function to start the game\n gamePlay(player1, player2);\n}", "function newRound() {\n checkPowerUps();\n cdpause();\n clearTimeout(setLock);\n\n // B o n u s F l i p\n function bonusFlip() {\n playAudioCards();\n playAudioGypsy();\n controls.classList.add('ui-disabled');\n\n const createFader = document.createElement('div');\n createFader.classList.add('fadeoutOverlay');\n canvas.appendChild(createFader);\n\n const createFaderText = document.createElement('span');\n createFaderText.classList.add('ghost-trapped');\n createFaderText.innerHTML = `<h1>Room ${round + 1}</h1>`;\n createFader.appendChild(createFaderText);\n getRound(); //Round Count increase by 1\n\n //remove progress bar\n var progressbar = document.getElementById('progressbar');\n progressbar.remove();\n\n //Create bonus Wrapper\n const bonusWrapper = document.createElement('div');\n bonusWrapper.classList.add('bonusScreen');\n canvas.appendChild(bonusWrapper);\n\n bonusWrapper.style.backgroundColor = bgColors[Math.floor(Math.random() * bgColors.length)];\n\n //Add Clouds\n const createClouds = document.createElement('div');\n createClouds.classList.add('clouds');\n bonusWrapper.appendChild(createClouds);\n\n //Create bonus Title\n const bonusWrapperTitle = document.createElement('div');\n bonusWrapperTitle.classList.add('bonusTitle');\n bonusWrapperTitle.innerHTML = \"<div class='screen-title font-smaller'>Choose fortune</div>\";\n bonusWrapper.appendChild(bonusWrapperTitle);\n\n //Create bonus card wrapper\n const bonusCardWrapper = document.createElement('div');\n bonusCardWrapper.classList.add('bonusCardWrapper');\n bonusWrapper.appendChild(bonusCardWrapper);\n\n var tarrotCard = document.createElement('div');\n tarrotCard.classList.add('tarrotcard');\n\n const tarrotCoin = document.createElement('div');\n tarrotCoin.classList.add('coin-collected-tarot', 'tarrotCoin');\n tarrotCoin.innerHTML = '<img src=\"./assets/coin.png\"/>';\n\n //Create bonus card hand\n const bonusCardHand = document.createElement('div');\n bonusCardHand.classList.add('tarot-hand');\n tarrotCard.appendChild(bonusCardHand);\n\n //Card colors\n var cardColors = ['#63b598', '#ce7d78', '#ea9e70', '#a48a9e', '#85a1a8', '#648177', '#3e6291', '#976094', '#3e3261', '#14a9ad', '#4ca2f9', '#889b69', '#d298e2', '#7b54b4', '#d2737d', '#756a43', '#966753', '#634891', '#79806e', '#6d9b6c', '#ac6550', '#9348af', '#3e8b63', '#c5a4fb', '#996635', '#9b4378', '#589c72', '#679b7c', '#545d88', '#2f7b99', '#a67564', '#618b57', '#809465', '#a1656a', '#6e5785', '#868d57', '#b3be94', '#559990', '#425e3c', '#566ca0', '#caa4aa', '#624f92', '#935b6d', '#916988', '#5c5184', '#8b8b5b', '#9e6d71', '#4a4e70', '#589b78', '#624c8d', '#9f69ad', '#568051', '#8a5747', '#8d504d', '#539397', '#814479', '#ca89a6', '#ba96ce', '#679c9d', '#a5a458', '#5d2c52', '#6c9c57', '#a0985b', '#65a4aa', '#70adb8', '#8da873', '#be608b', '#7f8658', '#3c7e91', '#a3668f', '#a56695', '#ee91e3', '#5e9e7f', '#6b5c97', '#5d558a', '#783f49', '#575074', '#6481a5', '#758054', '#b2b4f0', '#c3c89d', '#9c8d5a', '#6ea177', '#915f7d', '#608ea3', '#67964e', '#375577', '#779950', '#a56554', '#799246', '#4e546d', '#4c7045', '#986b53', '#9b5b62', '#983f7a', '#91537a', '#774d48', '#663f65', '#c79ed2', '#999e70', '#a55f67', '#898f5b', '#975894', '#4a9184', '#815178', '#64820f', '#425e80', '#799659', '#9c695a', '#748a47', '#455186', '#5c8653', '#986b53', '#9e5d65', '#983f7a', '#965a80', '#8a645e', '#70476f', '#c79ed2', '#a5aa7b', '#92565d', '#909665', '#8d578a', '#4d8379', '#88537d', '#808f56', '#7c8562', '#81654f', '#688d8b', '#6a8f77', '#9b8071', '#5d8862', '#aa798d', '#94a064', '#97567a', '#6f5d86', '#788353', '#865575', '#8ca083', '#77829e', '#7b4f80', '#8c9b6f', '#94835b', '#8ca86a', '#8b604f', '#646b99', '#9972aa', '#3f8473', '#978068', '#655381', '#885f99', '#635f6d'];\n\n //Card values\n var cardValues = ['0', '4', '1', '1', '2', '3'];\n\n for (var i = 0; i < 6; i++)\n bonusCardWrapper.appendChild(tarrotCard.cloneNode(true));\n\n var getTarrotCards = document.querySelectorAll('.tarrotcard');\n\n for (i = 0; i < getTarrotCards.length; i++) {\n getTarrotCards[i].style.backgroundColor = cardColors[Math.floor(Math.random() * cardColors.length)];\n getTarrotCards[i].onclick = function () {\n var chosenCard = cardValues[Math.floor(Math.random() * cardValues.length)];\n var varChosenCardNo = eval(chosenCard);\n var fetchTarrotCards = document.querySelectorAll('.tarrotcard');\n\n for (i = 0; i < fetchTarrotCards.length; i++)\n fetchTarrotCards[i].classList.add('unselected');\n\n this.classList.remove('unselected');\n this.classList.add('selected');\n\n if (varChosenCardNo === 1) {\n bonusWrapperTitle.innerHTML = \"<div class='screen-title font-smaller'>Good fortune</div>\";\n playAudioGoodFortune();\n this.appendChild(tarrotCoin.cloneNode(true));\n playAudioCoin();\n coins += 1;\n getCoins();\n score += 50;\n getScore();\n } else if (varChosenCardNo === 2) {\n bonusWrapperTitle.innerHTML = \"<div class='screen-title font-smaller'>Good fortune</div>\";\n playAudioGoodFortune();\n for (var i = 0; i < varChosenCardNo; i++) {\n this.appendChild(tarrotCoin.cloneNode(true));\n playAudioCoin();\n coins += 1;\n getCoins();\n score += 100;\n getScore();\n }\n } else if (varChosenCardNo === 3) {\n bonusWrapperTitle.innerHTML = \"<div class='screen-title font-smaller'>Good fortune</div>\";\n playAudioGoodFortune();\n\n for (var i = 0; i < varChosenCardNo; i++) {\n this.appendChild(tarrotCoin.cloneNode(true));\n playAudioCoin();\n coins += 1;\n getCoins();\n score += 150;\n getScore();\n }\n\n } else if (varChosenCardNo === 4) {\n bonusWrapperTitle.innerHTML = \"<div class='screen-title font-smaller'>Bad fortune</div>\";\n playAudioBadFortune();\n\n if (coins < 1) coins = 0;\n else coins -= 1;\n\n playAudioCoinMinus();\n subtractCoins();\n const getCoinImg = document.querySelector('.coins');\n const insertCoinImg = document.createElement('div');\n insertCoinImg.classList.add('coin-minus');\n insertCoinImg.innerHTML = \"<img src='./assets/coin.png'/>\";\n getCoinImg.appendChild(insertCoinImg);\n getCoins();\n } else if (varChosenCardNo === 0) {\n bonusWrapperTitle.innerHTML = \"<div class='screen-title font-smaller'>Bad fortune</div>\";\n playAudioBadFortune();\n\n if (coins < 3) coins = 0;\n else coins -= 2;\n\n subtractCoins();\n const getCoinImg = document.querySelector('.coins');\n const insertCoinImg = document.createElement('div');\n insertCoinImg.classList.add('coin-minus');\n insertCoinImg.innerHTML = \"<img src='./assets/coin.png'/>\";\n getCoinImg.appendChild(insertCoinImg);\n playAudioCoinMinus();\n } else {\n //do nothing\n }\n\n setTimeout(function () {\n continueNext();\n score += 100;\n getScore();\n\n }, 3000); // time before new round\n\n function continueNext() {\n checkTimers();\n cdreset();\n countdown();\n controls.classList.remove('ui-disabled');\n createFader.remove();\n getRandomBg.style.backgroundColor = bgColors[Math.floor(Math.random() * bgColors.length)];\n const getBonusWrapper = document.querySelector('.bonusScreen');\n getBonusWrapper.remove();\n const progressBar = document.createElement('div');\n progressBar.setAttribute(\"id\", \"progressbar\");\n const controlBar = document.querySelector('.controls');\n controlBar.appendChild(progressBar);\n\n createProgressbar('progressbar', '60s', function () {\n endGame();\n });\n\n getInventoryThermal();\n getInventoryCrystal();\n getInventoryK2();\n checkPowerUps();\n\n var getExistingDoors = document.querySelectorAll(\".opened\");\n var getLastDoor = document.querySelector(\".door\");\n [].forEach.call(getExistingDoors, function (el) {\n el.remove();\n });\n getLastDoor.remove();\n\n makeDoors(); //Reset Doors\n conjureGhost();\n\n }\n };\n }\n }\n bonusFlip();\n}", "function updateScore(){ // displays into HTML new current score counter\n $(\"#current-score\").text(counter);\n $(\"#win-record\").text(wins);\n $(\"#loss-record\").text(losses);\n}", "function handleScore() {\n // Get a random number\n let randomNumber = Math.random();\n // Constrain the followers between a max and min\n // While there are images\n if (currentImage < images.length) {\n // Uppdate the followers according to the images properties\n if (randomNumber < images[currentImage].followerProbability) {\n followers += images[currentImage].followersFluctuation;\n }\n } else { // When there are no more images drop the followers to 0 and call game over\n if (followers > 0) {\n followers -= 1;\n // Call the report alert\n endGame();\n }\n }\n // Rewrite the score\n updateScore();\n}", "updateScore( score ){\n this.score += score;\n this.playerDB.update(this.props());\n }", "function compare() {\n let p1 = player1.card[roundTracking][0];\n let p2 = player2.card[roundTracking][0];\n // reset string each round\n winnerAnnounced.innerHTML = '';\n \n if (p1.value > p2.value) {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n } else if (p1.value < p2.value) {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n } else {\n// spade\n if (p1.suit === 'spade' && p2.suit === 'diamond') {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n } else if (p1.suit === 'spade' && p2.suit === 'club') {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n } else if (p1.suit === 'spade' && p2.suit === 'heart') {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n// hearts\n } else if (p1.suit === 'heart' && p2.suit === 'diamond') {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n } else if (p1.suit === 'heart' && p2.suit === 'club') {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n } else if (p1.suit === 'heart' && p2.suit === 'spade') {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n// club\n } else if (p1.suit === 'club' && p2.suit === 'diamond') {\n player1.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player1.name} gets a point! Choose again`);\n } else if (p1.suit === 'club' && p2.suit === 'heart') {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n } else if (p1.suit === 'club' && p2.suit === 'spade') {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n// diamond\n } else if (p1.suit === 'diamond' && p2.suit === 'club') {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n } else if (p1.suit === 'diamond' && p2.suit === 'heart') {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n } else if (p1.suit === 'diamond' && p2.suit === 'spade') {\n player2.score += 1;\n winnerAnnounced.insertAdjacentHTML('afterbegin', `${player2.name} gets a point! Choose again`);\n } \n }\n}", "function updateScore() {\n store.score++;\n}", "function scoreDraw() {\n let healthElement = document.getElementById(\"healthcheckup\");\n let moodElement = document.getElementById(\"moodcheckup\");\n let nameElement = document.getElementById(\"name\");\n let drinkcountElement = document.getElementById(\"drinkcounter\");\n let modsElement = document.getElementById(\"modstotalcheckup\");\n let foodElement = document.getElementById(\"foodcheckup\");\n let waterElement = document.getElementById(\"watercheckup\");\n let coffeeElement = document.getElementById(\"coffeecheckup\")\n nameElement.textContent = `Name: ${target.name}`;\n moodElement.textContent = `Mood: ${target.moodScore.toString()}`;\n healthElement.textContent = `Health: ${target.healthScore.toString()}`;\n drinkcountElement.textContent = `Number of Drinks: ${target.hits}`;\n modsElement.textContent = `Modifiers Total: ${modsTotal}`;\n foodElement.textContent = `Food: ${foodCount.toString()}`;\n waterElement.textContent = `Water: ${waterCount.toString()}`;\n coffeeElement.textContent = `Coffee: ${coffeeCount}`;\n\n}", "function record() {\n if (position_player >= finish || position_computer >= finish) {\n // Stop timer on race completion\n clearInterval(timer);\n }\n else {\n //Timer increments in 0.01 second intervals for accuracy\n record_time += 0.01;\n var intCheck = (Math.round(record_time*10));\n // Only want to dislpay in increments of 0.1 seconds\n if (Number.isInteger(intCheck)) {\n document.getElementById('timer').innerHTML = (Math.round(record_time*10)/10);\n };\n };\n }", "async evaluateHand() {\n let hand = \"\"\n let evaluateHand = \"\";\n let handEvaluation = []\n for (let playerIndex = 0; playerIndex < this.state.memberSubCollection.length; playerIndex++) {\n for (let cardIndex = 0; cardIndex < this.state.memberSubCollection[playerIndex].cards.length; cardIndex++) {\n if (cardIndex === this.state.memberSubCollection[playerIndex].cards.length - 1) {\n hand = hand + this.state.memberSubCollection[playerIndex].cards[cardIndex].toString();\n } else {\n hand = hand + this.state.memberSubCollection[playerIndex].cards[cardIndex].toString() + \" \";\n }\n }\n if (hand.length === 0) {\n handEvaluation.push({ 'id': this.state.memberSubCollection[playerIndex].id, 'name': this.state.memberSubCollection[playerIndex].name, 'rank': '9999', 'score': '9999', 'cards': this.state.oldCards[playerIndex].cards, 'balance': this.state.memberSubCollection[playerIndex].balance })\n\n } else {\n evaluateHand = new this.PokerHand(hand)\n handEvaluation.push({ 'id': this.state.memberSubCollection[playerIndex].id, 'name': this.state.memberSubCollection[playerIndex].name, 'rank': evaluateHand.getRank(), 'score': evaluateHand.getScore(), 'cards': this.state.oldCards[playerIndex].cards, 'balance': this.state.memberSubCollection[playerIndex].balance })\n this.setState({ evaluateHandCollection: handEvaluation });\n }\n hand = \"\"\n evaluateHand = \"\"\n };\n }", "_hitMe() {\n this._getPlayerCards()\n this._playerScoreLogic() \n }", "function playGame() {\n //*game scope variables\n let ronUrl = \"https://ron-swanson-quotes.herokuapp.com/v2/quotes\";\n let kanyeUrl = \"https://api.kanye.rest/\";\n let trumpUrl = \"https://api.whatdoestrumpthink.com/api/v1/quotes/random/\";\n const userUrl = \"http://localhost:3000/users\";\n let sortedUsers = [];\n let currentUser = {};\n let urlArray = [ronUrl, kanyeUrl, trumpUrl];\n let currentQuote = 0;\n let scoreCounter = 0;\n let counter;\n\n //*Initializing the game\n let quote = document.querySelector(\".quote\");\n let start = document.createElement(\"button\");\n start.textContent = \"Click to Start!\";\n start.style.fontSize = \"30px\";\n quote.appendChild(start);\n start.setAttribute(\"class\", \"button\");\n start.addEventListener(\"click\", () => {\n getQuote();\n });\n\n function getQuote() {\n //*GENERATE A RANDOM NUMBER FROM 0 TO 2\n //*(RON=0), (KANYE=1), (TRUMP=2)\n clearInterval(counter);\n contestantArr.forEach((contestant) => {\n contestant.classList.remove(\"wrong\");\n contestant.classList.remove(\"correct\");\n });\n let i = Math.floor(Math.random() * 3);\n //*FETCHES QUOTE BASED OFF URL ARRAY INDEX\n fetch(urlArray[i])\n .then((response) => response.json())\n .then((data) => {\n currentQuote = i;\n renderQuote(data, i);\n });\n }\n\n //*renders the quote to screen\n function renderQuote(data, i) {\n setTimer();\n let newQuote = document.querySelector(\".quote\");\n switch (i) {\n case 0:\n newQuote.textContent = `\"${data}\"`;\n break;\n case 1:\n newQuote.textContent = `\"${data.quote}\"`;\n break;\n case 2:\n newQuote.textContent = `\"${data.message}\"`;\n break;\n default:\n newQuote.textContent = \"Press Start to Play\";\n }\n }\n\n //*game countdown\n function setTimer() {\n let timerText = document.querySelector(\".seconds\");\n timerText.style.color = \"white\";\n let count = 11;\n counter = setInterval(timer, 1000);\n timer();\n function timer() {\n count = count - 1;\n timerText.textContent = count;\n if (count <= 5) {\n timerText.style.color = \"red\";\n timerText.style.fontSize = \"55px\";\n }\n if (count <= 0) {\n displayLoss();\n return;\n }\n }\n }\n\n //*on loss, possible reset.\n function displayLoss() {\n clearInterval(counter);\n //! Grab score and compare if highscore.\n scoreBoard();\n let youLose = document.querySelector(\".quote\");\n let mainBox = document.querySelector(\".main-box\");\n youLose.textContent = \"\";\n let button = document.createElement(\"button\");\n button.textContent = \"Play Again?\";\n button.style.fontSize = \"30px\";\n youLose.appendChild(button);\n button.setAttribute(\"class\", \"button\");\n button.addEventListener(\"click\", () => {\n getQuote();\n });\n }\n //*compares highscores\n function scoreBoard() {\n if (scoreCounter > currentUser.highScore) {\n patchScore();\n }\n }\n\n //*update currentUser's highscore\n function patchScore() {\n let updateUser = {\n highScore: scoreCounter,\n };\n let configObj = {\n method: \"PATCH\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(updateUser),\n };\n\n fetch(userUrl + \"/\" + currentUser.id, configObj)\n .then((res) => res.json())\n .then((data) => getUsers())\n .catch((error) => console.error(\"ERROR: \", error));\n }\n function sortUsers(users) {\n sortedUsers = users.sort((a, b) => b.highScore - a.highScore);\n console.log(sortedUsers);\n }\n\n function displayLeaderBoard() {\n let ol = document.querySelector(\"#top-scores\");\n darlingCide(ol);\n for (let i = 0; i < 5; i++) {\n let li = document.createElement(\"li\");\n li.textContent = `${sortedUsers[i].username} : ${sortedUsers[i].highScore}`;\n appender(ol, li);\n }\n }\n\n //emptys divs\n function darlingCide(parent) {\n while (parent.firstChild) {\n parent.removeChild(parent.firstChild);\n }\n }\n\n //appends\n function appender(parent, child) {\n parent.appendChild(child);\n }\n\n //*Contestant divs\n const ron = document.querySelector(\".ron\");\n const kanye = document.querySelector(\".kanye\");\n const trump = document.querySelector(\".trump\");\n const score = document.querySelector(\".score>h3>span\");\n\n let contestantArr = [ron, kanye, trump];\n ron.addEventListener(\"click\", (e) => answer(e));\n kanye.addEventListener(\"click\", (e) => answer(e));\n trump.addEventListener(\"click\", (e) => answer(e));\n\n function incrementScore() {\n scoreCounter++;\n score.textContent = scoreCounter;\n }\n\n //*On selecting a contestant, path tree\n function answer(e) {\n clearInterval(counter);\n let y = e.path[1];\n let x = parseInt(e.path[1].dataset.num);\n if (x === currentQuote) {\n correct(y);\n } else {\n wrong(y);\n }\n }\n //*if correct\n function correct(y) {\n clearInterval(counter);\n y.classList.add(\"correct\");\n incrementScore();\n const nextQ = setInterval(() => nextQuestion(nextQ), 500);\n }\n\n //*if wrong, resets the board.\n function wrong(y) {\n clearInterval(counter);\n y.classList.add(\"wrong\");\n displayLoss();\n scoreCounter = -1;\n incrementScore();\n }\n //resets the board\n function nextQuestion(nextQ) {\n contestantArr.forEach((contestant) => {\n contestant.classList.remove(\"wrong\");\n contestant.classList.remove(\"correct\");\n });\n getQuote();\n clearInterval(nextQ);\n }\n\n //*** FORM AND USER VALIDATION ***/\n //grab form\n const form = document.querySelector(\"#login\");\n //add listener with validation callback\n form.addEventListener(\"submit\", (e) => createOrValidate(e));\n\n //*collects db to search through\n function getUsers() {\n fetch(userUrl)\n .then((res) => res.json())\n .then((users) => {\n sortUsers(users);\n displayLeaderBoard();\n })\n .catch((error) => console.error(\"ERROR:\", error));\n }\n //* user input decision tree\n function createOrValidate(e) {\n e.preventDefault();\n let radioBtn = e.target.radio.value;\n console.log(radioBtn);\n if (radioBtn === \"existingUser\") {\n validateUsers(e);\n } else {\n createUser(e);\n }\n }\n\n //*takes form input and checks database\n function validateUsers(e) {\n let username = e.target.name.value;\n let pin = e.target.pin.value;\n console.log(username, pin);\n let x = sortedUsers.find((user) => user.username === username);\n if (x != undefined) {\n x.pin === pin ? exitSignIn(x) : alert(\"incorrect password\");\n } else {\n console.log(\"at else Existing User\");\n alert(\"invalid input, try again\");\n }\n }\n //*creates new user if they are a unique key/val\n function createUser(e) {\n e.preventDefault();\n let username = e.target.name.value;\n let pin = e.target.pin.value;\n console.log(username, pin);\n //check if user name is unique\n let x = sortedUsers.find((user) => user.username === username);\n if (x === undefined) {\n postUser(username, pin);\n } else {\n console.log(\"at else Create User\");\n alert(\"Username taken, Try again.\");\n form.reset();\n }\n }\n function assignUserData(user) {\n currentUser = Object.assign(currentUser, user);\n console.log(currentUser);\n }\n function exitSignIn(user) {\n assignUserData(user);\n document.getElementById(\"overlay\").style.display = \"none\";\n }\n //POST new user if unique\n function postUser(username, pin) {\n newUser = {\n username: username,\n pin: pin,\n highScore: 0,\n };\n configObj = {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(newUser),\n };\n fetch(userUrl, configObj)\n .then((response) => response.json())\n .then((user) => {\n exitSignIn(user);\n })\n .catch((error) => console.error(\"ERROR: \", error));\n }\n\n getUsers();\n}", "function score(player) {\n if (player == pOne) {\n point1++;\n if (point1 > 3) {\n point1 = 0;\n point2 = 0;\n game1++;\n if (serving == pOne) {\n serving = pTwo;\n $('.scoreboard_scoreGroupP1 .icon-tennisBall').hide('fade', 500);\n $('.scoreboard_scoreGroupP2 .icon-tennisBall').show('fade', 500);\n } else if (serving == pTwo) {\n serving = pOne;\n $('.scoreboard_scoreGroupP1 .icon-tennisBall').show('fade', 500);\n $('.scoreboard_scoreGroupP2 .icon-tennisBall').hide('fade', 500);\n }\n setUpQ1();\n }\n } else if (player == pTwo) {\n point2++;\n if (point2 > 3) {\n point1 = 0;\n point2 = 0;\n game2++;\n if (serving == pOne) {\n serving = pTwo;\n $('.scoreboard_scoreGroupP1 .icon-tennisBall').hide('fade', 500);\n $('.scoreboard_scoreGroupP2 .icon-tennisBall').show('fade', 500);\n } else if (serving == pTwo) {\n serving = pOne;\n $('.scoreboard_scoreGroupP1 .icon-tennisBall').show('fade', 500);\n $('.scoreboard_scoreGroupP2 .icon-tennisBall').hide('fade', 500);\n }\n setUpQ1();\n }\n }\n updateScoreUI();\n}", "function doUpdateRating() {\n var power = (oppRating - myRating)/400;\n var expectedScore = 1/(1 + Math.pow(10, power));\n var actualScore = 1; //win\n if (result === 'draw') actualScore = 0.5; //draw\n if (result === 'lose') actualScore = 0; //lose\n var k = 32; //k-factor\n\n var adjustedRating = myRating + k*(actualScore - expectedScore);\n console.log(\"oppRating:\", oppRating);\n console.log(\"myRating:\", myRating);\n console.log(\"my new rating:\", adjustedRating);\n console.log(\"net gain:\", adjustedRating - myRating);\n\n firebase.database().ref('leaderboard/'+gametype+'/'+userkey).update({ rating: adjustedRating});\n }", "function getRoundsToPlay() {\n const tl2 = new TimelineMax();\n // When the player is playing for a 2nd time, they already have a name, so if there isn't a name, take the name from the name form in the last step and set it as the player1 name\n if (player1.name === '') {\n const plyr1Name = document.querySelector('#name').value;\n player1.name = plyr1Name;\n }\n const player1Hand = document.querySelector('.leftHand');\n const player2Hand = document.querySelector('.rightHand');\n const player1Score = document.querySelector('#player1Score');\n const player2Score = document.querySelector('#player2Score');\n const player1Name = document.querySelector('#player1Name');\n const player2Name = document.querySelector('#player2Name');\n const messageBox = document.querySelector('.messageBox');\n // If the user is playing for a 2nd time, the hands might still be in the settings from the last round, so this resets them both to the fist then resets the number of rounds, player scores, and the scores in the scoreboard back to 0 for the new game\n changeHand('rock', player1Hand);\n changeHand('rock', player2Hand);\n roundCounter = 0;\n player1.wins = 0;\n player2.wins = 0;\n player1Score.innerHTML = 0;\n player2Score.innerHTML = 0;\n // Put the 2 player names into the appropriate spots\n player1Name.innerHTML = player1.name;\n player2Name.innerHTML = player2.name;\n // Ask the user how many rounds they want to play\n messageBox.innerHTML = `\n <div class=\"enterRounds\">\n <label for=\"name\" class=\"medLabel\">How many rounds do you want to play?</label>\n <span class=\"enterRoundsForm\">\n <input type=\"number\" name=\"rounds\" id=\"rounds\" class=\"enterRoundsField\" step=\"1\"/>\n <button id=\"enterRoundButton\" type=\"submit\" class=\"enterNameButton\" onclick=\"\">Submit</button></span>\n </div>\n `;\n const submitButton = document.querySelector('#enterRoundButton');\n const number = document.querySelector('#rounds');\n // Ensure the cursor focuses to the new form field\n number.focus();\n // Let the user press enter instead of clicking the submit button if they want\n number.addEventListener('keyup', (event) => {\n event.preventDefault();\n if (event.keyCode === 13) {\n document.querySelector('#enterRoundButton').click();\n }\n });\n tl2.from('.enterRounds', 0.5, {\n opacity: 0\n });\n tl2.addPause(1, () => {\n // When the user clicks the submit button, fade out the form and move on to the next function\n submitButton.addEventListener('click', () => {\n tl2.play();\n tl2.to('.enterRounds', 0.5, {\n opacity: 0\n }).eventCallback('onComplete', roundsSetup);\n });\n });\n}", "function runPerformance() {\n writeLog('starting the performance')\n // We're starting a perfomrance, so set perfomring to true\n setPlayStatus('performing', true)\n // I don't remember why this is here but i'm afraid to remove it\n setPlayStatus('fresh', false)\n\n // all this will be run at the end of the performance.\n bot.setTimeout(()=> {\n // Get the live performers current annoucenemnt message.\n // so we can count their emoji stats\n let message = getMessage(getLivePerformer().message)\n\n // console.log(message)\n\n // get the current performer\n let live = liveAccount.findOne()\n // filter through all the reactions to get the fire and poop count\n message.reactions.map(reaction => {\n switch(reaction.emoji.name) {\n case \"🔥\":\n live.dopes = reaction.count\n break\n case \"💩\":\n live.nopes = reaction.count\n break\n default:\n }\n })\n // do the performance math\n live.total = live.dopes + live.nopes\n live.dopeness = (parseInt(live.dopes) / parseInt(live.total)).toFixed(2)\n //update the performer stats\n liveAccount.update(live)\n\n setPlayStatus('performing', false) //their current performance stops\n writeLog('ending performance')\n }, 15000) // we check the performers score every 15 seconds\n }", "function playerObject(){\n this.name = ''; //playername\n this.score = 0; //playerscore\n this.avatar = ''; //playeravatar\n this.admin = 0; //is the player an admin\n this.isplaying = 0; //is the player playing this game\n this.mainguessmiles = -1; //this is the player's estimation for the main game\n this.mainguessminutes = -1; //this is the player's estimation (in minutes) for the main game\n this.age = 0; //player's age\n this.vvCorrect = 0; //number of questions answered correctly\n this.vvTotal = 0; //total number of questions asked\n \n var that = this;\n var index = 0;\n \n this.setIndex = function(ind) {\n that.index = ind;\n }\n \n this.getIndex = function() {\n return that.index;\n }\n \n this.getName = function() {\n \treturn that.name;\n }\n \n this.addToScore = function(addedPoints) {\n that.score += Number(addedPoints);\n localStorage['player'+that.getIndex()+'score'] = that.score;\n add2ScoreInDBJS(that.name, addedPoints);\n }\n \n this.getScore = function () {\n return that.score;\n }\n \n this.getMilesGuess = function() {\n return that.mainguessmiles;\n }\n \n this.setMilesGuess = function(guess) {\n that.mainguessmiles = guess;\n }\n \n this.getTimeGuess = function() {\n return that.mainguessminutes;\n }\n \n this.getTimeGuessHours = function() {\n return Math.floor(that.mainguessminutes/60);\n }\n \n this.getTimeGuessMinsLeft = function() {\n var hours = that.getTimeGuessHours();\n var minutesTaken = hours*60;\n return that.getTimeGuess()-minutesTaken;\n }\n \n this.setTimeGuess = function(guess) {\n that.mainguessminutes = guess;\n addGuessToDBJS(that.name, guess, \"maintime\");\n }\n \n this.setTimeGuess = function(hours, mins) {\n that.mainguessminutes = Number(hours) * 60 + Number(mins);\n }\n \n this.getAge = function() {\n return that.age;\n }\n \n this.setAge = function(years) {\n that.age = years;\n }\n \n this.vvCorrectAnswer = function() {\n that.vvCorrect++;\n that.vvTotal++;\n }\n \n this.vvIncorrectAnswer = function() {\n that.vvTotal++;\n }\n\t\n\tthis.vvNumCorrect = function() {\n\t\treturn that.vvCorrect;\n\t}\n\t\n\tthis.vvNumTotal = function() {\n\t\treturn that.vvTotal;\n\t}\n \n this.vvReset = function() {\n that.vvCorrect = 0;\n that.vvTotal = 0;\n }\n}", "updateScoresBasic(lastRound) {\n switch (lastRound.p2) {\n case 'W':\n this.adjustMapValueBy(this.scores, 'D', 1);\n break;\n case 'D':\n this.enemyDynamite--;\n this.adjustMapValueBy(this.scores, 'W', -1);\n this.adjustMapValueBy(this.scores, 'D', 1);\n break;\n default:\n\n }\n if (lastRound.p1 === lastRound.p2) {this.adjustMapValueBy(this.scores, 'D', 1)};\n this.scores.forEach((value, key) => {\n if (value<0) {this.scores.set(key, 0)}\n });\n if (this.prevOpponentMove === lastRound.p2) {\n\n }\n if (this.dynamiteCount <= 0) {this.scores.set('D', 0);}\n }", "function roundComplete() {\n\n\t// player wins if total score = random number\n\tif (totalScore === rdmNum) {\n\t\twinCount++;\n\t\t$(\"#winCount\").html(winCount);\n\t\tresetNums();\n\t}\n\n\t// player loses if exceeds random number\n\tif (totalScore > rdmNum) {\n\t\tlossCount++;\n\t\talert(\"ha! \" + totalScore + \" doesn't equal \" + rdmNum + \".\");\n\t\t$(\"#lossCount\").html(lossCount);\n\t\tresetNums();\n\t}\n}", "function choiceMade(choice){\n\t if (playNum === 1) {\n \n playerRef.update({\n p1answer: choice\n \n });\n }\n else if (playNum === 2){\n \n playerRef.update({\n p2answer: choice\n \n });\n\n\n }\n\n\t\n results();\n\n}", "playBeat(selectedDrum) {\n this.midiSounds.playDrumsNow([selectedDrum]);\n\n if (this.state.recordStatus) {\n this.state.recordTune.beatPlayed.push(selectedDrum);\n this.state.recordTune.timePlayed.push(new Date())\n console.log(this.state.recordTune);\n }\n }", "function progressQuiz() { \n $('main').on('submit','#nextQuestion', e => {\n e.preventDefault();\n if (database.currentQuestionNumber === database.store.length) {\n displayScore();\n }\n else {\n database.currentQuestionNumber++;\n makeGuess();\n }\n });\n}", "function recordScores (name){\n if (score > localStorage.getItem(name)) {\n localStorage.setItem(name, score);\n newHighScore.textContent = `You've set a new record score of ${localStorage.getItem(name)}!`;\n }\n else if (score < localStorage.getItem(name)) {\n newHighScore.textContent = `The record score to beat is: ${localStorage.getItem(name)}`;\n } \n}", "function handleSubmit() {\n\n displayVoteCount();\n renderChart();\n pushNewData();\n}", "function sendScores() {\r\n $.post('scores.php', { scores: scores, SID: SID }, function(data) {\r\n if (data.status === 'success') {\r\n loadSolutionsHat();\r\n if (bonusScore) {\r\n $(\".scoreBonus\").html($(\".scoreBonus\").html().replace('50', bonusScore));\r\n $(\".scoreBonus\").show();\r\n }\r\n $(\".questionScore\").css(\"width\", \"50px\");\r\n $(\".questionListHeader\").css(\"width\", \"265px\");\r\n $(\".question, #divQuestionParams, #divClosed\").css(\"left\", \"272px\");\r\n var sortedQuestionIDs = getSortedQuestionIDs(questionsData);\r\n for (var iQuestionID = 0; iQuestionID < sortedQuestionIDs.length; iQuestionID++) {\r\n var questionID = sortedQuestionIDs[iQuestionID];\r\n var questionKey = questionsData[questionID].key;\r\n var image = \"\";\r\n var score = 0;\r\n var maxScore = 0;\r\n if (scores[questionKey] !== undefined) {\r\n score = scores[questionKey].score;\r\n maxScore = scores[questionKey].maxScore;\r\n if (score < 0) {\r\n image = \"<img src='images/35.png'>\";\r\n } else if (score == maxScore) {\r\n image = '<span class=\"check\">✓</span>';\r\n } else if (parseInt(score) > 0) {\r\n image = \"<img src='images/check.png'>\";\r\n } else {\r\n image = \"\";\r\n }\r\n }\r\n if (!newInterface) {\r\n $(\"#bullet_\" + questionKey).html(image);\r\n $(\"#score_\" + questionKey).html(\"<b>\" + score + \"</b> / \" + maxScore);\r\n }\r\n }\r\n $(\".scoreTotal\").hide();\r\n $(\".chrono\").html(\"<tr><td style='font-size:28px'> \" + t(\"score\") + ' ' + teamScore + \" / \" + maxTeamScore + \"</td></tr>\");\r\n $(\".chrono\").css(\"background-color\", \"#F66\");\r\n // window.selectQuestion(sortedQuestionIDs[0], false);\r\n }\r\n }, 'json');\r\n}", "function renderQueue() {\n //grabs info from firebase\n database.ref().once(\"value\", function (snapshot) {\n livePlaylist = snapshot.val().playlist;\n // empty current song container\n $(\".queued-track-container\").empty();\n // run sortPlaylist to make sure any upvoted songs get moved up the list\n sortPlaylist();\n // loads playlist on screen\n for (var i = 0; i < playlistArr.length; i++) {\n // checks if there is a current song\n if (currentSong == \"\") {\n //creates playlist format for each song\n currentSong = playlistArr[i][1].deezerID;\n $(\"#song\").attr(\"src\", playlistArr[i][1].preview);\n var queuedTrack = $(\"<div>\").addClass(\"current-song-container\").attr(\"data-id\", playlistArr[i][1].deezerID);\n var nameContainer = $(\"<div>\").addClass(\"name-container current-song\");\n var artistName = playlistArr[i][1].artistName;\n var songName = playlistArr[i][1].songName;\n var songNameP = $(\"<p>\").text(songName).addClass(\"song-name\");\n var artistNameP = $(\"<p>\").text(artistName).addClass(\"artist-name\");\n var thumbsDiv = $(\"<div>\").addClass(\"thumbs-container\");\n\n thumbsDiv.addClass(\"btn-group\");\n thumbsDiv.attr(\"role\", \"group\");\n\n var upButton = $(\"<a>\");\n // create upvote button\n upButton.attr(\"data-deezer\", playlistArr[i][1].deezerID);\n upButton.addClass(\"btn btn-flat waves-effect waves-green upvote\");\n upButton.html(\"<i class='material-icons'>thumb_up</i>\");\n // create downvote button\n var downButton = $(\"<a>\");\n downButton.attr(\"data-deezer\", playlistArr[i][1].deezerID);\n downButton.addClass(\"btn btn-flat waves-effect waves-red downvote\");\n downButton.html(\"<i class='material-icons'>thumb_down</i>\");\n // add upvote to song container\n thumbsDiv.append(upButton);\n thumbsDiv.append(downButton);\n\n\n //album artwork information\n var thumbnail = playlistArr[i][1].thumbnail;\n var thumbnailImg = $(\"<img>\").addClass(\"album-pic current-album\");\n thumbnailImg.attr(\"src\", thumbnail);\n\n nameContainer.append(songNameP, artistNameP);\n queuedTrack.append(thumbnailImg);\n queuedTrack.append(nameContainer);\n queuedTrack.append(thumbsDiv);\n // append current song to page\n $(\"#current-track-box\").empty();\n $(\"#current-track-box\").append(queuedTrack);\n }\n // checks if song ID matches current song ID\n else if (currentSong !== playlistArr[i][1].deezerID) {\n //creates playlist format for each song\n var queuedTrack = $(\"<div>\").addClass(\"queued-song\");\n var nameContainer = $(\"<div>\").addClass(\"name-container\");\n var artistName = playlistArr[i][1].artistName;\n var songName = playlistArr[i][1].songName;\n var songNameP = $(\"<p>\").text(songName).addClass(\"song-name\");\n var artistNameP = $(\"<p>\").text(artistName).addClass(\"artist-name\");\n var thumbsDiv = $(\"<div>\");\n\n //album artwork information\n var thumbnail = playlistArr[i][1].thumbnail;\n var thumbnailImg = $(\"<img>\").addClass(\"album-pic\");\n thumbnailImg.attr(\"src\", thumbnail);\n // create upvote button\n var upButton = $(\"<a>\");\n upButton.attr(\"data-deezer\", playlistArr[i][1].deezerID);\n upButton.addClass(\"btn btn-flat waves-effect waves-green upvote\");\n upButton.html(\"<i class='material-icons'>thumb_up</i>\");\n // create downvote button\n var downButton = $(\"<a>\");\n downButton.attr(\"data-deezer\", playlistArr[i][1].deezerID);\n downButton.addClass(\"btn btn-flat waves-effect waves-red downvote\");\n downButton.html(\"<i class='material-icons'>thumb_down</i>\");\n\n thumbsDiv.append(upButton);\n thumbsDiv.append(downButton);\n\n nameContainer.append(songNameP, artistNameP);\n queuedTrack.append(thumbnailImg);\n queuedTrack.append(nameContainer);\n queuedTrack.append(thumbsDiv);\n // append song to playlist container on page\n $(\".queued-track-container\").append(queuedTrack);\n }\n // set up to push array that holds all songs\n if (totalSongPlaylist.length !== 0) {\n var existing = false;\n for (var v = 0; v < totalSongPlaylist.length; v++) {\n if (playlistArr[i][1].deezerID == totalSongPlaylist[v][1].deezerID) {\n existing = true;\n }\n }\n if (!existing) {\n totalSongPlaylist.push(playlistArr[i]);\n }\n }\n else {\n totalSongPlaylist.push(playlistArr[i]);\n }\n }\n });\n // update top songs chart\n listRankings()\n}", "function calcTotalAutoUpgradePower() {\n let cheeseAutoHarvested =\n\n autoUpgrades['jackhammer'].quantity * autoUpgrades['jackhammer'].harvest\n\n +\n\n autoUpgrades['wheelbarrow'].quantity * autoUpgrades['wheelbarrow'].harvest;\n\n //console.log(`The amount of cheese auto harvested at the last 3 sec interval was ${cheeseAutoHarvested}`);\n\n player.currentCheeseBricks += cheeseAutoHarvested;\n players[0].currentCheeseBricks = player.currentCheeseBricks;\n //console.log(player.cheeseBricks);\n\n //console.log(`The total number of cheeseBricks in calcTotalAutoUpgradePower is ${player.cheeseBricks}`);\n\n document.getElementById('input-tc').value = player.currentCheeseBricks;\n\n turnButtonsOnOff();\n savePlayer();\n\n\n}", "function handleTick(event) {\n if (!event.paused) {\n // Actions carried out when the Ticker is not paused.\n }\n // Actions carried out each tick (aka frame)\n currentTime = Math.round(createjs.Ticker.getTime() / 1000);\n drDrew.curTime = currentTime;\n // console.log(currentTime);\n var timeNode = document.getElementById('timeSpot');\n while (timeNode.hasChildNodes()) {\n timeNode.removeChild(timeNode.childNodes[0]);\n }\n var timeText = document.createTextNode(\"Play time (s): \" + currentTime);\n var shapesPlayed = document.createTextNode(\"Shapes Played: \" + addedPlatforms + \"/\" + platformLimit);\n var score = document.createTextNode(\"Score: \" + sessionStorage.getItem('score'));\n drDrew.score = sessionStorage.getItem('score'); //keep current score inside of drDrew\n console.log(\"drDrew.score: \" + drDrew.score);\n timeNode.appendChild(timeText);\n timeNode.appendChild(document.createElement('br'));\n timeNode.appendChild(shapesPlayed);\n timeNode.appendChild(document.createElement('br'));\n timeNode.appendChild(score);\n // canvas.appendChild(document.createTextNode(currentTime));\n drDrew.tick();\n enemy.tick(drDrew);\n drDrew.collision(enemy);\n drDrew.collision(token);\n if (drDrew.addPlat) {\n console.log(\"ADD ONE YO\");\n addedPlatforms++;\n if (addedPlatforms <= platformLimit) {\n platforms.push(new platformCreate(drDrew.x, drDrew.y + 20));\n stage.addChild(platforms[platforms.length - 1]);\n drDrew.addPlat = false;\n } else {\n drDrew.addPlat = false;\n addedPlatforms = platformLimit\n }\n\n }\n // for(var i = 0; i < platforms.length; i++){\n // drDrew.collision(platforms[i]);\n // }\n\n stage.update();\n}", "completeRound(winner) {\n var setJudge = true;\n const playerInfo = this.state.playerInfo;\n for(var i = 0; i < playerInfo.length; i++) {\n if(playerInfo[i].name === winner) {\n playerInfo[i].score++;\n }\n if(playerInfo[i].isJudge && setJudge) {\n playerInfo[i].isJudge = false;\n if(i < playerInfo.length - 1) {\n playerInfo[i + 1].isJudge = true;\n } else {\n playerInfo[0].isJudge = true;\n }\n setJudge = false\n }\n }\n }", "updateScore() {\n if(Dashboard.candyMachted.length) {\n this.score += 1;\n this.levelUp();\n this.scoreUpdateView();\n Dashboard.candyMachted.pop();\n }\n }", "function clickSubmit(){\r\n\tresult.classList.remove(\"hide\");\r\n\tdocument.getElementById(\"quiz\").classList.add(\"hide\");\r\n\tdocument.getElementById(\"restart\").classList.remove(\"hide\");\r\n\tansMessage.innerHTML=\"\";\r\n\tbody.style.backgroundImage='url(\"https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/andromeda-galaxy-royalty-free-image-1585682435.jpg\")';\r\n\tbody.style.backgroundSize='cover';\r\n\r\n\tscoreContainer.classList.remove(\"hide\");\r\n\tfor(var i=0;i<10;i++){\r\n\t\tabc=shuffledQues[i];\r\n\t\tfinalScore+=abc.scores;\r\n\t}\r\n\r\n\tresult.innerHTML=\"Name: \"+username.value+\"<br> Your score is \"+finalScore+\"/10 <br> Correct Percentage:\"+finalScore*10+\"% <br> Number of correct questions= \"+finalScore;\r\n\tsubmit.disabled=true;\r\n\tnext.disabled=true;\r\n\tprev.disabled=true;\r\n\tvar today= new Date();\r\n\ttodaydate = today.getDate()+'-'+(today.getMonth()+1)+'-'+today.getFullYear();\r\n\ttodaytime = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\r\n\t\r\n\tvar scores = JSON.parse(localStorage.getItem(\"detailstored\"));\r\n\tconsole.log(JSON.parse(localStorage.getItem(\"detailstored\")));\r\n\tupdate();\r\n\tfunction update(){\r\n\r\n\t\tif(scores==null){\r\n\t\t\tvar details={\r\n\t\t\t\tname:username.value,\r\n\t\t\t\tscore:finalScore,\r\n\t\t\t\tdate:todaydate,\r\n\t\t\t\ttime:todaytime\r\n\t\t\t};\r\n\r\n\t\t\tlocalStorage.setItem(\"detailstored\", JSON.stringify(details));\r\n\t\t\tscores = JSON.parse(localStorage.getItem(\"detailstored\"));\r\n\r\n\t\t\tdispName.innerHTML=\"Name: \"+scores.name;\r\n\t\t\tdispScore.innerHTML=\"Score: \"+scores.score+\"/10\";\r\n\t\t\tdispDate.innerHTML=\"Date: \"+scores.date;\r\n\t\t\tdispTime.innerHTML=\"Time: \"+scores.time;\r\n\r\n\t\t}\r\n\t\tif((finalScore>=scores.score)){\r\n\t\t\tvar details={\r\n\t\t\t\tname:username.value,\r\n\t\t\t\tscore:finalScore,\r\n\t\t\t\tdate:todaydate,\r\n\t\t\t\ttime:todaytime\r\n\t\t\t};\r\n\r\n\t\t\tlocalStorage.setItem(\"detailstored\", JSON.stringify(details));\r\n\t\t\tscores = JSON.parse(localStorage.getItem(\"detailstored\"));\r\n\r\n\t\t\tdispName.innerHTML=\"Name: \"+scores.name;\r\n\t\t\tdispScore.innerHTML=\"Score: \"+scores.score+\"/10\";\r\n\t\t\tdispDate.innerHTML=\"Date: \"+scores.date;\r\n\t\t\tdispTime.innerHTML=\"Time: \"+scores.time;\r\n\r\n\t\t}\r\n\r\n\t\tif((finalScore<scores.score)){\r\n\t\t\tdispName.innerHTML=\"Name: \"+scores.name;\r\n\t\t\tdispScore.innerHTML=\"Score: \"+scores.score+\"/10\";\r\n\t\t\tdispDate.innerHTML=\"Date: \"+scores.date;\r\n\t\t\tdispTime.innerHTML=\"Time: \"+scores.time;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n}", "funcAftertimeup() {\n const { wholequiz, attemptingQuizName, takingRemainingquiz, quizCompleted, questionsAttempted, totalnumbers, quizNamebeforestartingquiz, quizToopenkey, userID } = this.state;\n if (wholequiz != null) {\n firebase.database().ref(\"quizes/\" + quizToopenkey + \"/\").on(\"value\", (s) => {\n var pqr = s.val();\n var ar = [];\n for (var key in pqr) {\n ar.push(pqr[key])\n }\n var quizTotalquestions = ar.length - 3\n if (takingRemainingquiz == false) {\n var mnop = wholequiz.length - 3;\n }\n else if (takingRemainingquiz == true) {\n var mnop = wholequiz.length\n }\n this.setState({\n minutes: '',\n seconds: '00',\n quizCompleted: true\n }, () => {\n\n var totalNum = quizTotalquestions;\n var numbersgot = totalnumbers;\n var percentage = numbersgot / totalNum * 100;\n var result = '';\n if (percentage >= 70) {\n var result = 'passed';\n }\n else {\n var result = 'fail'\n }\n var date = new Date().toDateString();\n var attemptedOn = date;\n if (attemptingQuizName == '') {\n var obj = {\n attemptedquizname: quizNamebeforestartingquiz,\n result,\n attemptedOn,\n percentage,\n quizCompleted\n }\n }\n else if (attemptingQuizName != '') {\n console.log(\"attemptingQuizName\", attemptingQuizName)\n var obj = {\n attemptedquizname: attemptingQuizName,\n result,\n attemptedOn,\n percentage,\n quizCompleted\n }\n }\n\n firebase.database().ref(\"users/\" + userID + \"/Attemptedquizes/\" + quizToopenkey + \"/\").update(obj).then((snapshot) => {\n // var keyforattemptedquiz = snapshot.key;\n // var keyobj = {\n // key: keyforattemptedquiz\n // }\n // firebase.database().ref(\"users/\" + userID + \"/Attemptedquizes/\" + quizToopenkey + \"/\").update(keyobj);\n this.setState({\n showResult: true\n }, () => {\n firebase.database().ref(\"users/\" + userID + \"/Attemptedquizes/\" + quizToopenkey + \"/\").on(\"value\", (snapshottwo) => {\n var data = snapshottwo.val();\n console.log(\"QUIZ SHOW KARNAY K LIYE SNAPSHOT DOT VAL\", data);\n this.setState({\n quizresultdate: data.attemptedOn,\n quizresultname: data.attemptedquizname,\n quizresultpassorfail: data.result,\n quizresultpercentage: data.percentage,\n takequizcondition: false\n })\n })\n })\n }).catch((e) => {\n console.log(\"Sorry Quiz RESULT COULD NOT BE SAVED!\")\n })\n\n })\n // var obj = {\n // totalnumbers,\n\n // }\n // firebase.database().ref(\"users/\" + userID + \"/\" + \"Attemptedquizes/\")\n // var totalNum = wholequiz.length;\n // var numbersgot = totalnumbers\n // var percentage = numbersgot / totalNum * 100;\n // console.log(\"percentage\", percentage)\n })\n }\n\n }", "function duckUpdate () {\n element[\"totalEggs\"].innerHTML = \"Total eggs: \" + gameData.eggs + \"/\" + gameData.storage;\n element[\"totalCash\"].innerHTML = \"Cash: £\" + gameData.cash.toFixed(2);\n element[\"totalEggsProg\"].value = 100 * (gameData.eggs/gameData.storage);\n element[\"eggPrice\"].innerHTML = \"Price per egg: £\" + gameData.cost.toFixed(2);\n \n \n element[\"sellEggs\"].innerHTML = \"Sell Eggs (£\" + (gameData.eggs * gameData.cost).toFixed(2) + \")\";\n element[\"sellEggsl\"].innerHTML = \"Total eggs sold: \" + gameData.eggsSold; \n element[\"eggCounter\"].innerHTML = gameData.eggsSold.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\"); \n \n element[\"eggCollector\"].innerHTML = \"Egg Collector (£\" + gameData.eggcollectorCost.toFixed(2)+ \") (\" + gameData.eggcollectorNum + \")\";\n element[\"eggCollectorl\"].innerHTML = \"Eggs collected per second: \" + (gameData.eggcollectorNum + gameData.roboteggcollectorNum * 5);\n \n element[\"eggRobotCollector\"].innerHTML = \"Robot Collector (£\" + gameData.roboteggcollectorCost.toFixed(2)+ \") (\" + gameData.roboteggcollectorNum + \")\";\n \n element[\"eggClickers\"].innerHTML = \"Eggs per click (£\" + gameData.click_increment_cost.toFixed(2) + \") (\" + gameData.click_increment + \")\";\n element[\"eggClickersl\"].innerHTML = \"Eggs per click: \"+ gameData.click_increment; \n \n element[\"upgradeEgg\"].innerHTML = \"Improve Egg Value (£\" + gameData.cost_increase_cost.toFixed(2) + \")\";\n\n element[\"lifetimeCash\"].innerHTML = \"Lifetime cash: £\" + gameData.lifetimeCash.toFixed(2); \n \n duckstoragebUpdate();\n buttonUpdate();\n unlockUpdate();\n}", "updateMatchup(result) {\n // Get the current matchup\n let matchup = this.state.matchup;\n\n // Give a point to the winner, or 0.5 to both if a draw (x10 to prevent rounding error)\n if (result < 2) data.items[this.matchups[matchup][result]].points += 10;\n else {\n data.items[this.matchups[matchup][0]].points += 5;\n data.items[this.matchups[matchup][1]].points += 5;\n }\n\n // If this was the last matchup, move to the next page, otherwise increment\n if (matchup === this.numMatchups - 1) this.props.nextPage();\n else {\n this.setState({\n matchup: matchup + 1,\n });\n }\n }", "function updateUserProgress() {\n // Every 50 droppedShapes is around 20 cleared rows, level up first around\n // 35, but slightly increaase the number of shapes dropped every level.\n var baseNumOfShapes = 30;\n var shapesPerLevel = 3;\n var delayIncrementFraction = 8;\n var updateLevel = Math.ceil(totalShapesDropped / (baseNumOfShapes + shapesPerLevel * level));\n if (level < updateLevel) {\n // Level up!\n level += 1;\n // Level 1 = .5sec, Level 2 = .437sec, Level 3 = .382sec, ...\n // Level 5 = .293sec ... Level 10 = .15sec\n delay = delay - delay / delayIncrementFraction;\n logger.log(\"Level:\" + level + \" Total shapes:\" + totalShapesDropped + \" Delay:\" + delay + \" sec.\");\n levelAlert(level);\n }\n // Update the scoreboard\n document.getElementById(\"score\").innerHTML = score;\n document.getElementById(\"level\").innerHTML = level;\n }", "function updateBlockedShots()\n{\n\tvar totalBlockShots = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.blockedShots += 1;\n\n\t\t//Step 1: Update total attempts\n\t\tupdateGoalAttempts();\n\n\t\t//Step 2: Update shots on goal\n\t\ttotalBlockShots = T1.blockedShots + T2.blockedShots;\n\n\t\tvar t1_bar = Math.floor((T1.blockedShots / totalBlockShots) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-block-shot-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-block-shot-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-block-shot-name\")[0].innerHTML = \"<b>Blocked Shots: \" + T1.blockedShots + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.blockedShots += 1;\n\n\t\t//Step 1: Update total attempts\n\t\tupdateGoalAttempts();\n\t\n\t\t//Step 2: Update shots on goal\n\t\ttotalBlockShots = T1.blockedShots + T2.blockedShots;\n\n\t\tvar t2_bar = Math.floor((T2.blockedShots / totalBlockShots) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-block-shot-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-block-shot-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-block-shot-name\")[0].innerHTML = \"<b>Blocked Shots: \" + T2.blockedShots + \"</b>\";\n\t}\n}", "function gryffindor() {\n gryffindorScore += 1;\n questionCount += 1;\n if (questionCount >= 3) {\n updateResult();\n }\n}", "function renderSubmission() {\n\n hideElement(quizIntro);\n hideElement(quizBody);\n showElement(quizSubmit);\n\n // To give the player a bonus for completing the quiz quickly, we add 10 points per correct answer (less negative 10 points for wrong answers) and add the total to secondsLeft\n var thisScore = userScore;\n finalScore.textContent = thisScore;\n\n // Also need to add the current player's initials to playerInitials array\n submitInitials.addEventListener(\"click\", function(event) {\n\n event.preventDefault();\n\n var initials = initialInput.value;\n\n // alert and return out of this function if player does not submit initials\n if (initials === \"\") {\n alert(\"You must submit your initials. Use an alias if needed!\")\n return;\n }\n\n // once player submits initials, also push those into the playerInitials array\n playerInitials.push(initials);\n // also push thisScore so that arrays are populated at same time\n playerScores.push(thisScore);\n\n // Call function to retrieve this + all other player data before rendering to the high scores page\n storeSubmission();\n });\n}", "async function SubmitScore(userName) {\n // get base point in firebase\n var entries = database.ref(\"/entries/\");\n\n // set up a new entry\n var newEntry = entries.push();\n \n // Assign values to new entry\n await newEntry.set({\n name: userName,\n score: Number(sessionStorage.getItem(\"strokes\"))\n });\n\n sessionStorage.removeItem(\"strokes\");\n}", "async playCards(playerOne, playerTwo) {\n // Getters\n const playerOneScoreUl = document.querySelector('.player-one-score');\n const playerTwoScoreUl = document.querySelector('.player-two-score');\n const compareScoresUl = document.querySelector('.score-list');\n let playerOneTotalScore = document.querySelector('#player-one-total-score');\n let playerTwoTotalScore = document.querySelector('#player-two-total-score');\n let winner = document.querySelector('#winner');\n \n // Loop over each hand to determine score\n for(let i = 0; i < this.players[0].hand.length; i++) {\n let playerOneCard = playerOne.hand[i];\n let playerTwoCard = playerTwo.hand[i];\n\n this.printCardPlayerOne(playerOneScoreUl, playerOneCard);\n this.printCardPlayerTwo(playerTwoScoreUl, playerTwoCard);\n\n if (playerOneCard.value > playerTwoCard.value) {\n this.printScore(`${playerOne.name} wins!`, compareScoresUl);\n playerOne.score++;\n } else if (playerOneCard.value < playerTwoCard.value) {\n this.printScore(`${playerTwo.name} wins!`, compareScoresUl);\n playerTwo.score++;\n } else if (playerOneCard.value === playerTwoCard.value) {\n this.printScore(`Its a draw! No points awarded.`, compareScoresUl);\n }\n\n playerOneTotalScore.innerHTML = `Score: ${playerOne.score}`;\n playerTwoTotalScore.innerHTML = `Score: ${playerTwo.score}`;\n await this.timer(600);\n }\n\n //Checks for final winner.\n if (playerOne.score > playerTwo.score) {\n winner.innerHTML = `${playerOne.name} Wins!!!`;\n } else if (playerOne.score < playerTwo.score) {\n winner.innerHTML = `${playerTwo.name} Wins!!!`;\n } else if (playerOne.score === playerTwo.score) {\n winner.innerHTML = `Its a Draw!!! Nobody wins in war.`;\n }\n\n //Updates start button to reload button\n document.querySelector('#startbutton').setAttribute('onclick', 'location.reload();');\n document.querySelector('#startbutton').disabled = false;\n document.querySelector('#startbutton').innerHTML = 'Play Again?';\n }", "function update_round_and_score(round, score) {\n var round_text = document.querySelector(\"#round\");\n var score_text = document.querySelector(\"#score\");\n round_text.innerHTML = round;\n score_text.innerHTML = score;\n}", "handleJoinTeam(data) {\n if (data.team === \"red\") {\n this.teams[data.playerName] = \"red\";\n this.redNum += 1;\n this.redTurnOrder.push(data.playerName);\n super.updatePlayerScore(data.playerName, \"Red\");\n }\n if (data.team === \"blue\") {\n this.teams[data.playerName] = \"blue\";\n this.blueNum += 1;\n this.blueTurnOrder.push(data.playerName);\n super.updatePlayerScore(data.playerName, \"Blue\");\n }\n if (data.team === \"any\") {\n if (this.redNum > this.blueNum) {\n this.teams[data.playerName] = \"blue\";\n this.blueNum += 1;\n this.blueTurnOrder.push(data.playerName);\n super.updatePlayerScore(data.playerName, \"Blue\");\n } else {\n this.teams[data.playerName] = \"red\";\n this.redNum += 1;\n this.redTurnOrder.push(data.playerName);\n super.updatePlayerScore(data.playerName, \"Red\");\n }\n }\n\n //Determine if the game is in state 4, and this player will be waiting on the other teams action.\n let wait = false;\n if (this.gameState === 4) {\n if (\n this.teams[data.playerName] === \"red\" &&\n this.redGuessHistory.length > this.currentRound\n ) {\n //Red team already guessed, they will be waiting.\n wait = true;\n }\n if (\n this.teams[data.playerName] === \"blue\" &&\n this.blueGuessHistory.length > this.currentRound\n ) {\n //Blue team already guessed, they will be waiting.\n wait = true;\n }\n }\n\n\n //Transmit all data for game state\n if (this.teams[data.playerName] === \"red\") {\n super.sendDataToPlayer(data.playerName, {\n event: \"team-info\",\n team: \"red\",\n selections: this.redSel,\n wordList: this.redWords,\n gameState: this.gameState,\n redHints: this.redHints[this.currentRound],\n blueHints: this.blueHints[this.currentRound],\n guesses: [\n this.redGuessHistory[this.currentRound],\n this.blueGuessHistory[this.currentRound],\n ],\n currentRound: this.currentRound,\n redScore: this.redScore,\n blueScore: this.blueScore,\n redHistory: this.redHistory,\n blueHistory: this.blueHistory,\n wait: wait,\n });\n }\n if (this.teams[data.playerName] === \"blue\") {\n super.sendDataToPlayer(data.playerName, {\n event: \"team-info\",\n team: \"blue\",\n selections: this.blueSel,\n wordList: this.blueWords,\n gameState: this.gameState,\n redHints: this.redHints[this.currentRound],\n blueHints: this.blueHints[this.currentRound],\n guesses: [\n this.redGuessHistory[this.currentRound],\n this.blueGuessHistory[this.currentRound],\n ],\n currentRound: this.currentRound,\n redScore: this.redScore,\n blueScore: this.blueScore,\n redHistory: this.redHistory,\n blueHistory: this.blueHistory,\n wait: wait,\n });\n }\n\n //Check if teams now have enough players to start the game, and that the game hasn't started. If this is the case, send the allow start event.\n if (this.redNum > 1 && this.blueNum > 1 && this.gameState === 0) {\n super.sendGameData({ event: \"allow-start\" });\n }\n }", "function CheckForWinners(p) \n{\n $(\".player0\").children(\".playingcard-backside\").toggleClass(\"playingcard-backside\");\n $(\".player0\").children(\".score\").text(CalculateTotal(allplayers.dealer));\n while (CalculateTotal(p[0]) < 18) {\n game.server.newCard(group, 0, 1);\n $(\".player0\").children(\".score\").text(CalculateTotal(allplayers.dealer));\n }\n var dealerToBeat = CalculateTotal(p[0]);\n for (var i = 1; i < p.length; i++) {\n var currP = \".player\" + i;\n if (p[i] != null) {\n // Make the bet go where it's supposed to go\n if (!p[i].totallyBust && (CalculateTotal(p[i]) > dealerToBeat)) {\n p[i].points += (2 * p[i].bet);\n $(currP).children(\".message\").text(\"Úps, þú sprakkst!\");\n \n }\n else if (!p[i].totallyBust && (CalculateTotal(p[i]) == dealerToBeat)) {\n p[i].points += p[i].bet;\n }\n // Reset the variables\n p[i].bet = 0;\n $(currP).children(\".message\").show();\n //p[i].hitMe = true;\n // TO DO: Update user points in database\n }\n }\n}", "function scrobbleTrack() {\n // stats\n chrome.runtime.sendMessage({type: 'trackStats', text: 'The sixtyone song scrobbled'});\n \n // scrobble\n chrome.runtime.sendMessage({type: 'submit'});\n}", "function savePlayerTurn() {\n if (listPlayers.length > 0) {\n let playerResultText = document.getElementById(\"listOfButtons\");\n let inputs = [];\n let divs = playerResultText.childNodes;\n divs.forEach((div) => {\n if (div.localName === \"div\") {\n inputs = inputs.concat(...div.childNodes);\n }\n });\n let lastDarts = {},\n numberDarts = 0;\n inputs.forEach((input, index) => {\n if (input.checked === true) {\n numberDarts += 1;\n lastDarts[input.name] = 1;\n }\n });\n if (numberDarts > 3) {\n alert(2);\n } else {\n alert(-2);\n lastDarts = procesLastDarts(lastDarts);\n // modifier le score du joueur et fermé les scores complets\n\n //compute new score and update the plaer which just payed\n changePlayerScore(lastDarts);\n rebuilt_list_player();\n }\n } else {\n alert(1);\n }\n nextTurn();\n}", "function scoreKeeper() {\n\t\t$('#total-score').text(userTotal);\n\t\t\tif (userTotal == computerChoice){\n\t\t\t\twins++;\n\t\t\t\t$('#win-counter').text('Wins: ' + wins);\n\t\t\t\treset();\n\t\t\t}\n\t\t\telse if(userTotal > computerChoice){\n\t\t\t\tlosses++;\n\t\t\t\t$('#loss-counter').text('Losses: ' + losses);\n\t\t\t\treset();\n\t\t\t}\n\t}", "function allRounds() {\n\tgameInstance();\n\tgameInstance();\n\tgameInstance();\n\tgameInstance();\n\tgameInstance();\n\n\tdisplayScores(userPoints, computerPoints); \n\n\t// Reset the points, so all we have to do is call 'allRounds' again to play a new\n\tuserPoints = 0;\n\tcomputerPoints = 0;\n}", "addAndUpdate(){\n if(this.state.score > 0){\n _storeData(this.state.score);\n }\n updateData(); \n }", "componentDidUpdate() {\r\n const { username, totalPoints, goalPoints } = this.state;\r\n\r\n // Maximum goal points reached - update total points and goal points\r\n if (goalPoints >= MAX_POINTS) {\r\n Alert.alert(\"Goal reached! 200 bonus points obtained\");\r\n\r\n // Give bonus points (both state variable and database)\r\n this.db.transaction(tx => {\r\n tx.executeSql(\r\n `UPDATE Users SET TotalPoints = TotalPoints + ${BONUS_POINTS} WHERE Username = '${username}';`, \r\n [],\r\n (tx, results) => { },\r\n (tx, error) => { console.log(error) }\r\n )});\r\n this.setState({ totalPoints: totalPoints + BONUS_POINTS });\r\n\r\n // Reset goal points to 0 (both state variable and database)\r\n this.db.transaction(tx => {\r\n tx.executeSql(\r\n `UPDATE Users SET GoalPoints = 0 WHERE Username = '${username}';`, [],\r\n (tx, results) => { },\r\n (tx, error) => { console.log(error) }\r\n )});\r\n this.setState({ goalPoints: 0 });\r\n }\r\n }", "function wrapup_trial(){\n\t var score = getValue('scale_value');\n\t var endTime = (new Date()).getTime();\n\t var response_time = endTime - startTime;\n\n\t // kill any remaining setTimeout handlers\n\t for (var i = 0; i < setTimeoutHandlers.length; i++) {\n\t clearTimeout(setTimeoutHandlers[i]);\n\t }\n\n\t console.log(score);\n\t jsPsych.data.write($.extend({}, {\n\t \"attr_score\": score,\n\t \"rt\": response_time,\n\t \"stimulus\": JSON.stringify([trial.a_path]),\n\t \"type\": trial.trial_num,\n\t \"set\": trial.set_num\n\t }, trial.data));\n\t // goto next trial in block\n\t display_element.html('');\n\t if (trial.timing_post_trial > 0) {\n\t setTimeout(function() {\n\t jsPsych.finishTrial();\n\t }, trial.timing_post_trial);\n\t\t } else {\n\t jsPsych.finishTrial();\n\t }\n \n\t }", "function scoreBucket(){\n $(\"#correctAnswers\").text(rightAnswers);\n $(\"#incorrectAnswers\").text(wrongAnswers);\n $(\"#unanswered\").text(unAnswered);\n console.log(\"score bucket is working\");\n }" ]
[ "0.60268193", "0.59536546", "0.5922168", "0.5896906", "0.56913334", "0.5687822", "0.56279933", "0.5603824", "0.5603136", "0.5560007", "0.55497855", "0.55475426", "0.5542796", "0.5521779", "0.55152464", "0.55133986", "0.55011845", "0.5479374", "0.54712886", "0.5469829", "0.5459849", "0.54459125", "0.5444227", "0.54369503", "0.54258", "0.542117", "0.54116863", "0.54028165", "0.5392635", "0.5367324", "0.53648543", "0.5364135", "0.536179", "0.5359705", "0.53507066", "0.5348235", "0.5344484", "0.53335", "0.53311366", "0.5327848", "0.53156704", "0.5312788", "0.53102326", "0.53086233", "0.53047067", "0.530247", "0.53004855", "0.5297932", "0.52902013", "0.52880436", "0.52836174", "0.52814597", "0.5271266", "0.52680045", "0.5266032", "0.5256757", "0.5254782", "0.52534795", "0.5251049", "0.52481776", "0.52479947", "0.5242012", "0.5241769", "0.5234873", "0.5230055", "0.52259713", "0.5222168", "0.52218384", "0.52147025", "0.5213226", "0.5206821", "0.52066284", "0.52035815", "0.51995516", "0.51994824", "0.51989084", "0.51982343", "0.5196159", "0.51960164", "0.519199", "0.5190607", "0.5185351", "0.5183541", "0.5181387", "0.5179966", "0.5179656", "0.5175812", "0.51716655", "0.51715326", "0.51669943", "0.516311", "0.5161741", "0.5161411", "0.515679", "0.515407", "0.51536226", "0.5152154", "0.51506394", "0.5146892", "0.5140333" ]
0.6856156
0
function remove "?embed=true" parameter from url
function urlWithoutEmbed() { if (window.location.href.includes("?embed=true&")) { return window.location.href.replace("embed=true&", ""); } else if (window.location.href.includes("?embed=true")) { return window.location.href.replace("?embed=true", ""); } if (window.location.href.includes("&embed=true")) { return window.location.href.replace("&embed=true", ""); } return window.location.href }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maskQueryStringInURL(url) {\n url = url || '';\n return url.replace(/\\?.*?$/, '');\n}", "removeQuery(url) {\n return url ? url.replace(/\\?.*$/, '') : '';\n }", "removeParamFromURL(event) {\n if (this.props.showArticleFinder) { return; }\n const viewer = document.getElementsByClassName('article-viewer')[0];\n if (!viewer || event) {\n if (window.location.search) {\n window.history.replaceState(null, null, window.location.pathname);\n }\n }\n }", "function removeVideoSuffix(video_url) {\n\tvar position = video_url.indexOf('&');\n\tif (position == -1) {\n\t\treturn video_url;\n\t\t}\n\telse {\n\t\tvar video2 = video_url.substring(0, video_url.length-(video_url.length-position));\n\t\treturn video2;\n\t\t}\n\t}", "function remove_query_arg(key, sourceURL) {\r\n\r\n var rtn = sourceURL.split(\"?\")[0],\r\n param,\r\n params_arr = [],\r\n queryString = (sourceURL.indexOf(\"?\") !== -1) ? sourceURL.split(\"?\")[1] : \"\";\r\n\r\n if (queryString !== \"\") {\r\n params_arr = queryString.split(\"&\");\r\n for (var i = params_arr.length - 1; i >= 0; i -= 1) {\r\n param = params_arr[i].split(\"=\")[0];\r\n if (param === key) {\r\n params_arr.splice(i, 1);\r\n }\r\n }\r\n\r\n rtn = rtn + \"?\" + params_arr.join(\"&\");\r\n\r\n }\r\n\r\n if (rtn.split(\"?\")[1] == \"\") {\r\n rtn = rtn.split(\"?\")[0];\r\n }\r\n\r\n return rtn;\r\n }", "function removeQS(url, parameter) {\n //prefer to use l.search if you have a location/link object\n var urlparts = url.split('?'); \n if (urlparts.length >= 2) {\n\n var prefix = encodeURIComponent(parameter)+'=';\n var pars = urlparts[1].split(/[&;]/g);\n //reverse iteration as may be destructive\n for (var i = pars.length; i-- > 0;) { \n //idiom for string.startsWith\n if (pars[i].lastIndexOf(prefix, 0) !== -1) { \n pars.splice(i, 1);\n }\n }\n url = urlparts[0]+'?'+pars.join('&');\n return url;\n } else {\n return url;\n }\n}", "function media_embed(url) {\n if(!url) return null\n\n if(url.indexOf('youtu.be/') > -1) {\n return 'https://www.youtube.com/embed/' + url.split('youtu.be/')[1].split('?')[0]\n } else if (url.indexOf('youtube.com/watch') > -1) {\n return 'https://www.youtube.com/embed/' + url.split('v=')[1].split('&')[0]\n }else if (url.indexOf('vimeo.com/') > -1) {\n return 'https://player.vimeo.com/video/' + url.split('vimeo.com/')[1].split('?')[0]\n }else if (url.indexOf('wistia.com/medias/') > -1) {\n return 'https://fast.wistia.net/embed/iframe/' + url.split('wistia.com/medias/')[1].split('?')[0]\n }else {\n return null\n }\n}", "function noSWParam(url) {\n const url2 = new URL(url);\n if (url2.searchParams.has(CACHE_SEARCH_PARAM)) {\n url2.searchParams.delete(CACHE_SEARCH_PARAM);\n return url2.href;\n }\n return url;\n}", "function pff_removeURLParams( urlTmp ){\n\tvar firstQuesMark = urlTmp.indexOf('?');\n\t// On essai de retirer tous les param�tres URL \n\tif(firstQuesMark != -1){\n var tmp = urlTmp.substring(0,firstQuesMark );\n return tmp;\n\t}\n\treturn urlTmp;\n}", "function get_orig_url(url)\n {\n return url.replace(/(?:re|edit)announce/, \"dispbbs\").replace(/reply.*?&/g, \"\")\n .replace(/&bm=/, \"#\");\n }", "function checkEmdeded(url) {\n\t\t// Detect domain\n\t\tvar domain = url.split('/')[2] || url.split('/')[0];\n\n\t\tswitch(domain) {\n\t\t\tcase \"www.youtube.com\":\n\t\t\t\treturn url.replace(\"www.youtube.com\", \"www.youtube.com/embed\");\n\t\t\t\tbreak;\n\t\t\t/*case \"www.facebook.com\": // https://www.facebook.com/facebook profile\n\t\t\t\treturn \"https://www.facebook.com/plugins/page.php?href=\" + encodeURIComponent(url) + \"&tabs=timeline&adapt_container_width=true&hide_cover=false&width=1600\";\n\t\t\t\tbreak;*/\n\t\t\tdefault:\n\t\t\t\t// !TODO! Link should be starts with preview.php ... (not quickparseapi.appspot.com)\n\t\t\t\treturn \"https://quickparseapi.appspot.com/?url=\" + url;\n\t\t}\n\t}", "function removeParam(key, sourceURL) {\n let rtn = sourceURL.split(\"?\")[0],\n param,\n params_arr = [],\n queryString = (sourceURL.indexOf(\"?\") !== -1) ? sourceURL.split(\"?\")[1] : \"\";\n if (queryString !== \"\") {\n params_arr = queryString.split(\"&\");\n for (var i = params_arr.length - 1; i >= 0; i -= 1) {\n param = params_arr[i].split(\"=\")[0];\n if (param === key) {\n params_arr.splice(i, 1);\n }\n }\n rtn = rtn + \"?\" + params_arr.join(\"&\");\n }\n return rtn;\n}", "function remove_param(name) {\n var params = get_params();\n var index = params.search('&' + name + '=');\n if (index === -1) {\n return;\n }\n var start = index + ('&' + name + '=').length;\n var end_index = params.substr(start).search('&');\n if (end_index < 0) {\n params = params.substr(0, index);\n } else {\n params = params.substr(0, index) + params.substr(start + end_index);\n }\n set_cookie('params', params);\n}", "function urlFix(url){\r\n var _url = url;\r\n\r\n //delete params\r\n _url = url.replace(delParamReg, '');\r\n\r\n //overwrite and add params\r\n _url = _url.replace(overwriteParamReg, '').replace(/&$/, '');\r\n _url += '&' + addParams.join('&') + '&urlfixed=1';\r\n\r\n return _url;\r\n}", "function removeURLParameter(url, parameter) { //prefer to use l.search if you have a location/link object\n var urlparts = url.split('?');\n if (urlparts.length >= 2) {\n\n var prefix = encodeURIComponent(parameter) + '=';\n var pars = urlparts[1].split(/[&;]/g);\n\n //reverse iteration as may be destructive\n for (var i = pars.length; i-- > 0; ) {\n //idiom for string.startsWith\n if (pars[i].lastIndexOf(prefix, 0) !== -1) {\n pars.splice(i, 1);\n }\n }\n url = urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : \"\");\n return url;\n } else {\n return url;\n }\n}", "function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '')\n return url.href.replace(/\\?($|#)/, '$1')\n }", "function buildUrl(params, embedParams) {\n var query = {};\n\n if (params.measures.length > 0) {\n query.measure = _.first(params.measures);\n }\n _.each(['groups', 'series', 'rows', 'columns'], function(axis) {\n if (params[axis].length > 0) {\n query[axis] = params[axis];\n }\n });\n query.filters = _.cloneDeep(params.filters);\n if (_.isArray(params.drilldown)) {\n _.each(params.drilldown, function(item) {\n // When drilldown - replace filters for all drilldown\n // dimensions: they cannot be selected by user, but ensure\n // that there are no any garbage\n query.filters[item.dimension] = [item.filter];\n });\n }\n\n if (params.orderBy.key) {\n query.order = params.orderBy.key + '|' + params.orderBy.direction;\n }\n if ((params.visualizations.length > 0) && !embedParams) {\n query.visualizations = params.visualizations;\n }\n\n var path = '/' + params.packageId;\n if (embedParams) {\n path = '/embed/' + embedParams.visualization + path;\n if (embedParams.base) {\n var base = embedParams.base;\n if (base.substr(0, 1) != '/') {\n base = '/' + base;\n }\n if (base.substr(-1, 1) == '/') {\n base = base.substr(0, base.length - 1);\n }\n path = base + path;\n }\n }\n\n query = encodeUrlValues(query);\n\n if (!!params.lang) {\n query.lang = params.lang;\n }\n if (!!params.theme) {\n query.theme = params.theme;\n }\n\n embedParams = embedParams || {}; // to simplify next lines\n\n return url.format({\n protocol: embedParams.protocol,\n hostname: embedParams.host,\n port: embedParams.port,\n pathname: path,\n search: qs.stringify(query, {\n arrayFormat: 'brackets',\n encode: false\n })\n });\n}", "function removeParam() {\n window.history.pushState({}, document.title, \"/trade\");\n }", "function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '')\n return url.href.replace(/\\?($|#)/, '$1')\n}", "function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '')\n return url.href.replace(/\\?($|#)/, '$1')\n}", "function podPress_get_OrigURL(strPlayerDiv) {\t\r\n\t\tvar realurl = document.getElementById('podPressPlayerSpace_' + strPlayerDiv + '_OrigURL').value;\r\n\t\tif ( typeof podPressPT == 'boolean' && podPressPT == true ) {\r\n\t\t\trealurl = realurl.replace(/^(https?:\\/\\/|http:\\/\\/)/, '');\r\n\t\t\trealurl = 'http://www.podtrac.com/pts/redirect.mp3/' + realurl;\r\n\t\t} else if ( typeof podPressBK == 'string' && podPressBK != '' ) {\r\n\t\t\trealurl = realurl.replace(/^http:\\/\\//, '');\r\n\t\t\trealurl = 'http://media.blubrry.com/' + podPressBK + '/'+ realurl;\r\n\t\t}\r\n\t\treturn realurl;\r\n\t}", "function stripInternalParams(url) {\n url.search = url.search.replace(/([?&])(_pjax|_)=[^&]*/g, '').replace(/^&/, '');\n return url.href.replace(/\\?($|#)/, '$1');\n }", "getVideoID(){\n return location.href.split('/').pop().replace('#','');\n }", "function getYouTubeVideoId () {\r\n\tvar regex = /(\\?|%3F|&|%26)v=[^\\?&#]*/gi;\r\n\tvar matches = document.URL.match(regex);\r\n\tif(matches == null) {\r\n\t\treturn null;\r\n\t}\r\n\tvar removeRegex = /(\\?|%3F|&|%26)v=/gi;\r\n\tvar vidId = matches[0].replace(removeRegex, \"\");\r\n\tif(vidId == null) {\r\n\t\treturn;\r\n\t}\r\n\treturn vidId;\r\n}", "function getNewUrl(filter,addSharp,url){\n var href=null;\n if(url!=undefined && url!=null)href=url;\n else href=window.location.href;\n var q_index=href.indexOf(\"?\");\n if(q_index>=0){\n\t var params = href.substr(q_index+1);\n\t params=clearSharp(params);\n\t\tvar reg = /([^&]*?)\\=([^&]*)/g;\n\t\tvar a_param = params.match(reg); \n\t\tvar str_param=\"\";\n\t\tvar isFirst=true;\n\t\tfor(var i=0;i<a_param.length;i++){\n\t\t var param=a_param[i].split(\"=\");\n\t\t if(!inArray(param[0],filter)){\n\t\t if(!isFirst)str_param+=\"&\";\n\t\t str_param+=param[0]+\"=\"+param[1];\n\t\t isFirst=false;\n\t\t }\n\t\t}\n\t\tvar href_load=null;\n\t\tif(str_param.isBlank()){\n\t\t\thref_load=href.substr(0,q_index);\n\t\t}else{\n\t\t\thref_load=href.substr(0,q_index+1)+str_param;\n\t\t}\n\t\t\n\t\tif(addSharp==undefined || addSharp==null || addSharp==true){\n\t\t\thref_load+=window.location.hash;\n\t\t}\n\t\treturn href_load;\n\t}else{\n\t return href;\n\t}\n}", "function removeQueryStringParm(parm, saveStateInd) {\r\n\r\n var parms = [];\r\n if (typeof parm === \"string\") {\r\n parms.push(parm);\r\n } else {\r\n parms = parm;\r\n }\r\n var qs = convertQueryStringToObj();\r\n $.each(parms, function(i, item) {\r\n delete qs[item];\r\n });\r\n \r\n var newqs = convertObjToQueryString(qs);\r\n if (saveStateInd) {\r\n var currURL = window.location.protocol + \"//\" + window.location.host + window.location.pathname + newqs;\r\n if (history.pushState) {\r\n history.pushState({}, \"ignored title\", currURL); \r\n }\r\n }\r\n\r\n return ;\r\n}", "function removeURLParameter(url, parameter) {\n\t //prefer to use l.search if you have a location/link object\n\t var urlparts= url.split('?'); \n\t if (urlparts.length>=2) {\n\n\t var prefix= encodeURIComponent(parameter)+'=';\n\t var pars= urlparts[1].split(/[&;]/g);\n\n\t //reverse iteration as may be destructive\n\t for (var i= pars.length; i-- > 0;) { \n\t //idiom for string.startsWith\n\t if (pars[i].lastIndexOf(prefix, 0) !== -1) { \n\t pars.splice(i, 1);\n\t }\n\t }\n\n\t url= urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : \"\");\n\t return url;\n\t } else {\n\t return url;\n\t }\n\t}", "function get_yt_embed(url) {\n var videoid = url.match(/(?:https?:\\/{2})?(?:w{3}\\.)?youtu(?:be)?\\.(?:com|be)(?:\\/watch\\?v=|\\/)([^\\s&]+)/);\n if(videoid != null) {\n return videoid[1];\n // return \"<iframe id=\\\"ytplayer\\\" type=\\\"text/html\\\" width=\\\"640\\\" height=\\\"390\\\" src=\\\"http://www.youtube.com/embed/\" + videoid[1] + \"?autoplay=1\\\" frameborder=\\\"0\\\"/>\";\n } else {\n return \"\";\n }\n}", "cleanVideoSource(input, type) {\n // ensure we are NOT local and do a sanity check\n if (type != \"local\" && typeof input === \"string\") {\n // strip off the ? modifier for youtube/vimeo so we can build ourselves\n var tmp = input.split(\"?\");\n var v = \"\";\n input = tmp[0];\n if (tmp.length == 2) {\n let tmp2 = tmp[1].split(\"&\"),\n args = tmp2[0].split(\"=\"),\n qry = Array.isArray(tmp2.shift())\n ? tmp2.shift().join(\"\")\n : tmp2.shift();\n if (args[0] == \"v\") {\n let q = qry !== undefined && qry !== \"\" ? \"?\" + qry : \"\";\n v = args[1] + q;\n }\n }\n // link to the vimeo video instead of the embed player address\n if (\n input.indexOf(\"player.vimeo.com\") == -1 &&\n input.indexOf(\"vimeo.com\") != -1\n ) {\n // normalize what the API will return since it is API based\n // and needs cleaned up for front-end\n if (input.indexOf(\"/videos/\") != -1) {\n input = input.replace(\"/videos/\", \"/\");\n }\n return input.replace(\"vimeo.com/\", \"player.vimeo.com/video/\");\n }\n // copy and paste from the URL\n else if (input.indexOf(\"youtube.com/watch\") != -1) {\n return input.replace(\"youtube.com/watch\", \"youtube.com/embed/\") + v;\n }\n // copy and paste from the URL\n else if (input.indexOf(\"youtube-no-cookie.com/\") != -1) {\n return input.replace(\"youtube-no-cookie.com/\", \"youtube.com/\") + v;\n }\n // weird share-ly style version\n else if (input.indexOf(\"youtu.be\") != -1) {\n return input.replace(\"youtu.be/\", \"www.youtube.com/embed/\") + v;\n }\n // embed link\n else if (input.indexOf(\"player.twitch.tv/\") != -1) {\n if (tmp[1]) {\n return `${input}?${tmp[1].replace(\"&parent=www.example.com\", \"\")}`;\n } else {\n let tmp2 = input.replace(\"&parent=www.example.com\", \"\").split(\"/\");\n return `https://player.twitch.tv/?channel=${tmp2.pop()}`;\n }\n }\n // URL / share link\n else if (input.indexOf(\"twitch.tv/videos/\") != -1) {\n let tmp2 = input.replace(\"&parent=www.example.com\", \"\").split(\"/\");\n return `https://player.twitch.tv/?video=${tmp2.pop()}`;\n }\n // twitch channel URL / share link\n else if (input.indexOf(\"twitch.tv/\") != -1) {\n let tmp2 = input.replace(\"&parent=www.example.com\", \"\").split(\"/\");\n return `https://player.twitch.tv/?channel=${tmp2.pop()}`;\n }\n // copy and paste from the URL for sketchfab\n else if (\n input.indexOf(\"sketchfab.com\") != -1 &&\n input.indexOf(\"/embed\") == -1\n ) {\n return input + \"/embed\";\n }\n }\n return input;\n }", "static _removeQueryParams(link) {\n const regexResult = link.match(/(.*\\.[a-zA-Z]{3,4})($|\\?|#)+/);\n if (regexResult !== null && regexResult.length > 1) {\n let matchWithLink = regexResult[1];\n if (/[\\\\?#&]+/.test(matchWithLink)) {\n throw Error('Link does not match');\n } else {\n return matchWithLink;\n }\n } else {\n throw Error('Link does not match');\n }\n }", "static _removeQueryParams(link) {\n const regexResult = link.match(/(.*\\.[a-zA-Z]{3,4})($|\\?|#)+/);\n if (regexResult !== null && regexResult.length > 1) {\n let matchWithLink = regexResult[1];\n if (/[\\\\?#&]+/.test(matchWithLink)) {\n throw Error('Link does not match');\n } else {\n return matchWithLink;\n }\n } else {\n throw Error('Link does not match');\n }\n }", "function getPlayerHtml(url, width, height, isVOD)\n{\n\tGM_log(url);\n\tif (!isVOD) {\n\t\treturn \"<a target=\\\"_new\\\" style=\\\"float:right;color:white;background-color:black;text-decoration:none\\\" href=\\\"\" + url + \"\\\">\\u05dc\\u05e6\\u05e4\\u05d9\\u05d4 \\u05d9\\u05e9\\u05d9\\u05e8\\u05d4</a><br>\" +\n\t\t\t\"<EMBED type='application/x-mplayer2' width='\" + width +\"' height='\" + height + \"' \" +\n\t\t\t\"src='\" + url + \"' autostart='1' showcontrols='1' loop='0'></EMBED>\"; // לצפיה ישירה\n\t}\n\telse {\n\t\treturn \"<EMBED type='application/x-mplayer2' width='\" + width +\"' height='\" + height + \"' \" +\n\t\t\t\"src='\" + url + \"' autostart='1' showcontrols='1' loop='0'></EMBED><br>\" +\n\t\t\t\"<a target=\\\"_new\\\" style=\\\"display:block;width:80px;white-space:nowrap;padding:0 4px;margin:0 auto;color:white;background-color:black;text-decoration:none\\\" href=\\\"\" + url + \"\\\">\\u05dc\\u05e6\\u05e4\\u05d9\\u05d4 \\u05d9\\u05e9\\u05d9\\u05e8\\u05d4</a>\"; // לצפיה ישירה\n\t}\n}", "function getPlayerQueryString() {\r\n\t\t\tvar qs = '';\r\n\t\t\tif (self.options.overrideStream) {\r\n\t\t\t\tqs += '&l=' + self.currentStream.mp3;\r\n\t\t\t}\r\n\t\t\tif (self.options.config) {\r\n\t\t\t\tqs += '&c=' + self.options.config;\r\n\t\t\t}\r\n\t\t\treturn qs;\r\n\t\t}", "function getUTUBEID(url) {\n\tid_start = url.indexOf('/v') + 3;\n\turl = url.slice(id_start);\n\tid_end = url.indexOf('&');\n\tif (id_end == -1) {\n\t\t// no query paramters\n\t} else {\n\t\turl = url.slice(0, id_end);\n\t}\n\treturn url;\n}", "function getUTUBEID(url) {\n\tid_start = url.indexOf('/v') + 3;\n\turl = url.slice(id_start);\n\tid_end = url.indexOf('&');\n\tif (id_end == -1) {\n\t\t// no query paramters\n\t} else {\n\t\turl = url.slice(0, id_end);\n\t}\n\treturn url;\n}", "function removePath(url) {\r\n var arr = url.split('?');\r\n arr.pop();\r\n return( arr.join('/') );\r\n}", "get embedUrl() {\n return this._data.embed_url;\n }", "function get_querystring( url ) {\n return url.replace( /(?:^[^?#]*\\?([^#]*).*$)?.*/, '$1' );\n }", "function unify(url) {\n\tif (url.indexOf(\"?\") != -1) {\n\t\treturn url + \"&t=\"+(new Date().getTime());\n\t}\n\treturn url + \"?t=\"+(new Date().getTime());\n}", "function refineUrl()\n{\n //get full url\n var url = window.location.href;\n //get url after/ \n var value = url = url.slice( 0, url.indexOf('?') );\n //get the part after before ?\n value = value.replace('@System.Web.Configuration.WebConfigurationManager.AppSettings[\"BaseURL\"]',''); \n return value; \n}", "function youTubeEmbed(id, link) {\n const query = youTubeQueryParams(link);\n return iframe(`https://www.youtube.com/embed/${id}${query}`);\n}", "function removeParamInUrl(url, param){\n var indexOfParam = url.indexOf(\"?\" + param);\n indexOfParam = indexOfParam == -1? url.indexOf(\"&\" + param): indexOfParam;\n var indexOfAndSign = url.indexOf(\"&\", indexOfParam + 1);\n var urlBeforeParam = url.substr(0, indexOfParam);\n var urlAfterParamValue = indexOfAndSign == -1? \"\": url.substr(indexOfAndSign);\n return urlBeforeParam + urlAfterParamValue;\n}", "function yellQueryParam(url,name)\n{\n name = (''+name).replace(/[\\[]/,\"\\\\\\[\").replace(/[\\]]/,\"\\\\\\]\");\n var regexS = \"[\\\\?&]\"+name+\"=([^&#]*)\";\n var regex = new RegExp(regexS);\n var results = regex.exec(url);\n if (results == null)\n return \"\";\n else\n return results[1];\n}", "url({ url }) {\n const removeKeysStartingWith = [\"utm_\", \"uta_\"]; // Remove all query parameters beginning with these strings\n const removeKeys = [\"fblid\", \"gclid\"]; // Remove all query parameters matching these keys\n\n const search = url.search\n .split(\"&\")\n .map((parameter) => parameter.split(\"=\"))\n .filter(([key]) => !removeKeysStartingWith.some((startingWith) => key.startsWith(startingWith)))\n .filter(([key]) => !removeKeys.some((removeKey) => key === removeKey));\n\n return {\n ...url,\n search: search.map((parameter) => parameter.join(\"=\")).join(\"&\"),\n };\n }", "function removeParamsFromUrl(paramKey) {\n\n\n var nextUrl = window.location.origin + window.location.pathname;\n\n var params = getUrlVars(); //Get all the query params as an ARRAY\n params[paramKey] = '';\n var size = Object.keys(params).length;\n var i = 0;\n if (size == 0) {\n window.location.href = window.location.origin + window.location.pathname;\n } else {\n nextUrl += '?'; // ? for started to attach the query string to url\n\n // This is for search,selection by any one of ways => BRAND or SEARCH Keyword\n if (paramKey == 'search' && params['brand'] != undefined) {\n params['brand'] = '';\n }\n if (paramKey == 'brand' && params['search'] != undefined) {\n params['search'] = '';\n }\n\n // Attach the query params to the nextURL \n $.each(params, function(key, value) {\n if (value != '') {\n if (i == size) {\n nextUrl += key + '=' + value;\n } else {\n nextUrl += key + '=' + value + '&';\n }\n }\n\n i++;\n });\n\n window.location.href = nextUrl;\n }\n}", "function onGruveoEmbedAPIReady() {\n embed = new Gruveo.Embed(\"myembed\", {\n responsive: 1,\n embedParams: {\n code: url\n }\n });\n }", "function getURL(theUrl, extraParameters) {\r\n var extraParametersEncoded = $.param(extraParameters);\r\n //var seperator = theUrl.indexOf('?') == -1 ? \"?\" : \"&\";\r\n //console.log(extraParametersEncoded);\r\n //return(theUrl + seperator + extraParametersEncoded);\r\n return(theUrl + extraParametersEncoded);\r\n}", "function getUrlParameter(id)\r\n{\r\n\tid = id.replace(/[\\[]/,\"\\\\\\[\").replace(/[\\]]/,\"\\\\\\]\");\r\n\tvar regex = new RegExp(\"[?&]\" + id + \"=([^&#]*)\");\r\n\tvar results = regex.exec(unescape(window.location.href));\r\n\tif (results == null) return \"\";\r\n\telse return results[1];\r\n}", "function stripUrlParams(url, paramsToStrip){\n var urlSplit = url.match(/^([\\w\\.]*\\??)([\\w\\W]*)$/);\n var urlHead = urlSplit[1];\n var queries = urlSplit[2];\n if (queries === \"\") return urlHead;\n if (typeof paramsToStrip === \"undefined\") {\n queries = queries.split(\"&\").uniqueQuery().join(\"&\");\n } else {\n queries = queries.split(\"&\").uniqueQuery(paramsToStrip).join(\"&\");\n }\n return urlHead + queries;\n}", "function getQueryParam(name) {\n var regexS = \"[\\\\?&]\" + name + \"=([^&#]*)\";\n var regex = new RegExp(regexS);\n var results = regex.exec(window.location.href);\n\n if (results === null) {\n return \"http://www.lexus.com/\";\n } else {\n return results[1].replace(\"%3f\", \"?\", \"g\");\n }\n }", "function makeEmbeddable(code) {\n return \"//www.youtube.com/embed/\"+code;\n }", "function set_youtube_embedded_code() {\n\n var youtube_url = document.getElementById('media_url').value;\n var code = extract_youtube_video_code(youtube_url);\n\n if (code != '') {\n document.getElementById('video_preview').innerHTML = generate_youtube_embedded_code(code);\n }\n\n return '';\n}", "function truncUrlFromParameter(page,param) {\r\n if (page.indexOf(\"?\"+param+\"=\") > 0) {\r\n page=page.substring(0,page.indexOf(\"?\"+param+\"=\"));\r\n } else if (page.indexOf(\"&\"+param+\"=\") > 0) {\r\n page=page.substring(0,page.indexOf(\"&\"+param+\"=\"));\r\n }\r\n return page;\r\n}", "deleteURLQueryString(key) {\n const searchParams = new URL.URLSearchParams(this.urlObj.search);\n searchParams.delete(key);\n this.urlObj.search = searchParams.toString();\n }", "cleanVideoSource(input, type) {\n if (type != \"local\") {\n // strip off the ? modifier for youtube/vimeo so we can build ourselves\n var tmp = input.split(\"?\");\n var v = \"\";\n input = tmp[0];\n if (tmp.length == 2) {\n let tmp2 = tmp[1].split(\"&\"),\n args = tmp2[0].split(\"=\"),\n qry = Array.isArray(tmp2.shift())\n ? tmp2.shift().join(\"\")\n : tmp2.shift();\n if (args[0] == \"v\") {\n let q = qry !== undefined && qry !== \"\" ? \"?\" + qry : \"\";\n v = args[1] + q;\n }\n }\n // link to the vimeo video instead of the embed player address\n if (\n input.indexOf(\"player.vimeo.com\") == -1 &&\n input.indexOf(\"vimeo.com\") != -1\n ) {\n // normalize what the API will return since it is API based\n // and needs cleaned up for front-end\n if (input.indexOf(\"/videos/\") != -1) {\n input = input.replace(\"/videos/\", \"/\");\n }\n return input.replace(\"vimeo.com/\", \"player.vimeo.com/video/\");\n }\n // copy and paste from the URL\n else if (input.indexOf(\"youtube.com/watch\") != -1) {\n return input.replace(\"youtube.com/watch\", \"youtube.com/embed/\") + v;\n }\n // embed link\n else if (input.indexOf(\"player.twitch.tv/\") != -1) {\n if (tmp[1]) {\n return `${input}?${tmp[1].replace(\"&parent=www.example.com\", \"\")}`;\n } else {\n let tmp2 = input.replace(\"&parent=www.example.com\", \"\").split(\"/\");\n return `https://player.twitch.tv/?channel=${tmp2.pop()}`;\n }\n }\n // URL / share link\n else if (input.indexOf(\"twitch.tv/videos/\") != -1) {\n let tmp2 = input.replace(\"&parent=www.example.com\", \"\").split(\"/\");\n return `https://player.twitch.tv/?video=${tmp2.pop()}`;\n }\n // twitch channel URL / share link\n else if (input.indexOf(\"twitch.tv/\") != -1) {\n let tmp2 = input.replace(\"&parent=www.example.com\", \"\").split(\"/\");\n return `https://player.twitch.tv/?channel=${tmp2.pop()}`;\n }\n // copy and paste from the URL\n else if (input.indexOf(\"youtube-no-cookie.com/\") != -1) {\n return input.replace(\"youtube-no-cookie.com/\", \"youtube.com/\") + v;\n }\n // weird share-ly style version\n else if (input.indexOf(\"youtu.be\") != -1) {\n return input.replace(\"youtu.be/\", \"www.youtube.com/embed/\") + v;\n }\n // copy and paste from the URL for sketchfab\n else if (\n input.indexOf(\"sketchfab.com\") != -1 &&\n input.indexOf(\"/embed\") == -1\n ) {\n return input + \"/embed\";\n }\n }\n return input;\n }", "function stripUrl(url) {\n\t\"use strict\";\n\tif (url.indexOf('?') !== -1 || url.indexOf('//') !== -1 || url.indexOf(';') !== -1) {\n\t\t// remove parameters\n\t\tif (url.indexOf('?') !== -1) {\n\t\t\turl = url.split('?')[0];\n\t\t}\n\t\tif (url.indexOf(';') !== -1) {\n\t\t\turl = url.split(';')[0];\n\t\t}\n\t\t// remove protocol & host (server) name\n\t\tif (url.indexOf('//') !== -1) {\n\t\t\turl = url.replace(location.protocol + '//' + location.host, '').trim();\n\t\t}\n\t}\n\treturn url;\n}", "function geneanetURLFix() {\n urlString = updateURLParameter(urlString, \"lang\", \"en\");\n}", "function qs(key) {\n key = key.replace(/[*+?^$.\\[\\]{}()|\\\\\\/]/g, \"\\\\$&\"); // escape RegEx meta chars\n var match = location.search.match(new RegExp(\"[?&]\"+key+\"=([^&]+)(&|$)\"));\n return match && decodeURIComponent(match[1].replace(/\\+/g, \" \"));\n}", "function sendEmbed (p) {\n return medal(p);\n}", "getFragment() {\n return this.clearSlashes(decodeURI(window.location.pathname + window.location.search)).replace(/\\?(.*)$/, '');\n }", "function PreventCaching(url)\n{\n var newUrl;\n \n newUrl = url;\n \n if(newUrl.indexOf('?') != -1)\t//has ?\t \n newUrl += \"&ms=\" + new Date().getTime();\t \n else\t \n newUrl += \"?ms=\" + new Date().getTime();\n \n return newUrl;\n}", "function qs(key) {\n key = key.replace(/[*+?^$.\\[\\]{}()|\\\\\\/]/g, \"\\\\$&\"); // escape RegEx meta chars\n var match = location.search.match(new RegExp(\"[?&]\"+key+\"=([^&]+)(&|$)\"));\n return match && decodeURIComponent(match[1].replace(/\\+/g, \" \"));\n }", "function rewrite_urls() {\n var is_embedded = window.location.href.endsWith(\"embedded\");\n\n if (!is_embedded) {\n return;\n }\n\n $('a').each(function () {\n var a = this;\n var href = $(a).attr('href');\n if (href.startsWith(\"/applab/docs\")) {\n var new_href = href;\n if (href.indexOf(\"?\") > -1) {\n new_href += \"&embedded\";\n } else {\n new_href += \"?embedded\";\n }\n $(a).attr('href', new_href);\n }\n });\n}", "function autoEdQueryString(p) {\n var re = RegExp('[&?]' + p + '=([^&]*)');\n var matches;\n if (matches = re.exec(document.location)) {\n try {\n return decodeURI(matches[1]);\n } catch (e) {\n }\n }\n return null;\n}", "function clean_feed_url(feed)\n{\n\tfeed = feed.replace(/itpc/i,\"http\");\n\tfeed = feed.replace(/pcast/i,\"http\");\n\tfeed = feed.replace(/feed/i,\"http\");\n\treturn feed;\n}", "function removeQueryParameter(_url, parameter) {\n const parsed = url.parse(_url, true, true)\n\n if (parameter in parsed.query) {\n delete parsed.search\n delete parsed.query[parameter]\n }\n\n return url.format(parsed)\n}", "function cleanLink(link) {\n // if it's a rel iq link\n if(link.indexOf('relate') > 0) {\n link = link.replace(/^(.*?)%2F%2F/,'');\n link = link.replace(/&.*$/,'');\n // now clean up the encoded URL pieces and remove junk at the end\n link = 'https://' + decodeURIComponent(link.replace(/\\+/g, '%20'));\n }\n // take off any UTM codes at the end\n if(link.indexOf('?utm') > 0) {\n link = link.substring(0, link.indexOf('?utm'));\n }\n return link;\n}", "function fixURLs(){\n for (let link of document.links) {\n var urlParams;\n\n // Sometimes \"q\" will be the first parameter\n if (link.href.includes(\"?q\")) {\n urlParams = new URLSearchParams(link.href);\n console.log(urlParams.get(\"https://www.youtube.com/redirect?q\"));\n var pURL = urlParams.get(\"https://www.youtube.com/redirect?q\");\n link.href = pURL;\n link.innerText = pURL;\n };\n\n // Other times it will appear later in the URL\n if (link.href.includes(\"&q\")) {\n urlParams = new URLSearchParams(link.href);\n console.log(urlParams.get(\"q\"));\n pURL = urlParams.get(\"q\");\n link.href = pURL;\n link.innerText = pURL;\n };\n\n // Some YouTube URLs may also have truncated URLs. This fixes that\n if (link.innerText.includes(\"...\") && !link.innerText.includes(\" \")){\n link.innerText = link.href;\n };\n };\n }", "function get_videoID()\r\n{\r\n\tv_id_patch=url.split(\"v=\");\r\n\tid_offset=v_id_patch[1].indexOf(\"&\");\r\n\tif(id_offset==-1) id_offset=v_id_patch[1].length;\r\n\tvid_id=v_id_patch[1].substring(0,id_offset);\r\n}", "function getQuerystring(e,a){null==a&&(a=\"\"),e=e.replace(/[\\[]/,\"\\\\[\").replace(/[\\]]/,\"\\\\]\");var t=new RegExp(\"[\\\\?&]\"+e+\"=([^&#]*)\"),o=t.exec(window.location.href);return null==o?a:o[1]}", "function d(e){return e.search=e.search.replace(/([?&])(_pjax|_)=[^&]*/g,\"\").replace(/^&/,\"\"),e.href.replace(/\\?($|#)/,\"$1\")}", "function getUrlVarsLocal(){\n\t\tvar hashes = window.location.href.slice(window.location.href.indexOf('?') + 1);\n\t\tif (window.location.href.indexOf('?') >= 0){\n\t\t\treturn '&' + hashes;\n\t\t}else{\n\t\t\treturn '';\n\t\t}\n\t}", "function smartUrl(url) {\n\n if (url.indexOf(languagemastersPath) > -1) {\n url = url.split(languagemastersPath)[1];\n } else if (url.indexOf(languagePath) > -1) {\n url = url.split(languagePath)[1];\n } else if (url.indexOf(liveURL) > -1) {\n url = url.split(liveURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if (url.indexOf(publishURL) > -1) {\n url = url.split(publishURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if (url.indexOf(stageLiveURL) > -1) {\n url = url.split(stageLiveURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if (url.indexOf(stagePublishURL) > -1) {\n url = url.split(stagePublishURL)[1].substring(parseInt(languagecodelength) + 2);\n } else if(url.indexOf(previewURL)> -1){\n url = url.split(previewURL)[1].substring(3);\n }\n\n\n if (url.indexOf(\".html\") > -1) {\n url = url.split(\".html\")[0];\n }\n\n return url;\n\n}", "getSongIdFromUrl(url) {\n let videoId,\n ampersandPosition;\n\n if (!url) return false;\n\n if (url.indexOf('?v=') !== -1) videoId = url.split('?v=')[1];\n else if (url.indexOf('youtu.be/') !== -1) videoId = url.split('youtu.be/')[1];\n\n if (!videoId) return url;\n\n ampersandPosition = videoId.indexOf('&');\n\n if (ampersandPosition !== -1) videoId = videoId.substring(0, ampersandPosition);\n\n return videoId;\n }", "removeAllURLQueryString() {\n delete this.urlObj.search;\n }", "function clearUrlQuery() {\n if (window.location.search && window.history && window.history.pushState) {\n window.history.pushState({}, document.title, window.location.pathname);\n }\n}", "function urlForAction(url, extension = '') {\n const [path, params] = url.split('?');\n const pathParts = path.split('/');\n const idPart = pathParts.pop();\n let newUrl = `${pathParts.join('/')}${extension}/${idPart}`;\n\n if (params) {\n newUrl += `?${params}`;\n }\n\n return newUrl;\n}", "function buildStreamIframeUrl(talkBaseUrl, query) {\n let url = talkBaseUrl + 'embed/stream?';\n\n url += queryString.stringify(query);\n\n return url;\n}", "function getUrlParam(name){\n\tvar reg = new RegExp(\"(^|&)\"+ name +\"=([^&]*)(&|$)\");\n\tvar r = window.location.search.substr(1).match(reg);\n\tif (r!=null) return unescape(r[2]);\n\treturn null;\n}", "function getYouTubeCode(url) {\n return url.split('?v=')[1];\n }", "function stripURL(str){\n\tstr = str.replace('http://paizo.com/pathfinderRPG/prd/', '');\n\treturn str.slice(0, str.indexOf('.html'));\n}", "function getEmbed(config, x) {\n var flashvars = [];\n for(var i=1; i<arguments.length; i+=2) {\n flashvars.push(encodeURIComponent(arguments[i]) + '=' + encodeURIComponent(arguments[i+1]));\n }\n var swf = (config.player_id.length>0 ? config.player_id + '.swf' : 'v.swf');\n return('<object width=\"'+config.player_width+'\" height=\"'+config.player_height+'\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" style=\"width:'+config.player_width+'px; height:'+config.player_height+'px;\"><param name=\"movie\" value=\"http://' + config.domain + '/' + swf + '\"></param><param name=\"FlashVars\" value=\"'+flashvars.join('&')+'\"></param><param name=\"allowfullscreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://' + config.domain + '/' + swf + '\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"'+config.player_width+'\" height=\"'+config.player_height+'\" FlashVars=\"'+flashvars.join('&')+'\"></embed></object>');\n}", "function updateURL() {\n var filters = window.getPostFilterValues();\n var params = '';\n for(let key in filters){\n var val = filters[key];\n if (typeof val === 'object') {\n params += key + '=' + val.join(',') + \"&\";\n }else{\n params += key + '=' + val + \"&\";\n }\n }\n params = params.length > 0 ? params.substr(0, params.length - 1) : params;\n var newUrl = window.location.href;\n newUrl = newUrl.split('?')[0] + ('?' + params);\n window.history.pushState(null, null, newUrl);\n }", "_getThumbnail(link) {\n var video_id = link.split(\"v=\")[1];\n var ampersandPosition = video_id.indexOf(\"&\");\n if (ampersandPosition !== -1) {\n video_id = video_id.substring(0, ampersandPosition);\n }\n return video_id;\n }", "function ManageEmbed(){}", "function normalizeVideoSrc (src) {\n // youtube\n const youtubeMatch = src.match(youtubeRegex)\n if (youtubeMatch) {\n return `https://www.youtube.com/embed/${youtubeMatch[2]}?enablejsapi=1`\n }\n\n // vimeo\n const vimeoMatch = src.match(vimeoRegex)\n if (vimeoMatch) {\n return `https://player.vimeo.com/video/${vimeoMatch[1]}`\n }\n\n // default to reflecting src back\n return src\n }", "function strip(url) {\n return url.replace(/(\\?|&)?forcedownload=\\d/g, \"\");\n }", "function gnh_normaliseUrl(url) {\n if (url === location.href) {\n if (url.indexOf('?') === -1) {\n url = url + '?gaia-navigator=1';\n } else {\n url = url + '&gaia-navigator=1';\n }\n }\n\n return url;\n}", "function _removeEmbed(state, id) {\n // get existing embed\n var embeds = state.uniqueEmbeds;\n var embed = embeds[id];\n var parent = embed.parent;\n var property = embed.property;\n\n // create reference to replace embed\n var subject = {'@id': id};\n\n // remove existing embed\n if(_isArray(parent)) {\n // replace subject with reference\n for(var i = 0; i < parent.length; ++i) {\n if(jsonld.compareValues(parent[i], subject)) {\n parent[i] = subject;\n break;\n }\n }\n } else {\n // replace subject with reference\n var useArray = _isArray(parent[property]);\n jsonld.removeValue(parent, property, subject, {propertyIsArray: useArray});\n jsonld.addValue(parent, property, subject, {propertyIsArray: useArray});\n }\n\n // recursively remove dependent dangling embeds\n var removeDependents = function(id) {\n // get embed keys as a separate array to enable deleting keys in map\n var ids = Object.keys(embeds);\n for(var i = 0; i < ids.length; ++i) {\n var next = ids[i];\n if(next in embeds && _isObject(embeds[next].parent) &&\n embeds[next].parent['@id'] === id) {\n delete embeds[next];\n removeDependents(next);\n }\n }\n };\n removeDependents(id);\n}", "function _removeEmbed(state, id) {\n // get existing embed\n var embeds = state.uniqueEmbeds;\n var embed = embeds[id];\n var parent = embed.parent;\n var property = embed.property;\n\n // create reference to replace embed\n var subject = {'@id': id};\n\n // remove existing embed\n if(_isArray(parent)) {\n // replace subject with reference\n for(var i = 0; i < parent.length; ++i) {\n if(jsonld.compareValues(parent[i], subject)) {\n parent[i] = subject;\n break;\n }\n }\n } else {\n // replace subject with reference\n var useArray = _isArray(parent[property]);\n jsonld.removeValue(parent, property, subject, {propertyIsArray: useArray});\n jsonld.addValue(parent, property, subject, {propertyIsArray: useArray});\n }\n\n // recursively remove dependent dangling embeds\n var removeDependents = function(id) {\n // get embed keys as a separate array to enable deleting keys in map\n var ids = Object.keys(embeds);\n for(var i = 0; i < ids.length; ++i) {\n var next = ids[i];\n if(next in embeds && _isObject(embeds[next].parent) &&\n embeds[next].parent['@id'] === id) {\n delete embeds[next];\n removeDependents(next);\n }\n }\n };\n removeDependents(id);\n}", "function _removeEmbed(state, id) {\n // get existing embed\n var embeds = state.uniqueEmbeds;\n var embed = embeds[id];\n var parent = embed.parent;\n var property = embed.property;\n\n // create reference to replace embed\n var subject = {'@id': id};\n\n // remove existing embed\n if(_isArray(parent)) {\n // replace subject with reference\n for(var i = 0; i < parent.length; ++i) {\n if(jsonld.compareValues(parent[i], subject)) {\n parent[i] = subject;\n break;\n }\n }\n } else {\n // replace subject with reference\n var useArray = _isArray(parent[property]);\n jsonld.removeValue(parent, property, subject, {propertyIsArray: useArray});\n jsonld.addValue(parent, property, subject, {propertyIsArray: useArray});\n }\n\n // recursively remove dependent dangling embeds\n var removeDependents = function(id) {\n // get embed keys as a separate array to enable deleting keys in map\n var ids = Object.keys(embeds);\n for(var i = 0; i < ids.length; ++i) {\n var next = ids[i];\n if(next in embeds && _isObject(embeds[next].parent) &&\n embeds[next].parent['@id'] === id) {\n delete embeds[next];\n removeDependents(next);\n }\n }\n };\n removeDependents(id);\n}", "function _removeEmbed(state, id) {\n // get existing embed\n var embeds = state.uniqueEmbeds;\n var embed = embeds[id];\n var parent = embed.parent;\n var property = embed.property;\n\n // create reference to replace embed\n var subject = {'@id': id};\n\n // remove existing embed\n if(_isArray(parent)) {\n // replace subject with reference\n for(var i = 0; i < parent.length; ++i) {\n if(jsonld.compareValues(parent[i], subject)) {\n parent[i] = subject;\n break;\n }\n }\n } else {\n // replace subject with reference\n var useArray = _isArray(parent[property]);\n jsonld.removeValue(parent, property, subject, {propertyIsArray: useArray});\n jsonld.addValue(parent, property, subject, {propertyIsArray: useArray});\n }\n\n // recursively remove dependent dangling embeds\n var removeDependents = function(id) {\n // get embed keys as a separate array to enable deleting keys in map\n var ids = Object.keys(embeds);\n for(var i = 0; i < ids.length; ++i) {\n var next = ids[i];\n if(next in embeds && _isObject(embeds[next].parent) &&\n embeds[next].parent['@id'] === id) {\n delete embeds[next];\n removeDependents(next);\n }\n }\n };\n removeDependents(id);\n}", "function getQueryVariableShortened(url){\n\n return url.split(\"/\")[3];\n}", "function weUrl(url)\n{\n\treturn url.indexOf(we_script) >= 0 ? url : we_script.replace(/:\\/\\/[^\\/]+/g, '://' + location.host) + (we_script.indexOf('?') == -1 ? '?' : (we_script.search(/[?&;]$/) == -1 ? ';' : '')) + url;\n}", "function elideUrl(url) {\n if (url.length < 40)\n return url;\n var protoIdx = url.indexOf(\"://\");\n var lslash = url.lastIndexOf(\"/\");\n if (lslash != -1)\n lslash = url.lastIndexOf(\"/\", lslash - 1);\n if (lslash == -1)\n return url;\n return url.substring(0, protoIdx + 3) + \"...\" + url.substring(lslash);\n}", "function _loadURL(source) {\n\t\tsource = source + ((source.indexOf(\"?\") > -1) ? \"&\"+options.requestKey+\"=true\" : \"?\"+options.requestKey+\"=true\");\n\t\tvar $iframe = $('<iframe class=\"boxer-iframe\" src=\"' + source + '\" />');\n\t\t_appendObject($iframe);\n\t}", "function prepURL(url) {\r\n // if a complete URL is passed, get the hostname\r\n if (url.indexOf(\"//\") > 0) { url = url.split(\"/\")[2]; }\r\n // remove www. (ww2, ww18, etc.) if there to save some space and return value\r\n // Thank you D. S. Kinney for pointing out the numbers\r\n return url.replace(/^ww[a-zA-Z0-9]*\\./i, \"\");\r\n}", "function buildEmbed() {\n\t// https://maps.google.com/maps?q=225+delaware+avenue,+Buffalo,+NY&hl=en&sll=42.746632,-75.770041&sspn=5.977525,8.591309&t=h&hnear=225+Delaware+Ave,+Buffalo,+Erie,+New+York+14202&z=16\n\t// API key console\n\t// https://code.google.com/apis/console\n\t// BfloFRED API Key : key=AIzaSyBMSezbmos0W2n6BQutkFvNjkF5NTPd0-Q\n\n\t$('<div class=\"map-container\"/>').html(embed).prependTo(map);\n}", "function replaceParams() {\n var href = $(this).attr(\"href\") || $(this).serialize()\n href = PlaceGuide.cleanParamString(href)\n var state = href.match(/[\\?\\&]/) ? $.deparam.querystring(href) : {}\n $.bbq.pushState(state, PlaceGuide.REPLACE_EXISTING)\n return false\n }", "function _removeEmbed(state, id) {\n // get existing embed\n var embeds = state.embeds;\n var embed = embeds[id];\n var parent = embed.parent;\n var property = embed.property;\n\n // create reference to replace embed\n var subject = {'@id': id};\n\n // remove existing embed\n if(_isArray(parent)) {\n // replace subject with reference\n for(var i = 0; i < parent.length; ++i) {\n if(jsonld.compareValues(parent[i], subject)) {\n parent[i] = subject;\n break;\n }\n }\n } else {\n // replace subject with reference\n var useArray = _isArray(parent[property]);\n jsonld.removeValue(parent, property, subject, {propertyIsArray: useArray});\n jsonld.addValue(parent, property, subject, {propertyIsArray: useArray});\n }\n\n // recursively remove dependent dangling embeds\n var removeDependents = function(id) {\n // get embed keys as a separate array to enable deleting keys in map\n var ids = Object.keys(embeds);\n for(var i = 0; i < ids.length; ++i) {\n var next = ids[i];\n if(next in embeds && _isObject(embeds[next].parent) &&\n embeds[next].parent['@id'] === id) {\n delete embeds[next];\n removeDependents(next);\n }\n }\n };\n removeDependents(id);\n}" ]
[ "0.6478938", "0.63223934", "0.6218399", "0.61243033", "0.6056966", "0.6049975", "0.6004344", "0.6001671", "0.5942131", "0.59209603", "0.5764331", "0.5728614", "0.56769824", "0.56652665", "0.566285", "0.56578565", "0.5643513", "0.56309515", "0.56294805", "0.56294805", "0.5628748", "0.5620831", "0.56149375", "0.5609465", "0.5563576", "0.55444086", "0.5530582", "0.55270875", "0.5496811", "0.5496317", "0.5496317", "0.54754204", "0.5463238", "0.5431395", "0.5431395", "0.54302144", "0.5419088", "0.5416636", "0.54154044", "0.5410664", "0.5394844", "0.53833276", "0.53696877", "0.5358367", "0.53563726", "0.5352403", "0.5351372", "0.53414845", "0.533867", "0.5335093", "0.5322988", "0.5317809", "0.5308978", "0.5306248", "0.52996576", "0.5298186", "0.52965903", "0.5295814", "0.52923536", "0.52856904", "0.52801126", "0.52752835", "0.5267831", "0.5263853", "0.5261545", "0.5257971", "0.5240524", "0.523448", "0.5229589", "0.5218273", "0.5210854", "0.52094024", "0.5193715", "0.51892453", "0.51765966", "0.51706374", "0.5167511", "0.51641136", "0.51632285", "0.5160902", "0.5155285", "0.51531476", "0.5144784", "0.5139256", "0.5130551", "0.51282376", "0.5124866", "0.5124207", "0.5117623", "0.5117623", "0.5117623", "0.5117623", "0.510754", "0.5102123", "0.50980794", "0.5077686", "0.50760037", "0.5074592", "0.5074432", "0.5068925" ]
0.8691991
0
This lets use use d3.scale.time for a nice time interval scale.
function secondsToRefDate(secs) { return new Date(2012, 0, 1, 0, 0, secs); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timeFormat(ms) {\r\n\tif (ms > 3600000) {\r\n\t\treturn d3.utcFormat(\"%H:%M:%S\")(new Date(ms));\r\n\t}\r\n\tif (ms > 60000) {\r\n\t\treturn d3.utcFormat(\"%M:%S.%L\")(new Date(ms));\r\n\t}\r\n\treturn d3.utcFormat(\"%S.%L\")(new Date(ms));\r\n}", "function render(data) {\n // different scales depending on the data\n scaleX.domain([0,data.length-1]);\n // scaleY.domain(d3.extent(data, d=>{return d[\"time\"];}));\n scaleY.domain([1,4000]);\n if (ots) {\n scaleR.range([1,(scaleX(2)-scaleX(1))/2-2])\n .domain(d3.extent(data, d=>{return d.bus}));\n } else {\n scaleR.range([1,(scaleX(2)-scaleX(1))/2-2])\n .domain(d3.extent(data, d=>{return d.int_vars+d.bin_vars}));\n }\n\n // define the axis\n var axisTime = d3.axisLeft(scaleY)\n axisTime.tickFormat(function(d) {\n return this.parentNode.nextSibling\n ? d\n : d + \" seconds\";\n });\n\n if (ots) {\n tip = d3.tip().attr('class', 'd3-tip').html(function(d) {\n return \"<span>\"+d.instance+\", \"+Math.round(d.time)+\" sec, \"+(d.bus)+\" bus</span>\"; \n });\n } else {\n tip = d3.tip().attr('class', 'd3-tip').html(function(d) {\n return \"<span>\"+d.instance+\", \"+Math.round(d.time)+\" sec, \"+(d.bin_vars+d.int_vars)+\" dvars</span>\"; \n });\n }\n /* Invoke the tip in the context of your visualization */\n g.call(tip)\n \n // the key of the data is the instance for updating\n let timeCircles = g.selectAll(\".timeCircles\").data(data, d => { return d.instance; });\n\n timeCircles.enter().append(\"circle\")\n .attr(\"class\", \"timeCircles\")\n .on('mouseover', tip.show)\n .on('mouseout', tip.hide)\n .merge(timeCircles) // enter + update\n .transition()\n .attr(\"cx\", (d,i) => {return scaleX(i);})\n .attr(\"cy\", d => {return scaleY(d[\"time\"]);})\n .attr(\"r\", d => {return getRadius(d)})\n .attr(\"fill\", d=> {return getColor(d.status)})\n .attr(\"id\", d => {return \"circle-\"+d.instance;})\n \n\n timeCircles.exit().remove();\n \n \n // create legend\n createLegend(data);\n axis.call(axisTime);\n}", "_scaleTime(timestamp) {\n return timestamp * 0.001\n }", "function TimeGraph(margin, width, height, selector) {\n var self = this;\n self.margin = margin;\n self.width = width - margin.left - margin.right;\n self.height = height - margin.top - margin.bottom;\n self.parseDate = d3.time.format('%Y-%m-%dT%H:%M:%S.%LZ').parse;\n self.x = d3.time.scale().range([0, self.width]);\n self.y = d3.scale.linear().range([self.height, 0]);\n self.color = d3.scale.category10();\n self.xAxis = d3.svg.axis().scale(self.x).orient('bottom');\n self.yAxis = d3.svg.axis().scale(self.y).orient('left');\n self.line = d3.svg.line().interpolate('basis')\n .x(function (d) { return self.x(d.time); })\n .y(function (d) { return self.y(d.value); });\n self.svg = d3.select(selector).append('svg')\n .attr('width', width).attr('height', height).append('g')\n .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');\n}", "get timeScale() {\n return this._timeScale\n }", "function setScales(data)\n{\n console.log('setting scales.');\n\n const xValue = d => d.x;\n const yValue = d => d.y;\n const durationValue = d => d.duration; // plot size\n const pupilValue = d => +d.avg_dilation; // plot color\n const timeValue = d => d.time;\n xMax = d3.max(data, xValue);\n xMin = d3.min(data, xValue);\n console.log('x '+xMin+' : '+xMax);\n yMax = d3.max(data, yValue);\n yMin = d3.min(data, yValue);\n console.log('y '+yMin+' : '+yMax);\n durationMax = d3.max(data, durationValue);\n durationMin = d3.min(data, durationValue);\n console.log('duration '+durationMin+' : '+durationMax);\n pupilMax = d3.max(data, pupilValue);\n pupilMin = d3.min(data, pupilValue);\n console.log('pupil '+pupilMin+' : '+pupilMax);\n timeMax = d3.max(data, timeValue);\n timeMin = d3.min(data, timeValue);\n console.log('time '+timeMin+' : '+timeMax);\n\n xScale = d3.scaleLinear()\n .domain([0, xMax])\n .range([0+20, svgWidth-50])\n .nice();\n yScale = d3.scaleLinear()\n .domain([0, yMax])\n .range([0+20, svgHeight-50])\n .nice();\n rScale.domain([100, durationMax]).nice();\n colorScale.domain([0, 0.4, 1]); //fixed with exagerated changes\n // .domain([0, (pupilMin+pupilMax)/2, pupilMax]) //show the distribution as it is\n // .domain([0, pupilMax*0.4, pupilMax]) //bit distorted\n timeScale = d3.scaleLinear()\n .domain([0, timeMax])\n .range([0, 10])\n .nice();\n \n timeSlider.attr('max',timeMax/1000); //set time slider range\n}", "function redraw() { \n oldRange = x.range();\n //console.log(oldRange);\n \n // Extract the width and height that was computed by CSS.\n width = 0.7 * window.innerWidth;\n //console.log(width);\n \n x = d3.scaleTime()\n .domain(timeRange)\n .range([40, width]);\n \n let ratio = oldRange/x.range(); \n \n svg.select(\".axis\")\n .call(d3.axisBottom(x)\n .tickFormat(d3.timeFormat(format)));\n \n //Uppdatera brush selection & overlay!\n \n //Get selection range to use for rescaling\n let start = Number(d3.select(\"#time\").select(\".selection\").attr(\"x\"));\n let end = Number(d3.select(\"#time\").select(\".selection\").attr(\"width\")) + start;\n //Update selections range/rescale\n d3.select(\"#time\").select(\".selection\").attr(\"x\", start);\n d3.select(\"#time\").select(\".selection\").attr(\"width\", end - start);\n d3.select(\"#time\").select(\".overlay\").attr(\"width\", width); //fel sak att ändra på? ändrar inte gränserna...\n \n /*if(start !== null && end !== null)\n brushX.move(timeBrush, x.range().map(() => {x.range()[0] = start;x.range()[1] = end;}));*/\n }", "scale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}", "scale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}", "function scaleTimeSelect() {\n if (!timefilter) return;\n context.on(\"mouseup\", stopTimeSelect);\n t1 = d3.svg.mouse(this);\n\n var minx = Math.min(t0[0], t1[0]),\n maxx = Math.max(t0[0], t1[0]);\n selStart = minx - 0.5;\n timefilter \n .attr(\"x\", selStart)\n .attr(\"y\", 5)\n .attr(\"width\", maxx - minx + 1)\n .attr(\"height\", barHeight);\n\tnumBarsSel = (timefilter.attr(\"width\")/barWidth);\n TRANGE = [Math.round(timefilter.attr(\"x\") / barWidth), \n Math.round((timefilter.attr(\"x\") / barWidth)+ numBarsSel)];\n// filterByDate(MONTHS[TRANGE[0]], MONTHS[TRANGE[1]], _(KIVA['loans']).clone());\n}", "function timeSeries() {\n var TRANSITION_DURATION = 1500;\n var data = [];\n var width = 640;\n var height = 480;\n var backgroundColor = 'white';\n var lineColor = 'red';\n var padding = {\n top: 50,\n bottom: 50,\n left: 50,\n right: 50\n };\n\n var xScale, yScale;\n\n\n // Chart generation closure.\n var chart = function(selection) {\n selection.each(function(data) {\n var container = d3.select(this);\n var svg = container.selectAll('svg').data([data]);\n\n var svgEnter = svg.enter()\n .append('svg')\n .attr('class', 'time-series');\n\n svg.attr('width', width)\n .attr('height', height)\n .style('background-color', backgroundColor);\n\n svgEnter.append('g')\n .attr('class', 'points-container')\n .attr('transform', 'translate(' + padding.left + ',' + padding.top + ')')\n .append('path')\n .attr('class', 'value line');\n\n svgEnter.append('g')\n .attr('class', 'x axis')\n .attr('transform', 'translate(' + padding.left + ',' + (height - padding.top) + ')');\n\n svgEnter.append('g')\n .attr('class', 'y axis')\n .attr('transform', 'translate(' + padding.left + ',' + padding.top + ')');\n\n svgEnter.append('g')\n .attr('class', 'x text')\n .attr('transform', 'translate(' + (padding.left + innerWidth()/2) + ',' + (innerHeight() + padding.top + 30) + ')')\n .attr('class', 'chart-title')\n .text('time');\n\n svgEnter.append('g')\n .attr('class', 'y text')\n .attr('transform', 'translate(' + (padding.left - 30) + ',' + (height/2) + ') rotate(-90)')\n .attr('class', 'chart-title')\n .text('counts');\n\n setScales(data);\n setAxes(container.select('.x.axis'),\n container.select('.y.axis'));\n var adjustedWidth = innerWidth();\n var adjustedHeight = innerHeight();\n\n var points = svg.select('.points-container')\n .selectAll('circle').data(data);\n\n points.enter().append('circle')\n .attr('r', 3)\n .attr('cx', function(d) { return xScale(d.date); })\n .attr('cy', function(d) { return yScale(d.frequency); })\n .style('opacity', 0.7)\n .attr('fill', lineColor);\n\n\n points.exit().remove();\n\n points.transition()\n .attr('cx', function(d) { return xScale(d.date); })\n .attr('cy', function(d) { return yScale(d.frequency); });\n\n container.select('.value.line')\n .transition()\n .attr('d', valueLine(data))\n .attr('stroke', lineColor);\n });\n };\n\n // Gets/sets the data associated with this chart.\n chart.data = function(val) {\n if (!arguments.length) return data;\n data = val;\n if (typeof updateData === 'function') {\n updateData();\n }\n };\n\n // Gets/sets the width of this chart.\n chart.width = function(val) {\n if (!arguments.length) return width;\n\n width = val;\n return this;\n };\n\n // Gets/sets the height of this chart.\n chart.height = function(val) {\n if (!arguments.length) return height;\n\n height = val;\n return this;\n };\n\n // Gets/sets the background color of this chart.\n chart.backgroundColor = function(val) {\n if (!arguments.length) return backgroundColor;\n\n backgroundColor = val;\n return this;\n }\n\n // Returns the width of the chart, excluding the paddings.\n var innerWidth = function() {\n return width - padding.left - padding.right;\n };\n\n // Returns the height of the chart, excluding the paddings.\n var innerHeight = function() {\n return height - padding.top - padding.bottom;\n };\n\n var setScales = function(data) {\n xScale = d3.time.scale()\n .domain([data[0].date, data[data.length - 1].date])\n .range([0, innerWidth()]);\n\n var yMin = d3.min(data, function(d) { return d.frequency });\n var yMax = d3.max(data, function(d) { return d.frequency });\n\n yScale = d3.scale.linear()\n .domain([yMin * 0.9, yMax])\n .range([innerHeight(), 0]);\n };\n\n var setAxes = function(xAxisLabel, yAxisLabel) {\n var xAxis = d3.svg.axis()\n .scale(xScale)\n .orient('bottom')\n .tickFormat(d3.time.format('%a'))\n .ticks(7);\n\n var yAxis = d3.svg.axis()\n .scale(yScale)\n .orient('left');\n\n xAxisLabel.transition().duration(TRANSITION_DURATION).call(xAxis);\n\n yAxisLabel.transition().duration(TRANSITION_DURATION).call(yAxis);\n };\n\n var valueLine = d3.svg.line()\n .x(function (d) { return xScale(d.date); })\n .y(function (d) { return yScale(d.frequency); });\n\n return chart;\n}", "function setupXScale()\n{\n\n x = d3.scaleTime()\n .range([0, width])\n .domain(d3.extent(Spain, function(d) { return d.x}));\n}", "function generate(scale, min, max, capacity) {\n var adapter = scale._adapter;\n var options = scale.options;\n var timeOpts = options.time;\n var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n var major = determineMajorUnit(minor);\n var stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n var weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n var majorTicksEnabled = options.ticks.major.enabled;\n var interval = INTERVALS[minor];\n var first = min;\n var last = max;\n var ticks = [];\n var time;\n\n if (!stepSize) {\n stepSize = determineStepSize(min, max, minor, capacity);\n } // For 'week' unit, handle the first day of week option\n\n\n if (weekday) {\n first = +adapter.startOf(first, 'isoWeek', weekday);\n last = +adapter.startOf(last, 'isoWeek', weekday);\n } // Align first/last ticks on unit\n\n\n first = +adapter.startOf(first, weekday ? 'day' : minor);\n last = +adapter.startOf(last, weekday ? 'day' : minor); // Make sure that the last tick include max\n\n if (last < max) {\n last = +adapter.add(last, 1, minor);\n }\n\n time = first;\n\n if (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n // Align the first tick on the previous `minor` unit aligned on the `major` unit:\n // we first aligned time on the previous `major` unit then add the number of full\n // stepSize there is between first and the previous major time.\n time = +adapter.startOf(time, major);\n time = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n }\n\n for (; time < last; time = +adapter.add(time, stepSize, minor)) {\n ticks.push(+time);\n }\n\n ticks.push(+time);\n return ticks;\n }", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = min;\n\tvar last = max;\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t\tlast = +adapter.startOf(last, 'isoWeek', weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\tlast = +adapter.startOf(last, weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast = +adapter.add(last, 1, minor);\n\t}\n\n\ttime = first;\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime = +adapter.startOf(time, major);\n\t\ttime = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = min;\n\tvar last = max;\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t\tlast = +adapter.startOf(last, 'isoWeek', weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\tlast = +adapter.startOf(last, weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast = +adapter.add(last, 1, minor);\n\t}\n\n\ttime = first;\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime = +adapter.startOf(time, major);\n\t\ttime = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = min;\n\tvar last = max;\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t\tlast = +adapter.startOf(last, 'isoWeek', weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\tlast = +adapter.startOf(last, weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast = +adapter.add(last, 1, minor);\n\t}\n\n\ttime = first;\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime = +adapter.startOf(time, major);\n\t\ttime = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = min;\n\tvar last = max;\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t\tlast = +adapter.startOf(last, 'isoWeek', weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\tlast = +adapter.startOf(last, weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast = +adapter.add(last, 1, minor);\n\t}\n\n\ttime = first;\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime = +adapter.startOf(time, major);\n\t\ttime = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = min;\n\tvar last = max;\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t\tlast = +adapter.startOf(last, 'isoWeek', weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\tlast = +adapter.startOf(last, weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast = +adapter.add(last, 1, minor);\n\t}\n\n\ttime = first;\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime = +adapter.startOf(time, major);\n\t\ttime = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = valueOrDefault$c(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = min;\n\tvar last = max;\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t\tlast = +adapter.startOf(last, 'isoWeek', weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\tlast = +adapter.startOf(last, weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast = +adapter.add(last, 1, minor);\n\t}\n\n\ttime = first;\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime = +adapter.startOf(time, major);\n\t\ttime = +adapter.add(time, ~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "get timeScale() {\n\t\treturn this.__Internal__Dont__Modify__.timeScale;\n\t}", "function hourMinuteMilliseconds(d) {\n return d3.time.format(\"%H:%M:%S\")(new Date(d * 1000))\n}", "createScales(){\n let dv = this;\n\n // set scales\n dv.x = d3.scaleTime().range([0, dv.width]);\n dv.y = d3.scaleLinear().range([dv.height, 0]);\n\n // Update scales\n dv.x.domain(d3.extent(dv.data[0].values, d => {\n return (d.date); }));// this needs to be dynamic dv.date!!\n \n // for the y domain to track negative numbers \n const minValue = d3.min(dv.data, d => {\n return d3.min(d.values, d => { return d[dv.value]; });\n });\n\n // Set Y axis scales 0 if positive number else use minValue\n dv.y.domain([ minValue >=0 ? 0 : minValue,\n d3.max(dv.data, d => { \n return d3.max(d.values, d => { return d[dv.value]; });\n })\n ]);\n\n dv.xLabel.text(dv.titleX);\n dv.yLabel.text(dv.titleY);\n\n dv.drawGridLines();\n // dv.tickNumber = 0 ; //= dv.data[0].values.length;\n\n // Update axes\n dv.tickNumber !== \"undefined\" ? dv.xAxisCall.scale(dv.x).ticks(dv.tickNumber) : dv.xAxisCall.scale(dv.x);\n\n // // Update axes - what about ticks for smaller devices??\n // dv.xAxisCall.scale(dv.x).ticks(d3.timeYear.filter((d) => {\n // return d = parseYear(\"2016\");\n // }));\n // dv.xAxisCall.scale(dv.x).ticks(dv.tickNumber).tickFormat( (d,i) => {\n // return i < dv.tickNumber ? dv.data[0].values[i].label : \"\";\n // });\n \n // .tickFormat(dv.formatQuarter);\n dv.xAxis.transition(dv.t()).call(dv.xAxisCall);\n \n //ticks(dv.tickNumberY)\n dv.yScaleFormat !== \"undefined\" ? dv.yAxisCall.scale(dv.y).tickFormat(dv.yScaleFormat ) : dv.yAxisCall.scale(dv.y);\n dv.yAxis.transition(dv.t()).call(dv.yAxisCall);\n\n // Update x-axis label based on selector\n // dv.xLabel.text(dv.variable);\n\n // Update y-axis label based on selector\n // var selectorKey = dv.keys.findIndex( d => { return d === dv.variable; });\n // var newYLabel =[selectorKey];\n // dv.yLabel.text(newYLabel);\n\n dv.update();\n }", "function timeUpdate() { \n var playPercent = timelineWidth * (clip.currentTime / duration);\n var formattedTimeCurrent = (clip.currentTime.toString()/100).toFixed(2)\n var formattedTimeCurrentLarge = ((clip.currentTime + 40).toString()/100).toFixed(2)\n var formattedTimeEnd = ((duration - clip.currentTime).toString()/100).toFixed(2)\n\n\n d3.select(timeCurrent)\n .html(function() {\n if (Math.round(clip.currentTime) % 60 != 0) { \n if (Math.round(clip.currentTime) % 60 > 9){ \n return Math.floor( clip.currentTime / 60) + \":\" + (Math.round(clip.currentTime) % 60)\n } \n return Math.floor( clip.currentTime / 60) + \":0\" + (Math.round(clip.currentTime) % 60) \n }\n return Math.floor( clip.currentTime / 60) + \":00\"\n \n })\n d3.select(timeEnd)\n .html(function() { \n if (Math.round(duration-clip.currentTime) % 60 != 0) {\n if (Math.round(duration-clip.currentTime) % 60 > 9){ \n return Math.floor( (duration-clip.currentTime) / 60) + \":\" + (Math.round(duration-clip.currentTime) % 60)\n }else{\n return Math.floor( (duration-clip.currentTime) / 60) + \":0\" + (Math.round(duration-clip.currentTime) % 60)\n }\n }else{\n return Math.ceil( (Math.floor( (duration-clip.currentTime)) / 60)) + \":00\"\n }\n })\n playhead.style.marginLeft = \"0px\";\n playhead.style.width = playPercent + \"px\";\n\n if (clip.currentTime == duration) { \n pButton.className = \"\";\n pButton.className = \"play\";\n }\n}", "function makeScales(times, dataLists) {\n let scales = {};\n\n // make scales for all variables in data\n for (i in dataLists) {\n scales[i] = d3.scaleLinear()\n .domain([0, d3.max(dataLists[i], y => y[\"value\"])]);\n }\n\n // add a time scale, made from the input times\n scales[\"Time\"] = d3.scaleTime()\n .domain(d3.extent(times))\n .clamp(true);\n\n // define color scale\n scales[\"Color\"] = d3.scaleOrdinal()\n .domain(function() {\n let dom = [];\n for (i in iceGgLists) {\n dom.push(i);\n }\n return dom;\n })\n .range([\"#980C1D\",\n \"#C34D3A\",\n \"#3B83A5\",\n \"#246084\",\n \"#0F3C6B\",\n \"#FFFFFF\"]);\n\n return(scales);\n}", "function X(d) {\n return xscale(d.time);\n }", "function generate(scale, min, max, capacity) {\r\n\tvar adapter = scale._adapter;\r\n\tvar options = scale.options;\r\n\tvar timeOpts = options.time;\r\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\r\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\r\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\r\n\tvar first = min;\r\n\tvar ticks = [];\r\n\tvar time;\r\n\r\n\t// For 'week' unit, handle the first day of week option\r\n\tif (weekday) {\r\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\r\n\t}\r\n\r\n\t// Align first ticks on unit\r\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\r\n\r\n\t// Prevent browser from freezing in case user options request millions of milliseconds\r\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\r\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\r\n\t}\r\n\r\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\r\n\t\tticks.push(time);\r\n\t}\r\n\r\n\tif (time === max || options.bounds === 'ticks') {\r\n\t\tticks.push(time);\r\n\t}\r\n\r\n\treturn ticks;\r\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function generate(scale, min, max, capacity) {\n\tvar adapter = scale._adapter;\n\tvar options = scale.options;\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar first = min;\n\tvar ticks = [];\n\tvar time;\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = +adapter.startOf(first, 'isoWeek', weekday);\n\t}\n\n\t// Align first ticks on unit\n\tfirst = +adapter.startOf(first, weekday ? 'day' : minor);\n\n\t// Prevent browser from freezing in case user options request millions of milliseconds\n\tif (adapter.diff(max, min, minor) > 100000 * stepSize) {\n\t\tthrow min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n\t}\n\n\tfor (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n\t\tticks.push(time);\n\t}\n\n\tif (time === max || options.bounds === 'ticks') {\n\t\tticks.push(time);\n\t}\n\n\treturn ticks;\n}", "function scale(val, ignoreTimescale) {\n var diff = tickDelta / createjs.Ticker.getInterval();\n val = val * diff;\n if (!ignoreTimescale) {\n val *= timeScale;\n }\n\n return val;\n}", "set timeScale(pScl) {\n\t\tthis.__Internal__Dont__Modify__.timeScale = Math.max(Validate.type(pScl, \"number\", 0, true), 0);\n\t}", "function scaleTime(timeInMilliseconds) {\n const TIME_SCALE = TEMPO * 4;\n return timeInMilliseconds * (TIME_SCALE / 60);\n }", "UpdateTimeScale(time_scale) {\n this.plotObject.updatePlotTimeScale(time_scale)\n }", "function fmtTimeInterval(value, decimals, step) {\r\n decimals = (decimals === undefined ? 2 : decimals);\r\n step = (step === undefined ? 2 : step);\r\n\r\n var converted;\r\n var units = ['ns', 'us', 'ms', 's', 'min', 'h', 'd'];\r\n var absValue = Math.abs(value);\r\n var multipliers = [1000, 1000, 1000, 60, 60, 24];\r\n var multiplier = 1;\r\n var i;\r\n for (i = 0; i < units.length; i++) {\r\n if (absValue < multiplier * step * multipliers[i]) {\r\n break;\r\n } else if (i < units.length - 1) {\r\n multiplier = multiplier * multipliers[i];\r\n }\r\n }\r\n i = (i < units.length ? i : units.length - 1);\r\n\r\n convertedValue = (value / multiplier).toFixed(decimals);\r\n var unit = units[i];\r\n\r\n return {\r\n value: convertedValue,\r\n unit: unit,\r\n output: convertedValue + ' ' + unit\r\n };\r\n}", "function getTimeRange() {\n let TimeRange = d3.select('.range-slider').property('value').split(',').map(d => parseInt(d));\n return TimeRange;\n}", "function scale(data, range, axis) {\n var scale = d3.scale.linear()\n //extent returns min and max values of data\n .domain(d3.extent(data, function(d) {\n return d[axis];\n }))\n .range(range)\n \n //makes scale end at rounded values\n .nice();\n return scale;\n }", "function plotChart_time(uberPool_time, uberX_time, uberXL_time, black_time,\n\t\t\t\t\tlyft_line_time, lyft_time, lyft_plus_time, lyft_lux_time) {\n\tconsole.log(\"--jiayi time----------\")\n\tconsole.log(uberPool_time, uberX_time, uberXL_time, black_time,\n\t\t\t\t\tlyft_line_time, lyft_time, lyft_plus_time, lyft_lux_time)\n\tdocument.getElementById('uberPool_time').value = uberPool_time;\n document.getElementById('uberX_time').value = uberX_time;\n document.getElementById('uberXL_time').value = uberXL_time;\n document.getElementById('black_time').value = black_time;\n// document.getElementById('uberlower_time').value = Math.min(uberPool_time, uberX_time, uberXL_time, black_time);\n\n document.getElementById('lyft_line_time').value = lyft_line_time;\n document.getElementById('lyft_time').value = lyft_time;\n document.getElementById('lyft_plus_time').value = lyft_plus_time;\n document.getElementById('lyft_lux_time').value = lyft_lux_time;\n// document.getElementById('lyftlower_time').value = Math.min(lyft_line_time, lyft_time, lyft_plus_time, lyft_lux_time);\n\n $('#tripmap').show();\n\t$('#rateChart').show();\n}", "timeScale (rate) {\n\n if (rate) {\n this._timeScale = rate;\n }\n\n return this._timeScale;\n }", "timeScale (rate) {\n\n if (rate) {\n this._timeScale = rate;\n }\n\n return this._timeScale;\n }", "function d3_time_range(floor, step, number) {\n return function (t0, t1, dt) {\n var time = floor(t0), times = [];\n if (time < t0) step(time);\n if (dt > 1) {\n while (time < t1) {\n var date = new Date(+time);\n if (!(number(date) % dt)) times.push(date);\n step(time);\n }\n } else {\n while (time < t1) times.push(new Date(+time)), step(time);\n }\n return times;\n };\n}", "niceScale (yMin, yMax, ticks = 10) {\n if ((yMin === Number.MIN_VALUE && yMax === 0) || (!Utils.isNumber(yMin) && !Utils.isNumber(yMax))) {\n // when all values are 0\n yMin = 0\n yMax = 1\n ticks = 1\n let justRange = this.justRange(yMin, yMax, ticks)\n return justRange\n }\n\n // Calculate Min amd Max graphical labels and graph\n // increments. The number of ticks defaults to\n // 10 which is the SUGGESTED value. Any tick value\n // entered is used as a suggested value which is\n // adjusted to be a 'pretty' value.\n //\n // Output will be an array of the Y axis values that\n // encompass the Y values.\n let result = []\n // If yMin and yMax are identical, then\n // adjust the yMin and yMax values to actually\n // make a graph. Also avoids division by zero errors.\n if (yMin === yMax) {\n yMin = yMin - 10 // some small value\n yMax = yMax + 10 // some small value\n }\n // Determine Range\n let range = yMax - yMin\n let tiks = ticks + 1\n // Adjust ticks if needed\n if (tiks < 2) {\n tiks = 2\n } else if (tiks > 2) {\n tiks -= 2\n }\n\n // Get raw step value\n let tempStep = range / tiks\n // Calculate pretty step value\n\n let mag = Math.floor(this.log10(tempStep))\n let magPow = Math.pow(10, mag)\n let magMsd = parseInt(tempStep / magPow)\n let stepSize = magMsd * magPow\n\n // build Y label array.\n // Lower and upper bounds calculations\n let lb = stepSize * Math.floor(yMin / stepSize)\n let ub = stepSize * Math.ceil((yMax / stepSize))\n // Build array\n let val = lb\n while (1) {\n result.push(val)\n val += stepSize\n if (val > ub) { break }\n }\n\n // TODO: need to remove this condition below which makes this function tightly coupled with w.\n if (this.w.config.yaxis[0].max === undefined &&\n this.w.config.yaxis[0].min === undefined) {\n return {\n result,\n niceMin: result[0],\n niceMax: result[result.length - 1]\n }\n } else {\n result = []\n let v = yMin\n result.push(v)\n let valuesDivider = Math.abs(yMax - yMin) / ticks\n for (let i = 0; i <= ticks - 1; i++) {\n v = v + valuesDivider\n result.push(v)\n }\n\n return {\n result,\n niceMin: result[0],\n niceMax: result[result.length - 1]\n }\n }\n }", "function getTimeTicks(timeDomain) {\n function daysInMonth(date) {\n return 32 - new Date(date.getFullYear(), date.getMonth(), 32).getDate();\n }\n var timeRange = d3.timeMonth.range(timeDomain[0], timeDomain[1]);\n var timeTicks =\n timeRange.map(function(d) {\n return d3.timeDay.offset(d3.timeMonth.floor(d), daysInMonth(d) / 2 - 1);\n });\n return timeTicks;\n }", "drawChart(data_unparsed, data_format) {\n\n // Save object (Timedata) instance\n var self = this;\n\n // Parse data\n var data = [];\n for(var i = 0; i < data_unparsed.length; i++) {\n data.push(\n {\n date: new Date(data_unparsed[i]['date']),\n value: data_unparsed[i]['value']\n })\n }\n\n // Remove old data\n self.timedata_svg.selectAll('*').remove();\n\n // Define display translation on SVG\n var g = self.timedata_svg.append('g')\n .attr('transform', 'translate(' + self.margin.left + ',' + self.margin.top + ')');\n\n // Define x and y axis scale dimensions with respect to SVG\n var x = d3.scaleTime().rangeRound([0, self.svgWidth - 50]);\n var y = d3.scaleLinear().rangeRound([self.svgHeight, 0]);\n\n // Define line graphic from parsed data\n var line = d3.line()\n .x(function(d){ return x(d.date) })\n .y(function(d){ return y(d.value) });\n\n // Define x and y domain values\n x.domain(d3.extent(data, function(d){ return d.date }));\n y.domain(d3.extent(data, function(d){ return d.value }));\n\n // Add background grid to SVG on x axis\n g.append('g')\n .attr('class', 'grid')\n .call(d3.axisBottom(x).ticks(10)\n .tickSize(self.svgHeight)\n .tickFormat('')\n );\n\n // Add background grid to SVG on y axis\n g.append('g')\n .attr('class', 'grid')\n .call(d3.axisLeft(y).ticks(5)\n .tickSize(-(self.svgWidth-50))\n .tickFormat('')\n );\n\n // Add text on x axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .attr('transform', 'translate(0,' + self.svgHeight + ')')\n .call(d3.axisBottom(x))\n\n // Add a thich line over the x axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .call(d3.axisBottom(x))\n .attr('stroke-width', 2)\n .selectAll('text')\n .remove()\n\n // Add a thich line over the y axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .attr('transform', 'translate(' + parseInt(self.svgWidth - 50) + ', 0)')\n .call(d3.axisLeft(y))\n .attr('stroke-width', 2)\n .selectAll('text')\n .remove()\n\n // Add text on y axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .call(d3.axisLeft(y))\n .append('text')\n .attr('id', 'serie_unit')\n .attr('fill', '#000')\n .attr('transform', 'rotate(-90)')\n .attr('y', 6)\n .attr('dy', '0.71em')\n .attr('dx', '-0.71em')\n .attr('text-anchor', 'end')\n .text($(self.dataselection_name).val() +' [' + data_format.units[self.selected_map] +']');\n\n // Add data and line graphic to SVG\n g.append('path')\n .datum(data)\n .attr('fill', 'none')\n .attr('stroke', 'steelblue')\n .attr('stroke-linejoin', 'round')\n .attr('stroke-linecap', 'round')\n .attr('stroke-width', 2)\n .attr('d', line);\n\n // Define the tip position when hovering over data\n var dx_tip = -50;\n var dy_tip = 30;\n\n // Add hovering tip to every point in data\n self.timedata_svg.selectAll('.dot')\n .data(data)\n .enter().append('circle')\n .attr('class', 'dot')\n .attr('cx', function(d){ return x(d.date) + self.margin.left })\n .attr('cy', function(d){ return y(d.value) + self.margin.top })\n .attr('r', 5)\n .attr('opacity', 0.0)\n .on('mouseover', function(d){\n // Add the tip and text when hovering over a point\n\n var x_t = d3.select(this).attr('cx');\n var y_t = d3.select(this).attr('cy');\n var w = d3.select(this).attr('r');\n var h = d3.select(this).attr('r');\n var cx = parseInt(x_t)+parseInt(w)/2;\n var cy = parseInt(y_t)+parseInt(h)/2;\n var dx = cx+dx_tip;\n var dy = cy-dy_tip;\n var asdf = new Date(d.date);\n // Define text background rectangle\n self.timedata_svg.append('rect')\n .attr('id', 'tip_rect')\n .attr('x', parseInt(x_t)-70)\n .attr('y', parseInt(y_t)-60)\n .attr('width', 140)\n .attr('height', 40)\n .attr('fill', 'black')\n .attr('opacity', 0.7)\n .style('pointer-events','none');\n // Define text of the data to show (date)\n self.timedata_svg.append('text')\n .attr('id', 'tip_text_date')\n .text(''+asdf.getDate()+'/'+(asdf.getMonth()+1)+'/'+asdf.getFullYear()+'-'+('0' + asdf.getHours()).slice(-2)+':'+('0' + asdf.getMinutes()).slice(-2))\n .attr('text-anchor', 'end')\n .attr('x', parseInt(x_t)+68)\n .attr('y', parseInt(y_t)-45)\n .attr('fill', 'white')\n .attr('font-size', '16px')\n .style('pointer-events','none');\n // Define text of the data to show (value)\n self.timedata_svg.append('text')\n .attr('id', 'tip_text_value')\n .text(''+d.value.toFixed(3) + data_format.units[self.selected_map])\n .attr('text-anchor', 'end')\n .attr('x', parseInt(x_t)+68)\n .attr('y', parseInt(y_t)-25)\n .attr('fill', 'white')\n .attr('font-size', '16px')\n .style('pointer-events','none');\n // Define tip line\n self.timedata_svg.append('line')\n .attr('id', 'tip_line')\n .attr('x1', x_t)\n .attr('y1', y_t)\n .attr('x2', parseInt(x_t)-70)\n .attr('y2', parseInt(y_t)-20)\n .attr('stroke-width', 1)\n .attr('stroke', 'red')\n .style('pointer-events','none');\n // Define red circle highlight\n self.timedata_svg.append('circle')\n .attr('id', 'tip_circle')\n .attr('cx', x_t)\n .attr('cy', y_t)\n .attr('r', 3)\n .attr('fill', 'red')\n .style('pointer-events','none');\n $(this).attr('class', 'focus')\n })\n .on('mouseout', function(){\n // Delete the tip and text when hovering outside data point\n\n d3.select('#tip_rect').remove();\n d3.select('#tip_text_date').remove();\n d3.select('#tip_text_value').remove();\n d3.select('#tip_line').remove();\n d3.select('#tip_circle').remove();\n $(this).attr('class', 'dot')\n });\n }", "function updateTimescale() {\n var lineDataByBrand = captureLineData();\n\n d3.selectAll('.line')\n .transition()\n .duration(1000)\n .attr({ 'd': function(d) { return path(d); } });\n }", "function generate(scale, min, max, capacity) {\n var adapter = scale._adapter;\n var options = scale.options;\n var timeOpts = options.time;\n var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n var stepSize = resolve$5([timeOpts.stepSize, timeOpts.unitStepSize, 1]);\n var weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n var first = min;\n var ticks = [];\n var time; // For 'week' unit, handle the first day of week option\n\n if (weekday) {\n first = +adapter.startOf(first, 'isoWeek', weekday);\n } // Align first ticks on unit\n\n\n first = +adapter.startOf(first, weekday ? 'day' : minor); // Prevent browser from freezing in case user options request millions of milliseconds\n\n if (adapter.diff(max, min, minor) > 100000 * stepSize) {\n throw min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor;\n }\n\n for (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {\n ticks.push(time);\n }\n\n if (time === max || options.bounds === 'ticks') {\n ticks.push(time);\n }\n\n return ticks;\n }", "componentWillMount() {\n this.getTimeScale('3m');\n this.getTimeScale('6m');\n this.getTimeScale('1y');\n this.getTimeScale('max');\n }", "function updateTimeLine () {\n var meanCol = columnMean(parsedData.colBased)\n // set the domains for yScaleTLOri, xScaleTL\n timeLine.yScaleOri.domain(\n d3.extent(meanCol, function (d) {\n return d.val\n })\n )\n timeLine.xScale.domain(d3.extent(Object.keys(parsedData.colBased)))\n timeLine.xScale.domain(d3.extent(Array.from(Array(Object.keys(parsedData.colBased).length).keys())))\n\n // update yAxisTLOri and xAxisTL\n d3.select('#g-xAxisTL')\n .call(timeLine.xAxisTL)\n .selectAll('text')\n .attr('font-weight', 'normal')\n .style('text-anchor', 'end')\n .attr('dx', '.8em')\n .attr('dy', '.5em')\n .attr('transform', function (d) {\n return 'rotate(-30)'\n })\n d3.select('#g-yAxisTLOri')\n .call(timeLine.yAxisOri)\n\n // attach data to x&yaxis and draw the linear timeline of the orignal dataset\n d3.select('#pathTimelineOri')\n .datum(meanCol)\n .attr('fill', 'none')\n .attr('stroke', 'black')\n .attr('stroke-linejoin', 'round')\n .attr('stroke-linecap', 'round')\n .attr('stroke-width', 2)\n .attr('d', timeLine.lineOri)\n .attr('transform', 'translate(' + globalSettings.xpadding + ',' + -globalSettings.ypadding + ')')\n\n // draw points in the timeline\n d3.select('#g-TLPointsOri')\n .selectAll('rect').remove()\n d3.select('#g-TLPointsOri')\n .selectAll('rect')\n .data(meanCol)\n .enter()\n .append('rect')\n .attr('id', function (d) {\n return 'c' + d.col\n })\n .attr('x', function (d) {\n return timeLine.xScale(d.idx) - timeLine.wPoints / 2\n })\n .attr('y', function (d) {\n return timeLine.yScaleOri(d.val) - timeLine.hPoints / 2\n })\n .attr('height', timeLine.wPoints)\n .attr('width', timeLine.hPoints)\n .attr('stroke', 'black')\n .attr('stroke-width', 1)\n .attr('fill', 'black')\n .on('mouseover', mouseOverOri)\n .on('mouseout', mouseOutOri)\n}", "function setTickDuration() {\n\ttickDuration = Math.round(60000/bpm/ticksPerBeat)\n}", "function Time() {\n this._clock = void 0;\n this._timeScale = void 0;\n this._deltaTime = void 0;\n this._startTime = void 0;\n this._lastTickTime = void 0;\n this._clock = wechatAdapter.performance ? wechatAdapter.performance : Date;\n this._timeScale = 1.0;\n this._deltaTime = 0.0001;\n\n var now = this._clock.now();\n\n this._startTime = now;\n this._lastTickTime = now;\n }", "function initTimeUnits () {\n var divider = 1;\n timeUnits.forEach(function (unit) {\n divider = divider * unit[1];\n unit[1] = divider;\n });\n timeUnits.reverse();\n}", "function timeModel(data) {\r\n\t// create map to store incidents and their times of occurence\r\n\tvar incidentMap = new Map();\r\n\tfor (var incIn = 1; incIn < data.length; incIn++) {\r\n\t\tvar parsedDate = Date.parse(data[incIn][6]);\r\n\t\tvar currentDate = new Date(parsedDate);\r\n\t\tif (incidentMap.get(data[incIn][3]) != null) {\r\n\t\t\tvar numIncidents = incidentMap.get(data[incIn][3]).get(\r\n\t\t\t\t\tcurrentDate.getUTCHours()) + 1;\r\n\t\t\tincidentMap.get(data[incIn][3]).set(currentDate.getUTCHours(),\r\n\t\t\t\t\tnumIncidents);\r\n\t\t} else {\r\n\t\t\t// create map to store time data\r\n\t\t\tvar timeList = new Map();\r\n\t\t\tfor (var i = 0; i < 24; i++) {\r\n\t\t\t\ttimeList.set(i, 0);\r\n\t\t\t}\r\n\t\t\ttimeList.set(currentDate.getUTCHours(), 1);\r\n\t\t\tincidentMap.set(data[incIn][3], timeList);\r\n\t\t}\r\n\t}\r\n\tgoogle.charts.setOnLoadCallback(drawChart3(incidentMap));\r\n}", "function makeColorScale(data){\n\n var colorScale=d3.scale.quantile()//use quantile for scale generator\n .range(objectColors[expressed]);//incorporate objectColors array to change depending on variable\n\n//creating equal interval classifcation\n var minmax = [\n d3.min(data, function(d) { return parseFloat(d[expressed]); }),\n d3.max(data, function(d) { return parseFloat(d[expressed]); })\n ];\n //assign two-value array as scale domain\n colorScale.domain(minmax);\n return colorScale;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\tvar major = determineMajorUnit(minor);\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function drawTimeSeries(regionData) {\n let dataset = d3.nest().key(d => d[\"Sensor-id\"]).entries(regionData);\n var yMin = d3.min(dataset, d => d3.min(d.values, v => v.value_median)),\n yMax = d3.max(dataset, d => d3.max(d.values, v => v.Value)) + 100;\n\n let qTotal = d3.nest().key(d=>d[\"Sensor-id\"]).rollup(v=> {\n return {\n // Timestamp = v.value.Timestamp,\n q25sum : d3.sum(v, d => d.value_quantile25),\n q75sum : d3.sum(v, d => d.value_quantile75)\n };\n }).entries(regionData);\n\n let qTotalMax = d3.max(qTotal, d=>d.value.q75sum)\n let qTotalMin = d3.min(qTotal, d=>d.value.q25sum)\n\n let q25 = qTotal.map(d=>d.value.q25sum)\n let q75 = qTotal.map(d=>d.value.q75sum)\n\n // debugger\n\n\n tsxScale.domain(d3.extent(regionData, d => d.Timestamp));\n tsyScale.domain([yMin, yMax]);\n // Setting a duplicate xdomain for burshing reference\n tsxScale2.domain(tsxScale.domain());\n tsxScale3.domain(tsxScale.domain());\n\n // Create invisible rect for mouse tracking\n svgTs.append(\"rect\")\n .attr(\"width\", tsWidth)\n .attr(\"height\", tsHeight)\n .attr(\"x\", 0)\n .attr(\"y\", 0)\n .attr(\"id\", \"mouse-tracker\")\n .style(\"fill\", \"none\");\n\n // --------------------------For slider part--------------------------\n var context = svgTs.append(\"g\")\n .attr(\"class\", \"context\")\n .attr(\"transform\", \"translate(\" + 0 + \",\" + 630 + \")\");\n\n // Append clip path for lines plotted, hiding those part out of bounds\n svgTs.append(\"defs\")\n .append(\"clipPath\")\n .attr(\"id\", \"clip\")\n .append(\"rect\")\n .attr(\"width\", tsWidth)\n .attr(\"height\", tsHeight);\n\n var brush = d3.brushX()\n .extent([[0, 0], [tsWidth, tsHeight2]])\n .on(\"brush\", brushing)\n .on(\"end\", brushended);\n\n // Create brushing tsxAxis\n context.append(\"g\")\n .attr(\"class\", \"axis axis--x\")\n .attr(\"transform\", \"translate(0,\" + tsHeight2 + \")\")\n .call(tsxAxis2);\n context.append(\"g\")\n .attr(\"class\", \"axis axis--grid\")\n .attr(\"transform\", \"translate(0,\" + tsHeight2 + \")\")\n .call(tsxAxis3);\n context.append(\"g\")\n .attr(\"class\", \"brush\")\n .call(brush);\n// --------------------------End slider part--------------------------\n\n //Draw line graph\n svgTs.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,\" + tsHeight + \")\")\n .call(tsxAxis);\n\n svgTs.append(\"g\")\n .attr(\"class\", \"y axis\")\n .call(tsyAxis);\n\n svgTs.append(\"g\")\n .append(\"text\")\n .attr(\"y\", -18)\n .attr(\"x\", -4)\n .attr(\"dy\", \"0.7em\")\n .style(\"text-anchor\", \"end\")\n .text(\"cpm\")\n .attr(\"fill\", \"#000000\");\n\n// Draw focus\n var focus = svgTs.append(\"g\")\n .attr(\"class\", \"circle\")\n .style(\"display\", \"none\")\n .attr(\"pointer-events\", \"none\");\n focus.append(\"circle\")\n .attr(\"r\", 3);\n\n// create a tooltip\n var tooltip = d3.select(\"#timeSeries\")\n .append(\"div\")\n .style(\"opacity\", 0)\n .attr(\"class\", \"tstooltip\")\n\n// define areas\n var upperAreas = svgTs.selectAll(\".u-area-group\")\n .data(dataset)\n .enter()\n .append(\"g\")\n .attr(\"clip-path\", \"url(#clip)\")\n .attr(\"class\", \"u-area-group\")\n\n var lowerAreas = svgTs.selectAll(\".l-area-group\")\n .data(dataset)\n .enter()\n .append(\"g\")\n .attr(\"clip-path\", \"url(#clip)\")\n .attr(\"class\", \"l-area-group\")\n // .attr(\"id\", d=> \"area-group-\" + d.key);\n\n upperAreas.append(\"path\")\n .attr(\"class\", \"u-area\")\n .attr(\"d\", d => d.visible ? upperArea(d.values) : null)\n .style(\"fill\", d => getColorTs(d.key))\n .attr(\"id\", d => \"u-area-\" + d.key)\n .on(\"click\", d => {\n return d.visible = !d.visible;\n });\n\n lowerAreas.append(\"path\")\n .attr(\"class\", \"l-area\")\n .attr(\"d\", d => d.visible ? lowerArea(d.values) : null)\n .style(\"fill\", d => getColorTs(d.key))\n .attr(\"id\", d => \"l-area-\" + d.key)\n .on(\"click\", d => {\n return d.visible = !d.visible;\n });\n toolTipLine();\n// Draw Line\n var lines = svgTs.selectAll(\".line-group\")\n .data(dataset)\n .enter()\n .append(\"g\")\n .attr(\"clip-path\", \"url(#clip)\")\n .attr(\"class\", \"line-group\")\n .attr(\"id\", d => \"line-\" + d.key);\n\n lines.append(\"path\")\n .attr(\"class\", \"line\")\n .attr(\"d\", d => d.visible ? line(d.values) : null)\n // .attr(\"d\", d=> line(d.values))\n .style(\"stroke\", d => getColorTs(d.key))\n // .style(\"fill-opacity\", 0.5)\n .attr(\"id\", d => \"lin-\" + d.key)\n // .on(\"click\", (d, i) => {\n //\n // d.visible = !d.visible;\n // // Update graph\n // upperAreas.select(\"#u-area-\" + d.key)\n // .transition()\n // .attr(\"d\", d => d.visible ? upperArea(d.values) : null);\n // lowerAreas.select(\"#l-area-\" + d.key)\n // .transition()\n // .attr(\"d\", d => d.visible ? upperArea(d.values) : null);\n // // maxLines.select(\"#maxline-\" + d.key)\n // // .transition()\n // // .attr(\"d\",d=>d.visible? maxLine(d.values):null);\n // // minLines.select(\"#minline-\" + d.key)\n // // .transition()\n // // .attr(\"d\", d=>d.visible? minLine(d.values):null);\n // // if(d.visible){\n // // plot_dots(\"d\");\n // // }else{\n // // null;\n // // }\n // // plot_dots(d.key);\n // })\n .on(\"mouseover\", function (d,i) {\n // change line opacity\n d3.selectAll('.line').style(\"opacity\", 0.1);\n d3.select(this).style(\"opacity\", 1).style(\"stroke-width\", \"2px\");\n\n // change areas opacity\n d3.selectAll('.u-area').style(\"opacity\",0.1);\n d3.select(\"#u-area-\" + d.key).style(\"opacity\",1)\n d3.selectAll('.l-area').style(\"opacity\",0.1);\n d3.select(\"#l-area-\" + d.key).style(\"opacity\",1)\n\n // change legend box opacity\n d3.selectAll(\".legend\").style(\"opacity\", 0.1);\n d3.select(\"#leg-\" + d.key).style(\"opacity\", 1);\n\n // change mobile route opacity (on map)\n d3.selectAll(\".mobileRoute\").style(\"opacity\", 0.1)\n d3.select(\"#route-\" + d.key).style(\"opacity\", 1)\n\n // change dots opacity (on map)\n d3.selectAll(\".dots\").style(\"opacity\",0.1)\n d3.selectAll(\".dots-\" + d.key).style(\"opacity\",1)\n\n // Show circle\n var x0 = tsxScale.invert(d3.mouse(this)[0]),\n x1 = d3.timeMinute.every(5).round(x0),\n i = bisectDate(d.values, x1);\n focus.attr(\"transform\", \"translate(\" + tsxScale(x1) + \",\" + tsyScale(d.values[i].value_median) + \")\"); // Find position\n focus.style(\"display\", null);\n focus.selectAll(\"circle\")\n // .attr(\"id\", f=>\"circle-\" + f.key)\n .attr(\"fill\", getColorTs(d.key));\n\n\n // Show tooltip\n // tooltip.style(\"display\", null)\n tooltip.transition()\n .duration(200)\n .style(\"opacity\", 1);\n tooltip\n .html(\"Sensor: \" + d.key + \"<br>\"\n + \"Time: \" + d.values[i].Timestamp.toLocaleTimeString([], {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit'\n }) + \"<br>\"\n + \"Median: \" + d.values[i].value_median.toFixed(2) + \" (cpm)\" + \"<br>\"\n + \"Max: \" + d.values[i].Value.toFixed(2) + \" (cpm)\" + \"<br>\"\n + \"Min: \" + d.values[i].value_min.toFixed(2) + \" (cpm)\" + \"<br>\")\n .style(\"left\", (d3.event.pageX + 9) + \"px\")\n .style(\"top\", (d3.event.pageY - 43) + \"px\");\n debugger\n\n })\n .on(\"mouseout\", function () {\n // change opacity\n d3.selectAll('.line').style(\"opacity\", 1);\n // d3.select(this).style(\"stroke-width\", \"1.5px\");\n d3.selectAll(\".legend\").style(\"opacity\", 1);\n d3.selectAll(\".mobileRoute\").style(\"opacity\", 0.5)\n d3.selectAll(\".dots\").style(\"opacity\",0.5)\n d3.selectAll(\".u-area\").style(\"opacity\",0.5)\n d3.selectAll(\".l-area\").style(\"opacity\",0.5)\n\n focus.style(\"display\", \"none\");\n\n // Hide tooltip\n tooltip.style(\"opacity\", 0)\n });\n\n // Draw legend\n var legendSpace = tsHeight / (dataset.length + 1);\n var legend = svgTs.selectAll('.legend')\n .data(dataset)\n .enter()\n .append(\"g\")\n .attr(\"class\", \"legend\")\n .attr(\"id\", d => \"leg-\" + d.key);\n\n legend.append(\"rect\")\n // .attr(\"width\", (d,i)=>((q75[i] - q25[i])/1500 ))\n // .attr(\"height\", (d,i)=>((q75[i] - q25[i])/1500 ))\n .attr(\"width\", (d,i)=>((q75[i] - q25[i])/500 ))\n .attr(\"height\", 10)\n // .attr(\"width\",12)\n // .attr(\"height\",12)\n .attr(\"x\", tsWidth + (tsMargin.right / 3) - 25)\n .attr(\"y\", (d, i) => (i + 1 ) * legendSpace -4)\n // .attr(\"stroke\",\"black\")\n // .attr(\"stroke-width\",(d,i)=>{\n // return (d.values[i].Value - d.values[i].value_min)/250 + 3\n // })\n .attr(\"fill\", d => d.visible ? getColorTs(d.key) : greyBtn)\n // .attr(\"fill\", d => getColorTs(d.key))\n .attr(\"class\", \"legend-box\")\n .on(\"click\", (d, i) => {\n d.visible = !d.visible;\n\n //Update axis\n maxY = findMaxY(dataset);\n minY = findMinY(dataset);\n tsyScale.domain([minY, maxY]).nice();\n svgTs.select(\".y.axis\")\n .transition()\n .call(tsyAxis);\n\n // Update graph\n lines.select(\"#lin-\"+d.key)\n .transition()\n .attr(\"d\", d => d.visible ? line(d.values) : null);\n // update legend\n legend.select(\"rect\")//(\"#leg-\"+d.key)\n .transition()\n .attr(\"fill\", d => d.visible ? getColorTs(d.key) : greyBtn);\n\n // // update upper area\n upperAreas.select(\"#u-area-\" + d.key)\n .transition()\n .attr(\"d\",d=>d.visible?upperArea(d.values):null)\n // .attr(\"d\", d => {\n // if (!d.visible) {\n // null;\n // }\n // });\n // update\n lowerAreas.select(\"#l-area-\" + d.key)\n .transition()\n .attr(\"d\",d=>d.visible?lowerArea(d.values):null)\n\n // .attr(\"d\", d => {\n // if (!d.visible) {\n // null;\n // }\n // });\n\n if (d.visible) {\n //plot sensor routes on map\n tsRoutes(d.key);\n tsDots(d.key);\n // plot_dots(d.key);\n }else{\n //remove sensor routes, icons and dots from map\n removePlot(d.key);\n }\n })\n .on(\"mouseover\", function (d) {\n // d3.select(this)\n // .transition()\n // .attr(\"fill\", d => getColorTs(d.key));\n // change line opacity\n d3.selectAll('.line').style(\"opacity\", 0.1);\n d3.select(\"#lin-\" + d.key).style(\"opacity\", 1);\n // change legend opacity\n d3.selectAll(\".legend\").style(\"opacity\", 0.1);\n d3.select(\"#leg-\" + d.key).style(\"opacity\", 1);\n\n // change areas opacity\n d3.selectAll('.u-area').style(\"opacity\",0.1);\n d3.select(\"#u-area-\" + d.key).style(\"opacity\",1)\n d3.selectAll('.l-area').style(\"opacity\",0.1);\n d3.select(\"#l-area-\" + d.key).style(\"opacity\",1)\n\n // change mobile route opacity (on map)\n d3.selectAll(\".mobileRoute\").style(\"opacity\", 0.1)\n d3.select(\"#route-\" + d.key).style(\"opacity\", 1)\n\n // change dots opacity (on map)\n d3.selectAll(\".dots\").style(\"opacity\",0.1)\n d3.selectAll(\".dots-\" + d.key).style(\"opacity\",1)\n\n })\n\n .on(\"mouseout\", function (d) {\n // d3.select(this)\n // .transition()\n // .attr(\"fill\", d => d.visible ? getColorTs(d.key) : greyBtn);\n\n d3.selectAll('.line').style(\"opacity\", 1);\n d3.select(this).style(\"stroke-width\", \"2px\");\n d3.selectAll(\".legend\").style(\"opacity\", 1);\n d3.selectAll(\".mobileRoute\").style(\"opacity\", 0.5)\n d3.selectAll(\".dots\").style(\"opacity\",0.5)\n d3.selectAll(\".u-area\").style(\"opacity\",0.5)\n d3.selectAll(\".l-area\").style(\"opacity\",0.5)\n\n focus.style(\"display\", \"none\");\n\n // Hide tooltip\n tooltip.style(\"opacity\", 0)\n });\n\n legend.append(\"text\")\n .attr(\"x\", tsWidth + (tsMargin.right / 3 + 10 ))\n .attr(\"y\", (d, i) => (i + 1) * legendSpace + 4)\n .attr(\"class\", \"legend-text\")\n .attr(\"fill\", \"#5d5d5d\")\n .style(\"font-size\", \"11\")\n .text(d => d.key);\n\n // draw a vertical line, to control movement of sensors on the map over time.\n function toolTipLine(){\n var mouseG = svgTs.append(\"g\")\n .attr(\"class\", \"mouse-over-effects\");\n\n mouseG.append(\"path\") // this is the black vertical line to follow mouse\n .attr(\"class\", \"mouse-line\")\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", \"1px\")\n .style(\"opacity\", \"0\");\n\n var lines = document.getElementsByClassName('line');\n\n var mousePerLine = mouseG.selectAll('.mouse-per-line')\n .data(dataset)\n .enter()\n .append(\"g\")\n .attr(\"class\", \"mouse-per-line\");\n\n // mousePerLine.append(\"circle\")\n // .attr(\"r\", 4)\n // .style(\"stroke\", function(d) {\n // return getColorTs(d.key);\n // })\n // .style(\"fill\", \"none\")\n // .style(\"stroke-width\", \"1px\")\n // .style(\"opacity\", \"0\");\n //\n // mousePerLine.append(\"text\")\n // .attr(\"transform\", \"translate(10,3)\")\n\n mouseG.append('svg:rect') // append a rect to catch mouse movements on canvas\n .attr('width', tsWidth) // can't catch mouse events on a g element\n .attr('height', tsHeight)\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-line circle\")\n // .style(\"opacity\", \"0\");\n // d3.selectAll(\".mouse-per-line text\")\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-line circle\")\n // .style(\"opacity\", \"1\");\n // d3.selectAll(\".mouse-per-line text\")\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] + \",\" + tsHeight;\n d += \" \" + mouse[0] + \",\" + 0;\n return d;\n });\n\n\n d3.selectAll(\".mouse-per-line\")\n .attr(\"transform\", function(d, i) {\n console.log(tsWidth/mouse[0])\n\n var xDate = tsxScale.invert(mouse[0]);\n var x1 = d3.timeMinute.every(5).round(xDate),\n\n idx = bisectDate(d.values, x1);\ndebugger\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(tsyScale.invert(pos.y))\n .attr(\"font-size\",\"11px\");\n // \"#dot-\" + d.key + \"-\" + idx.style(\"fill\",\"white\").style(\"opacity\",1);\n let xPos = d3.select(\"#dot-\" + d.key + \"-\" + idx).attr(\"cx\");\n\n let yPos = d3.select(\"#dot-\" + d.key + \"-\" + idx).attr(\"cy\");\ndebugger\n d3.select(\"#carIcon-\" + d.key )\n .transition()\n .duration(2000)\n // .attrTween(\"transform\", translateAlong(tsRoutes.node()))\n .ease(d3.easeLinear)\n .attr(\"x\", xPos-5)\n .attr(\"y\", yPos-5);\n // .attr(\"transform\", (d,i)=> {\n // return \"translate(\" + [projectionTs([d.values[i].Long,d.values[i].Lat])[0]-5,projectionTs([d.values[i].Long,d.values[i].Lat])[1]-5] + \")\";\n // });\n// debugger\n return \"translate(\" + mouse[0] + \",\" + pos.y +\")\";\n });\n });\n }\n\n\n //For brusher of the slider bar at the bottom\n function brushing() {\n tsxScale.domain(!d3.event.selection ? tsxScale2.domain() : d3.event.selection.map(tsxScale2.invert)); // If brush is empty then reset the tsxScale domain to default, if not then make it the brush extent\n reDraw();\n }\n\n function brushended() {\n if (!d3.event.sourceEvent) {\n return; // Only transition after input;\n }\n if (!d3.event.selection) {\n tsxScale.domain(tsxScale2.domain());\n } else {\n var d0 = d3.event.selection.map(tsxScale2.invert),\n d1 = d0.map(d3.timeHour.round);\n // If empty when rounded, use floor & ceil instead.\n if (d1[0] >= d1[1]) {\n d1[0] = d3.timeHour.floor(d0[0]);\n d1[1] = d3.timeHour.offset(d1[0]);\n }\n d3.select(this).transition().call(d3.event.target.move, d1.map(tsxScale2));\n tsxScale.domain([d1[0], d1[1]]);\n }\n reDraw();\n }\n\n function reDraw() {\n svgTs.select(\".x.axis\")\n .transition()\n .call(tsxAxis);\n\n maxY = findMaxY(dataset);\n minY = findMinY(dataset);\n tsyScale.domain([minY, maxY]).nice();\n\n svgTs.select(\".y.axis\")\n .transition()\n .call(tsyAxis);\n\n lines.select(\".line-group path\")\n .transition()\n .attr(\"d\", d => d.visible ? line(d.values) : null);\n\n upperAreas.select(\".u-area-group path\")\n .transition()\n .attr(\"d\", d => d.visible ? upperArea(d.values) : null);\n lowerAreas.select(\".l-area-group path\")\n .transition()\n .attr(\"d\", d => d.visible ? lowerArea(d.values) : null);\n\n }\n\n // function to remove mobile dots on map\n function removePlot(sensor){\n d3.selectAll(\".dots-\" + sensor).remove();\n d3.select(\"#route-\" + sensor).remove();\n d3.selectAll(\"#carIcon-\" + sensor).remove();\n\n }\n}", "function setupProbVsTime(){\n $(\".graph-container\").empty();\n graph = d3.select(\".graph-container\").append(\"svg\")\n .attr(\"class\",\"graph\").attr(\"height\", graph_container_height)\n .attr(\"width\",parseInt(graph_container_width)).append(\"g\")\n .attr(\"transform\",\"translate(\" + graph_margin.left + \",\" + graph_margin.top + \")\");\n\n graph.selectAll(\".y-line\").data(y_scale.ticks(1)).enter().append(\"line\")\n .attr(\"class\", \"y-line\")\n .attr('x1', 0)\n .attr('x2', graph_width)\n .attr('y1', y_scale)\n .attr('y2',y_scale);\n \n graph.selectAll(\".x-line\").data(x_scale.ticks(1)).enter().append(\"line\")\n .attr(\"class\", \"x-line\").attr('x1', x_scale)\n .attr('x2', x_scale).attr('y1', 0)\n .attr('y2',graph_height);\n\n graph.append(\"rect\")\n .attr(\"x\",0)\n .attr(\"y\",0)\n .attr(\"width\",graph_width)\n .attr(\"height\",graph_height)\n .attr(\"fill\",\"#e4e4e4\");\n \n graph.selectAll(\".y-scale-label\").data(y_scale.ticks(6)).enter().append(\"text\")\n .attr(\"class\", \"y-scale-label\")\n .attr(\"x\",x_scale(0))\n .attr('y',y_scale)\n .attr(\"text-anchor\",\"end\")\n .attr(\"dy\",\"0.3em\")\n .attr(\"dx\",\"-0.1em\")\n .text(String);\n \n graph.append(\"text\")\n .attr(\"class\", \"time-label\")\n .attr(\"x\",graph_width/2)\n .attr('y',y_scale(0))\n .attr(\"text-anchor\",\"middle\")\n .attr(\"dy\",\"2em\")\n //.attr(\"dx\",\"-0.1em\")\n .text(\"Time\");\n\n graph.append(\"text\")\n .attr(\"class\", \"prob-label\")\n .attr(\"x\",x_scale(0))\n .attr(\"y\",graph_height/2)\n .attr(\"text-anchor\",\"middle\")\n .attr(\"transform\",'rotate(-90 -12,65)')\n .text(\"Probability\");\n }", "function d3_time_range(floor, step, number) {\n return function(t0, t1, dt) {\n var time = floor(t0),\n times = [];\n if (time < t0) step(time);\n if (dt > 1) {\n while (time < t1) {\n var date = new Date(+time);\n if (!(number(date) % dt)) times.push(date);\n step(time);\n }\n } else {\n while (time < t1) times.push(new Date(+time)), step(time);\n }\n return times;\n };\n }", "function generate(min, max, capacity, options) {\n\t\tvar timeOpts = options.time;\n\t\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\t\tvar major = determineMajorUnit(minor);\n\t\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\t\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\t\tvar majorTicksEnabled = options.ticks.major.enabled;\n\t\tvar interval = INTERVALS[minor];\n\t\tvar first = moment(min);\n\t\tvar last = moment(max);\n\t\tvar ticks = [];\n\t\tvar time;\n\n\t\tif (!stepSize) {\n\t\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t\t}\n\n\t\t// For 'week' unit, handle the first day of week option\n\t\tif (weekday) {\n\t\t\tfirst = first.isoWeekday(weekday);\n\t\t\tlast = last.isoWeekday(weekday);\n\t\t}\n\n\t\t// Align first/last ticks on unit\n\t\tfirst = first.startOf(weekday ? 'day' : minor);\n\t\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t\t// Make sure that the last tick include max\n\t\tif (last < max) {\n\t\t\tlast.add(1, minor);\n\t\t}\n\n\t\ttime = moment(first);\n\n\t\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t\t// stepSize there is between first and the previous major time.\n\t\t\ttime.startOf(major);\n\t\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t\t}\n\n\t\tfor (; time < last; time.add(stepSize, minor)) {\n\t\t\tticks.push(+time);\n\t\t}\n\n\t\tticks.push(+time);\n\n\t\treturn ticks;\n\t}", "function formatTicks(d) \r\n {\r\n return d3\r\n .format(\"~s\")(d) // will change 0's to M, G, T\r\n\r\n // now replace those single letter to something more meaningful to users\r\n .replace(\"M\", \" mil\") // million\r\n .replace(\"G\", \" bn\") // billion\r\n ;\r\n }", "function unscaleTime(scaledTime) {\n const TIME_SCALE = TEMPO * 4;\n return scaledTime / (TIME_SCALE / 60);\n }", "function drawTimeGraph(station_times_url) {\n // If mobile device, make it a bit smaller\n if ($(window).width() < 431) {\n var margin = { top: 30, right: 30, bottom: 30, left: 50 },\n width = 360 - margin.left - margin.right,\n height = 300 - margin.top - margin.bottom;\n }\n\n else {\n var margin = { top: 30, right: 30, bottom: 30, left: 50 },\n width = 400 - margin.left - margin.right,\n height = 300 - margin.top - margin.bottom;\n }\n\n var x = d3.scale.linear().range([0, width])\n var y = d3.scale.linear().range([height, 0]);\n\n var color = d3.scale.category10();\n\n var xAxis = d3.svg.axis()\n .scale(x)\n .ticks(12)\n .orient(\"bottom\");\n\n var yAxis = d3.svg.axis()\n .scale(y)\n .ticks(5)\n .orient(\"left\");\n\n var line = d3.svg.line()\n .interpolate(\"basis\")\n .x(function (d) { return x(d.TIME); })\n .y(function (d) { return y(d.AMOUNT); });\n\n\n var svg = d3.select(\"#graphContainer\").append(\"svg\")\n .attr(\"width\", width + margin.left + margin.right)\n .attr(\"height\", height + margin.top + margin.bottom)\n .append(\"g\")\n .attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\")\n .attr(\"preserveAspectRatio\", \"xMinYMin meet\")\n .attr(\"viewBox\", \"0 0 300 300\")\n .classed(\"svg-content\", true);\n\n d3.json(station_times_url, function (error, data) {\n color.domain(d3.keys(data[0]).filter(function (key) { return key !== \"TIME\"; }));\n\n\n var time_series = color.domain().map(function (name) {\n return {\n name: name,\n values: data.map(function (d) {\n return { TIME: d.TIME, AMOUNT: +d[name] };\n })\n };\n });\n\n x.domain([0, 24])\n\n y.domain([0, d3.max(time_series, function (c) { return d3.max(c.values, function (v) { return v.AMOUNT; }); })\n ]);\n\n svg.append(\"g\")\n .attr(\"class\", \"x axis\")\n .attr(\"transform\", \"translate(0,\" + height + \")\")\n .style({ 'stroke': '#5b5b5b', 'fill': 'none', 'stroke-width': '1px' })\n .call(xAxis);\n\n svg.append(\"g\")\n .attr(\"class\", \"y axis\")\n .style({ 'stroke': '#5b5b5b', 'fill': 'none', 'stroke-width': '1px' })\n .call(yAxis);\n\n\n\n var time_serie = svg.selectAll(\".timeSeries\")\n .data(time_series)\n .enter().append(\"g\")\n .attr(\"class\", \"timeSeries\");\n\n var path = svg.selectAll(\".timeSeries\").append(\"path\")\n .attr(\"class\", \"line\")\n .attr(\"d\", function (d) { return line(d.values); })\n .attr(\"data-legend\", function (d) { return d.name })\n .style(\"stroke\", function (d) {\n if (d.name == \"DEPARTURES\") { return \"#004080\" }\n else { return \"#EE6C4D\"; }\n });\n\n var totalLength = [path[0][0].getTotalLength(), path[0][1].getTotalLength()];\n\n d3.select(path[0][0])\n .attr(\"stroke-dasharray\", totalLength[0] + \" \" + totalLength[0])\n .attr(\"stroke-dashoffset\", totalLength[0])\n .transition()\n .duration(1000)\n .ease(\"linear\")\n .attr(\"stroke-dashoffset\", 0);\n\n d3.select(path[0][1])\n .attr(\"stroke-dasharray\", totalLength[1] + \" \" + totalLength[1])\n .attr(\"stroke-dashoffset\", totalLength[1])\n .transition()\n .duration(1000)\n .ease(\"linear\")\n .attr(\"stroke-dashoffset\", 0);\n\n\n var legend = svg.append(\"g\")\n .attr(\"class\", \"legend\")\n .attr(\"transform\", \"translate(20,30)\")\n .style(\"font-size\", \"14px\")\n .call(d3.legend)\n\n });\n\n}", "function generate(min, max, capacity, options) {\n var timeOpts = options.time;\n var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n var major = determineMajorUnit(minor);\n var stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n var weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n var majorTicksEnabled = options.ticks.major.enabled;\n var interval = INTERVALS[minor];\n var first = moment(min);\n var last = moment(max);\n var ticks = [];\n var time;\n\n if (!stepSize) {\n stepSize = determineStepSize(min, max, minor, capacity);\n }\n\n // For 'week' unit, handle the first day of week option\n if (weekday) {\n first = first.isoWeekday(weekday);\n last = last.isoWeekday(weekday);\n }\n\n // Align first/last ticks on unit\n first = first.startOf(weekday ? 'day' : minor);\n last = last.startOf(weekday ? 'day' : minor);\n\n // Make sure that the last tick include max\n if (last < max) {\n last.add(1, minor);\n }\n\n time = moment(first);\n\n if (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n // Align the first tick on the previous `minor` unit aligned on the `major` unit:\n // we first aligned time on the previous `major` unit then add the number of full\n // stepSize there is between first and the previous major time.\n time.startOf(major);\n time.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n }\n\n for (; time < last; time.add(stepSize, minor)) {\n ticks.push(+time);\n }\n\n ticks.push(+time);\n\n return ticks;\n }", "function autoTimeFormat(date) {\n var formatMillisecond = d3_time_format_1.timeFormat('.%L'), formatSecond = d3_time_format_1.timeFormat(':%S'), formatMinute = d3_time_format_1.timeFormat('%I:%M'), formatHour = d3_time_format_1.timeFormat('%I %p'), formatDay = d3_time_format_1.timeFormat('%a %d'), formatWeek = d3_time_format_1.timeFormat('%b %d'), formatMonth = d3_time_format_1.timeFormat('%B'), formatYear = d3_time_format_1.timeFormat('%Y');\n return (d3_time_1.timeSecond(date) < date ? formatMillisecond\n : d3_time_1.timeMinute(date) < date ? formatSecond\n : d3_time_1.timeHour(date) < date ? formatMinute\n : d3_time_1.timeDay(date) < date ? formatHour\n : d3_time_1.timeMonth(date) < date ? (d3_time_1.timeWeek(date) < date ? formatDay : formatWeek)\n : d3_time_1.timeYear(date) < date ? formatMonth\n : formatYear)(date);\n}", "function updateTime() {\n if (typeof envData === 'undefined') {\n return;\n }\n else if (scope.currenttime > envData[envData.length -1].time) {\n timeData[0].time = envData[envData.length -1].time;\n timeData[1].time = envData[envData.length -1].time;\n }\n else if (scope.currenttime < envData[0].time) {\n timeData[0].time = envData[0].time;\n timeData[1].time = envData[0].time;\n }\n else if (typeof timeData !== 'undefined') { \n timeData[0].time = scope.currenttime;\n timeData[1].time = scope.currenttime;\n }\n \n svg.select('#timeLine')\n .datum(timeData)\n .transition() \n .attr(\"d\", currentTimeLine)\n .ease(\"linear\")\n .duration(150); \n }", "function drawTimeUi() {\n ctx.save();\n ctx.fillStyle = '#222';\n\n // top bar\n ctx.beginPath();\n ctx.moveTo(0, 43 * options.uiScale);\n ctx.lineTo(80 * options.uiScale, 43 * options.uiScale);\n for (let i = 1; i <= 10 * options.uiScale | 0; i++) {\n ctx.lineTo(80 * options.uiScale +i*2, 43 * options.uiScale -i*2);\n ctx.lineTo(80 * options.uiScale +i*2+2, 43 * options.uiScale -i*2);\n }\n\n let position = 130 + translation.time.length * 10;\n ctx.lineTo(position * options.uiScale, 23 * options.uiScale);\n for (let i = 1; i <= 10 * options.uiScale | 0; i++) {\n ctx.lineTo(position * options.uiScale +i*2, 23 * options.uiScale -i*2);\n ctx.lineTo(position * options.uiScale +i*2+2, 23 * options.uiScale -i*2);\n }\n ctx.lineTo((position + 22) * options.uiScale, 0);\n ctx.lineTo(0, 0);\n ctx.closePath();\n ctx.fill();\n\n // bottom bar\n ctx.beginPath();\n let y = kontra.canvas.height - 25 * options.uiScale;\n ctx.moveTo(0, y);\n\n position = 85 + translation.best.length * 10;\n ctx.lineTo(position * options.uiScale, y);\n for (let i = 1; i <= 10 * options.uiScale | 0; i++) {\n ctx.lineTo(position * options.uiScale +i*2, y+i*2);\n ctx.lineTo(position * options.uiScale +i*2+2, y+i*2);\n }\n ctx.lineTo((position + 22) * options.uiScale, kontra.canvas.height);\n ctx.lineTo(0, kontra.canvas.height);\n ctx.closePath();\n ctx.fill();\n\n ctx.fillStyle = '#fdfdfd';\n let time = getTime(audio.currentTime);\n\n setFont(40);\n ctx.fillText(getSeconds(time).padStart(3, ' '), 5 * options.uiScale, 35 * options.uiScale);\n setFont(18);\n ctx.fillText(':' + getMilliseconds(time).padStart(2, '0') + '\\t' + translation.time, 80 * options.uiScale, 17 * options.uiScale);\n ctx.fillText(bestTime.padStart(6, ' ') + '\\t' + translation.best, 5 * options.uiScale, kontra.canvas.height - 5 * options.uiScale);\n ctx.restore();\n}", "function renderTime(time){\n var timerSpans = document.querySelectorAll(\".timer .act-tim-digit\");\n\n if (time[0]>-1){ // hour\n if (time[0]>9)\n timerSpans[0].innerHTML=time[0]\n else\n timerSpans[0].innerHTML=\"0\"+time[0];\n }\n\n if (time[1]>-1){ // min\n if (time[1]>9)\n timerSpans[1].innerHTML=time[1]\n else\n timerSpans[1].innerHTML=\"0\"+time[1];\n }\n\n if (time[2]>-1){ // sec\n if (time[2]>9)\n timerSpans[2].innerHTML=time[2]\n else\n timerSpans[2].innerHTML=\"0\"+time[2];\n }\n\n}", "initializeSerie(data, data_format){\n\n // Save object (Timedata) instance\n var self = this;\n\n // Set SVG Map dimensions\n self.timedata_svg.attr('width', self.svgWidth + self.margin.left + self.margin.right);\n self.timedata_svg.attr('height', self.svgHeight + self.margin.top + self.margin.bottom);\n\n // Define display translation on SVG\n var g = self.timedata_svg.append('g')\n .attr('transform', 'translate(' + self.margin.left + ',' + self.margin.top + ')');\n\n // Define x and y axis scale dimensions with respect to SVG\n var x = d3.scaleTime().rangeRound([0, self.svgWidth - 50]);\n var y = d3.scaleLinear().rangeRound([self.svgHeight, 0]);\n\n // Define line graphic from parsed data\n var line = d3.line()\n .x(function(d){ return x(d.date) })\n .y(function(d){ return y(d.value) });\n\n // Define x and y domain values\n x.domain(d3.extent(data, function(d){ return d.date }));\n y.domain(d3.extent(data, function(d){ return d.value }));\n\n // Add background grid to SVG on x axis\n g.append('g')\n .attr('class', 'grid')\n .call(d3.axisBottom(x).ticks(10)\n .tickSize(self.svgHeight)\n .tickFormat('')\n );\n\n // Add background grid to SVG on y axis\n g.append('g')\n .attr('class', 'grid')\n .call(d3.axisLeft(y).ticks(5)\n .tickSize(-(self.svgWidth-50))\n .tickFormat('')\n );\n\n // Add text on x axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .attr('transform', 'translate(0,' + self.svgHeight + ')')\n .call(d3.axisBottom(x))\n\n // Add a thich line over the x axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .call(d3.axisBottom(x))\n .attr('stroke-width', 2)\n .selectAll('text')\n .remove()\n\n // Add a thich line over the y axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .attr('transform', 'translate(' + parseInt(self.svgWidth - 50) + ', 0)')\n .call(d3.axisLeft(y))\n .attr('stroke-width', 2)\n .selectAll('text')\n .remove()\n\n // Add text on y axis on SVG\n g.append('g')\n .attr('class', 'white_axis')\n .call(d3.axisLeft(y))\n .append('text')\n .attr('id', 'serie_unit')\n .attr('fill', '#000')\n .attr('transform', 'rotate(-90)')\n .attr('y', 6)\n .attr('dy', '0.71em')\n .attr('dx', '-0.71em')\n .attr('text-anchor', 'end')\n .text($(self.dataselection_name).val() +' [' + data_format.units[self.selected_map] +']');\n }", "function redrawTics() {\n while (_tickSet.length) {\n _tickSet.splice(0, 1)[0].remove();\n }\n var resolution = getResolution();\n if (resolution) {\n var begin = getStartTime();\n var end = getEndTime();\n var beginX = getScaleAreaX();\n var cellCount = Math.floor((end - begin) / resolution);\n var cellWidth = getScaleAreaWidth() / cellCount;\n var previousHours;\n for (var i = 0; i <= cellCount; ++i) {\n var positionX = beginX + i * cellWidth;\n var date = new Date(begin + i * resolution);\n // Minor tick height as default.\n var tickEndY = getScaleAreaHeight() - (_scaleConfig.height - _scaleConfig.bgHeight);\n var newHour = date.getMinutes() === 0 && date.getSeconds() === 0 && date.getMilliseconds() === 0;\n if (newHour || i === 0 || i === cellCount) {\n // Exact hour, major tick.\n tickEndY = tickEndY - _scaleConfig.progressCellHeight;\n }\n\n if (tickEndY) {\n var beginY = getScaleAreaY() + getScaleAreaHeight();\n var tick = _paper.path(\"M\" + positionX + \",\" + beginY + \"V\" + tickEndY);\n tick.attr(\"stroke\", Raphael.getRGB(\"white\")).attr(\"opacity\", 0.5);\n _tickSet.push(tick);\n jQuery(tick.node).mousewheel(handleMouseScroll);\n if (newHour && i < cellCount) {\n var hourLabel = _paper.text(positionX, getScaleAreaY() + getScaleAreaHeight() / 3, getTimeStr(date)).attr({\n \"font-family\" : _labelFontFamily,\n \"font-size\" : _labelFontSize,\n \"fill\" : Raphael.getRGB(\"black\")\n });\n // Check if the hourlabel fits into the scale area.\n var hourLabelNode = jQuery(hourLabel.node);\n if (hourLabelNode.offset().left >= getScaleAreaOffsetX() && hourLabelNode.offset().left + hourLabelNode.width() <= getScaleAreaOffsetX() + getScaleAreaWidth()) {\n // Label fits. So, let it be in the UI.\n _tickSet.push(hourLabel);\n jQuery(hourLabel.node).mousewheel(handleMouseScroll);\n\n } else {\n // Remove hour label because it overlaps the border.\n hourLabel.remove();\n }\n }\n if (i === cellCount) {\n var zoneLabel = _paper.text(positionX, getScaleAreaY() + getScaleAreaHeight() * 2 / 3, getZoneStr()).attr({\n \"font-family\" : _labelFontFamily,\n \"font-size\" : _labelFontSize,\n \"fill\" : Raphael.getRGB(\"black\"),\n \"text-anchor\" : \"end\"\n });\n // Check if the label fits into the scale area.\n var zoneLabelNode = jQuery(zoneLabel.node);\n _tickSet.push(zoneLabel);\n jQuery(zoneLabel.node).mousewheel(handleMouseScroll);\n }\n }\n previousHours = date.getHours();\n }\n }\n }", "drawUtilizationBar() {\r\n const scope = this;\r\n $(\"#time-of-day-bar\").empty();\r\n\r\n const svg_height = 400,\r\n margin = {top: 40, right: 10, bottom: 60, left: 40},\r\n width = $(\"#time-of-day-bar\").innerWidth() - margin.left - margin.right,\r\n height = svg_height - margin.top - margin.bottom,\r\n\r\n svg = d3.select(\"#time-of-day-bar\").append(\"svg\")\r\n .attr(\"width\", width + margin.left + margin.right)\r\n .attr(\"height\", height + margin.top + margin.bottom),\r\n\r\n g = svg.append(\"g\").attr(\"transform\", \"translate(\" + margin.left + \",\" + margin.top + \")\");\r\n\r\n // set the ranges\r\n let x = d3.scaleBand().rangeRound([0, width]).padding(0.1),\r\n y = d3.scaleLinear().rangeRound([height, 0]);\r\n\r\n x.domain(scope.props.data.map(d => {\r\n let x_label;\r\n if (d.time === 12) x_label = `${d.time} PM`;\r\n else if (d.time < 12) x_label = `${d.time} AM`;\r\n else if(d.time > 12) x_label = `${d.time % 12} PM`;\r\n return x_label;\r\n }));\r\n\r\n y.domain([0, (d3.max(scope.props.data, d => d.occupancy.length === 0 ? 0 : d3.max(d.occupancy, v => v)))/1393]);\r\n\r\n const group = g.selectAll(\".group\")\r\n .data(scope.props.data)\r\n .enter().append(\"g\")\r\n .attr(\"class\", \"group\");\r\n\r\n group.append(\"rect\")\r\n .attr(\"class\", \"max\")\r\n .attr(\"x\", function(d) {\r\n let x_label;\r\n if (d.time === 12)\r\n x_label = `${d.time} PM`;\r\n else if (d.time < 12)\r\n x_label = `${d.time} AM`;\r\n else if(d.time > 12)\r\n x_label = `${d.time % 12} PM`;\r\n return x(x_label); })\r\n .attr(\"width\", x.bandwidth())\r\n .attr(\"y\", d => y(0))\r\n .attr(\"height\", d => 0 )\r\n .transition()\r\n .duration(500)\r\n .attr(\"y\", d => y(d.occupancy.length === 0 ? 0 : (d3.max(d.occupancy, v => v))/1393))\r\n .attr(\"height\", d => height - y(d.occupancy.length == 0 ? 0 : (d3.max(d.occupancy, v => v))/1393));\r\n\r\n group.append(\"rect\")\r\n .attr(\"class\", \"average\")\r\n .attr(\"x\", function(d) {\r\n let x_label;\r\n if (d.time === 12)\r\n x_label = `${d.time} PM`;\r\n else if (d.time < 12)\r\n x_label = `${d.time} AM`;\r\n else if(d.time > 12)\r\n x_label = `${d.time % 12} PM`;\r\n return x(x_label); })\r\n .attr(\"width\", x.bandwidth())\r\n .attr(\"y\", d => y(0))\r\n .attr(\"height\", d => 0 )\r\n .transition()\r\n .duration(500)\r\n .attr(\"y\", d => y(d.average/1393))\r\n .attr(\"height\", d => height - y(d.average/1393));\r\n\r\n // add the x Axis\r\n g.append(\"g\").attr(\"transform\", \"translate(0,\" + height + \")\").attr(\"class\", \"x-axis\").call(d3.axisBottom(x));\r\n // add the y Axis\r\n g.append(\"g\").attr(\"class\", \"y-axis\").call(d3.axisLeft(y).tickSize(-width).tickFormat(d3.format(\".1%\")));\r\n\r\n svg.append(\"g\")\r\n .attr(\"class\", \"bottom-label\")\r\n .append(\"text\")\r\n .attr(\"x\", width / 2 - margin.left)\r\n .attr(\"y\", margin.top + height + 50)\r\n .text(\"Utilization of all spaces\");\r\n\r\n let legend = svg.append('g')\r\n .attr('class', 'legend')\r\n .attr('width', 400)\r\n .attr('height', 20)\r\n .attr('x', 0)\r\n .attr('y', 0)\r\n .attr('transform', 'translate(' + (width / 2 - 200) + ' , 0)');\r\n\r\n legend.append('rect')\r\n .attr('class', 'max')\r\n .attr('width', 40)\r\n .attr('height', 20)\r\n .attr('x', 0)\r\n .attr('y', 0);\r\n legend.append('text')\r\n .attr('x', 50)\r\n .attr('y', 14)\r\n .text(\"Peak Utilization\");\r\n legend.append('rect')\r\n .attr('width', 40)\r\n .attr('height', 20)\r\n .attr('x', 200)\r\n .attr('y', 0)\r\n .attr('class', 'average');\r\n legend.append('text')\r\n .attr('x', 250)\r\n .attr('y', 14)\r\n .text(\"Average Utilization\");\r\n }", "function generate(min, max, minor, major, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generate(min, max, minor, major, capacity, options) {\n\tvar timeOpts = options.time;\n\tvar stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);\n\tvar weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n\tvar majorTicksEnabled = options.ticks.major.enabled;\n\tvar interval = INTERVALS[minor];\n\tvar first = moment(min);\n\tvar last = moment(max);\n\tvar ticks = [];\n\tvar time;\n\n\tif (!stepSize) {\n\t\tstepSize = determineStepSize(min, max, minor, capacity);\n\t}\n\n\t// For 'week' unit, handle the first day of week option\n\tif (weekday) {\n\t\tfirst = first.isoWeekday(weekday);\n\t\tlast = last.isoWeekday(weekday);\n\t}\n\n\t// Align first/last ticks on unit\n\tfirst = first.startOf(weekday ? 'day' : minor);\n\tlast = last.startOf(weekday ? 'day' : minor);\n\n\t// Make sure that the last tick include max\n\tif (last < max) {\n\t\tlast.add(1, minor);\n\t}\n\n\ttime = moment(first);\n\n\tif (majorTicksEnabled && major && !weekday && !timeOpts.round) {\n\t\t// Align the first tick on the previous `minor` unit aligned on the `major` unit:\n\t\t// we first aligned time on the previous `major` unit then add the number of full\n\t\t// stepSize there is between first and the previous major time.\n\t\ttime.startOf(major);\n\t\ttime.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);\n\t}\n\n\tfor (; time < last; time.add(stepSize, minor)) {\n\t\tticks.push(+time);\n\t}\n\n\tticks.push(+time);\n\n\treturn ticks;\n}", "function generateTicks(options, dataRange) {\n\t\tvar niceMin;\n\t\tvar niceMax;\n\t\tvar isoWeekday = options.timeOpts.isoWeekday;\n\t\tif (options.unit === 'week' && isoWeekday !== false) {\n\t\t\tniceMin = moment$$1(dataRange.min).startOf('isoWeek').isoWeekday(isoWeekday).valueOf();\n\t\t\tniceMax = moment$$1(dataRange.max).startOf('isoWeek').isoWeekday(isoWeekday);\n\t\t\tif (dataRange.max - niceMax > 0) {\n\t\t\t\tniceMax.add(1, 'week');\n\t\t\t}\n\t\t\tniceMax = niceMax.valueOf();\n\t\t} else {\n\t\t\tniceMin = moment$$1(dataRange.min).startOf(options.unit).valueOf();\n\t\t\tniceMax = moment$$1(dataRange.max).startOf(options.unit);\n\t\t\tif (dataRange.max - niceMax > 0) {\n\t\t\t\tniceMax.add(1, options.unit);\n\t\t\t}\n\t\t\tniceMax = niceMax.valueOf();\n\t\t}\n\t\treturn generateTicksNiceRange(options, dataRange, {\n\t\t\tmin: niceMin,\n\t\t\tmax: niceMax\n\t\t});\n\t}", "function updateTimePeriod(timePeriod) {\n\tvar maxIndex = symptomInfoStack.length - 1;\t\n\t\n\tswitch(timePeriod) {\n\t\tcase \"oneWeek\":\n\t\t\t// X & Y SCALE\n\t\t\tmaxX = new Date(TODAY);\t\t\t\t\t \n\t\t\tminX = new Date(ONE_WEEK_AGO);\n\t\t\tbreak;\n\t\tcase \"twoWeek\":\n\t\t\tmaxX = new Date(TODAY);\t\t\t\t\t \n\t\t\tminX = new Date(TWO_WEEK_AGO);\n\t\t\tbreak;\n\t\tcase \"oneMonth\":\n\t\t\tmaxX = new Date(TODAY);\t\t\t\t\t \n\t\t\tminX = new Date(ONE_MONTH_AGO);\n\t\t\tbreak;\n\t\tcase \"sixMonth\":\n\t\t\tmaxX = new Date(TODAY);\t\t\t\t\t \n\t\t\tminX = new Date(SIX_MONTH_AGO);\n\t\t\tbreak;\n\t\tcase \"oneYear\":\n\t\t\tmaxX = new Date(TODAY);\t\t\t\t\t \n\t\t\tminX = new Date(ONE_YEAR_AGO);\n\t\t\tbreak;\n\t\tcase \"allTime\":\n\t\t\tmaxX = new Date(TODAY);\t\n\t\t\tvar minTime = d3.min(symptomInfoStack, function(d) { return (new Date(d.oldestDate)).getTime(); });\n\t\t\tminX = new Date();\n\t\t\tminX.setTime(minTime);\t\t\t\t \n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmaxX = new Date(TODAY);\t\t\t\t\t \n\t\t\tminX = d3.min(data, function(d) { return new Date(d.date); });\n\t\t\tbreak;\n\t}\n\t\n\txDomain = { max: maxX, min: minX };\n\t\n\t// X & Y SCALES\n\tupdateScales(symptomInfoStack[ maxIndex ].maxValue);\n\t\n\t// SCALE LINES\n\tscaleLines();\n\t\t\n\t// X & Y GRIDS \n\tupdateGrids(symptomInfoStack[ maxIndex ].maxValue);\n\t\n\t// X & Y AXIS\n\tupdateAxes(symptomInfoStack[ maxIndex ].maxValue);\n}", "function TimeViz(props) {\n let timeData = props.timeData;\n let selectedQueries = props.selectedQueries;\n console.log(\"time data\", props.timeData);\n console.log(props.selectedQueries);\n let timing = {}; //this will be a {\"querr\": [array of all responsetimes]}\n let timeStamps = []; //this will be an array of timestamp strings\n\n for (let quer in timeData) {\n timing[quer] = [];\n timeData[quer].forEach(response => {\n timeStamps.push(response.timestamp);\n timing[quer].push((response.timing[0] + response.timing[1] / 1000000000))\n });\n timing[quer].shift()\n }\n\n\n console.log(\"values\", timing)\n console.log(\"x-axis\", timeStamps)\n console.log(\"digging for data\", timing[selectedQueries[0]])\n\n // const [data, setData] = useState();\n let data;\n if (timing[selectedQueries[0]]) {\n data = timing[selectedQueries[0]];\n }\n else {\n data = [.10, .10, .10, .10, .10, .10, .10];\n }\n\n\n let lengthy = data;\n // const [time, setTime] = useState([{ name: \"Query 1\", labelOffset: 60, value: function (t) { return d3.10l(t, 1, 0.5); } },\n // ]);\n const svgRef = useRef();\n /*The most basic SVG file contains the following format:\n --Size of the viewport (Think of this as the image resolution)\n --Grouping instructions via the element -- How should elements be grouped?\n --Drawing instructions using the shapes elements\n --Style specifications describing how each element should be drawn.*/\n // will be called initially and on every data change\n\n useEffect(() => {\n\n if (timing[selectedQueries[0]]) {\n\n }\n\n let max = Math.max(...data)\n let upperLine = 1.5 * max;\n\n\n const svg = select(svgRef.current);\n\n //range in the scales control how long the axis line is on the graph\n const xScale = scaleLinear().domain([0, lengthy.length - 1]).range([0, 750]);\n const yScale = scaleLinear()\n //domain is the complete set of values and the range is the set of resulting values of a function\n .domain([0, `${upperLine}`])\n .range([300, 0]);\n // let z = schemeCategory10();\n //calling the xAxis function with current selection\n const xAxis = axisBottom(xScale).ticks(lengthy.length).tickFormat(index => Math.floor(index + 1));\n svg.select('.x-axis').style('transform', \"translateY(300px)\").style(\"filter\", \"url(#glow)\").call(xAxis)\n //ticks are each value in the line\n const yAxis = axisRight(yScale).ticks(20).tickFormat(index => Math.round((index + 0.01) * 1000) / 1000);\n svg.select(\".y-axis\").style(\"transform\", \"translateX(750px)\").style(\"filter\", \"url(#glow)\").call(yAxis);\n //initialize a line to the value of line \n //x line is rendering xscale and y is rendering yscale\n const newLine = line().x((value, index) => xScale(index)).y(yScale).curve(curveCardinal);\n //select all the line elements you find in the svg and synchronize with data provided\n //wrap data in another array so d3 doesn't generate a new path element for every element in data array\n //join creates a new path element for every new piece of data\n //class line is to new updating path elements\n //Container for the gradients\n let defs = svg.append(\"defs\");\n\n //Filter for the outside glow\n let filter = defs.append(\"filter\")\n .attr(\"id\", \"glow\");\n filter.append(\"feGaussianBlur\")\n .attr(\"stdDeviation\", \"3.5\")\n .attr(\"result\", \"coloredBlur\");\n let feMerge = filter.append(\"feMerge\");\n feMerge.append(\"feMergeNode\")\n .attr(\"in\", \"coloredBlur\");\n feMerge.append(\"feMergeNode\")\n .attr(\"in\", \"SourceGraphic\");\n\n let g = svg\n .selectAll(\".line\")\n .data([lengthy])\n .join(\"path\")\n .attr(\"class\", \"line\")\n .attr(\"d\", newLine)\n .attr(\"fill\", \"none\")\n .attr(\"stroke\", \"rgb(6, 75, 115)\")\n .style(\"filter\", \"url(#glow)\");\n //adding label to each line -- coming back here\n // g.append(\"text\")\n // .attr(\"x\", () => setTime(time.map(d => d.labelOffset)) ;\n // })\n // .attr(\"dy\", -5)\n // .style(\"fill\", function (d, i) { return lab(z(i)).darker(); })\n // .append(\"textPath\")\n // .text(function (d) { return d.name; });\n },\n //rerender data here\n [lengthy]);\n return (\n <React.Fragment>\n <svg ref={svgRef}>\n <g className=\"x-axis\" />\n <g className=\"y-axis\" /></svg>\n <br />\n <button onClick={() => setData(data.map(value => value + 5))}>\n Update Data </button>\n </React.Fragment >\n )\n}", "function yScale(timesData, chosenYAxis) {\n // create scales\n var yLinearScale = d3.scaleLinear()\n .domain([d3.min(timesData, d => d[chosenYAxis]) * 0.8 ,d3.max(timesData, d => d[chosenYAxis]) * 1.1])\n .range([height,0]);\n return yLinearScale;\n }" ]
[ "0.6303957", "0.6292558", "0.6014297", "0.5919765", "0.58890843", "0.5887953", "0.58635724", "0.5834182", "0.5834182", "0.58336806", "0.5822177", "0.5762679", "0.56953883", "0.56509095", "0.56509095", "0.56509095", "0.56509095", "0.56509095", "0.56509095", "0.5629078", "0.55502063", "0.5487399", "0.54707927", "0.54581314", "0.5455389", "0.54446054", "0.5401024", "0.5401024", "0.5401024", "0.5401024", "0.5401024", "0.5401024", "0.5401024", "0.5401024", "0.5389575", "0.5337842", "0.5327165", "0.5327153", "0.53153694", "0.5307916", "0.52962315", "0.5284566", "0.5283107", "0.5283107", "0.5272718", "0.52500916", "0.52442735", "0.5235782", "0.52354115", "0.52044487", "0.5201235", "0.51952523", "0.5152023", "0.51496", "0.51465255", "0.5144264", "0.51371753", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5137076", "0.5113952", "0.5110476", "0.5106186", "0.5084666", "0.50790757", "0.50727546", "0.50636196", "0.50561297", "0.50294787", "0.50252885", "0.5023636", "0.50208116", "0.49938932", "0.49659348", "0.496399", "0.4962416", "0.4962416", "0.49488503", "0.49488333", "0.49481505", "0.49441078" ]
0.0
-1
(throttling, 1000ms not out yet) when 1000 ms time out... ...outputs 3, intermediate value 2 was ignored
function throttle(func, ms) { let isThrottled = false, savedArgs, savedThis; function wrapper() { if (isThrottled) { // (2) savedArgs = arguments; savedThis = this; return; } func.apply(this, arguments); // (1) isThrottled = true; setTimeout(function() { isThrottled = false; // (3) if (savedArgs) { wrapper.apply(savedThis, savedArgs); savedArgs = savedThis = null; } }, ms); } return wrapper; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timersweep() {\n let t0, t1 = timerqueueHead, time = Infinity;\n\n while (t1) {\n if (t1.f) {\n t1 = t0 ? t0.n = t1.n : timerqueueHead = t1.n;\n } else {\n if (t1.t < time) {\n time = t1.t;\n }\n t1 = (t0 = t1).n;\n }\n }\n timerqueueTail = t0;\n return time;\n}", "onTimeOut() {\n if(this.exhausted) {\n this.stop();\n return;\n }\n \n this.roll();\n }", "function func3(){\n var result=0;\n for(var i=1; i<=5000; i++){\n if(i%2===1){\n result+=i;\n }\n }\n return result;\n}", "maxOutTimeTicker() {\r\n this.timeTicker = this.maxTime - 1;\r\n }", "function async(multipliers, useResult)\r\n{\r\n setTimeout(step1, 500);\r\n\r\n\r\n function step1()\r\n {\r\n console.log('Step 1');\r\n var x = Math.random();\r\n setTimeout(step2.bind(null, 0, x), 500);\r\n }\r\n\r\n\r\n function step2(index, x)\r\n {\r\n if(index === multipliers.length)\r\n return useResult(x);\r\n\r\n console.log('Step 2, call #' + (index+1));\r\n x *= multipliers[index];\r\n setTimeout(step2.bind(null, index+1, x), 500);\r\n }\r\n}", "next(){\n if(max>0){\n return {value: max--, done: false}\n }else{\n return {value: undefined, done: true}\n }\n\n }", "static async algo(n){\n\n let req = n, share = new fairShare(),\n a = bigInteger(1), b = bigInteger(0);\n\n while (n--){\n let temp = a;\n a = a.plus(b);\n b = temp;\n // Let other functions run in parallell after 10 ms\n await share.do(); \n }\n\n return {\n request: req,\n stats: share.stats,\n result: b.toString()\n };\n\n }", "function reduceLimit() {\n limit -= 3;\n}", "performFinalCorrection(amount) {\n\n console.log(\"entering performFinalCorrection()\");\n\n let who = this.sjs.id;\n\n let bumpMs = 300;\n\n let limit = 128;\n\n let acc = 0;\n\n let curMs = 0;\n\n while(acc < amount) {\n let thisOne = Math.min(limit,amount-acc);\n\n // if( (amount-limit) > 0 ) {\n // amount -= thisOne;\n // }\n\n setTimeout(()=>{\n console.log(\"run: \" + thisOne);\n this.sjs.dsp.setPartnerSfoAdvance(who, thisOne, 4, false);\n },curMs);\n\n curMs += bumpMs;\n acc += thisOne;\n }\n\n setTimeout(()=>{\n if( this.onDoneCb ) {\n this.onDoneCb();\n }\n }, curMs);\n\n }", "function d3_timer_sweep() {\n var t0,\n t1 = d3_timer_queueHead,\n time = Infinity;\n while (t1) {\n if (t1.f) {\n t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;\n } else {\n if (t1.t < time) time = t1.t;\n t1 = (t0 = t1).n;\n }\n }\n d3_timer_queueTail = t0;\n return time;\n }", "function three(){\n var sum = 0;\n for(var i = 1; i <= 5000; i+=2){\n sum+=i; \n }\n return sum; \n}", "_timeout(count) {\n if (count < this.minCount) {\n return this.minTimeout;\n } // fuzz the timeout randomly, to avoid reconnect storms when a\n // server goes down.\n\n var timeout =\n Math.min(\n this.maxTimeout,\n this.baseTimeout * Math.pow(this.exponent, count)\n ) *\n (Random.fraction() * this.fuzz + (1 - this.fuzz / 2));\n return timeout;\n }", "function ARandomAsyncFunction(toIncrease) {\n setTimeout(() => {\n toIncrease.value++\n /*\n (3)\n When we see this value it should be the value of result,\n which is defined on line 10, but moduified. This is to prove\n that line 27 did actually do something.\n */\n console.log(`INSIDE: ARandomAsyncFunction and result at this point is: ${result.value}`)\n }, 500)\n\n}", "function d3_timer_sweep() {\n var t0,\n t1 = d3_timer_queueHead,\n time = Infinity;\n while (t1) {\n if (t1.flush) {\n t1 = t0 ? t0.next = t1.next : d3_timer_queueHead = t1.next;\n } else {\n if (t1.time < time) time = t1.time;\n t1 = (t0 = t1).next;\n }\n }\n d3_timer_queueTail = t0;\n return time;\n}", "_setupBackoffTimes() {\n return {\n _times: [0, 1000, 5000, 10000, 60000],\n\n _next: 0,\n\n next() {\n let val = this._times[this._next];\n if (this._next < this._times.length - 1) {\n this._next++;\n }\n return val;\n },\n\n reset() {\n this._next = 0;\n },\n };\n }", "afterCount(result, params) {\n console.log(\"Hereeeeeeeeeee 10\");\n }", "function addTo(n) {\n\tconsole.log('Very long time')\n\treturn n + 80;\n}", "function thunk2() {\n let now = Date.now();\n // This should be the current time in ms\n\n let value = 0;\n\n // Something will take 2 seconds to complete\n // This structure is technically blocking\n // This would be refactored to be asynchronous\n while(Date.now() <= now + 2000) {\n value = Date.now(); // Making up some random data\n }\n // Let's pretend we got some data back in response\n\n return subtract(Date.now(), value);\n}", "function abc() {\n var sum = 0;\n for (var i = 1; i < 5000; i++) {\n if (i % 2 === 1) {\n sum += i;\n }\n }\n return sum;\n}", "function doubleCritDmg() {setTimeout(() => {critDmgMultiplier *= 2;}, 5000);}", "async next () {\n callTimes.push(Date.now() - startTime); // Record the time that next() was called\n await delay(100); // Each call to next() takes 100ms to resolve\n\n if (--this.length < 0) {\n return { done: true };\n }\n else {\n return { value: \"A\" };\n }\n }", "hurryTick() {\n this.requestedDelay -= this.options.delay;\n }", "function rxFetchUserCount() {\n logger.info(`shortDelay: ${shortDelay} shortUpdateDuration:${shortUpdateDuration}`);\n rx.Observable.timer(shortDelay, shortUpdateDuration).flatMap(() => {\n logger.info(`[time task] rxFetchUserCount :::`);\n return user.getUserCount();\n }).subscribe(data => {\n logger.info(`[time task] fetch user count next ${JSON.stringify(data)}`);\n global.userCount = data;\n ServerConfig.userCount = data;\n }, error => {\n logger.error(`[time task] fetch user count error ${error}`);\n })\n}", "function calculateTimeout(counter, array) {\r\n var computerMessageLength = array[(counter)].length;\r\n var timeoutFactor = (computerMessageLength / 30);\r\n console.log(`Number of seconds for typing loader / setTimeout: ${timeoutFactor.toFixed(1)} seconds`)\r\n return (timeoutFactor * 1000); // multiple timeout factor by 1000 miliseconds for setTimeout length\r\n }", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n) {\n console.log('long time')\n return n + 80;\n}", "function addTo80(n){\n console.log('long time');\n return n + 80;\n}", "_throttle (callback, limit) {\n let inThrottle = false;\n return function() {\n const args = arguments;\n const context = this;\n if (!inThrottle) {\n callback.apply(context, args);\n inThrottle = true;\n setTimeout(() => inThrottle = false, limit);\n }\n }\n }", "function currCb(res,isErr){if(effectSettled){return;}effectSettled=true;cb.cancel=_chunk_e922c950_js__WEBPACK_IMPORTED_MODULE_4__[\"x\"];// defensive measure\nif(env.sagaMonitor){if(isErr){env.sagaMonitor.effectRejected(effectId,res);}else{env.sagaMonitor.effectResolved(effectId,res);}}if(isErr){setCrashedEffect(effect);}cb(res,isErr);}// tracks down the current cancel", "getPollingTimeout () {\r\n return Math.pow(2, Math.min(this.consecutiveErrorsCount, 4)) * this.pollingTimeout;\r\n }", "function addTo80(n) {\n\tconsole.log('Heavy computation');\n\treturn n + 80;\n}", "function futureValue(P, i, n, t) {\n\treturn P*Math.pow((1 + i/n), n*t); \n}", "customBackoff(retryCount, err) { // eslint-disable-line\n if (!err.retryable) { return -1; }\n return 100 + retryCount * 100;\n // returns delay in ms\n }", "function throttle(fn, time, context) {\n var lock, args, wrapperFn, later;\n\n later = function () {\n // reset lock and call if queued\n lock = false;\n\n if (args) {\n wrapperFn.apply(context, args);\n args = false;\n }\n };\n\n wrapperFn = function () {\n if (lock) {\n // called too soon, queue to call later\n args = arguments;\n } else {\n // call and lock until later\n fn.apply(context, arguments);\n setTimeout(later, time);\n lock = true;\n }\n };\n\n return wrapperFn;\n } // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number", "function getRetryMultiplier() {\n return 1.5;\n}", "function getRetryMultiplier() {\n return 1.5;\n}", "get _timeout() {\n this._timeoutMS += 500;\n return this._timeoutMS;\n }", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn(curr,next,opts,fwd);\n\t\twhile ((t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function faster() {\n if (stepDelay <= MIN_DELAY) { return; }\n stepDelay /= 2;\n }", "error (err) {\n return function (res, cb) {\n _setImmediate(() => {\n res.value += 10\n cb(err, res)\n })\n }\n }", "async function timerExample() {\n try {\n console.log('Before I/O callbacks');\n let cacheTimeOut = timeout();\n await setImmediatePromise();\n if(cacheTimeOut._called){\n return 'timed out value';\n }else{\n console.log('After I/O callbacks');\n return 'not called';\n }\n //return value;\n \n } catch (error) {\n console.log('error >>>', error);\n }\n\n}", "function func2(){\n var result=0;\n for(var i=1; i<=1000; i++){\n result+=i;\n }\n return result;\n}", "static async rateLimiting() {\n await new Promise(resolve => setTimeout(resolve, 250))\n }", "function slowFunction(times) {\n var i = 0,\n times = parseInt(1000000000 * times);\n \n while (i < times) {\n i += 1;\n }\n \n return times;\n }", "async function test(fn) {\n await sleep(1000);\n let counter = 0;\n let totalTime = 0;\n for (let i = 0; i < 1000; i++) {\n // const qs = Object.keys(variables).map(k => [k, variables[k]()])\n // .reduce((o, n) => {\n // o[n[0]] = n[1];\n // return o;\n // }, {});\n const qs = {\n userId: (Math.random() > 0.05 ? 8 : 0)\n };\n qs.pageNum = Math.ceil(Math.random() * (qs.userId === 0 ? 100 : 10));\n console.log('qsqsqsqs', qs);\n const timeStart = Date.now();\n console.log('qsqsqs', qs);\n fn(qs)\n .then((res) => {\n // console.log(res);\n const time = Date.now() - timeStart;\n counter++;\n totalTime += time;\n console.log('timeStart: ', timeStart);\n console.log('counter: ', counter);\n console.log('totalTime: ', totalTime);\n console.log('avgTime: ', totalTime / counter);\n });\n // await sleep();\n }\n}", "function use_cb(i, cb) {\n console.log(i + ' -> doing something...');\n setTimeout(function () { cb(i) }, 4000 - i*1000);\n}", "function slower() {\n if (stepDelay >= MAX_DELAY) { return; }\n stepDelay *= 2;\n }", "function getTimeout(curr, next, opts, fwd) {\n if (opts.timeoutFn) {\n // call user provided calc fn\n var t = opts.timeoutFn.call(curr, curr, next, opts, fwd);\n while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n t += opts.speed;\n debug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n if (t !== false) return t;\n }\n return opts.timeout;\n }", "_configureThrottling() {\n if (this.options.maxTPS && this.options.maxTPS > 0) {\n const minTime = parseInt(1000 / this.options.maxTPS);\n if (minTime > 0) {\n this.rate_limiter = new Bottleneck({ minTime });\n this._processMatchedSqsMessage = this.rate_limiter.wrap(this._processMatchedSqsMessage);\n }\n }\n }", "_get_delay(context) {\n let nextable = this._nextable;\n\n if(nextable && nextable[STRATEGY_CHECKED]) {\n return nextable.call(context);\n }\n\n let n;\n try {\n n = nextable.call(context);\n if((typeof n !== 'number') || isNaN(n)) {\n throw 'NaN';\n }\n\n nextable[STRATEGY_CHECKED] = true;\n } catch(ex) {\n throw 'Strategy must be a \"nextable\" or \"nextable factory\"';\n }\n\n return n;\n }", "static get THRESHOLD () {\n return 9;\n }", "function p3(){\n var sum = 0;\n for (var i = 1; i <= 5000; i += 2) {\n sum += i\n console.log(sum)\n }\n}", "function getTimeout(curr, next, opts, fwd) {\n if (opts.timeoutFn) {\n // call user provided calc fn\n var t = opts.timeoutFn.call(curr, curr, next, opts, fwd);\n while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n t += opts.speed;\n debug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n if (t !== false)\n return t;\n }\n return opts.timeout;\n }", "function getTimeout(curr, next, opts, fwd) {\n if (opts.timeoutFn) {\n // call user provided calc fn\n var t = opts.timeoutFn.call(curr, curr, next, opts, fwd);\n while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n t += opts.speed;\n debug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n if (t !== false)\n return t;\n }\n return opts.timeout;\n }", "function getTimeout(curr, next, opts, fwd) {\n if (opts.timeoutFn) {\n // call user provided calc fn\n var t = opts.timeoutFn.call(curr, curr, next, opts, fwd);\n while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n t += opts.speed;\n debug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n if (t !== false)\n return t;\n }\n return opts.timeout;\n }", "_recomputeThrottled() {\n\n if (!this._recomputeRun) {\n this._recompute();\n this._recomputeRun = true;\n }\n\n this._clearRecomputeDebounced();\n }", "static throttle(func, delay) {\r\n let isWaiting = false;\r\n return (...args) => {\r\n if (!isWaiting) {\r\n isWaiting = true;\r\n setTimeout(() => { func(...args); isWaiting = false; }, delay);\r\n }\r\n };\r\n }", "function getTimeout(curr, next, opts, fwd) {\r\n\tif (opts.timeoutFn) {\r\n\t\t// call user provided calc fn\r\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\r\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\r\n\t\t\tt += opts.speed;\r\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\r\n\t\tif (t !== false)\r\n\t\t\treturn t;\r\n\t}\r\n\treturn opts.timeout;\r\n}", "get throttleRate() {\n const { canary, binaryType, assert, referrer, expected } = this.opts;\n let throttleRate = 1;\n\n // Throttle errors from Stable.\n if (!canary && !['control', 'rc', 'nightly'].includes(binaryType)) {\n throttleRate /= 10;\n }\n\n // Throttle user errors.\n if (assert) {\n throttleRate /= 10;\n }\n\n // Throttle errors on origin pages; they may not be valid AMP docs.\n if (!CDN_REGEX.test(referrer)) {\n throttleRate /= 20;\n }\n\n if (expected) {\n throttleRate /= 10;\n }\n\n return throttleRate;\n }", "function concurrent_time() {\n if (app_opt.simulate)\n return simulate(event_opt.simulate.min, event_opt.simulate.max);\n else\n return event_opt.simulate.tick;\n }", "function ex3() {\n (() => {\n console.log(1);\n setTimeout(() => {\n console.log(2);\n }, 1000);\n setTimeout(() => {\n console.log(3);\n }, 0);\n console.log(4);\n })();\n}", "function abc () {\n var sum = 0;\n for( i =0; i <= 5000; i++) {\n if(i % 2 == 1) {\n sum = sum + i;\n }\n }\n return sum;\n}", "function adjustTiming(count) {\n if (count > 0) {\n quoteDuration = 10000;\n }\n if (count > 1) {\n quoteDuration = 8000;\n }\n if (count > 2) {\n quoteDuration = 4000;\n }\n if (count > 3) {\n quoteDuration = 2000;\n }\n }", "function tweakWaitTime(t) {\n t += (t*Math.random()/5*(Math.random()>.5 ? 1 : -1));\n // now we need to tweak the start time to avoid a timing problem in htmlservice \n // .. never start one within 750ms of the last one.\n var now = new Date().getTime();\n startTime_ = Math.max(now + t, startTime_+750);\n return startTime_ - now;\n }", "function Recvq_Unthrottle() {\n\tthis.throttled = false;\n\tthis.num_sent = 3;\n\tthis.time_marker = system.timer;\n\tjs.setImmediate(Process_Recvq, this);\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "function getTimeout(curr, next, opts, fwd) {\n\tif (opts.timeoutFn) {\n\t\t// call user provided calc fn\n\t\tvar t = opts.timeoutFn.call(curr,curr,next,opts,fwd);\n\t\twhile (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout\n\t\t\tt += opts.speed;\n\t\tdebug('calculated timeout: ' + t + '; speed: ' + opts.speed);\n\t\tif (t !== false)\n\t\t\treturn t;\n\t}\n\treturn opts.timeout;\n}", "_calculate_throttle_timeout() {\n let timeout;\n const throttle = this.getAttribute(\"throttle\");\n\n if (throttle === undefined || throttle === \"null\" || !this.hasAttribute(\"throttle\")) {\n if (!this.__render_times || this.__render_times.length < 5) {\n return 0;\n }\n\n timeout = this.__render_times.reduce((x, y) => x + y, 0) / this.__render_times.length;\n timeout = Math.min(5000, timeout);\n } else {\n timeout = parseInt(throttle);\n\n if (isNaN(timeout) || timeout < 0) {\n console.warn(`Bad throttle attribute value \"${throttle}\". Can be (non-negative integer) milliseconds.`);\n this.removeAttribute(\"throttle\");\n return 0;\n }\n }\n\n return Math.max(0, timeout);\n }", "function two(){\n var sum = 0;\n for(var i = 0; i <= 1000; i+=2){\n sum+=i; \n }\n return sum; \n}", "function checker(){\n if (index--) requestFrame(checker);\n else {\n // var result = 3*Math.round(count*1000/3/(performance.now()-start));\n var result = count*1000/(performance.now()- start);\n if (typeof opts.callback === \"function\") opts.callback(result);\n console.log(\"Calculated: \"+result+\" frames per second\");\n }\n }", "processResult() {\n this.test.result.latency = {\n status: this.status,\n progress: 0\n };\n if (this.status <= STATUS.WAITING) return;\n\n const durationFromInit = Date.now() - this.initDate;\n const progress = durationFromInit / this.test.config.latency.duration;\n this.test.result.latency.progress = progress;\n if (this.status <= STATUS.STARTING) return;\n\n const latencies = this.data;\n this.test.result.latency = {\n ...this.test.result.latency,\n min: +Math.min.apply(null, latencies).toFixed(2),\n max: +Math.max.apply(null, latencies).toFixed(2),\n avg: +(latencies.reduce((total, latency) => total + latency, 0) / latencies.length).toFixed(2)\n };\n this.test.result.jitter = Jitter.compute(latencies).toFixed(2);\n }", "function counterMakerWithLimit(/* CODE HERE */) {\n /* CODE HERE */\n}", "function doWorkAsyncFirst(){\n setTimeout(()=>{\n let sum=0;\n for (let index = 0; index < 1000000000; index++) {\n sum+=index;\n }\n console.log('Sum: ',sum);\n return sum;\n },10);\n}", "function finalCountdown(param1, param2, param3, param4) {\n var mult = param1;\n\n while(mult <= param3) {\n\n mult += param1;\n \n if(mult == param4 || mult > param3) {\n continue;\n }\n \n console.log(mult);\n \n }\n\n \n}", "function enough(cap, on, wait){\n return Math.max(on + wait + -cap, 0)\n}", "throttle () {\n return _.throttle.apply(_, arguments);\n }", "avgByElementOverlapped(measure, number, bufdim) {\n var avg;\n var subscription = this.extract(measure)\n .bufferCount(number, bufdim)\n .subscribe(function (x) {\n avg = x.reduce(function (tot, elem) {\n return tot + elem;\n }) / num;\n console.log(avg);\n });\n return subscription;\n }", "delay(ctx) {\n if (ctx.type !== 'data' || ctx.xStarted) {\n return 0;\n }\n ctx.xStarted = true;\n return ctx.index * delayBetweenPoints;\n }", "delay(ctx) {\n if (ctx.type !== 'data' || ctx.xStarted) {\n return 0;\n }\n ctx.xStarted = true;\n return ctx.index * delayBetweenPoints;\n }", "static get PAUSE() { return 4; }", "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 responce_time(r) {\n\t\t\tvar nextr = e.C + \n\t\t\t\t_.chain(tasks_)\n\t\t\t\t\t// Sum including every task with \n\t\t\t\t\t// less dealine that current task\n\t\t\t\t\t.filter(function(t) {\n\t\t\t\t\t\treturn t.D < e.D;\n\t\t\t\t\t})\n\t\t\t\t\t.map(function(t) {\n\t\t\t\t\t\treturn Math.ceil(r / t.T) * t.C;\n\t\t\t\t\t})\n\t\t\t\t\t.foldl(sum, 0)\n\t\t\t\t\t.value();\n\n\t\t\tif(nextr === r) return r;\n\t\t\treturn arguments.callee(nextr);\n\t\t}", "function TimeOfImpact(output, input) {\n var timer = Timer.now();\n ++stats.toiCalls;\n output.state = TOIOutput.e_unknown;\n output.t = input.tMax;\n var proxyA = input.proxyA;\n // DistanceProxy\n var proxyB = input.proxyB;\n // DistanceProxy\n var sweepA = input.sweepA;\n // Sweep\n var sweepB = input.sweepB;\n // Sweep\n DEBUG && common.debug(\"sweepA\", sweepA.localCenter.x, sweepA.localCenter.y, sweepA.c.x, sweepA.c.y, sweepA.a, sweepA.alpha0, sweepA.c0.x, sweepA.c0.y, sweepA.a0);\n DEBUG && common.debug(\"sweepB\", sweepB.localCenter.x, sweepB.localCenter.y, sweepB.c.x, sweepB.c.y, sweepB.a, sweepB.alpha0, sweepB.c0.x, sweepB.c0.y, sweepB.a0);\n // Large rotations can make the root finder fail, so we normalize the\n // sweep angles.\n sweepA.normalize();\n sweepB.normalize();\n var tMax = input.tMax;\n var totalRadius = proxyA.m_radius + proxyB.m_radius;\n var target = Math.max(Settings.linearSlop, totalRadius - 3 * Settings.linearSlop);\n var tolerance = .25 * Settings.linearSlop;\n ASSERT && common.assert(target > tolerance);\n var t1 = 0;\n var k_maxIterations = Settings.maxTOIIterations;\n var iter = 0;\n // Prepare input for distance query.\n var cache = new SimplexCache();\n var distanceInput = new DistanceInput();\n distanceInput.proxyA = input.proxyA;\n distanceInput.proxyB = input.proxyB;\n distanceInput.useRadii = false;\n // The outer loop progressively attempts to compute new separating axes.\n // This loop terminates when an axis is repeated (no progress is made).\n for (;;) {\n var xfA = Transform.identity();\n var xfB = Transform.identity();\n sweepA.getTransform(xfA, t1);\n sweepB.getTransform(xfB, t1);\n DEBUG && common.debug(\"xfA:\", xfA.p.x, xfA.p.y, xfA.q.c, xfA.q.s);\n DEBUG && common.debug(\"xfB:\", xfB.p.x, xfB.p.y, xfB.q.c, xfB.q.s);\n // Get the distance between shapes. We can also use the results\n // to get a separating axis.\n distanceInput.transformA = xfA;\n distanceInput.transformB = xfB;\n var distanceOutput = new DistanceOutput();\n Distance(distanceOutput, cache, distanceInput);\n DEBUG && common.debug(\"distance:\", distanceOutput.distance);\n // If the shapes are overlapped, we give up on continuous collision.\n if (distanceOutput.distance <= 0) {\n // Failure!\n output.state = TOIOutput.e_overlapped;\n output.t = 0;\n break;\n }\n if (distanceOutput.distance < target + tolerance) {\n // Victory!\n output.state = TOIOutput.e_touching;\n output.t = t1;\n break;\n }\n // Initialize the separating axis.\n var fcn = new SeparationFunction();\n fcn.initialize(cache, proxyA, sweepA, proxyB, sweepB, t1);\n if (false) {\n // Dump the curve seen by the root finder\n var N = 100;\n var dx = 1 / N;\n var xs = [];\n // [ N + 1 ];\n var fs = [];\n // [ N + 1 ];\n var x = 0;\n for (var i = 0; i <= N; ++i) {\n sweepA.getTransform(xfA, x);\n sweepB.getTransform(xfB, x);\n var f = fcn.evaluate(xfA, xfB) - target;\n printf(\"%g %g\\n\", x, f);\n xs[i] = x;\n fs[i] = f;\n x += dx;\n }\n }\n // Compute the TOI on the separating axis. We do this by successively\n // resolving the deepest point. This loop is bounded by the number of\n // vertices.\n var done = false;\n var t2 = tMax;\n var pushBackIter = 0;\n for (;;) {\n // Find the deepest point at t2. Store the witness point indices.\n var s2 = fcn.findMinSeparation(t2);\n var indexA = fcn.indexA;\n var indexB = fcn.indexB;\n // Is the final configuration separated?\n if (s2 > target + tolerance) {\n // Victory!\n output.state = TOIOutput.e_separated;\n output.t = tMax;\n done = true;\n break;\n }\n // Has the separation reached tolerance?\n if (s2 > target - tolerance) {\n // Advance the sweeps\n t1 = t2;\n break;\n }\n // Compute the initial separation of the witness points.\n var s1 = fcn.evaluate(t1);\n var indexA = fcn.indexA;\n var indexB = fcn.indexB;\n DEBUG && common.debug(\"s1:\", s1, target, tolerance, t1);\n // Check for initial overlap. This might happen if the root finder\n // runs out of iterations.\n if (s1 < target - tolerance) {\n output.state = TOIOutput.e_failed;\n output.t = t1;\n done = true;\n break;\n }\n // Check for touching\n if (s1 <= target + tolerance) {\n // Victory! t1 should hold the TOI (could be 0.0).\n output.state = TOIOutput.e_touching;\n output.t = t1;\n done = true;\n break;\n }\n // Compute 1D root of: f(x) - target = 0\n var rootIterCount = 0;\n var a1 = t1, a2 = t2;\n for (;;) {\n // Use a mix of the secant rule and bisection.\n var t;\n if (rootIterCount & 1) {\n // Secant rule to improve convergence.\n t = a1 + (target - s1) * (a2 - a1) / (s2 - s1);\n } else {\n // Bisection to guarantee progress.\n t = .5 * (a1 + a2);\n }\n ++rootIterCount;\n ++stats.toiRootIters;\n var s = fcn.evaluate(t);\n var indexA = fcn.indexA;\n var indexB = fcn.indexB;\n if (Math.abs(s - target) < tolerance) {\n // t2 holds a tentative value for t1\n t2 = t;\n break;\n }\n // Ensure we continue to bracket the root.\n if (s > target) {\n a1 = t;\n s1 = s;\n } else {\n a2 = t;\n s2 = s;\n }\n if (rootIterCount == 50) {\n break;\n }\n }\n stats.toiMaxRootIters = Math.max(stats.toiMaxRootIters, rootIterCount);\n ++pushBackIter;\n if (pushBackIter == Settings.maxPolygonVertices) {\n break;\n }\n }\n ++iter;\n ++stats.toiIters;\n if (done) {\n break;\n }\n if (iter == k_maxIterations) {\n // Root finder got stuck. Semi-victory.\n output.state = TOIOutput.e_failed;\n output.t = t1;\n break;\n }\n }\n stats.toiMaxIters = Math.max(stats.toiMaxIters, iter);\n var time = Timer.diff(timer);\n stats.toiMaxTime = Math.max(stats.toiMaxTime, time);\n stats.toiTime += time;\n}", "get STATE_AWAIT() { return 5; }", "function timeToWait() {\n let timesList = list.filter(times => times.status == \"done\");\n let times = [];\n for (let i = 0; i < timesList.length; i++) {\n times.push(timesList[i].timeServiced);\n }\n if (times.length > 0) {\n let sum = times.reduce((previous, current) => current += previous);\n avg = sum / times.length;\n return avg;\n }\n}", "N() {\n return this.maxIteration - this.iteration;\n }", "delay(ctx) {\n if (ctx.type !== \"data\" || ctx.xStarted) {\n return 0;\n }\n ctx.xStarted = true;\n return ctx.index * delayBetweenPoints;\n }", "function throttleFilter(ms, trailing = true) {\n let lastExec = 0;\n let timer;\n\n const clear = () => {\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n }\n };\n\n const filter = invoke => {\n const duration = unref(ms);\n const elapsed = Date.now() - lastExec;\n clear();\n\n if (duration <= 0) {\n lastExec = Date.now();\n return invoke();\n }\n\n if (elapsed > duration) {\n lastExec = Date.now();\n invoke();\n } else if (trailing) {\n timer = setTimeout(() => {\n clear();\n invoke();\n }, duration);\n }\n };\n\n return filter;\n} // implementation", "function expectedWaitTimes(lambda, mu, priorResults, results) {\n // For reference:\n // first row of queueStats contains headers\n // queueStats[0] = number of build minions\n // queueStats[1] = avgNumWaiting in queue\n // queueStast[2] = avgWaitDuration in queue\n // queueStats[3] = avgMinionUtilization\n\n var queueStats = priorResults;\n var resultsExpectedWaitAll = [];\n var minuteBuckets = ['Minions', 0.5, 5, 10, 15, 20, 25, 30]; // array of wait values in minutes to calc prob for\n resultsExpectedWaitAll.push(minuteBuckets);\n\n var k = queueStats.length;\n for (var j=1; j<=k-1; j++) {\n var resultsExpectedWaitNumMinions = [];\n var numBuildMinions = queueStats[j][0];\n var avgNumWaiting = queueStats[j][1];\n var avgWaitDuration = queueStats[j][2];\n var avgMinionUtilization = queueStats[j][3];\n\n resultsExpectedWaitNumMinions.push(roundNum(numBuildMinions, 2));\n\n for (var l=1; l<=minuteBuckets.length - 1; l++) {\n resultsExpectedWaitNumMinions.push(\n roundNum((1 - (1 - avgMinionUtilization)/avgMinionUtilization * avgNumWaiting *\n Math.exp((lambda - numBuildMinions * mu) * minuteBuckets[l] / 60)), 2));\n }\n resultsExpectedWaitAll.push(resultsExpectedWaitNumMinions);\n }\n return results(null, [resultsExpectedWaitAll, queueStats]);\n}", "function a$4(e){return n$9(e.frameDurations.reduce(((t,e)=>t+e),0))}" ]
[ "0.5584466", "0.5569967", "0.55487597", "0.5526954", "0.55195343", "0.5504583", "0.5464044", "0.5452678", "0.54485244", "0.54454446", "0.54083604", "0.5398492", "0.5378185", "0.53728503", "0.5308329", "0.530411", "0.5303797", "0.5294422", "0.52921295", "0.5291942", "0.5266328", "0.5255667", "0.52332324", "0.52016985", "0.5194027", "0.5194027", "0.5194027", "0.5194027", "0.5194027", "0.5194027", "0.5194027", "0.5194027", "0.51916033", "0.51845795", "0.5178254", "0.5172991", "0.5152214", "0.5149577", "0.5135722", "0.51307994", "0.5119195", "0.5119195", "0.51185155", "0.5117762", "0.5104486", "0.50976306", "0.50952476", "0.5094883", "0.5084617", "0.5083428", "0.50778604", "0.50721145", "0.50695795", "0.5066147", "0.5060198", "0.5059251", "0.50468844", "0.50350726", "0.5027846", "0.5027846", "0.5027846", "0.50273025", "0.50217074", "0.5020167", "0.5018222", "0.5015096", "0.5005329", "0.5003997", "0.50027114", "0.49978268", "0.49958396", "0.49945384", "0.49945384", "0.49945384", "0.49945384", "0.49945384", "0.49945384", "0.49945384", "0.49923873", "0.4987878", "0.4976738", "0.49724713", "0.4971087", "0.49670216", "0.49662185", "0.49651212", "0.4964521", "0.4961288", "0.49592716", "0.49592716", "0.4958328", "0.495068", "0.49494097", "0.49469846", "0.49396446", "0.49383596", "0.49380112", "0.4922259", "0.49172145", "0.49152553", "0.49057087" ]
0.0
-1
returns some "handler object" that has .close() method and emits 'connection' event
function listen (stream_url, options, callback) { if (options && options.constructor===Function) { callback = options; options = undefined; } var u = url.parse(stream_url.toString()); var proto = u.protocol.substr(0, u.protocol.length-1); var adaptor = adaptors[proto]; if (!adaptor) { throw new Error('protocol unknown: '+u.protocol); } return adaptor.listen(u, options, callback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeHandler() {\n eventHandler.emit('startRead');\n}", "function emitClose() {\n socket.emit(\"close\");\n}", "function getCloser(connection)\n\t{\n\t\treturn function(callback)\n\t\t{\n\t\t\tconnection.end(callback);\n\t\t};\n\t}", "function handleClose(){\n\n console.log('[SOCKET] - CLOSE');\n }", "_onClosed() {\n this.emit(\"closed\");\n }", "onClose(callback){\n this.socket.onclose = err => {\n callback(err)\n }\n }", "function _connectHandler(self) {\n return function() {\n // Assign\n var connection = this;\n\n // Pool destroyed stop the connection\n if (self.state === DESTROYED || self.state === DESTROYING) {\n return connection.destroy();\n }\n\n // Clear out all handlers\n handlers.forEach(function(event) {\n connection.removeAllListeners(event);\n });\n\n // Reset reconnect id\n self.reconnectId = null;\n\n // Apply pool connection handlers\n connection.on('error', connectionFailureHandler(self, 'error'));\n connection.on('close', connectionFailureHandler(self, 'close'));\n connection.on('timeout', connectionFailureHandler(self, 'timeout'));\n connection.on('parseError', connectionFailureHandler(self, 'parseError'));\n\n // Apply any auth to the connection\n reauthenticate(self, this, function() {\n // Reset retries\n self.retriesLeft = self.options.reconnectTries;\n // Push to available connections\n self.availableConnections.push(connection);\n // Set the reconnectConnection to null\n self.reconnectConnection = null;\n // Emit reconnect event\n self.emit('reconnect', self);\n // Trigger execute to start everything up again\n _execute(self)();\n });\n };\n }", "_onClose() {\n this.logger.info(\n {\n tnx: 'network'\n },\n 'Connection closed'\n );\n\n if (this.upgrading && !this._destroyed) {\n return this._onError(new Error('Connection closed unexpectedly'), 'ETLS', false, 'CONN');\n } else if (![this._actionGreeting, this.close].includes(this._responseActions[0]) && !this._destroyed) {\n return this._onError(new Error('Connection closed unexpectedly'), 'ECONNECTION', false, 'CONN');\n }\n\n this._destroy();\n }", "_onClose() {\n this.logger.info(\n {\n tnx: 'network'\n },\n 'Connection closed'\n );\n\n if (this.upgrading && !this._destroyed) {\n return this._onError(new Error('Connection closed unexpectedly'), 'ETLS', false, 'CONN');\n } else if (![this._actionGreeting, this.close].includes(this._responseActions[0]) && !this._destroyed) {\n return this._onError(new Error('Connection closed unexpectedly'), 'ECONNECTION', false, 'CONN');\n }\n\n this._destroy();\n }", "_onClose() {\n this.logger.info(\n {\n tnx: 'network'\n },\n 'Connection closed'\n );\n\n if (this.upgrading && !this._destroyed) {\n return this._onError(new Error('Connection closed unexpectedly'), 'ETLS', false, 'CONN');\n } else if (![this._actionGreeting, this.close].includes(this._responseActions[0]) && !this._destroyed) {\n return this._onError(new Error('Connection closed unexpectedly'), 'ECONNECTION', false, 'CONN');\n }\n\n this._destroy();\n }", "function _connectHandler(self) {\n return function() {\n // Assign\n var connection = this;\n\n // Pool destroyed stop the connection\n if(self.state == DESTROYED || self.state == DESTROYING) {\n return connection.destroy();\n }\n\n // Clear out all handlers\n handlers.forEach(function(event) {\n connection.removeAllListeners(event);\n });\n\n // Reset reconnect id\n self.reconnectId = null;\n\n // Apply pool connection handlers\n connection.on('error', connectionFailureHandler(self, 'error'));\n connection.on('close', connectionFailureHandler(self, 'close'));\n connection.on('timeout', connectionFailureHandler(self, 'timeout'));\n connection.on('parseError', connectionFailureHandler(self, 'parseError'));\n\n // Apply any auth to the connection\n reauthenticate(self, this, function() {\n // Reset retries\n self.retriesLeft = self.options.reconnectTries;\n // Push to available connections\n self.availableConnections.push(connection);\n // Set the reconnectConnection to null\n self.reconnectConnection = null;\n // Emit reconnect event\n self.emit('reconnect', self);\n // Trigger execute to start everything up again\n _execute(self)();\n });\n }\n }", "function onclose () {\n\t onerror('socket closed');\n\t }", "function onclose () {\n\t onerror('socket closed');\n\t }", "function onclose () {\n\t onerror('socket closed');\n\t }", "function onclose () {\n\t onerror('socket closed');\n\t }", "function onclose () {\n\t onerror('socket closed');\n\t }", "endConnection() {\n this.connection.end()\n }", "close() {\n return new Promise((resolve, reject) => {\n this.connection.end(err => {\n if (err) { return reject( err ); }\n resolve();\n });\n });\n }", "close() {\n return new Promise((resolve, reject) => {\n this.connection.end(err => {\n if (err) { return reject( err ); }\n resolve();\n });\n });\n }", "function Connection(type){\n\tthis.type = type;\n\tthis.sock = 0;\n\tthis.id = 0;\n\tthis.ProcessConnection = function(data){\n\t\tsock.on('test' , function(data){\n\t\tconsole.log(data);});\n\t};\n}", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose(){\n\t onerror(\"socket closed\");\n\t }", "function onclose() {\n onerror(\"socket closed\");\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose () {\n onerror('socket closed');\n }", "function onclose() {\n onerror('socket closed');\n }", "function onclose() {\n onerror('socket closed');\n }", "function onclose() {\n onerror(\"socket closed\");\n }", "function onclose() {\n onerror(\"socket closed\");\n }", "function onclose() {\n onerror(\"socket closed\");\n }", "function onclose() {\n onerror(\"socket closed\");\n }", "handleClose() {\n log.info(`[WS] WebSocket connection closed`)\n }", "close() {\n clearTimeout(this._connectionTimeout);\n clearTimeout(this._greetingTimeout);\n this._responseActions = [];\n\n // allow to run this function only once\n if (this._closing) {\n return;\n }\n this._closing = true;\n\n let closeMethod = 'end';\n\n if (this.stage === 'init') {\n // Close the socket immediately when connection timed out\n closeMethod = 'destroy';\n }\n\n this.logger.debug(\n {\n tnx: 'smtp'\n },\n 'Closing connection to the server using \"%s\"',\n closeMethod\n );\n\n let socket = (this._socket && this._socket.socket) || this._socket;\n\n if (socket && !socket.destroyed) {\n try {\n this._socket[closeMethod]();\n } catch (E) {\n // just ignore\n }\n }\n\n this._destroy();\n }", "close() {\n clearTimeout(this._connectionTimeout);\n clearTimeout(this._greetingTimeout);\n this._responseActions = [];\n\n // allow to run this function only once\n if (this._closing) {\n return;\n }\n this._closing = true;\n\n let closeMethod = 'end';\n\n if (this.stage === 'init') {\n // Close the socket immediately when connection timed out\n closeMethod = 'destroy';\n }\n\n this.logger.debug(\n {\n tnx: 'smtp'\n },\n 'Closing connection to the server using \"%s\"',\n closeMethod\n );\n\n let socket = (this._socket && this._socket.socket) || this._socket;\n\n if (socket && !socket.destroyed) {\n try {\n this._socket[closeMethod]();\n } catch (E) {\n // just ignore\n }\n }\n\n this._destroy();\n }", "close() {\n clearTimeout(this._connectionTimeout);\n clearTimeout(this._greetingTimeout);\n this._responseActions = [];\n\n // allow to run this function only once\n if (this._closing) {\n return;\n }\n this._closing = true;\n\n let closeMethod = 'end';\n\n if (this.stage === 'init') {\n // Close the socket immediately when connection timed out\n closeMethod = 'destroy';\n }\n\n this.logger.debug(\n {\n tnx: 'smtp'\n },\n 'Closing connection to the server using \"%s\"',\n closeMethod\n );\n\n let socket = (this._socket && this._socket.socket) || this._socket;\n\n if (socket && !socket.destroyed) {\n try {\n this._socket[closeMethod]();\n } catch (E) {\n // just ignore\n }\n }\n\n this._destroy();\n }", "onConnection(delegate) {\n this.connected = delegate\n }", "onClose() {\n if (!this.dead) this.client.setTimeout(this.connect.bind(this), this.attempts * 1000);\n }", "close()\n {\n this.emit( this.finishStep({}) )();\n this.emit = function()\n {\n throw( \"This client has shut down!\");\n };\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }", "function onclose(){\n onerror(\"socket closed\");\n }" ]
[ "0.6754185", "0.64962906", "0.64600635", "0.6403356", "0.6273734", "0.61808014", "0.6180456", "0.6160751", "0.6160751", "0.6160751", "0.6158082", "0.6147628", "0.6147628", "0.6147628", "0.6147628", "0.6147628", "0.61403173", "0.61403066", "0.61403066", "0.61289436", "0.6100282", "0.6100282", "0.6100282", "0.6100282", "0.6100282", "0.6100282", "0.6100282", "0.6100282", "0.609785", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.6063011", "0.604756", "0.6040258", "0.6040258", "0.6033488", "0.6033488", "0.6023325", "0.6023325", "0.60220253", "0.60079557", "0.60079557", "0.60079557", "0.5989728", "0.59705967", "0.5957684", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274", "0.59432274" ]
0.0
-1
returns a stream, either immediately or through the callback
function connect (stream_url, options, callback) { if (options && options.constructor===Function) { callback = options; options = undefined; } var u = url.parse(stream_url.toString()); var proto = u.protocol.substr(0, u.protocol.length-1); var adaptor = adaptors[proto]; if (!adaptor) { throw new Error('protocol unknown: '+u.protocol); } return adaptor.connect(u, options, callback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createStream () {\n\n }", "getStream(url, callback) {\n var stream;\n if (url.startsWith('http')) {\n return request.get(url).on('response', function(res) {\n if (res.headers['content-type'] === 'audio/mpeg') {\n return callback(res);\n } else {\n self.emit('invalid url', url);\n return loadNextSong();\n }\n });\n } else {\n stream = fs.createReadStream(url);\n return callback(stream);\n }\n }", "function initstream() {\n function Stream( head, tailPromise ) {\n if ( typeof head != 'undefined' ) {\n this.headValue = head;\n }\n if ( typeof tailPromise == 'undefined' ) {\n tailPromise = function () {\n return new Stream();\n };\n }\n this.tailPromise = tailPromise;\n }\n\n // TODO: write some unit tests\n Stream.prototype = {\n empty: function() {\n return typeof this.headValue == 'undefined';\n },\n head: function() {\n if ( this.empty() ) {\n throw new Error('Cannot get the head of the empty stream.');\n }\n return this.headValue;\n },\n tail: function() {\n if ( this.empty() ) {\n throw new Error('Cannot get the tail of the empty stream.');\n }\n // TODO: memoize here\n return this.tailPromise();\n },\n item: function( n ) {\n if ( this.empty() ) {\n throw new Error('Cannot use item() on an empty stream.');\n }\n var s = this;\n while ( n != 0 ) {\n --n;\n try {\n s = s.tail();\n }\n catch ( e ) {\n throw new Error('Item index does not exist in stream.');\n }\n }\n try {\n return s.head();\n }\n catch ( e ) {\n throw new Error('Item index does not exist in stream.');\n }\n },\n length: function() {\n // requires finite stream\n var s = this;\n var len = 0;\n\n while ( !s.empty() ) {\n ++len;\n s = s.tail();\n }\n return len;\n },\n add: function( s ) {\n return this.zip( function ( x, y ) {\n return x + y;\n }, s );\n },\n append: function ( stream ) {\n if ( this.empty() ) {\n return stream;\n }\n var self = this;\n return new Stream(\n self.head(),\n function () {\n return self.tail().append( stream );\n }\n );\n },\n zip: function( f, s ) {\n if ( this.empty() ) {\n return s;\n }\n if ( s.empty() ) {\n return this;\n }\n var self = this;\n return new Stream( f( s.head(), this.head() ), function () {\n return self.tail().zip( f, s.tail() );\n } );\n },\n map: function( f ) {\n if ( this.empty() ) {\n return this;\n }\n var self = this;\n return new Stream( f( this.head() ), function () {\n return self.tail().map( f );\n } );\n },\n concatmap: function ( f ) {\n return this.reduce( function ( a, x ) {\n return a.append( f(x) );\n }, new Stream () );\n },\n reduce: function () {\n var aggregator = arguments[0];\n var initial, self;\n if(arguments.length < 2) {\n if(this.empty()) throw new TypeError(\"Array length is 0 and no second argument\");\n initial = this.head();\n self = this.tail();\n }\n else {\n initial = arguments[1];\n self = this;\n }\n // requires finite stream\n if ( self.empty() ) {\n return initial;\n }\n // TODO: iterate\n return self.tail().reduce( aggregator, aggregator( initial, self.head() ) );\n },\n sum: function () {\n // requires finite stream\n return this.reduce( function ( a, b ) {\n return a + b;\n }, 0 );\n },\n walk: function( f ) {\n // requires finite stream\n this.map( function ( x ) {\n f( x );\n return x;\n } ).force();\n },\n force: function() {\n // requires finite stream\n var stream = this;\n while ( !stream.empty() ) {\n stream = stream.tail();\n }\n },\n scale: function( factor ) {\n return this.map( function ( x ) {\n return factor * x;\n } );\n },\n filter: function( f ) {\n if ( this.empty() ) {\n return this;\n }\n var h = this.head();\n var t = this.tail();\n if ( f( h ) ) {\n return new Stream( h, function () {\n return t.filter( f );\n } );\n }\n return t.filter( f );\n },\n take: function ( howmany ) {\n if ( this.empty() ) {\n return this;\n }\n if ( howmany == 0 ) {\n return new Stream();\n }\n var self = this;\n return new Stream(\n this.head(),\n function () {\n return self.tail().take( howmany - 1 );\n }\n );\n },\n drop: function( n ){\n var self = this;\n\n while ( n-- > 0 ) {\n\n if ( self.empty() ) {\n return new Stream();\n }\n\n self = self.tail();\n }\n\n // create clone/a contructor which accepts a stream?\n return new Stream( self.headValue, self.tailPromise );\n },\n member: function( x ){\n var self = this;\n\n while( !self.empty() ) {\n if ( self.head() == x ) {\n return true;\n }\n\n self = self.tail();\n }\n\n return false;\n },\n toArray: function( n ) {\n var target, result = [];\n if ( typeof n != 'undefined' ) {\n target = this.take( n );\n }\n else {\n // requires finite stream\n target = this;\n }\n target.walk( function ( x ) {\n result.push( x );\n } );\n return result;\n },\n print: function( n ) {\n var target;\n if ( typeof n != 'undefined' ) {\n target = this.take( n );\n }\n else {\n // requires finite stream\n target = this;\n }\n target.walk( function ( x ) {\n //console.log( x );\n } );\n },\n toString: function() {\n // requires finite stream\n return '[stream head: ' + this.head() + '; tail: ' + this.tail() + ']';\n }\n };\n\n Stream.makeOnes = function() {\n return new Stream( 1, Stream.makeOnes );\n };\n Stream.makeNaturalNumbers = function() {\n return new Stream( 1, function () {\n return Stream.makeNaturalNumbers().add( Stream.makeOnes() );\n } );\n };\n Stream.make = function( /* arguments */ ) {\n if ( arguments.length == 0 ) {\n return new Stream();\n }\n var restArguments = Array.prototype.slice.call( arguments, 1 );\n return new Stream( arguments[ 0 ], function () {\n return Stream.make.apply( null, restArguments );\n } );\n };\n Stream.fromArray = function ( array ) {\n if ( array.length == 0 ) {\n return new Stream();\n }\n return new Stream( array[0], function() { return Stream.fromArray(array.slice(1)); } );\n };\n Stream.range = function ( low, high ) {\n if ( typeof low == 'undefined' ) {\n low = 1;\n }\n if ( low == high ) {\n return Stream.make( low );\n }\n // if high is undefined, there won't be an upper bound\n return new Stream( low, function () {\n return Stream.range( low + 1, high );\n } );\n };\n Stream.equals = function ( stream1, stream2 ) {\n if ( ! (stream1 instanceof Stream) ) return false;\n if ( ! (stream2 instanceof Stream) ) return false;\n if ( stream1.empty() && stream2.empty() ) {\n return true;\n }\n if ( stream1.empty() || stream2.empty() ) {\n return false;\n }\n if ( stream1.head() === stream2.head() ) {\n return Stream.equals( stream1.tail(), stream2.tail() );\n }\n };\n return Stream;\n}", "function initstream() {\n function Stream(head, tailPromise) {\n if (typeof head != 'undefined') {\n this.headValue = head;\n }\n if (typeof tailPromise == 'undefined') {\n tailPromise = function () {\n return new Stream();\n };\n }\n this.tailPromise = tailPromise;\n }\n\n // TODO: write some unit tests\n Stream.prototype = {\n empty: function () {\n return typeof this.headValue == 'undefined';\n },\n head: function () {\n if (this.empty()) {\n throw new Error('Cannot get the head of the empty stream.');\n }\n return this.headValue;\n },\n tail: function () {\n if (this.empty()) {\n throw new Error('Cannot get the tail of the empty stream.');\n }\n // TODO: memoize here\n return this.tailPromise();\n },\n item: function (n) {\n if (this.empty()) {\n throw new Error('Cannot use item() on an empty stream.');\n }\n var s = this;\n while (n != 0) {\n --n;\n try {\n s = s.tail();\n } catch (e) {\n throw new Error('Item index does not exist in stream.');\n }\n }\n try {\n return s.head();\n } catch (e) {\n throw new Error('Item index does not exist in stream.');\n }\n },\n length: function () {\n // requires finite stream\n var s = this;\n var len = 0;\n\n while (!s.empty()) {\n ++len;\n s = s.tail();\n }\n return len;\n },\n add: function (s) {\n return this.zip(function (x, y) {\n return x + y;\n }, s);\n },\n append: function (stream) {\n if (this.empty()) {\n return stream;\n }\n var self = this;\n return new Stream(self.head(), function () {\n return self.tail().append(stream);\n });\n },\n zip: function (f, s) {\n if (this.empty()) {\n return s;\n }\n if (s.empty()) {\n return this;\n }\n var self = this;\n return new Stream(f(s.head(), this.head()), function () {\n return self.tail().zip(f, s.tail());\n });\n },\n map: function (f) {\n if (this.empty()) {\n return this;\n }\n var self = this;\n return new Stream(f(this.head()), function () {\n return self.tail().map(f);\n });\n },\n concatmap: function (f) {\n return this.reduce(function (a, x) {\n return a.append(f(x));\n }, new Stream());\n },\n reduce: function () {\n var aggregator = arguments[0];\n var initial, self;\n if (arguments.length < 2) {\n if (this.empty()) throw new TypeError(\"Array length is 0 and no second argument\");\n initial = this.head();\n self = this.tail();\n } else {\n initial = arguments[1];\n self = this;\n }\n // requires finite stream\n if (self.empty()) {\n return initial;\n }\n // TODO: iterate\n return self.tail().reduce(aggregator, aggregator(initial, self.head()));\n },\n sum: function () {\n // requires finite stream\n return this.reduce(function (a, b) {\n return a + b;\n }, 0);\n },\n walk: function (f) {\n // requires finite stream\n this.map(function (x) {\n f(x);\n return x;\n }).force();\n },\n force: function () {\n // requires finite stream\n var stream = this;\n while (!stream.empty()) {\n stream = stream.tail();\n }\n },\n scale: function (factor) {\n return this.map(function (x) {\n return factor * x;\n });\n },\n filter: function (f) {\n if (this.empty()) {\n return this;\n }\n var h = this.head();\n var t = this.tail();\n if (f(h)) {\n return new Stream(h, function () {\n return t.filter(f);\n });\n }\n return t.filter(f);\n },\n take: function (howmany) {\n if (this.empty()) {\n return this;\n }\n if (howmany == 0) {\n return new Stream();\n }\n var self = this;\n return new Stream(this.head(), function () {\n return self.tail().take(howmany - 1);\n });\n },\n drop: function (n) {\n var self = this;\n\n while (n-- > 0) {\n\n if (self.empty()) {\n return new Stream();\n }\n\n self = self.tail();\n }\n\n // create clone/a contructor which accepts a stream?\n return new Stream(self.headValue, self.tailPromise);\n },\n member: function (x) {\n var self = this;\n\n while (!self.empty()) {\n if (self.head() == x) {\n return true;\n }\n\n self = self.tail();\n }\n\n return false;\n },\n toArray: function (n) {\n var target,\n result = [];\n if (typeof n != 'undefined') {\n target = this.take(n);\n } else {\n // requires finite stream\n target = this;\n }\n target.walk(function (x) {\n result.push(x);\n });\n return result;\n },\n print: function (n) {\n var target;\n if (typeof n != 'undefined') {\n target = this.take(n);\n } else {\n // requires finite stream\n target = this;\n }\n target.walk(function (x) {\n //console.log( x );\n });\n },\n toString: function () {\n // requires finite stream\n return '[stream head: ' + this.head() + '; tail: ' + this.tail() + ']';\n }\n };\n\n Stream.makeOnes = function () {\n return new Stream(1, Stream.makeOnes);\n };\n Stream.makeNaturalNumbers = function () {\n return new Stream(1, function () {\n return Stream.makeNaturalNumbers().add(Stream.makeOnes());\n });\n };\n Stream.make = function () /* arguments */{\n if (arguments.length == 0) {\n return new Stream();\n }\n var restArguments = Array.prototype.slice.call(arguments, 1);\n return new Stream(arguments[0], function () {\n return Stream.make.apply(null, restArguments);\n });\n };\n Stream.fromArray = function (array) {\n if (array.length == 0) {\n return new Stream();\n }\n return new Stream(array[0], function () {\n return Stream.fromArray(array.slice(1));\n });\n };\n Stream.range = function (low, high) {\n if (typeof low == 'undefined') {\n low = 1;\n }\n if (low == high) {\n return Stream.make(low);\n }\n // if high is undefined, there won't be an upper bound\n return new Stream(low, function () {\n return Stream.range(low + 1, high);\n });\n };\n Stream.equals = function (stream1, stream2) {\n if (!(stream1 instanceof Stream)) return false;\n if (!(stream2 instanceof Stream)) return false;\n if (stream1.empty() && stream2.empty()) {\n return true;\n }\n if (stream1.empty() || stream2.empty()) {\n return false;\n }\n if (stream1.head() === stream2.head()) {\n return Stream.equals(stream1.tail(), stream2.tail());\n }\n };\n return Stream;\n }", "invokeStream(path, params = {}, callback, maxPermission = permission_1.Permission.CONFIG) {\n let node = this.nodeCache.getRemoteNode(path);\n let stream = node._invoke(params, this, maxPermission);\n if (callback) {\n stream.listen(callback);\n }\n return stream;\n }", "function doStream(self, hashname, callback)\n{\n var stream = getStream(self, seen(self, hashname));\n stream.handler = function(self, packet, cbHandler) { callback(null, packet, cbHandler); }\n return stream;\n}", "newStream() {\n return this.channel.newStream();\n }", "getStream() {\n if(this.newStreamRequired()) {\n if (this.stream){\n this.stream.destroy();\n } \n this.streamCreatedAt = new Date();\n //console.log(\"Sending request as \" + this.request.config.languageCode);\n this.stream = speech.streamingRecognize(this.request)\n .on('error', console.error) \n .on('data', this.sendTranscription.bind(this));\n }\n return this.stream;\n }", "function createWrapperStream () {\n const stream = new PassThrough()\n let onFinishCallbacks = []\n\n stream._realOn = stream.on\n stream.on = function (eventName, callback) {\n if (eventName === 'finish') {\n return onFinishCallbacks.push(callback)\n }\n\n if (eventName === 'progress') {\n return stream.upload.on('httpUploadProgress', callback)\n }\n\n return stream._realOn(eventName, callback)\n }\n\n stream.triggerFinish = () => onFinishCallbacks.forEach(fn => fn())\n\n return stream\n}", "getStream() {\n return h(\n this._client.connect()\n .then(() => {\n const query = new QueryStream(this._source, this._params);\n const stream = this._client.query(query);\n\n stream.on('end', () => {\n this._client.end();\n });\n\n return stream\n .pipe(h())\n ;\n })\n )\n .flatten()\n ;\n }", "stream(){\n var fileName = __dirname + '/songs' + this.dataFile;\n var stats = fs.statSync(fileName);\n var stream = fs.createReadStream(fileName);\n return {\n stream : stream,\n stats : stats\n };\n }", "function _createOrRetrieveStream(inline) {\n // build the stream processors if needed\n if (!_streams.length) {\n // append the $sink as the ultimate filter\n $filters.push(function(_, inline) {return inline ? {init:$sink.init, decl:$sink.decl, done:$sink.done, err: $sink.err} : $sink})\n for(var i = 0; i < 2; i++){ // 0 for j2c.sheet, 1 for j2c.inline\n for (var j = $filters.length; j--;) {\n _streams[i] = freeze(\n defaults(\n $filters[j](_streams[i], !!i),\n _streams[i]\n )\n )\n }\n }\n }\n return _streams[inline]\n }", "function getStream(req, res) {\n var track = Track.create({id: req.params.id}),\n converter = Converter.create();\n\n res.contentType('application/ogg');\n\n track.stream(function (err, steam) {\n if (err) {\n console.log(err);\n res.send(503, err);\n return;\n }\n steam.pipe(converter.process.stdin);\n converter.process.stdout.pipe(res);\n });\n\n res.header('Access-Control-Allow-Origin', '*');\n\n // may need long polling here ?\n // https://devcenter.heroku.com/articles/request-timeout\n // res.header('transports', ['xhr-polling']);\n\n req.on('close', function () {\n track.stopStream();\n converter.kill();\n });\n }", "function stream(fn, initial) {\n function _stream(value) {\n return {\n value,\n next() {\n return _stream(fn(value));\n }\n };\n }\n \n return () => _stream(initial);\n}", "stream(URL, handler) {\n console.log(`GET ${URL} stream`);\n oboe({\n method: \"GET\",\n url: this.baseURL + URL,\n headers: this.headers,\n })\n .node(\"!\", function(data) {\n console.log(\"STREAM data : \" + JSON.stringify(data));\n handler(data);\n })\n .fail(function(errorReport) {\n console.error(JSON.stringify(errorReport));\n });\n }", "async getStream () {\n\t\tthis.stream = await this.request.data.streams.getById(this.id);\n\t\tif (!this.stream) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'stream' });\n\t\t}\n\t}", "function getObjectStream(_a) {\n var bucket = _a.bucket, key = _a.key, client = _a.client;\n return __awaiter(this, void 0, void 0, function () {\n var stream;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, client.getObject(bucket, key)];\n case 1:\n stream = _b.sent();\n return [2 /*return*/, stream.pipe(gunzip_maybe_1.default()).pipe(maybeTarball())];\n }\n });\n });\n}", "async getStream () {\n\t\tif (!this.streamId) {\n\t\t\tthrow this.errorHandler.error('noMatchFound', { info: this.request.body.to });\n\t\t}\n\t\ttry {\n\t\t\tthis.stream = await this.data.streams.getById(this.streamId);\n\t\t}\n\t\tcatch (error) {\n\t\t\tthrow this.errorHandler.error('internal', { reason: error });\n\t\t}\n\t\tif (!this.stream) {\n\t\t\tthrow this.errorHandler.error('streamNotFound', { info: this.streamId });\n\t\t}\n\t}", "readStream(path, cb) {\n\t\tconst promise = Path.normalizePath(path).then((path) => this.adapter.readStream(path));\n\n\t\tif (cb) {\n\t\t\tpromise.nodeify(cb);\n\t\t}\n\n\t\treturn promise;\n\t}", "function SimpleStream(){\n EventHandler.call(this);\n }", "async getStream () {\n\t\tif (this.codeError) {\n\t\t\t// replies to code errors become part of the code error stream\n\t\t\tthis.attributes.streamId = this.codeError.get('streamId');\n\t\t} else if (this.creatingCodeError) {\n\t\t\t// if creating a code error, we'll create a stream\n\t\t\treturn;\n\t\t}\n\n\t\tthis.stream = await this.data.streams.getById(this.attributes.streamId);\n\t\tif (!this.stream) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'stream'});\n\t\t}\n\t\tif (this.stream.get('type') === 'file') {\n\t\t\t// creating posts in a file stream is no longer allowed\n\t\t\tthrow this.errorHandler.error('createAuth', { reason: 'can not post to a file stream' });\n\t\t} else if (this.stream.get('type') === 'object' && !this.attributes.parentPostId) {\n\t\t\t// can't create root posts in an object stream\n\t\t\tthrow this.errorHandler.error('createAuth', { reason: 'cannot create non-reply in object stream' });\n\t\t}\n\t}", "consumeStream(topic, callback) {\n // let's monitor end of stream to show in pending list if timeout happens\n this.consume(`${topic }:end`).catch(() => {});\n // eslint-disable-next-line no-use-before-define\n const stream = new ReadableStream(topic, this.eventContext);\n if (callback) {\n callback(stream);\n return this;\n }\n return stream;\n }", "function Stream(){EE.call(this);}", "function Stream(){EE.call(this);}", "function Stream(){EE.call(this);}", "function Stream(){EE.call(this);}", "function successCallback(gotStream) {\n // Make the stream available to the console for introspection \n window.stream = gotStream;\n\n // Attach the returned stream to the <video> element // in the HTML page\n video.src = window.URL.createObjectURL(stream);\n\n // Start playing video\n video.play();\n}", "_esWait() {\n // Create through stream.....\n return es( function(err, data) {\n if (err) {\n log(err, 'red')\n }\n })\n }", "function StreamLikeSequence() {}", "function Stream() {\n EventEmitter.call(this);\n}", "function Stream() {\n EventEmitter.call(this);\n}", "function Stream() {\n EventEmitter.call(this);\n }", "newStream (callback) {\n callback = callback || noop\n let stream = this.multiplex.createStream()\n\n const conn = new Connection(\n catchError(toPull.duplex(stream)),\n this.conn\n )\n\n setImmediate(() => callback(null, conn))\n\n return conn\n }", "newStream (callback) {\n callback = callback || noop\n let stream = this.multiplex.createStream()\n\n const conn = new Connection(\n catchError(toPull.duplex(stream)),\n this.conn\n )\n\n setImmediate(() => callback(null, conn))\n\n return conn\n }", "newStream (callback) {\n callback = callback || noop\n let stream = this.multiplex.createStream()\n\n const conn = new Connection(\n catchError(toPull.duplex(stream)),\n this.conn\n )\n\n setImmediate(() => callback(null, conn))\n\n return conn\n }", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function Stream() {\n\t EventEmitter.call(this);\n\t}", "function createStream() {\n var\n self = this,\n s = new Stream(),\n transport = self._createTransport(),\n count = 0,\n processed = 0;\n\n s.readable = true;\n s.writable = true;\n s.destroy = function () { s.writable = false; };\n\n s.write = function (msg) {\n count += 1;\n sendMessage.call(self, transport, msg, function (err, res) {\n if (err) { return s.emit('error', err); }\n s.emit('data', res);\n processed += 1;\n });\n };\n\n s.end = function (msg) {\n var intvl;\n\n if (arguments.length) { s.write(msg); }\n\n intvl = setInterval(function () {\n if (count === processed) {\n transport.close();\n s.emit('end');\n clearInterval(intvl);\n }\n }, 25);\n s.destroy();\n };\n\n return s;\n}", "function newStream(trackingList) {\n return __awaiter(this, void 0, void 0, function () {\n var ready;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n // close old stream if it exists\n if (stream)\n stream.close();\n // setup stream stream\n stream = new TwitterStream(conf, false);\n ready = false;\n // setup stream events\n stream.stream(\"statuses/filter\", { track: trackingList });\n stream.on(\"connection success\", function () {\n console.log(\"connection success\");\n // allow this method to return fully initialized stream\n ready = true;\n // block parse method from returning\n // streaming = true; \n });\n stream.on(\"connection aborted\", function () {\n console.log(\"connection closed\");\n stream = null;\n });\n _a.label = 1;\n case 1:\n if (!!ready) return [3 /*break*/, 3];\n return [4 /*yield*/, wait(100)];\n case 2:\n _a.sent();\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, stream];\n }\n });\n });\n}", "* getStream (path) {\n return this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }).createReadStream()\n }", "createStream() {\n const [status, ctx] = binding.CreateStream(this._impl);\n if (status !== 0) {\n throw `CreateStream failed: ${binding.ErrorCodeToErrorMessage(status)} (0x${status.toString(16)})`;\n }\n return new StreamImpl(ctx);\n }", "function streamify(promise, factory) {\n var _then = promise.then;\n promise.then = function() {\n factory();\n var newPromise = _then.apply(promise, arguments);\n return streamify(newPromise, factory);\n };\n promise.stream = factory;\n return promise;\n}", "function gulpCallback(obj) {\n var stream = new Stream.Transform({objectMode: true});\n\n stream._transform = function(file, unused, callback) {\n var result = obj(file, stream);\n file = result === undefined ? file : result;\n callback(null, file);\n };\n\n return stream;\n}", "getStream(subscriber) {\n return subscriber.stream.getMediaStream();\n }", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}", "function Stream() {\n EE.call(this);\n}" ]
[ "0.69684416", "0.6697496", "0.649594", "0.64256966", "0.6297833", "0.6272961", "0.6232723", "0.6209701", "0.6203551", "0.6202945", "0.6165016", "0.61540854", "0.6143595", "0.6141776", "0.61142117", "0.6018327", "0.60158896", "0.6010273", "0.6007689", "0.59725046", "0.59573394", "0.5952457", "0.5946876", "0.5946876", "0.5946876", "0.5946876", "0.5940544", "0.59359264", "0.5934292", "0.5910599", "0.5910599", "0.59098834", "0.5905742", "0.5905742", "0.5905742", "0.5885662", "0.5885662", "0.5885662", "0.5885662", "0.5885662", "0.5877511", "0.582003", "0.58081555", "0.5771662", "0.5740577", "0.573424", "0.5724289", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395", "0.57076395" ]
0.0
-1
This is our generic mouse move handler. PaperJS doesn't give us a simple mouse event for each object so we need to map the generic events to our specific object. This handles mouseover and mouseout events.
function onMouseMove(event) { var hitResult = project.hitTest(event.point, rel.hitOptions); if (hitResult && hitResult.item && hitResult.item.rel) { if (rel.currentItem === hitResult.item) { return; } else { if (rel.currentItem) { rel.currentItem.rel.mouseout(); rel.currentItem = null; } rel.currentItem = hitResult.item; rel.currentItem.rel.mouseover(); } } else { /* * This is mouse out */ if (rel.currentItem) { rel.currentItem.rel.mouseout(); rel.currentItem = null; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onElementMouseMove(event) {}", "mouseMoveGeneralHandler () {\n this.raycaster.setFromCamera(this.mouse, this.camera);\n\n // Check if the user mouses over a strand arrow\n this.intersects = this.raycaster.intersectObjects(this.strandArrows);\n\n if (this.intersects.length) {\n this.hoveredStrandArrow = this.intersects[0].object;\n this.previousHoveredStrandArrow = this.hoveredStrandArrow;\n } else if (this.previousHoveredStrandArrow) {\n this.previousHoveredStrandArrow = undefined;\n }\n\n // Check if we intersect with a pile\n this.intersects = this.raycaster.intersectObjects(this.pileMeshes);\n\n if (this.intersects.length) {\n this.mouseOverPileHandler(this.intersects[0].object);\n } else if (fgmState.previousHoveredPile) {\n this.mouseOutPileHandler();\n }\n\n // Draw rectangular lasso\n if (\n this.lassoIsActive ||\n (this.mouseWentDown && !fgmState.hoveredPile)\n ) {\n if (!this.lassoIsActive) { this.initLasso(); }\n\n this.drawLasso(\n this.dragStartPos.x,\n this.mouse.x,\n this.dragStartPos.y,\n this.mouse.y\n );\n }\n }", "function canvasMouseMoveEv(event) {}", "function mouseMoveHandler(event){\n\t\t\tif(event.pageX == null && event.clientX != null){\n\t\t\t\tvar de = document.documentElement, b = document.body;\n\t\t\t\tlastMousePos.pageX = event.clientX + (de && de.scrollLeft || b.scrollLeft || 0);\n\t\t\t\tlastMousePos.pageY = event.clientY + (de && de.scrollTop || b.scrollTop || 0);\n\t\t\t}else{\n\t\t\t\tlastMousePos.pageX = event.pageX;\n\t\t\t\tlastMousePos.pageY = event.pageY;\n\t\t\t}\n\t\t\t\n\t\t\tvar offset = overlay.cumulativeOffset();\n\t\t\tvar pos = {\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\t\n\t\t\tif(options.mouse.track && selectionInterval == null){\t\t\t\t\n\t\t\t\thit(pos);\n\t\t\t}\n\t\t\t\n\t\t\ttarget.fire('flotr:mousemove', [event, pos]);\n\t\t}", "function onMouseMove(event) {\n\tmousePos = event.point;\n}", "function onMouseMove(event) {\n mousePos = event.point;\n}", "function handleMouseMove(evt) {\n evt.preventDefault();\n var p = mouseCoordsSvg(evt);\n if(g['shape'].active){\n g['shape'].mousemove(p.x, p.y);\n }\n else if (g['active_tool']){\n if (g['tool']=='move'){\n var t = [];\n t.x = p.x - g['p'].x;\n t.y = p.y - g['p'].y;\n g['moving_object'].setAttribute('transform',\n 'translate('+t.x+','+t.y+')');\n }\n else if (g['tool']=='delete'){\n var target = evt.target;\n if (target.NodeName !== 'svg' && target.id !== 'canvas'){\n var group = find_group(target.parentNode);\n delete_object(group);\n }\n }\n }\n}", "onMouseMove (e) {\n let event = 'mouse-move';\n if (this.isMouseDown) {\n event = 'mouse-drag';\n }\n\n this.emit(event, normaliseMouseEventToElement(this.canvas, e));\n }", "onMouseMove(event) {\n this.internalMove(event);\n }", "onMouseMove(event) {\n this.internalMove(event);\n }", "function onMouseMove(event) {\n moveAt(event.pageX, event.pageY);\n }", "on_mousemove(e, localX, localY) {\n\n }", "function _onMouseMove(event) {\n $.mouse.x = Graphics.pageToCanvasX(event.pageX);\n $.mouse.y = Graphics.pageToCanvasY(event.pageY);\n }", "function mouseMoveHandler(e) {\n updateFromEvent(e);\n move(mouseX, mouseY);\n }", "function onMouseMove(event) {\n\tmousePosition=event;\n}", "function on_mousemove(event){\n\tif(event.offsetX) {\n\t\tmouseX = event.offsetX;\n\t\tmouseY = event.offsetY;\n\t\t}\n\telse if(event.layerX) {\n\t\tmouseX = event.layerX;\n\t\tmouseY = event.layerY;\n\t\t}\n\tmouse_pos = [mouseX, mouseY];\n\t}", "function cust_MouseMove(evnt, swipedirection) {\n //f_log(evnt.clientX+\", \"+evnt.clientY)\n}", "mouseUpdate() {\n\t\t\t\tvar mouseWasOver = this.mouseIsOver;\n\t\t\t\tvar mouseWasPressed = this.mouseIsPressed;\n\n\t\t\t\tthis.mouseIsOver = false;\n\t\t\t\tthis.mouseIsPressed = false;\n\n\t\t\t\tvar mousePosition;\n\n\t\t\t\tif (this._drawnWithCamera) mousePosition = this.p.createVector(this.p.camera.mouseX, this.p.camera.mouseY);\n\t\t\t\telse mousePosition = this.p.createVector(this.p.mouseX, this.p.mouseY);\n\n\t\t\t\t//rollover\n\t\t\t\tif (this.collider) {\n\t\t\t\t\tif (this.collider instanceof CircleCollider) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tdist(mousePosition.x, mousePosition.y, this.collider.center.x, this.collider.center.y) <\n\t\t\t\t\t\t\tthis.collider.radius\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\tthis.mouseIsOver = true;\n\t\t\t\t\t} else if (this.collider instanceof AABB) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tmousePosition.x > this.collider.left() &&\n\t\t\t\t\t\t\tmousePosition.y > this.collider.top() &&\n\t\t\t\t\t\t\tmousePosition.x < this.collider.right() &&\n\t\t\t\t\t\t\tmousePosition.y < this.collider.bottom()\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.mouseIsOver = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//global p5 var\n\t\t\t\t\tif (this.mouseIsOver && this.p.mouseIsPressed) this.mouseIsPressed = true;\n\n\t\t\t\t\t//event change - call functions\n\t\t\t\t\tif (!mouseWasOver && this.mouseIsOver && this.onMouseOver !== undefined)\n\t\t\t\t\t\tif (typeof this.onMouseOver === 'function') this.onMouseOver.call(this, this);\n\t\t\t\t\t\telse this.p.print('Warning: onMouseOver should be a function');\n\n\t\t\t\t\tif (mouseWasOver && !this.mouseIsOver && this.onMouseOut !== undefined)\n\t\t\t\t\t\tif (typeof this.onMouseOut === 'function') this.onMouseOut.call(this, this);\n\t\t\t\t\t\telse this.p.print('Warning: onMouseOut should be a function');\n\n\t\t\t\t\tif (!mouseWasPressed && this.mouseIsPressed && this.onMousePressed !== undefined)\n\t\t\t\t\t\tif (typeof this.onMousePressed === 'function') this.onMousePressed.call(this, this);\n\t\t\t\t\t\telse this.p.print('Warning: onMousePressed should be a function');\n\n\t\t\t\t\tif (mouseWasPressed && !this.p.mouseIsPressed && !this.mouseIsPressed && this.onMouseReleased !== undefined)\n\t\t\t\t\t\tif (typeof this.onMouseReleased === 'function') this.onMouseReleased.call(this, this);\n\t\t\t\t\t\telse this.p.print('Warning: onMouseReleased should be a function');\n\t\t\t\t}\n\t\t\t}", "function mouse_move_handler(e) {\n //Saves the previous coordinates\n mouse.px = mouse.x;\n mouse.py = mouse.y;\n\n //Sets the new coordinates\n mouse.x = e.offsetX || e.layerX;\n mouse.y = e.offsetY || e.layerY;\n }", "function mouseMove(event) {\n // Update the mouse coordinates\n data.input.mouse.x = event.clientX;\n data.input.mouse.y = event.clientY;\n}", "mouseMove(x, y) {}", "listenMouseMove(point) {\n const nearest = this.getNearestPoint(point);\n const container = this.map.getContainer();\n if (nearest) {\n container.style.cursor = 'pointer';\n if (this.$$hoveringPoint !== nearest) {\n this.$$hoveringPoint = nearest;\n if (this.options.onHover) {\n this.options.onHover(point, nearest);\n }\n }\n } else {\n this.$$hoveringPoint = null;\n delete container.style.cursor;\n }\n }", "mouseMove(mousePos, mapSize, mapPos, scale, tileSize=32) {\n const newPos = this.getTilePos(mousePos, mapSize, mapPos, scale, tileSize);\n this.socket.emit('move', newPos);\n }", "mouseMove(prev, pt) {}", "function mouseMove(event) {\r\n drawStarsMove(event.clientX, event.clientY);\r\n}", "function mousemove(e){\n\t\t// console.log(e);\n\t}", "function onMouseMove(e) {\n\t// store mouseX and mouseY position\n\tmouseX = e.clientX;\n\tmouseY = e.clientY;\n}", "onMouseMove(event) {\n this.internalMove(false, event);\n }", "onMouseMove(event) {\n this.internalMove(false, event);\n }", "function eventMouseMove(e) {\n\n //move the box based on the mouse X and Y\n movePiece(e.offsetX, e.offsetY);\n\n }", "function handleMouseMove(e)\r\n{\r\n if (!e)\r\n {\r\n var e = window.event;\r\n }\r\n\r\n if (e.pageX || e.pageY)\r\n {\r\n _mouse_x = e.pageX;\r\n _mouse_y = e.pageY;\r\n }\r\n else if (e.clientX || e.clientY)\r\n {\r\n /* _mouse_x = e.clientX + document.body.scrollLeft\r\n + document.documentElement.scrollLeft;\r\n _mouse_y = e.clientY + document.body.scrollTop\r\n + document.documentElement.scrollTop;*/\r\n }\r\n\r\n if (_isResizing)\r\n {\r\n updateResize();\r\n }\r\n\r\n if (_isMoving)\r\n {\r\n updateMove();\r\n }\r\n}", "function onMouseMove(evt) {\n if (evt) {\n mx = evt.clientX;\n my = evt.clientY;\n }\n if (!hoverback) { return; }\n function find(node, ox, oy) {\n if (mx < ox ||\n my < oy ||\n mx > ox + node.width ||\n my > oy + node.height) {\n return;\n }\n if (node instanceof Split) {\n return find(node.first, ox, oy) || (node.isVertical ?\n find(node.second, ox, oy + node.firstSize + 10) :\n find(node.second, ox + node.firstSize + 10, oy));\n }\n if (node instanceof Desktop) {\n return find(node.child, ox, oy);\n }\n return node;\n }\n var node = find(desktop, 0, 0);\n if (node && node.onMove) { node.onMove(mx, my); }\n }", "mouseMove(evt, point) {\n this.setHover(this.topBlockAt(point));\n }", "function mouseMoveHandler(e) {\r\n\tif (!e) {\r\n\t\te = event;\r\n\t}\r\n\tif (e.clientX) {\r\n\t //if there is an x pos property\r\n\t //GET MOUSE LOCATION\r\n\t\tv_xcoordinate = mouseX(e);\r\n\t\tv_ycoordinate = mouseY(e);\t\r\n\t\tv_havemouse = 1;\r\n\t}\r\n\tif (v_visible == 1) { \r\n\t\tpositionLayer();\t\r\n\t}\r\n}", "function customMouseMove(event) {\n\tGL_handleMouseMove(event);\n\tif (BASE_PICK_isMovieMode == false) {\n\t\tdrawScene();\n\t}\n}", "function documentMouseMoveHandler(event){\n mouseX = event.clientX * scale;\n mouseY = event.clientY * scale;\n }", "function bindMouseMove() {\r\n canvas.addEventListener('mousemove', function(e) {\r\n mousePos = getMousePos(e);\r\n });\r\n }", "handleMouseMove(e) {\n e.preventDefault();\n this.props.onMouseMove(e, this.props.id);\n }", "function onMouseMove(e) {\n console.log(e);\n draw(e);\n}", "function onMouseMove( event ) {\n\n\t// calculate mouse position in normalized device coordinates\n\t// (-1 to +1) for both components\n\n\tmouse.x = ( event.clientX / WIDTH ) * 2 - 1;\n\t\n\t// HACKY!!!\n\tmouse.y = (- ( event.clientY / HEIGHT ) * 2 + 1) + 1;\t\n\n if (selectedObject) {\n\n\n // If the mouse is moving while there is an object selected\n raycaster.setFromCamera( mouse, camera );\n \n intersects = raycaster.intersectObject( plane );\n\n if (intersects.length > 0) {\n selectedObject.position.copy(intersects[ 0 ].point);\n }\n /*} else {\n // If the mouse is moving while there is no object intersected\n intersects = raycaster.intersectObject(cubeMesh);\n if ( intersects.length > 0 ) {\n plane.position.copy(intersects[0].object.position );\n plane.lookAt( camera.position );\n }\n } */\n\n }\n}", "function handleMouseMove(event) {\n var tx = -1 + (event.clientX / WIDTH) * 2;\n var ty = 1 - (event.clientY / HEIGHT) * 2;\n mousePos = {\n x: tx,\n y: ty\n };\n}", "onElementMouseMove(event) {\n // Keep track of the last mouse position in case, due to OSX sloppy focusing,\n // focus is moved into the browser before a mousedown is delivered.\n // The cached mousemove event will provide the correct target in\n // GridNavigation#onGridElementFocus.\n this.mouseMoveEvent = event;\n }", "function onMouseMove(e) {\r\n controller.onMouseMove(e);\r\n}", "function combineMouseMoveHandlers(e) {\n highlightElementWhenHoveredOver(e);\n detectMouseShake(e);\n }", "e_mouseOver(e)\n\t{\n\n\t}", "function mpMouseover() {\n // Get mouse positions from the main canvas.\n var mousePos = d3.mouse(this)\n // Get the data from our map!\n if (typeof (transform) !== \"undefined\") {\n var nodeData = quadtree.find((mousePos[0] - margin.left - transform[\"x\"]) / transform[\"k\"],\n (mousePos[1] - margin.top - transform[\"y\"]) / transform[\"k\"], 50)\n } else {\n nodeData = quadtree.find(mousePos[0] - margin.left, mousePos[1] - margin.top, 50)\n }\n\n // Only show mouseover if hovering near a point\n if (typeof (nodeData) !== \"undefined\") {\n // If we're dealing with mp nodes\n if (typeof (nodeData.id) !== \"undefined\") {\n slide5_show_mp_tooltip(nodeData, mousePos)\n } else {\n median_mouseover(nodeData, mousePos)\n }\n }\n d3.event.preventDefault()\n\n }", "function onMouseMove(obj, e)\n {\n //trace(\"onMouseMove\", obj, e);\n var snumber = obj._id;\n var seriesInfo = pThis.series[snumber];\n var seriesObj;\n\n if (seriesInfo && seriesInfo.keyData != 0)\n {\n seriesObj = {\n datapoint: [seriesInfo.percent, seriesInfo.data],\n dataIndex: 0,\n series: seriesInfo,\n seriesIndex: snumber\n }\n pThis._checkPieHighlight(obj, seriesObj);\n pThis._moveTooltip(obj, e);\n }\n }", "function handleMouseMove(event) {\n var eventDoc, doc, body;\n event = event || window.event;\n if (event.pageX == null && event.clientX != null) {\n eventDoc = (event.target && event.target.ownerDocument) || document;\n doc = eventDoc.documentElement;\n body = eventDoc.body;\n\n event.pageX = event.clientX +\n (doc && doc.scrollLeft || body && body.scrollLeft || 0) -\n (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = event.clientY +\n (doc && doc.scrollTop || body && body.scrollTop || 0) -\n (doc && doc.clientTop || body && body.clientTop || 0 );\n }\n mousex = event.pageX;\n mousey = event.pageY;\n }", "mouseMove(event) {\n this.pmouse = this.mouse.clone();\n\n if (event.offsetX) {\n this.mouse.x = event.offsetX;\n this.mouse.y = event.offsetY;\n } else {\n var clientRect = this.container.getBoundingClientRect();\n this.mouse.x = event.pageX - Math.round(clientRect.left + window.pageXOffset);\n this.mouse.y = event.pageY - Math.round(clientRect.top + window.pageYOffset);\n }\n }", "mouseMove(event) {\n this.pmouse = this.mouse.clone();\n\n if (event.offsetX) {\n this.mouse.x = event.offsetX;\n this.mouse.y = event.offsetY;\n } else {\n var clientRect = this.container.getBoundingClientRect();\n this.mouse.x = event.pageX - Math.round(clientRect.left + window.pageXOffset);\n this.mouse.y = event.pageY - Math.round(clientRect.top + window.pageYOffset);\n }\n }", "_onMouseMove(/*object*/ event) {\n const x = event.clientX;\n const y = event.clientY;\n\n this._deltaX += (x - this._x);\n this._deltaY += (y - this._y);\n\n if (this._animationFrameID === null) {\n // The mouse may move faster then the animation frame does.\n // Use `requestAnimationFramePolyfill` to avoid over-updating.\n this._animationFrameID =\n requestAnimationFramePolyfill(this._didMouseMove);\n }\n\n this._x = x;\n this._y = y;\n event.preventDefault();\n }", "mouseMoveHandler(evt){\n let mousePos = this.calculateMousePos(evt);\n this.setPaddlePos(mousePos);\n }", "externalMouseMove() {\n this._strikeMouseMove();\n this._localPointer._mouseX = this.getPointer()._mouseX;\n this._localPointer._mouseY = this.getPointer()._mouseY;\n }", "function mouseMoved()\n{\n\t\n}", "function mouseMoved(){\n stroke(r, g, b, 120);\n strokeWeight(5);\n fill(r, g, b, 100);\n ellipse(mouseX, mouseY, 10);\n}", "function documentMouseMoveHandler(event){\n game.mouse.position.x = event.clientX - 10;\n game.mouse.position.y = event.clientY - 10;\n}", "onMouseMove($event) {\n this.isMouseMoveCalled = true;\n if ((this.isPanning || this.isMinimapPanning) && this.panningEnabled) {\n this.panWithConstraints(this.panningAxis, $event);\n }\n else if (this.isDragging && this.draggingEnabled) {\n this.onDrag($event);\n }\n }", "e_mouseMove(e)\n\t{\n\t\tthis.mouseState.lx = this.mouseState.x;\n\t\tthis.mouseState.ly = this.mouseState.y;\n\t\tthis.mouseState.x = e.clientX;\n\t\tthis.mouseState.y = e.clientY;\n\t\tthis.mouseState.dx = this.mouseState.x - this.mouseState.lx;\n\t\tthis.mouseState.dy = this.mouseState.y - this.mouseState.ly;\n\n\t\t// Should probably move this to Update loop\n\t\tthis.GetComponents().forEach(function(component)\n\t\t{\n\t\t\tif(CCUtil.Collides(component._getBoundingBox(), e.clientX, e.clientY))\n\t\t\t{\n\t\t\t\tif(!component.isMouseOver)\n\t\t\t\t\tcomponent._mouseEvent(ComponentEvent.MOUSE_OVER, e);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(component.isMouseOver)\n\t\t\t\t\tcomponent._mouseEvent(ComponentEvent.MOUSE_OUT, e);\n\t\t\t}\n\t\t});\n\t}", "function onMouseMove(e) {\n\t\n\t\t\t// propagate the event to the callback with x,y coords\n\t\t\tmouseMoveCB(e, translateMouseCoords(e.clientX, e.clientY));\n\n\t\t}", "onElementMouseMove(event) {\n if (this.dragContext) {\n this.updateMove(event.clientX);\n event.preventDefault();\n }\n }", "onElementMouseMove(event) {\n if (this.dragContext) {\n this.updateMove(event.clientX);\n event.preventDefault();\n }\n }", "function handleMouseMove(evt) {\r\n\r\n g_mouseX = evt.clientX - g_canvas.offsetLeft;\r\n g_mouseY = evt.clientY - g_canvas.offsetTop;\r\n \r\n}", "_strikeMouseMove() {\n for (let i = 0; i < this._mouseMoveCallbacks.length; i++) {\n let currentCallback = this._mouseMoveCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._mouseMoveCallbacks.length; i++) {\n if (this._mouseMoveCallbacks[i][1])\n this._mouseMoveCallbacks.splice(i--, 1);\n }\n }", "function onMousemoveNodeHandler(d) {\r\n\t\t\t\t\t\t\toCtrl.fireHover(d);\r\n\t\t\t\t\t\t\t// console.log('onMousemoveNodeHandler: pos X '+ d.x\r\n\t\t\t\t\t\t\t// + \" pos Y \" + d.y);\r\n\t\t\t\t\t\t}", "onElementMouseMove(event) {\n if (this.dragContext) {\n this.updateMove(event.clientX);\n event.preventDefault();\n }\n }", "function mainMouseMove(e){\n\t\t\t\tif($(\".timeline .item:hover\").length == 0){\n\t\t\t\t\t$(\".battle .tooltip\").hide();\n\t\t\t\t}\n\n\t\t\t\tif(($(\".timeline-container:hover\").length > 0)&&(! animating)){\n\t\t\t\t\tvar offsetX = ($(window).width() - $(\".timeline-container\").width()) / 2;\n\t\t\t\t\tvar posX = e.clientX - offsetX;\n\t\t\t\t\tvar hoverTime;\n\n\t\t\t\t\tif(timelineScaleMode == \"fit\"){\n\t\t\t\t\t\thoverTime = ((battle.getDuration()+2000) * (posX / $(\".timeline-container\").width()))-1000;\n\t\t\t\t\t} else if(timelineScaleMode == \"zoom\"){\n\t\t\t\t\t\thoverTime = ((posX - 50 + $(\".timeline-container\").scrollLeft())/50) * 1000;\n\t\t\t\t\t}\n\n\n\t\t\t\t\ttime = hoverTime;\n\n\t\t\t\t\tself.displayCumulativeDamage(battle.getTimeline(), time);\n\t\t\t\t}\n\t\t\t}", "onMouseMove(event) {\n //Mausposition soll fuer den Canvas(bzw. auch den CanvasDiv berechnet werden)\n event.preventDefault();\n let wrapper = $('#visualizationsCanvasDiv');\n const pos = this.getCanvasRelativePosition(event);\n //in mouse(2d Vektor) wird aktuelle x und y Position der Maus in der Szene gespeichert\n //wert zwischen -1 und 1, wenn auf Canvas und |1|> wenn nicht auf Canvas\n this.mouse.x = (pos.x / wrapper.width()) * 2 - 1;\n this.mouse.y = -(pos.y / wrapper.height()) * 2 + 1;\n //rendert das Bild neu\n if (window.actionDrivenRender)\n this.render();\n }", "function canvasMouseMove(e){\r\n\tif(!e) e = window.event;\r\n\tif(useStates){\r\n\t\tStates.current().input.mouseMove(e);\r\n\t}\r\n\tgInput.mouseMove(e);\r\n}", "function mouseMoveHandler() {\n // make sure you hide the rect\n d3.select('.highlight-rect')\n .attr(\"width\", 0)\n .attr(\"height\",0)\n .attr('opacity', 0);\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 // highlight the point if we found one, otherwise hide the highlight circle\n highlight(site && site.data);\n\n highlightDapi(site && site.data)\n\n }", "function onPointerMove( event ) {\r\n\r\n\t\tevent.preventDefault();\r\n\r\n\t\tswitch ( event.pointerType ) {\r\n\r\n\t\t\tcase 'mouse':\r\n\t\t\tcase 'pen':\r\n\t\t\t\tonMouseMove( event );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// TODO touch\r\n\r\n\t\t}\r\n\r\n\t}", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.mouseover = true;\n this.stroke = 3;\n }\n else {\n this.mouseover = false;\n this.stroke = 2;\n }\n }", "function onMouseUpdate(e) {\n x = e.pageX;\n y = e.pageY;\n}", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.mouseover = true;\n }\n else {\n this.mouseover = false;\n }\n }", "function handleMouseMove() {\n document.body.style.pointerEvents = \"auto\";\n }", "function onMouseMove(e) {\n //Posição do mouse\n var pos = getMousePos(canvas, e);\n if (drag && level.selectedtile.selected) {\n //Pega o tile sobre o mouse\n mt = getMouseTile(pos);\n if (mt.valid) {\n //Verifica se pode ser trocado\n if (canSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row)) {\n //Troca os tiles\n mouseSwap(mt.x, mt.y, level.selectedtile.column, level.selectedtile.row);\n }\n }\n }\n }", "_setupMouse () {\n this._events['mousemove'] = {event: this._handleMouseMove, context: document}\n this._events['mousedown'] = {event: this._handleMouseDown, context: document}\n this._events['mouseenter'] = {event: this._handleMouseEnter, context: document}\n this._events['mouseleave'] = {event: this._handleMouseLeave, context: document}\n this._events['mouseup'] = {event: this._handleMouseUp, context: document}\n }", "onIntersectedByMouse(){\n }", "function tileMouseMove(e, $element){\n\t\t//&& (e.which === 1 || ev.touches)\n\t\tif( GAME.board.painting ){\n\n\t\t\tswitch($activeTool){\n\t\t\t\tcase $paintTool:\n\t\t\t\t\tthrottlePaint($element);\n\t\t\t\t\tbreak;\n\t\t\t\tcase $fillTool:\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase $eraseTool:\n\t\t\t\t\tthrottleErase($element);\n\t\t\t\t\tbreak;\n\t\t\t\tcase $highlightTool:\n\t\t\t\t\tthrottleHighlight($element);\n\t\t\t\t\tbreak;\n\t\t\t\tcase $sampleTool:\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "function handleMouseMove(evt){\n\t\tdocument.getElementById(\"box\").style.cursor=\"crosshair\";\n\t}", "function mousemoveEvents(e) {\n if (isSuggestion(e) && !autoScrolled) {\n unselect(selectedLi);\n selectedLi = getSelectionMouseIsOver(e);\n select(selectedLi);\n }\n\n mouseHover = true;\n autoScrolled = false;\n }", "function handleMouseMove(event) {\n\n\t// here we are converting the mouse position value received \n\t// to a normalized value varying between -1 and 1;\n\t// this is the formula for the horizontal axis:\n\t\n\tvar tx = -1 + (event.clientX / sceneWidth)*2;\n\n\t// for the vertical axis, we need to inverse the formula \n\t// because the 2D y-axis goes the opposite direction of the 3D y-axis\n\t\n\tvar ty = 1 - (event.clientY / sceneHeight)*2;\n\tmousePos = {x:tx, y:ty};\n\n}", "mouseMoved({pageX, pageY, clientX, clientY, height=window.innerHeight, width=window.innerWidth}){\n this.mouseX = pageX - (width/2);\n this.mouseY = pageY - (height/2);\n this.clientX = clientX;\n this.clientY = clientY;\n\n }", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tdocument.body.style.cursor = 'pointer';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tdocument.body.style.cursor = 'default';\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "function mouse(kind, pt, id) {\n \n}", "onMouseMove(event) {\n event.preventDefault();\n\n var rect = event.target.getBoundingClientRect();\n var x = event.clientX;\n var y = event.clientY;\n this.mouse.x = (x - rect.left) / (this.canvasWebGL.clientWidth / 2.0) - 1.0; //Get mouse x position\n this.mouse.y = -((y - rect.bottom) / (this.canvasWebGL.clientHeight / 2.0) + 1.0); //Get mouse y position\n this.raycaster.setFromCamera(this.mouse, this.camera); //Set raycast position\n\n //If the selected object is a slot\n if (this.selected_slot && this.canMoveSlots) {\n this.moveSlot();\n return;\n }\n\n //If the selected object is a closet face\n if (this.selected_face && this.canMoveCloset) {\n this.moveFace();\n return;\n }\n\n //If the selected object is a closet pole or shelf\n if (this.selected_component && this.canMoveComponents) {\n this.moveComponent();\n return;\n }\n\n var intersects = this.raycaster.intersectObjects(this.scene.children[0].children);\n if (intersects.length > 0) {\n //Updates plane position to look at the camera\n var face = intersects[0].object;\n this.plane.setFromNormalAndCoplanarPoint(this.camera.position, face.position);\n\n if (this.hovered_object !== face) this.hovered_object = face;\n } else {\n if (this.hovered_object !== null) this.hovered_object = null;\n }\n }", "handleMouseMove({offsetX,offsetY}){\n // Update last mouse position only when scroll out\n if(this.state.zoom === MAP_LIMITS.ZOOM.MIN){\n this.setState({\n cursorX: offsetX,\n cursorY: offsetY\n });\n }\n }", "function onMouseMove(event) {\n if (!mouseDown) { // if the mouse is not held down, it returns nothing.\n return;\n }\n // The variables rotationX and rotationY are given the mouses position on the screen using the functions,\n // clientX and clientY, which get the mouses current position in the scene.\n // The values of the mousePosition is the current position of the mouse on the screen,\n // these values are taken away from the mouses position so that the object can follow the mouse,\n // position on the screen when the mouse is being moved.\n var rotationX = event.clientX - mousePositionX,\n rotationY = event.clientY - mousePositionY;\n // resets the values to be the same as the current mouse position.\n mousePositionX = event.clientX;\n mousePositionY = event.clientY;\n // calls the function with the mouse position information and the functions information.\n rotateObject(rotationX, rotationY, projectile);\n }", "function logMouseMove (event) {\n\t\t\tmousePos = {\n\t\t\t\tx: event.pageX,\n\t\t\t\ty: event.pageY,\n\t\t\t\tw: window.innerWidth,\n\t\t\t\th: window.innerHeight\n\t\t\t};\n\t\t\tif (chkAxes(mousePos)) socket.emit('mousepoll', mousePos);\n\t\t}", "function onMouse_Item(event, source, typeView) {\r\n\tif (typeView == 'border') {\r\n\t\tif (event.type == 'mouseover') {\r\n\t\t\t//mouseover\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn showBorder(source);\r\n\t\t} else {\r\n\t\t\t//mouseout\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn removeBorder(source);\r\n\t\t}\r\n\t} else {\r\n\t\tif (event.type == 'mouseover') {\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn highlight(source);\r\n\t\t} else {\r\n\t\t\tevent.cancelBubble=true;\r\n\t\t\treturn lowlight(source);\r\n\t\t}\r\n\t}\r\n}", "function CALCULATE_TOUCH_MOVE_OR_MOUSE_MOVE() {\r\n \r\n \r\n \r\n for (var x=0;x<BUTTONS.length;x++){\r\n if ( GLOBAL_CLICK.x > BUTTONS[x].POSITION.x && GLOBAL_CLICK.x <BUTTONS[x].POSITION.x + BUTTONS[x].DIMENSIONS.W() && GLOBAL_CLICK.y > BUTTONS[x].POSITION.y && GLOBAL_CLICK.y < BUTTONS[x].POSITION.y + BUTTONS[x].DIMENSIONS.H() ) {\r\n \r\n }\r\n else {\r\n \r\n }\r\n }\r\n\r\n \r\n/////////////////////////////////////\r\n// get object highlight on mouse over\r\n/////////////////////////////////////\r\n \r\nfor (var x=0;x<HOLDER.length;x++){\r\n\r\n\r\n // HOLDER[x].POSITION.x , HOLDER[x].POSITION.y , HOLDER[x].FI \r\n if (GET_DISTANCE_FROM_OBJECT.VALUE(x) < HOLDER[x].FI ) {\r\n\t\r\n HOLDER[x].HOVER = true;\r\n \r\n VOICE.SPEAK(\"Object \" + HOLDER[x].NAME + \" selected\");\r\n \r\nif (HOLDER[x].GLOBAL_STATE == \"PASIVE\" && GLOBAL_CLICK.CLICK_PRESSED == true ) {\r\n\r\n\r\n if ( HOLDER[x].roundedRect_X < 1.8 ) {\r\n HOLDER[x].roundedRect_X = HOLDER[x].roundedRect_X + 0.01;\r\n HOLDER[x].roundedRect_W = HOLDER[x].roundedRect_W + 0.02;\r\n }\r\n\r\n \r\n }\r\n \r\n \r\n }else {\r\n HOLDER[x].HOVER = false; \r\n }\r\n\r\n\r\n\r\n}\r\n\r\n\r\n\r\n DETECTED_COLOR = SURF.getImageData(GLOBAL_CLICK.x, GLOBAL_CLICK.y, 1, 1).data; \r\n\r\n \r\n \r\n \r\n \r\n }", "_onMouseMove(event) {\n super._onMouseMove(event);\n if (event.data.createState >= 1) {\n let drawing = event.data.object;\n let [gx, gy] = [event.data.originalEvent.x, event.data.originalEvent.y];\n\n // If the cursor has moved close to the edge of the window\n this._panCanvasEdge(gx, gy);\n\n drawing.updateDragPosition(event.data.destination)\n drawing.refresh();\n event.data.createState = 2;\n }\n }", "function handleMouseMove(event) {\n\t// here we are converting the mouse position value received \n\t// to a normalized value varying between -1 and 1;\n\t// this is the formula for the horizontal axis:\n\t\n\tlet tx = -1 + (event.clientX / WIDTH) * 2;\n\n\t// for the vertical axis, we need to inverse the formula \n\t// because the 2D y-axis goes the opposite direction of the 3D y-axis\n\t\n\tlet ty = 1 - (event.clientY / HEIGHT) * 2;\n\tmousePos = {x:tx, y:ty};\n\n}", "function handleMouseMove(xpos, ypos, state, evnt, widgets) {\n\tif(isWidgetLocked) {\n\t\tstate = lockedWidget.listener.mouseMove(xpos, ypos, state, evnt);\n\t}\n\treturn state;\n}", "mouseOn() {\n if (mouseX > this.x && mouseX < this.x + this.w\n && mouseY > this.y && mouseY < this.y + this.h) {\n this.stroke = 2;\n this.mouseover = true;\n }\n else {\n this.stroke = 1;\n this.mouseover = false;\n }\n }", "_addMouseMoveEventListener(range = this.RANGE) {\n this.canvas.addEventListener(\"mousemove\", e => {\n this._setMousePosition(e);\n })\n this.mouse.range = range;\n }", "function onMouseMove(event) {\r\n\r\n // Update the mouse variable\r\n event.preventDefault();\r\n mouse.x = (event.clientX / window.innerWidth) * 2 - 1;\r\n mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;\r\n}", "_mouseEvent(eventType, e)\n\t{\n\t\tswitch(eventType)\n\t\t{\n\t\t\tcase ComponentEvent.MOUSE_OVER:\n\t\t\t\tdocument.body.style.cursor = 'text';\n\t\t\t\tbreak;\n\n\t\t\tcase ComponentEvent.MOUSE_OUT:\n\t\t\t\tdocument.body.style.cursor = 'default';\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tsuper._mouseEvent(eventType, e);\n\t}", "function canvasMouseMove(event) {\r\n\tvar mouseX = event.pageX - canvas[0].offsetLeft;\r\n\tvar mouseY = event.pageY - canvas[0].offsetTop;\r\n\tif (mouseDown && anySelected && !resize) {\r\n\t\t// move shape\r\n\t\tmoveShape(mouseX, mouseY);\r\n\t} else if (mouseDown && !resize) {\r\n\t\t// add shape\r\n\t\taddShape(mouseX, mouseY);\r\n\t\tmouseDown = false;\r\n\t} else if (anySelected && resize && !resizeChange) {\r\n\t\t// resize shape\r\n\t\tvar shape = previousSelectedShape;\r\n\t\tif (shape.testHit(mouseX+10, mouseY+10) || shape.testHit(mouseX+10, mouseY-10) || shape.testHit(mouseX-10, mouseY+10) || shape.testHit(mouseX-10, mouseY-10)) {\r\n\t\t\tshape.update(shape.x1, shape.y1, mouseX, mouseY);\r\n\t\t\tdrawShapes();\r\n\t\t\tresizeChange = true;\r\n\t\t}\r\n\t} else if ((!anySelected && !resize) || resizeChange) {\r\n\t\t// update shape\r\n\t\tif (resizeChange){\r\n\t\t\tvar shape = previousSelectedShape;\r\n\t\t} else {\r\n\t\t\tvar shape = shapes[shapes.length-1];\r\n\t\t}\r\n\t\tif (shape) {\r\n\t\t\tshape.update(shape.x1, shape.y1, mouseX, mouseY);\r\n\t\t}\r\n\t}\r\n\tdrawShapes();\r\n}", "mouseMoveHandler() {\n return (e) => {\n this.mouse_x = e.pageX - this.canvas.offsetLeft;\n this.mouse_y = e.pageY - this.canvas.offsetTop;\n }\n }", "function onWindowMouseMove( event )\n\t\t{\n\t\t\tmouseX = event.clientX-$(canvasContainer).offset().left;\n\t\t\tmouseY = event.clientY-$(canvasContainer).offset().top;\n\t\t\ttargetX += (mouseX-targetX)*0.2;\n\t\t\ttargetY += (mouseY-targetY)*0.2;\n\t\t}" ]
[ "0.6958642", "0.69252837", "0.6903783", "0.6833184", "0.6817881", "0.68149614", "0.6785755", "0.6744116", "0.6695063", "0.6695063", "0.6685408", "0.66851974", "0.6675137", "0.66101855", "0.6554682", "0.652512", "0.6519885", "0.6519761", "0.6486477", "0.64525104", "0.64495045", "0.6413251", "0.638654", "0.63713133", "0.6354173", "0.6311836", "0.62785095", "0.6277837", "0.6277837", "0.6275563", "0.62746906", "0.6268971", "0.626097", "0.6253603", "0.62510157", "0.6250411", "0.62416226", "0.6241587", "0.623883", "0.6237242", "0.6233593", "0.6233528", "0.6217352", "0.62028253", "0.62009203", "0.6194593", "0.6173951", "0.61547095", "0.61308867", "0.61308867", "0.6126958", "0.6124442", "0.61239636", "0.61196196", "0.61165106", "0.6116476", "0.6107191", "0.60960704", "0.6093812", "0.6091418", "0.6091418", "0.60809636", "0.6064928", "0.6055378", "0.6053718", "0.60459656", "0.6030592", "0.6025601", "0.60235184", "0.6021402", "0.6006699", "0.60059243", "0.5990967", "0.5990932", "0.5987369", "0.59708524", "0.5966715", "0.59665924", "0.5966315", "0.5962797", "0.5961783", "0.59585375", "0.5954164", "0.59532887", "0.5949519", "0.5933465", "0.5928303", "0.5924495", "0.59202564", "0.5919921", "0.5907774", "0.58903444", "0.5886935", "0.5885259", "0.5884835", "0.58833283", "0.58816487", "0.5879767", "0.5878185", "0.5875731" ]
0.62737924
31
Click events are easier. We just find the item which was under the mour when the button was released and call its click function.
function onMouseUp(event) { var hitResult = project.hitTest(event.point, rel.hitOptions); if (hitResult && hitResult.item && hitResult.item.rel) { hitResult.item.rel.click(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onClick(event) {\n const itemElement = event.target.closest(this.itemSelector);\n\n if (itemElement) {\n this.onItemClick(itemElement, event);\n }\n }", "onClick(event) {\n const itemElement = event.target.closest(this.itemSelector);\n\n if (itemElement) {\n this.onItemClick(itemElement, event);\n }\n }", "function clickItem()\n{\n\tvar item = this.item;\n\n\tif (null == item) item = this.parent.item\n\tif (null == item) item = this.parent.parent.item;\n\n\timage_list.toggleSelect(item.index);\n}", "function InventoryItemMouth2CupholderGagClick() {\n\tInventoryItemMouthCupholderGagClick();\n}", "itemClicked(e, item) {\n e.preventDefault()\n e.stopPropagation()\n\n // If the Quick Add button was clicked\n if (e.target.type === 'button') {\n this.addToCartClicked(e, item)\n }\n }", "onItemClick(name, elem, evt){\r\n this.emit('click', name, elem, evt);\r\n }", "clickItem(event) {\n\t\tconsole.log('Clicked item ' + JSON.stringify(event));\n\t\tthis.cursor = this.findCursorByID(event);\n\t\tconsole.log('Cursor is at ' + this.cursor);\n\t\tconsole.log('Selecting');\n\t\tthis.select();\n\t}", "function onItemActionClick(event){\r\n\t\t\t\t\r\n\t\t//var obj\r\n\t\tvar objButton = jQuery(this);\r\n\t\tvar objItem = objButton.parents(\"li\");\r\n\t\t\r\n\t\tg_objItems.selectSingleItem(objItem);\r\n\t\t\r\n\t\tvar action = objButton.data(\"action\");\r\n\t\t\r\n\t\tif(action == \"open_menu\")\r\n\t\t\treturn(true);\r\n\t\t\r\n\t\tt.runItemAction(action);\r\n\t\t\r\n\t}", "function bwClick(itemId) {\n $(itemId).click();\n}", "on_item_clicked(id) {\n\t\tsetGlobalConstrainById(this.entity_name,id);\n\t\tpageEventTriggered(this.lowercase_entity_name+\"_clicked\",{id:id});\n\t}", "on_item_clicked(id) {\n\t\tsetGlobalConstrainById(this.entity_name,id);\n\t\tpageEventTriggered(this.lowercase_entity_name+\"_clicked\",{id:id});\n\t}", "onElementMouseUp(event) {}", "onElementMouseUp(event) {}", "handleClick( event ){ }", "click(event) {\n if (event.target === this.get('element')) {\n this.sendAction();\n }\n }", "function takeButton(){\n\t\n\tif (player.playerLocation.LItem !== null) {\n\t\taddItemToInventory(player.playerLocation.LItem);\n\t\tplayer.playerLocation.LItem = null;\n\t} \n\t\n\t\tdisplayInventory();\n}", "selectItem() {\n if (this.selectedItem !== this.item.Name) {\n const selectEvent = new CustomEvent(\"buttonclick\", {\n bubbles: true,\n detail: this.item\n });\n this.dispatchEvent(selectEvent);\n }\n }", "function C012_AfterClass_Dorm_Click() {\n\n\t// Checks if the user clicks on any regular item\n\tInventoryClick(GetClickedInventory(), CurrentChapter, CurrentScreen);\n\n}", "click(){\n createAddItemWindow();\n }", "function onItemClick(ev) {\n const itemIndex = puzzleData.findIndex(item => item.el === ev.currentTarget);\n const possibleMoveIndex = possibleMove(itemIndex);\n if (possibleMoveIndex === false) {\n return;\n }\n\n moveItem(puzzleData[itemIndex], possibleMoveIndex, itemIndex);\n }", "handleClick() {}", "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 itemClick(event) {\n event.preventDefault();\n event.stopPropagation();\n $(this)\n .trigger('pathSelected')\n .addClass('fp-trail fp-clicked')\n .closest('ul')\n .trigger('debug');\n }", "function clickOn() {\n openedCards[0].click(cardToggle);\n}", "function clickMe(item, isSlider) {\n EventUtil.addHandler(item, \"mousedown\", function (event) {\n event = EventUtil.getEvent(event);\n // var target = EventUtil.getTarget(event);\n EventUtil.preventDefault(event);\n EventUtil.stopPropagation(event);\n\n dragMe.isSlider = isSlider;\n dragMe.obj = item;\n //dragMe.obj = target;\n\n // record the offset\n dragMe.diffX = event.clientX - item.offsetLeft;\n dragMe.diffY = event.clientY - item.offsetTop;\n });\n }", "onItemClick() {\n this.navigateTo(this.item.path);\n }", "function handleClick(e) {\n\tAlloy.Events.trigger('toggleLeft_Window');\n\n\tlet section = $.Left_elementsList.sections[e.sectionIndex];\n\t// Get the clicked item from that section\n\tlet item = section.getItemAt(e.itemIndex);\n\n\tif (item.label.text == \"Home\") {\n\n\t\tAlloy.Events.trigger('goToHome_fromDetailsWind');\n\t\tAlloy.Events.trigger('goToHome_frommenuListItemWin');\n\n\t} else {\n\n\n\t\t//let centerWin = require('appLevelVariable');\n\t\tlet menulistItemView = Alloy.createController('menuListItem').getView();\n\t\t// Get the section of the clicked item\n\n\t\trequire(\"loader_indica\").removeLoader();\n\t\trequire(\"loader_indica\").addLoader(menulistItemView, \"Loading Data..\");\n\n\t\tTi.API.info(\"Position\" + e.itemIndex);\n\t\t// Update the item's `title` property and set it's color to red:\n\t\tTi.API.info(item.label.text += \" (clicked)\");\n\t\t//Ti.API.info(centerWin_ios.getCenterwin());\n\t\t//centerWin.getCenterwin().add(menulistItemView);\n\t\tAlloy.Globals.centerWin.add(menulistItemView);\n\t\t//Ti.API.info(\"win\",centerWin_ios.getData());\n\t\trequire(\"animation\").rightToLeft(menulistItemView);\n\n\t}\n}", "function buttonsClick(e) {\n var target = e.target;\n while (target.id != \"story_content\") {\n switch (target.className) {\n case \"top\":\n moveBlockUp(target);\n return;\n case \"bottom\":\n moveBlockDown(target);\n return;\n case \"delete\":\n deleteBlock(target);\n return;\n case \"addmarker\":\n setactiveMarker(target);\n return;\n case \"addmarkerArtifact\":\n setactiveMarker(target);\n return;\n case \"removemarker\":\n removeMarker(target);\n return;\n case \"image_story gallery\":\n galleryChangePicture(target);\n return;\n case \"block_story\":\n editBlock(target);\n return;\n }\n target = target.parentNode;\n }\n}", "function onItemClick(){\r\n\t\t\t\t\r\n\t\tvar objItem = jQuery(this);\r\n\t\t\r\n\t\t//protection against double event handling\r\n\t\tvar isBelongs = isObjectBelongsToParent(objItem);\r\n\t\tif(isBelongs == false)\r\n\t\t\treturn(true);\r\n\t\t\r\n\t\tvar type = objItem.data(\"type\");\r\n\t\tvar file = objItem.data(\"file\");\r\n\t\t\r\n\t\tif(type == \"dir\"){\r\n\t\t\tt.loadPath(file);\r\n\t\t\treturn(false);\r\n\t\t}\r\n\t\t\r\n\t\t//on filename click:\r\n\t\t\r\n\t\t//if browser mode - then do identical to checkbox click\r\n\t\tif(g_temp.isBrowser == true && g_options.single_item_select == false)\r\n\t\t\ttoggleItemSelection(objItem);\r\n\t\telse\r\n\t\t\tselectSingleItem(objItem);\r\n\t\t\r\n\t\tvar isSelected = isItemSelected(objItem);\r\n\t\ttriggerEvent(events.SELECT_OPERATION, [objItem, isSelected]);\r\n\t\t\r\n\t}", "onMouseClick(event) {\n const me = this,\n menuItem = event.target.closest('.b-menuitem');\n\n if (menuItem) {\n me.triggerElement(menuItem, event); // IE / Edge still triggers event listeners that were removed in a listener - prevent this\n\n event.stopImmediatePropagation();\n }\n }", "onMouseClick(event) {\n const me = this,\n menuItem = event.target.closest('.b-menuitem');\n\n if (menuItem) {\n me.triggerElement(menuItem, event);\n\n // IE / Edge still triggers event listeners that were removed in a listener - prevent this\n event.stopImmediatePropagation();\n }\n }", "function clickOnBoardItem() {\n let tempActiveTag;\n\n return function userClick(event) {\n let currentActiveTag = event.target;\n\n if (currentActiveTag !== tempActiveTag && activeExists()) {\n activeExists().classList.remove('active');\n }\n event.target.classList.toggle('active');\n showCurrentTag(event.target);\n tempActiveTag = event.target;\n }\n}", "function clickHandler(event)\n {\n console.log(\"offers\" + document.getElementsByClassName(\"footer\")[0].offsetTop);\n // Get value of current clicked item\n const data = event.target.firstChild.data;\n // Find class of pressed element and move to the section\n Object.keys(NavItemsData).forEach(i => {\n if(NavItemsData[i].name == data)\n {\n document.getElementsByClassName(NavItemsData[i].position)[0].scrollIntoView({ behavior: 'smooth' });\n }\n });\n }", "function clickHandler(){ // declare a function that updates the state\n elementIsClicked = true;\n isElementClicked();\n }", "click(x, y, _isLeftButton) {}", "function clickHandler() {\n console.log(\"Button 2 Pressed\");\n }", "function buthandleclick_this() {\n\tbuthandleclick(this);\n}", "function clickElement(el) {\r\n\t/*var clickMouse = document.createEvent(\"MouseEvents\");\r\n\tclickMouse.initMouseEvent(\"click\", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\r\n\tplaybutton.dispatchEvent(clickMouse);*/\r\n\tvar clickUI = document.createEvent(\"UIEvents\");\r\n\tclickUI.initUIEvent(\"click\", true, true, window, 1);\r\n\tel.dispatchEvent(clickUI);\r\n}", "clicked(x, y) {}", "function clickOnGameButton(event)\n{\n // Hier coderen we alles wat moet worden gedaan zodra een speler op de game button clicked\n // @TODO: Click event van de game button programmeren. Wat moet er allemaal gebeuren na een klik?\n}", "function cb_beforeClick(cb, pos) { }", "viewWasClicked (view) {\n\t\tthis.parent.menuItemWasSelected(view.menuItem)\n\t}", "menuButtonClicked() {}", "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}", "function __clickhandler() {\n buttonfunc(elemnode); return false;\n }", "function _dragAreaClicked(event) {\n\t\t\t\tif (this._cancelNextItemClick) return false;\n\t\t\t\t// TODO work out which item, if any, has been clicked and fire itemClicked event\n\n\t\t\t\tvar itemElm = $(event.source);\n\n\t\t\t\t// bubble up until we find the item the user clicked on\n\t\t\t\twhile (itemElm[0] != event.attachedTo) {\n\t\t\t\t\tif ( itemElm.hasClass(\"timetable-item\") ) {\n\t\t\t\t\t\t// found it!\n\t\t\t\t\t\t$fire(this._timetable, \"itemClick\", $apply({item: this.itemInstance[ itemElm[0].id ]}, new $events.Event(event)));\n\t\t\t\t\t}\n\t\t\t\t\titemElm = itemElm.parent();\n\t\t\t\t}\n\t\t\t}", "function clicked() {\r\n // consists of animations and transitions\r\n resetClickLinks();\r\n // Click node Action and Info\r\n // only if it is defined\r\n click_node = drag_node; // defining here\r\n nodePop(click_node);\r\n loadInfo();\r\n}", "function InventoryItemMouthFuturisticHarnessPanelGagClick() {\n\tInventoryItemMouthFuturisticPanelGagClick();\n}", "handleClick(e,item) {\n console.log(e);\n \n //send the item back up to the parent\n this.props.handleNavigation(item);\n }", "addClickEvents () {\n this.clickEvents.clickId.forEach((cid, i) => {\n let id = document.getElementById(cid)\n id.run = this.clickEvents.clickRun[i]\n id.addEventListener('mousedown', (e) => {\n e.currentTarget.run()\n this.checkItemStates()\n })\n })\n }", "function buttonDown(event) {\n this.isdown = true;\n // calculate offset\n var pos = event.data.getLocalPosition(this.parent);\n this.offX = pos.x - this.x;\n this.offY = pos.y - this.y;\n this.alpha = 1;\n}", "_handleClick(e) {\n this.dispatchEvent(\n new CustomEvent(\"hax-tray-button-click\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n eventName: this.eventName,\n index: this.index,\n value: this.eventData,\n },\n })\n );\n }", "clickHandler(evt) {\n if (evt.target.classList.contains('fa-check')) {\n gameApp.eventHandler(evt);\n }\n\n if (evt.target.classList.contains('assignment') || evt.target.parentElement.classList.contains('assignment')) {\n gameApp.activateContract(evt);\n }\n\n if (evt.target.classList.contains('loc')) {\n gameApp.addLoc();\n }\n\n if (evt.target.classList.contains('nav-button')) {\n let elem = evt.target;\n gameApp.gameView.changeMenue(elem);\n }\n }", "static handleRelease(event){\n if(event.target.tagName === \"BUTTON\"){\n let pokemonId = parseInt(event.target.parentNode.dataset.id)\n event.target.parentNode.remove()\n\n deletePokemon(pokemonId)\n }\n }", "function clickHandler(e) {\n // Nur bei Linksklick\n if (e.button !== 0) return;\n clickAt(e.offsetX, e.offsetY);\n }", "function mediumClick() {\n if (mediumButton.isUnderMouse(mouseX, mouseY)) {\n isUnder = true;\n mediumLevel();\n levelPicked = true;\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 }", "function onItemButtonClick(event){\r\n\t\t\r\n\t\tvar objButton = jQuery(this);\r\n\t\t\r\n\t\t//open preview dialog\r\n\t\tif(objButton.hasClass(\"uc-button-preview\")){\r\n\t\t\t\r\n\t\t\tevent.preventDefault();\r\n\t\t\t\r\n\t\t\tvar objItem = objButton.parents(\"li\");\r\n\t\t\tvar urlPreview = objButton.data(\"url-link\");\r\n\t\t\t\r\n\t\t\topenAddonPreviewDialog(objItem, urlPreview);\r\n\t\t\t\r\n\t\t\tevent.stopPropagation();\r\n\t\t\treturn(false);\r\n\t\t}\r\n\t\t\r\n\t\tif(objButton.hasClass(\"uc-button-free\"))\r\n\t\t\treturn(true);\r\n\t\t\r\n\t\tevent.stopPropagation();\r\n\t\t\t\t\r\n\t\treturn(true);\r\n\t}", "function tileClick() {\n\tmoveOneTile(this);\n}", "function reactionMouseUp (e) { \r\n reactionUp(); // Hilfsroutine aufrufen \r\n }", "function _click(d){\n \n }", "metodoClick(){\n console.log(\"diste click\")\n }", "function clickEvent(){ \r\n const execCode = new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnDoublePickTrigger, (event) => {\r\n if(event.meshUnderPointer.value === null ){\r\n console.log(board.indexOf(event.meshUnderPointer));\r\n if(canPlay){ \r\n if (turn){\r\n event.meshUnderPointer.value = 'x';\r\n makeX(event.meshUnderPointer); \r\n win();\r\n }else{\r\n event.meshUnderPointer.value = 'o';\r\n makeO(event.meshUnderPointer);\r\n win();\r\n }\r\n }\r\n }\r\n });\r\n return execCode;\r\n }", "function quanPress(){\r\n quantityButton.hide();\r\n pricesButton.hide();\r\n visButton.hide();\r\n fill(244,24,100);\r\n textSize(20);\r\n text(\"You can click on an icon in order to view its name and quantity.\", 200, 700);\r\n\r\n//cycles through all of the items in the array, and draws a \"graph\" based on the quantity of the item, the quantity of the item = the number of items drawn.\r\n for (var x = 0; x < 18; x++){\r\n for (var g = 0; g < itemQuantity[x]/10000; g++){\r\n img[x] = createImg(\"http://services.runescape.com/m=itemdb_oldschool/1545055248360_obj_big.gif?id=\" + itemID[x]);\r\n//creates an event if one of the items is clicked\r\n img[x].mouseClicked(itemQuanClicked);\r\n img[x].position(x*70,g*1.25);\r\n img[x].size(80,80);\r\n }\r\n }\r\n }", "function clickHandle( event ) {\n\t\tvar tagName = event.target.tagName.toLowerCase();\n\t\t\n\t\tif ( tagName !== 'button' || window.isGiveUp ) {\n\t\t\treturn;\n\t\t}\n\t\t// console.log( window.isGiveUp )\n\t\tvar id = event.target.id;\n\t\tvar obj = {\n\t\t\tcards : window.myCards\n\t\t};\n\n\t\tswitch( id ) {\n\t\t\tcase 'giveUp':\n\t\t\t\tsend( socket, 'giveUp', obj );\n\t\t\t\tbreak;\n\t\t\tcase 'double':\n\t\t\t\tsend( socket, 'double', obj );\n\t\t\t\tbreak;\n\t\t\tcase 'compare':\n\t\t\t\twindow.isClickCompare = true;\n\t\t\t\tbreak;\n\t\t\tcase 'goOn':\n\t\t\t\tsend( socket, 'goOn', obj );\n\t\t\t\tbreak;\n\n\t\t}\n\t}", "function buttonClicked(e) {\n\tvar element = e.memo.element;\n\tif (this.options.singleSelect) {\n\t\tthis.select(element);\n\t} else {\n\t\tif (this.isSelected(element)) {\n\t\t\tthis.deselect(element);\t\n\t\t} else {\n\t\t\tthis.select(element);\n\t\t}\n\t}\n}", "function clickHandler(event) {\n //take the path from the src attribute of the img node\n //that we clicked on. We get a reference to that node\n //from event.target\n var targetString = event.target.src;\n //take the relevant part of the path from the node\n var targetPath = targetString.split('assets')[1];\n var itemPath;\n\n //look through the ItemImage objects to find the one that\n //corresponds to the image we clicked on\n for (var i = 0; i < items.length; i++) {\n //get the relevant part from the path on the object\n itemPath = items[i].path.split('assets')[1];\n if (itemPath === targetPath) {\n //when we find the right object increment its clicked\n //property\n items[i].clicked += 1;\n }\n }\n\n changePicture();\n}", "function addEventHandlersOnItems() {\n //Favorite button click\n $(\".itemCardFavIcon\").click(function (e) {\n e.stopPropagation();\n displayAlert(\"Added on favorites!\");\n });\n\n \n //SET HANDLER FOR ITEM DETAILS\n $(\".shopContent .itemCard\").click(function () {\n var itemId = $(this).attr(\"id\");\n detailID = itemId;\n showItemDetails();\n });\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 }", "function onItemActionMenuClick(event){\r\n\t\t\r\n\t\tvar objButton = jQuery(this);\r\n\t\tvar objItem = objButton.parents(\"li.uc-addon-thumbnail\");\r\n\t\tg_ucAdmin.validateDomElement(objItem, \"item object\");\r\n\t\t\r\n\t\tvar objMenu = jQuery(\"#rightmenu_item_actions\");\r\n\t\tg_ucAdmin.validateDomElement(objMenu, \"items action menu\");\r\n\t\t\r\n\t\tg_manager.showMenuOnMousePos(event, objMenu);\r\n\t\t\r\n\t}", "function moveItemDown(evt) {\n\tvar button = evt.target;\n\tvar row = button.parentNode.parentNode;\n\tvar cells = row.getElementsByTagName(\"td\");\n\tif (row.id.slice(0, row.id.indexOf(\"-\")) === \"base\") {\n\t\tmoveType(baseItems.types, cells[2].innerHTML, \"-\");\n\t} else {\n\t\tmoveType(optionalItems.types, cells[2].innerHTML, \"-\");\n\t}\n\tpopulateInventory();\n\tsyncToStorage();\n}", "onButtonDown() {\n\t\tif(!character.isClicked) {\n\t\t\tcharacter.sprite.y -= 100;\n\t\t\tcharacter.isClicked = true;\n\t\t\tsetup();\n\t\t}\n\t}", "function listenForClick() {\n loopThroughGrid();\n clickTurnBtn();\n }", "on_desklet_clicked(event) {\n this.retrieveEvents();\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 }", "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 }", "clickFunction(event) {\n try {\n const targets = event.composedPath();\n for (let target of targets) {\n if (this.checkIfElementIsActionMenuIcon(target)) {\n return;\n }\n }\n }\n catch (err) {\n if (this.checkIfElementIsActionMenuIcon(event.target)) {\n return;\n }\n }\n this.rowActionMenuOpened = null;\n }", "_handleClick(event) {\n this.interaction.next(event);\n event.stopPropagation();\n }", "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 }", "function handleButtonClick(e){\n\tdeselectAll();\n\tmarkAsSelected(e);\n\tsetPosibleMoves();\n}", "function tagItem1(){\r\n var current = getCurrentEntry();\r\n var currentEntry = current.getElementsByTagName(\"entry-tagging-action-title\")[0];\r\n // var currentEntry = $(\"#current-entry .entry-actions\r\n // .entry-tagging-action-title\");\r\n simulateClick(currentEntry);\r\n }", "function triggerToggleButton(e) {\n $(e).parent().children(\"button\").click();\n}", "onClick(element) {\n\t\taction(`You have clicked on element ${element.name}`).call();\n\t}", "function handleClick(event)\n{\n}", "onButtonUp() {\n\t\tif(character.isClicked) {\n\t\t\tcharacter.sprite.y += 100;\n\t\t\tcharacter.isClicked = false;\n\t\t}\n\t}", "function elementClicked(id) {\n switch (id) {\n case \"waterButton\":\n buttonClicked = 1;\n break;\n case \"battleshipButton\":\n buttonClicked = 2;\n break;\n default:\n break;\n }\n}", "function clicked(item) {\n var btnId = $(item).attr(\"id\");\n addToCart(btnId)\n}", "function RightClickItem(idPoint) {\n idItem = idPoint.replace(\"item\", \"\");\n iCurrentPoint = GetIFromIdPoint(idItem);\n idBlocOver = idItem;\n}", "function clickBtn(ev){\r\n\r\n //Brightspace ref: week 6\r\n let clickedButton = ev.target;\r\n\r\n let btnsArray=[\r\n ctrlBtns[0],\r\n ctrlBtns[1],\r\n ctrlBtns[2],\r\n ];\r\n\r\n //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf\r\n let index = btnsArray.indexOf(clickedButton);\r\n p(index);\r\n\r\n // /MDN ref:https://developer.mozilla.org/en-US/docs/Web/API/Element\r\n p(clickedButton.id);\r\n //handle moving id-active to the currently clicked button\r\n //remove currently present id 'active'\r\n for(let i=0; i < ctrlBtns.length ; i++){\r\n if(ctrlBtns[i].id){\r\n //MDN ref:https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute\r\n ctrlBtns[i].removeAttribute('id')\r\n }\r\n }\r\n //assign id=\"active\" to currently clicked button\r\n clickedButton.id=\"active\";\r\n //Load corresponding data into the container div\r\n cntnr.innerHTML = `<h2>${pages[index].heading}</h2> \r\n <img src=\"${pages[index].img}\" alt=\"${pages[index].alt}\">\r\n <p>${pages[index].bodyText}</p>\r\n `;\r\n\r\n }", "function btnDown() {\n //dbg(\"mousedown\");\n lastBtn = this.id;\n //add graphical feed back here\n dbg({ keydown: this.id });\n rokupost(\"keydown\", this.id);\n}", "handle_click(e, item) {\n if (item.length > 0) {\n this.props.onclick_piechart(this.props.pie_chart_data[item[0]._index])\n }\n }", "function buttonClick(e) {\n\tvar element = e.memo.element;\n\tif (this.options.singleSelect) {\n\t\tthis.select(element);\n\t} else {\n\t\tif (this.isSelected(element)) {\n\t\t\tthis.deselect(element);\t\n\t\t} else {\n\t\t\tthis.select(element);\n\t\t}\n\t}\n}", "static _HandleButtonDown(e) {\n if (!Mouse._button_down.includes(e.button))\n Mouse._button_down.push(e.button)\n }", "function buttonClick(e) {\n if (active === null) {\n setActive(e.target.id);\n tools.find(obj => obj.category === e.target.id && setList(obj.skills));\n set(!toggle);\n } else if (active === e.target.id) {\n setActive(null);\n set(!toggle);\n } else return;\n }", "function clickButton(id) {\n // Initial click.\n if(time_stop === true && status === 'init') {\n // Mark game status as \"ongoing\".\n status = \"active\";\n // Start the timer.\n // time should start from 0.\n time = 0;\n time_stop = false;\n }\n\n let cur_button = $(\"#\"+id);\n\n // Change clicked fields' background color and track clicked time of right click.\n cur_button.css(\"background-color\", \"white\");\n cur_button.attr(\"clicked\", 1);\n\n if(parseInt(cur_button.attr(\"hasBomb\")) === 1){\n // Mark status as lose.\n status = \"inactive\";\n // Stop the timer.\n time_stop = true;\n // Show failure message.\n $(\".main\").append(\"<div class = 'message-field'></div>\");\n $(\".message-field\").append(\"<div>Bomb! You failed.</div>\");\n // Mark all mine fields as bomb.\n $(\".btn[hasbomb='1']\").html(\"\").append(\"<span class='btn-span'><i class='fas fa-bomb'></i></span>\");\n // Mark all wrongly marked field if any.\n $(\".btn[hasbomb='0'][rclicked='1']\").html(\"\")\n .append(\"<span class='btn-span'><i class='fas fa-times'></i></span>\");\n } else {\n // See if surrounding has bomb.\n let x = parseInt(cur_button.attr(\"x\"));\n let y = parseInt(cur_button.attr(\"y\"));\n let count = countBomb(x, y);\n if (count !== 0) {\n // First click. Unreveal the field.\n if (cur_button.has(\"span\").length === 0) {\n cur_button.html(\"<span class = 'btn-span'>\" + count + \"</span>\");\n } else {\n // Check surrounding marked count.\n // If surrounding marked equals to the num on this field.\n // Fake click all surrounding fields.\n if (countMarked(x, y) === count) {\n // if mark count is same with bomb count, fake click all surrounding field.\n for (let i = x - 1; i <= x + 1; i++) {\n for (let j = y - 1; j <= y + 1; j++) {\n // Generate button id.\n let adj_id = i + \"-\" + j;\n // Fake click on unclicked ones.\n if ($(\"#\"+adj_id).attr(\"clicked\") === '0' &&\n $(\"#\"+adj_id).attr(\"rclicked\") !== '1') {\n clickButton(adj_id);\n }\n }\n }\n }\n }\n } else {\n // If the current field has no bomb, then explore the adjacent ones (8 at max).\n // Keep exploring until find bomb.\n // Traverse all adjacent field.\n for (let i = x - 1; i <= x + 1; i++) {\n for (let j = y - 1; j <= y + 1; j++) {\n // Generate button id.\n let adj_id = i + \"-\" + j;\n // Fake click on unclicked ones.\n if ($(\"#\"+adj_id).attr(\"clicked\") === '0' && \n $(\"#\"+adj_id).attr(\"rclicked\") === '0') {\n clickButton(adj_id);\n }\n }\n }\n }\n\n }\n }", "_handleItemClick(event) {\n const that = this,\n clickedItem = event.target.closest('.jqx-carousel-item');\n\n if (that.disabled || !clickedItem || that.displayMode!=='3d' || that.disableItemClick) {\n return;\n }\n\n const itemId = parseInt(clickedItem.getAttribute('item-id')),\n itemPosition = parseInt(clickedItem.getAttribute('position'));\n\n if (Math.abs(itemPosition) > 3){\n return;\n }\n\n that._goToItem(itemId);\n }", "function PageClick(event) {\n var el;\n if (activeButton == null) { return; }\n if (browser.isIE)\n el = window.event.srcElement;\n else\n el = (event.target.tagName ? event.target : event.target.parentNode);\n\n if (el == activeButton)\n return;\n if (getContainerWith(el, \"DIV\", \"kmaMenu\") == null) {\n resetButton(activeButton);\n activeButton = null;\n }\n}", "function buttonClick(){\r\n\r\n var buttonTriggered = this.innerHTML;\r\n clickPress(buttonTriggered);\r\n buttonAnimation(buttonTriggered);\r\n\r\n}", "function NavBar_Item_Click(event)\n{\n\t//get html\n\tvar html = Browser_GetEventSourceElement(event);\n\t//this a sub component?\n\tif (html.Style_Parent)\n\t{\n\t\t//use the parent\n\t\thtml = html.Style_Parent;\n\t}\n\t//valid?\n\tif (html && html.Action_Parent && !html.IsSelected || __DESIGNER_CONTROLLER)\n\t{\n\t\t//get the data\n\t\tvar data = [\"\" + html.Action_Index];\n\t\t//trigger the event\n\t\tvar result = __SIMULATOR.ProcessEvent(new Event_Event(html.Action_Parent, __NEMESIS_EVENT_SELECT, data));\n\t\t//not blocking it?\n\t\tif (!result.Block)\n\t\t{\n\t\t\t//not an action?\n\t\t\tif (!result.AdvanceToStateId)\n\t\t\t{\n\t\t\t\t//notify that we have changed data\n\t\t\t\t__SIMULATOR.NotifyLogEvent({ Type: __LOG_USER_DATA, Name: html.Action_Parent.GetDesignerName(), Data: data });\n\t\t\t}\n\t\t\t//update selection\n\t\t\thtml.Action_Parent.Properties[__NEMESIS_PROPERTY_SELECTION] = html.Action_Index;\n\t\t\t//and update its state\n\t\t\tNavBar_UpdateSelection(html.Action_Parent.HTML, html.Action_Parent);\n\t\t}\n\t}\n}", "buttonClicked() {\n alert(\"buttonclicked of button\");\n }" ]
[ "0.70126", "0.70126", "0.68131447", "0.68069285", "0.67297256", "0.6706524", "0.66946656", "0.6672447", "0.66382396", "0.6607907", "0.6607907", "0.6582985", "0.6582985", "0.65322304", "0.6490514", "0.64811903", "0.64605725", "0.6445495", "0.6435166", "0.64182645", "0.6387842", "0.63800657", "0.63777006", "0.63672525", "0.63543737", "0.63425285", "0.6277641", "0.62735194", "0.62379456", "0.62252754", "0.6222719", "0.62198603", "0.62042224", "0.61853313", "0.6170918", "0.6163535", "0.61592275", "0.61589706", "0.61559063", "0.6150186", "0.61476684", "0.614463", "0.61422896", "0.6135459", "0.6132645", "0.6131848", "0.61181426", "0.6098356", "0.6085584", "0.608376", "0.60780996", "0.60691965", "0.6069184", "0.60647374", "0.6056086", "0.6055169", "0.60486937", "0.60435486", "0.60416", "0.6039901", "0.6032774", "0.60276186", "0.6026879", "0.6025404", "0.60198784", "0.60198057", "0.60197914", "0.6016909", "0.6016125", "0.6015828", "0.6015639", "0.6015099", "0.6014563", "0.60129166", "0.60067564", "0.6002354", "0.6001345", "0.600048", "0.59977376", "0.5973542", "0.5972591", "0.5971528", "0.59708214", "0.59695435", "0.5969437", "0.5968353", "0.59631264", "0.5959685", "0.59573233", "0.59503317", "0.5943091", "0.593979", "0.5936915", "0.593547", "0.5923272", "0.59227735", "0.5915567", "0.5912578", "0.591108", "0.59093344" ]
0.6281986
26
Write a function that accepts a string. The function should capitalize the first letter of each word in the string then return the capitalized string. Examples capitalize('a short sentence') > 'A Short Sentence' capitalize('a lazy fox') > 'A Lazy Fox' capitalize('look, it is working!') > 'Look, It Is Working!'
function capitalize(str) { let result = str[0].toUpperCase(); for (let i = 1; i < str.length; i++) { if (str[i-1] === ' ') { result += str[i].toUpperCase(); } else { result += str[i]; } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function capitalizeWord(string) {\n \n // Should take a string of one word, and return the word with its first letter capitalized\n return string[0].toUpperCase() + string.substring(1, string.length);\n \n}", "function capitalize(string) {\n if (string.indexOf(\" \") !== -1) {\n var arr = string.split(\" \");\n var capitals = arr.map(capitalizeWord);\n return capitals.join(\" \");\n } else {\n return capitalizeWord(string);\n }\n }", "function capitalizeAllWords(string){\nvar subStrings = string.split(\" \");\nvar upperString = \"\";\nvar finishedString = \"\";\n for(var i = 0; i < subStrings.length; i++){\n if(subStrings[i]) {\n upperString = subStrings[i][0].toUpperCase() + subStrings[i].slice(1) + \" \";\n finishedString += upperString;\n }\n } return finishedString.trim()\n}", "function capitalize(str) {}", "function capitalizeWord(string) {\n //I-string of one word\n //O- return the word with first letter in caps\n //C-\n //E-\n let array = string.split(\"\")\n array[0] = array[0].toUpperCase()\n string = array.join(\"\")\n return string\n}", "function capitalizeAllWords(string) {\n var splitStr = string.toLowerCase().split(' ');\n \nfor (var i = 0; i < splitStr.length; i++){\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n}\nreturn splitStr.join(' ');\n}", "function capitalizeWord (string) {\n var firstLetter = string[0];\n var restOfWord = string.substring(1); \n return firstLetter.toUpperCase() + restOfWord;\n}", "function capitalize(text){\n // in: \"some_string\"\n // out: \"Some_string\"\n return text.charAt(0).toUpperCase() + text.slice(1);\n}", "function sc_string_capitalize(s) {\n return s.replace(/\\w+/g, function (w) {\n\t return w.charAt(0).toUpperCase() + w.substr(1).toLowerCase();\n });\n}", "function capitalizeWord(string) {\n return string[0].toUpperCase() + string.substring(1);\n}", "static capitalize(string){\n let array = string.split(\"\")\n array[0] = string[0].toUpperCase()\n return array.join(\"\")\n }", "function capitalize(string) {\n return `${string[0].toUpperCase()}${string.slice(1)}`;\n} //so we return the first character captitalized, and the rest of the string starting from the first index", "function capitalize(s){\n return s[0].toUpperCase() + s.slice(1);\n}", "function capitalize( s ) {\n // GOTCHA: Assumes it's all-one-word.\n return s[0].toUpperCase() + s.substring(1).toLowerCase();\n}", "function capitalize(string) {\n var splitStr = string.toLowerCase().split(' ');\n for (var i = 0; i < splitStr.length; i++) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);\n }\n return splitStr.join(' ');\n}", "function capitalizeWord(string) {\n str1 = string.charAt(0);\n str1 = str1.toUpperCase();\n for (var i = 1; i < string.length; i++)\n {\n str1 += string[i];\n }\n return str1;\n}", "function capitalizeAllWords(string) {\n var split = string.split(\" \"); //splits string up\n for (var i = 0; i < split.length; i++) { //loops over array of strings\n split[i] = split[i][0].toUpperCase() + split[i].slice(1); //uppercases first chas on string and slices the extra letter\n }\n var finalStr = split.join(' '); // joins split string into one string\n return finalStr; //return final string\n}", "function capitalizeWord(string){\n var firstLetter = string.charAt(0); // takes first letter\n var goodString = firstLetter.toUpperCase() + string.slice(1); //capitalize and reattach\n return goodString;\n}", "function capitalizeWord(string) {\n return string[0].toUpperCase() + string.slice(1);\n}", "function capitalize(str) {\n \n function nowCapitalize(string){\n var result = '';\n for(i in string){\n if(i==0){\n result+=string[i].toUpperCase();\n } else{\n result += string[i];\n }\n }\n return result;\n }\n return str.replace(/\\s+/g,' ').split(\" \").map(x=>nowCapitalize(x)).join(' ');\n\n \n}", "function capitalize(str) {\n str = str.trim().toLowerCase(); // remove extra whitespace and change all letters to lower case\n var words = str.split(' ') // split string into array of individual words\n str = ''; // clear string variable since all the words are saved in an array\n // this loop takes each word in the array and capitalizes the first letter then adds each word to the new string with a space following \n for (i = 0; i < words.length; i++) {\n var foo = words[i];\n foo = foo.charAt(0).toUpperCase() + foo.slice(1);\n str += foo + \" \";\n }\n return str.trim(); // return the new string with the last space removed\n}", "function capitalizeWord(string) {\n let newstr = string[0].toUpperCase() + string.substring(1);\n //console.log(newstr);\n return newstr;\n}", "function capitalizeWord(string) {\n return string.replace(string[0], string[0].toUpperCase()); //return string but replace the string[0] with a capital letter\n}", "function LetterCapitalize(str) {\n\nlet words = str.split(' ')\n\nfor ( i = 0 ; i < words.length ; i++) {\n\n words[i] = words[i].substring(0,1).toUpperCase() + words[i].substring(1)\n\n}\n\nwords = words.join(' ')\nreturn words\n\n}", "function capitalizeWord(string) {\n return string[0].toUpperCase() + string.slice(1);\n}", "function capitalize(string){\r\n\treturn string.charAt(0).toUpperCase() + string.slice(1);\r\n}", "function capitalize(s){\n\t\t\treturn s[0].toUpperCase() + s.slice(1);\n\t\t}", "function capitalizeAllWords(string) {\n \n // Should take a string of words and return a string with all the words capitalized\n \n let newStr = \"\";\n \n for (let word of string.split(\" \")) {\n newStr = newStr + word[0].toUpperCase() + word.substring(1,word.length) + \" \";\n }\n \n return newStr.substring(0,newStr.length - 1);\n \n}", "function Capitaliser(input) {\n const eachWord = input.split(\" \");\n for (let index = 0; index < eachWord.length; index++) {\n eachWord[index] = eachWord[index][0].toUpperCase() + eachWord[index].substr(1);\n }\n return eachWord.join(\" \");\n}", "function capitalize(string) {\n // capitalize first letter\n // capitalize a letter with a SPACE to its left\n let str=string[0].toUpperCase();\n for(i=1;i<string.length;i++){\n if(string[i-1]===' '){\n str+=string[i].toUpperCase();\n }else{\n str+=string[i];\n }\n }\n return str;\n}", "function LetterCapitalize(str) { \n let words = str.split(' ');\n for (let i = 0; i < words.length; i++) {\n let word = words[i][0].toUpperCase() + words[i].slice(1);\n words[i] = word;\n }\n return words.join(' ');\n}", "function firstLetterCapitalized (word){//function that capitalizes first letter of one word\n var letterOne = word.substring(0,1)//finds first letter\n var capitalizedLetter = letterOne.toUpperCase()//to upper case\n return capitalizedLetter + word.substring(1)//concatenates capitalized first letter and rest of word\n}", "function capitalizeAllWords(string) {\n var arr = string.split(\" \");\n for (var i = 0;i < arr.length; i++){\n arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);\n }\n return arr.join(\" \");\n}", "function capitalizeWord(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}", "function capitalizeWord(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}", "function capitalizeFirstWordInAString(stringToCapitalize) {\n if (stringToCapitalize.length === 0) {\n return \"ERROR - String to manipulate is undefined\";\n }\n\n return (\n stringToCapitalize.charAt(0).toUpperCase() + stringToCapitalize.slice(1)\n );\n}", "function capitalizeAllWords(string) {\n// will use .toLower case and .split to lowercase and put in an array\nvar myArr = string.toLowerCase().split(\" \")\n// will use for loop to itterate over array\nfor(var i = 0; i < myArr.length; i++){\n // Will use charAt to return the character in string\n // will use toUpperCase to uppercase the first characters\n //will use .slice to add remaing array\n myArr[i] = myArr[i].charAt(0).toUpperCase() + myArr[i].slice(1);\n}\n // use join() to turn array to string and return\n return myArr.join(\" \");\n}", "function capitalize(){\nvar string=\"js string exercises\"\nvar newString=string.charAt(0).toUpperCase()+ string.slice(1)\nreturn newString\n}", "function capital(str) \r\n{\r\n str = str.split(\" \");\r\n\r\n for (var i = 0, x = str.length; i < x; i++) {\r\n str[i] = str[i][0].toUpperCase() + str[i].substr(1);\r\n }\r\n\r\n return str.join(\" \");\r\n}", "function capitalize(string){\n return string[0].toUpperCase() + string.slice(1);\n}", "function capitalize(str)\n{\n //return str.charAt(0).toUpperCase() + str.slice(1);\n var pieces = str.split(' ');\n for (var i = 0; i < pieces.length; i++) {\n var j = pieces[i].charAt(0).toUpperCase();\n pieces[i] = j + pieces[i].substr(1);\n }\n return pieces.join(' ');\n}", "function LetterCapitalize(str) { \n return str\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n}", "function capitalize_Words(str) {\n return str.replace(/\\w\\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "function capitalize(string) {\n let result = string[0].toUpperCase();\n for(let i = 1; i < string.length; i++) {\n if(string[i - 1] == \" \") {\n result += string[i].toUpperCase();\n }\n else {\n result += string[i];\n }\n }\n return result;\n}", "function capitalizeWord(string) {\n //i string\n //r string with first capitalized\n \n let newString = string[0].toUpperCase()+string.slice(1);\n \n return newString;\n}", "function capitalize(string) {\r\n return string[0].toUpperCase() + string.slice(1);\r\n}", "function capitalizeLetters(str) {\r\n\r\n let strArr = str.toLowerCase().split(' '); //lowercase all the words and store it in an array.\r\n console.log(\"outside: \" + strArr); //Testing use for checking\r\n //iterate through the array\r\n //Add the first letter of each word from the array with the rest of the letter following each word\r\n //Ex) L + ove = Love;\r\n for(let i = 0; i < strArr.length; i++){\r\n strArr[i] = strArr[i].substring(0, 1).toUpperCase() + strArr[i].substring(1);\r\n }\r\n return strArr.join(\" \"); //put the string back together.\r\n\r\n // const upper = str.charAt(0).toUpperCase() + str.substring(1);\r\n // return upper;\r\n}", "function capitalize(s) {\r\n return s.charAt(0).toUpperCase() + s.slice(1)\r\n}", "function capitalizeWord(string) {\n return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();\n }", "titleCase(string) {\n var sentence = string.toLowerCase().split(\" \");\n for(var i = 0; i< sentence.length; i++){\n sentence[i] = sentence[i][0].toUpperCase() + sentence[i].slice(1);\n }\n \n return sentence.join(\" \");\n }", "function capitalize(str) {\n let capArr = [];\n let strArr = str.split(' ');\n for (var i = 0; i < strArr.length; i++) {\n capArr.push(capital(strArr[i]));\n }\n return capArr.join(' ')\n\n\n}", "function capitalize(sentence) {\n // Get the individual words\n let words = sentence.split(' ');\n\n // Capitalize the first character in each word\n words = words.map(word => word[0].toUpperCase() + word.slice(1));\n\n return words.join(' ');\n}", "static capitalize(sentence){\n let a= sentence.toUpperCase().charAt(0);\n return a+sentence.substr(1);\n }", "static capitalize(inputString) {\n return inputString.charAt(0).toUpperCase() + inputString.slice(1)\n }", "function capitalise(s){\n let ns = [];\n for(let w of s.split(\" \")){\n ns.push(w[0].toUpperCase() + w.slice(1));\n }\n return ns.join(\" \");\n}", "function capitalize( str , echo){\n var words = str.toLowerCase().split(\" \");\n for ( var i = 0; i < words.length; i++ ) {\n var j = words[i].charAt(0).toUpperCase();\n words[i] = j + words[i].substr(1);\n }\n if(typeof echo =='undefined')\n return words.join(\" \");\n else\n return str;\n}", "function capitalizeWord(word){\n return word[0].toUpperCase() + word.substr(1);\n}", "function capitalize(word) { // capitalizes word\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\n}", "function titleCase(str) {\r\n var words = str.toLowerCase().split(' ');\r\n var charToCapitalize;\r\n\r\n for (var i = 0; i < words.length; i++) {\r\n charToCapitalize = words[i].charAt(0);\r\n // words[i] = words[i].replace(charToCapitalize, charToCapitalize.toUpperCase()); // works only if first letter is not present elsewhere in word\r\n words[i] = words[i].charAt(0).toUpperCase().concat(words[i].substr(1));\r\n }\r\n\r\n return words.join(' ');\r\n}", "function capitalWord(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n //function to make input value to have capital as it is inputed\n}", "function capitalizeEachWord(str) {\n return str.toUpperCase();\n}", "function capitalizeEveryWordInAString(stringToCapitalize) {\n const arrayOfStrings = stringToCapitalize.toLowerCase().split(\" \");\n let capitalizedString = \"\";\n\n for (let i = 0; i < arrayOfStrings.length; i++) {\n capitalizedString +=\n arrayOfStrings[i].charAt(0).toUpperCase() +\n arrayOfStrings[i].slice(1, arrayOfStrings[i].length) +\n \" \";\n }\n\n return capitalizedString;\n}", "function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1);\n }", "static capitalize(word){\n let arr;\n arr = word.split(\"\")\n arr[0] = arr[0].toUpperCase()\n return arr.join(\"\")\n }", "function capitalizeEveryWordOfAStringLib (string) {\n let words = string.split(\" \");\n\n for (let i = 0; i < words.length; i++) {\n\n words[i] = words[i][0].toUpperCase() + words[i].substr(1);\n\n }\n\n return words.join(\" \");\n}", "function capitalize(str) {\n\n const capWords = [];\n\n let strArray = str.split(' ');\n\n strArray.forEach((word, i) => {\n let upperLetter = strArray[i][0].toUpperCase() + word.slice(1)\n capWords.push(upperLetter)\n\n })\n\n return capWords.join(' ');\n}", "function capitalizeAllWords(string) {\n //split string into array of string words\n var splitStr = string.split(\" \");\n //loop through array\n for(var i = 0; i < splitStr.length; i++){\n //if there is a value at element then do a thing\n if(splitStr[i]){\n //access word in word array,uppercase first char, then slice the rest back on\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1);\n }\n string = splitStr.join(\" \");\n }\n return string;\n}", "function f(str) {\n const words = str.split(' ');\n let capitalizedWords = [];\n for (let i = 0; i < words.length; i++) {\n const capitalizedWord = words[i].charAt(0).toUpperCase() + words[i].slice(1).toLowerCase();\n capitalizedWords.push(capitalizedWord);\n }\n return capitalizedWords.join(' ');\n}", "function capitalizeAllWords(string) {\n let stringsArr = string.split(' ');\n for (let i = 0; i < stringsArr.length; i++) {\n stringsArr[i] = stringsArr[i][0].toUpperCase() + stringsArr[i].substring(1);\n }\n return stringsArr.join(' ');\n}", "static capitalize(string){\n return string[0].toUpperCase() + string.slice(1);\n }", "function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}", "function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}", "static capitalize(string){\n return string.charAt(0).toUpperCase()+ string.slice(1)\n }", "function capitalize(string) {\r\n if (string) {\r\n return string.charAt(0).toUpperCase() + string.slice(1);\r\n }\r\n return '';\r\n}", "static capitalize(string){\n let firstLetter = string.slice(0,1).toUpperCase()\n return firstLetter + string.slice(1)\n }", "static capitalize(string) {\n let newString = string[0].toUpperCase() + string.slice(1)\n return newString\n }", "capitalize(word){\n let char = word.charAt(0).toUpperCase();\n let remainder = word.slice(1);\n return char + remainder;\n }", "function LetterCapitalize(str) {\n var strArr = str.split(\" \");\n var newArr = [];\n\n for(var i = 0 ; i < strArr.length ; i++ ){\n\n var FirstLetter = strArr[i].charAt(0).toUpperCase();\n var restOfWord = strArr[i].slice(1);\n\n newArr[i] = FirstLetter + restOfWord;\n\n }\n\n return newArr.join(' ');\n\n}", "static capitalize(string) {\n return `${string.charAt(0).toUpperCase()}` + `${string.slice(1)}`;\n }", "function capitalizeStr(str) {\r\n let input = str.toLowerCase().split(\" \"); // Seperating each words and make an array\r\n input = input.map(function (value, index, array) { // value is the iterator\r\n return value.charAt(0).toUpperCase() + value.slice(1);\r\n });\r\n\r\n return input.join(\" \");\r\n}", "function capitalize(string) {\n return string[0].toUpperCase() + string.slice(1);\n}", "function capitalize(str){\n return str[0].toUpperCase() + str.slice(1);\n}", "function capitalize(s){\n return s.split('').reduce((acc, curr, i) => {\n if (i % 2 === 0){\n acc[0] += curr.toUpperCase()\n acc[1] += curr\n } else {\n acc[1] += curr.toUpperCase()\n acc[0] += curr \n }\n return acc\n }, [\"\",\"\"])\n}", "function capitalize(str) {\n str = str.toLowerCase();\n return finalSentence = str.replace(/(^\\w{1})|(\\s+\\w{1})/g, letter => letter.toUpperCase());\n}", "function capitalize(str) {\n const array = str.split(' ');\n array.forEach((word, index) => array[index] = word[0].toUpperCase() + word.substr(1));\n return array.join(' ');\n}", "function capitalize(str) {\n var arr = str.split(\"\");\n arr[0] = arr[0].toUpperCase();\n return arr.join(\"\");\n}", "function capitalize(str) {\n var splitStr = str.toLowerCase().split(' ');\n for (var i = 0; i < splitStr.length; i++) {\n splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);\n }\n return splitStr.join(' ');\n}", "function capitalize(input) {\n var CapitalizeWords = input[0].toUpperCase();\n for (var i = 1; i <= input.length - 1; i++) {\n let currentCharacter,\n previousCharacter = input[i - 1];\n if (previousCharacter && previousCharacter == ' ') {\n currentCharacter = input[i].toUpperCase();\n } else {\n currentCharacter = input[i];\n }\n CapitalizeWords = CapitalizeWords + currentCharacter;\n }\n return CapitalizeWords;\n}", "function capitalize(str) {\n return str.toLowerCase().split(' ').map(item => {\n return item[0].toUpperCase() + item.substring(1, item.length);\n }).join(' ');\n}", "function LetterCapitalize(str) {\n \"use strict\";\n // code goes here \n var strArray = str.split(\" \"); //take my string and separate it into an array of strings (strArray) using the .split method.\n var newString = \"\";\n for (var i = 0; i < strArray.length; i++) {\n var newWord = strArray[i].substr(0, 1).toUpperCase() + strArray[i].substr(1, strArray.length);\n newString = newString + \" \" + newWord;\n //alert(newString);\n }\n\n return newString;\n\n}", "function LetterCapitalize(str) {\n // First, we use the split method to divide the input string into an array of individual words\n // Note that we pass a string consisting of a single space into the method to \"split\" the string at each space\n str = str.split(\" \");\n\n // Next, we loop through each item in our new array...\n for (i = 0; i < str.length; i++) {\n // ...and set each word in the array to be equal to the first letter of the word (str[i][0]) capitalized using the toUpperCase method.\n // along with a substring of the remainder of the word (passing only 1 arg into the substr method means that you start at that index and go until the end of the string)\n str[i] = str[i][0].toUpperCase() + str[i].substr(1);\n }\n // Finally, we join our array back together...\n str = str.join(\" \");\n\n // ...and return our answer.\n return str;\n}", "function capitalizeWords(input) {\n\n let wordInput = input.split(' ');\n\n for (let i = 0; i < wordInput.length; i++) {\n var lettersUp = ((wordInput[i])[0]).toUpperCase();\n wordInput[i] = wordInput[i].replace((wordInput[i])[0], lettersUp);\n }\n return console.log(wordInput.join(\" \"));\n}", "function capitalize(s) {\n return s.charAt(0).toUpperCase() + s.slice(1);\n }", "function capitalizeFirst(input) {\n return input\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}", "static capitalize(string){\n return string.charAt(0).toUpperCase() + string.slice(1);\n }", "static capitalize(string){\n return string.charAt(0).toUpperCase() + string.slice(1);\n }", "static capitalize(string){\n return string.charAt(0).toUpperCase() + string.slice(1);\n }", "static capitalize(string) {\n return string.charAt(0).toUpperCase() + string.substring(1);\n }", "function capitalizeAllWords(string){\n var splitString = string.split(' '); //splitting string at spaces into an array of strings\n //splitString is now an array containing each word of the string separately\n for(var i = 0; i < splitString.length; i++){\n var letters = splitString[i].split(''); //separating each word in array into an array of letters\n letters[0] = letters[0].toUpperCase(); //sets letter at index[0] to upper case\n splitString[i] = letters.join(''); //slaps em all back together\n }\n return splitString.join(' ');\n}", "static capitalize(string){\n return string.charAt(0).toUpperCase() + string.slice(1)\n }", "static capitalize(string){\n return string.charAt(0).toUpperCase() + string.slice(1)\n }" ]
[ "0.8286303", "0.8236763", "0.82224137", "0.8193967", "0.8187306", "0.81804687", "0.8171213", "0.81708187", "0.81483495", "0.81393105", "0.8133485", "0.81141996", "0.8113782", "0.8111276", "0.8096858", "0.80950826", "0.80911434", "0.8087885", "0.80708635", "0.80676126", "0.8061747", "0.8060221", "0.8053147", "0.8044455", "0.803549", "0.8033983", "0.80304843", "0.80212426", "0.80193114", "0.80108654", "0.8008722", "0.80016905", "0.79990244", "0.7996682", "0.7996682", "0.7989344", "0.79883045", "0.7985263", "0.79839975", "0.79818183", "0.79733354", "0.79731053", "0.79561675", "0.7955881", "0.79451936", "0.79445124", "0.79424256", "0.79417294", "0.79413116", "0.7935056", "0.79317147", "0.79283535", "0.7927368", "0.7926464", "0.79208905", "0.79177153", "0.7912075", "0.7909317", "0.790798", "0.79077196", "0.7902818", "0.7901781", "0.7896612", "0.7893253", "0.78925264", "0.7891729", "0.78883564", "0.78878665", "0.7886472", "0.7879149", "0.7872501", "0.7872501", "0.7870805", "0.7863396", "0.7859448", "0.7851669", "0.7851038", "0.7844872", "0.7843575", "0.78429735", "0.78392595", "0.78373796", "0.7834347", "0.78316677", "0.78305537", "0.7830301", "0.7828994", "0.78278375", "0.7825919", "0.78254676", "0.7825405", "0.781627", "0.7811816", "0.78108376", "0.7810076", "0.7810076", "0.7810076", "0.7804063", "0.78020954", "0.7801995", "0.7801995" ]
0.0
-1
XXX dead code removal broke this
function canComplete() { return state.accounts.data.email && state.accounts.data.personId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "private public function m246() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "static final private internal function m106() {}", "transient final private protected internal function m167() {}", "static transient final protected internal function m47() {}", "static transient final private internal function m43() {}", "transient private protected public internal function m181() {}", "static private internal function m121() {}", "static private protected internal function m118() {}", "static transient private protected internal function m55() {}", "static transient final protected public internal function m46() {}", "static transient final private protected internal function m40() {}", "transient final private internal function m170() {}", "static transient private protected public internal function m54() {}", "function StupidBug() {}", "transient final private protected public internal function m166() {}", "static transient final protected function m44() {}", "transient private public function m183() {}", "static final private protected internal function m103() {}", "static private protected public internal function m117() {}", "static transient private public function m56() {}", "static transient final private protected public internal function m39() {}", "static final private protected public internal function m102() {}", "__previnit(){}", "static transient private internal function m58() {}", "static final protected internal function m110() {}", "static transient final private protected public function m38() {}", "static protected internal function m125() {}", "transient final private public function m168() {}", "static transient final private public function m41() {}", "static final private public function m104() {}", "static transient protected internal function m62() {}", "obtain(){}", "preorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function _____SHARED_functions_____(){}", "postorder() {\n throw new Error(\"This method hasn't been implemented yet!\");\n }", "function TMP() {\n return;\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "compilable(_locator) {\n throw new Error('Method not implemented.');\n }", "static transient final private public internal function m42() {}", "static private public function m119() {}", "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 }", "apply () {}", "hacky(){\n return\n }", "function _0x329edd(_0x38ef9f){return function(){return _0x38ef9f;};}", "function __func(){}", "_get () {\n throw new Error('_get not implemented')\n }", "frame() {\n throw new Error('Not implemented');\n }", "adoptedCallback() { }", "prepare() {}", "function ea(){}", "function __it() {}", "method() {\n throw new Error('Not implemented');\n }", "function TMP(){return;}", "function TMP(){return;}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function oi(){}", "removed() {}", "removed() {}", "_add () {\n throw new Error('not implemented')\n }", "sourceToInternal (metadata, v) {\n return v;\n }", "function _p(t,e){0}", "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 a(e){return void 0===e&&(e=null),Object(r[\"p\"])(null!==e?e:i)}", "function customHandling() { }", "_firstRendered() { }", "SameSide() {}", "__init12() {this.error = null}", "__init25() {this.forceRenames = new Map()}", "function fn() {\n\t\t }", "static get END() { return 6; }", "function miFuncion (){}", "internalToExternal (metadata, v) {\n return v;\n }", "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." ]
[ "0.7560008", "0.7384083", "0.73804635", "0.72823244", "0.7132312", "0.7028051", "0.7015289", "0.67277634", "0.6724852", "0.6717013", "0.6712795", "0.65816325", "0.6543048", "0.6522552", "0.64880705", "0.6472956", "0.639889", "0.628974", "0.62314", "0.6204026", "0.6192816", "0.6178109", "0.6110152", "0.60250723", "0.6024253", "0.59465003", "0.59423536", "0.5929687", "0.59271646", "0.59123135", "0.58973575", "0.58824426", "0.5861407", "0.5782473", "0.5729767", "0.5671138", "0.56428105", "0.55867475", "0.5541159", "0.5466123", "0.53836924", "0.5381602", "0.5368754", "0.5368754", "0.5368754", "0.53554225", "0.5319335", "0.5256961", "0.5256961", "0.5214776", "0.5192348", "0.5167182", "0.5148955", "0.51452464", "0.5125624", "0.5125266", "0.51135874", "0.5111422", "0.51028955", "0.50900465", "0.50855434", "0.50855434", "0.507114", "0.507114", "0.507114", "0.5041392", "0.50367767", "0.50367767", "0.5014709", "0.5002256", "0.49914604", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49691978", "0.49614286", "0.49574253", "0.49543694", "0.49524206", "0.49523088", "0.49465838", "0.49362752", "0.49330205", "0.49289724", "0.49274406", "0.49174735", "0.49174735", "0.49174735", "0.49174735", "0.49174735", "0.49174735", "0.49174735" ]
0.0
-1
Take a potentially misbehaving resolver function and make sure onFulfilled and onRejected are only called once. Makes no guarantees about asynchrony.
function doResolve(fn, self) { var done = false; try { fn(function (value) { if (done) return; done = true; resolve(self, value); }, function (reason) { if (done) return; done = true; reject(self, reason); }); } catch (ex) { if (done) return; done = true; reject(self, ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n onFulfilled(value);\n }, function (reason) {\n if (done) return;\n done = true;\n onRejected(reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n onRejected(ex);\n }\n }", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function(value) {\n if (done) return\n done = true\n onFulfilled(value)\n }, function(reason) {\n if (done) return\n done = true\n onRejected(reason)\n })\n } catch (ex) {\n if (done) return\n done = true\n onRejected(ex)\n }\n }", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done)\n return;\n done = true;\n onFulfilled(value);\n }, function (reason) {\n if (done)\n return;\n done = true;\n onRejected(reason);\n });\n }\n catch (ex) {\n console.error(ex);\n if (done)\n return;\n done = true;\n onRejected(ex);\n }\n }", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n onFulfilled(value);\n }, function (reason) {\n if (done) return;\n done = true;\n onRejected(reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n onRejected(ex);\n }\n }", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t})\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t})\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t})\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t})\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\tvar done = false;\n\t\ttry {\n\t\t\tfn(function (value) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonFulfilled(value);\n\t\t\t}, function (reason) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(reason);\n\t\t\t})\n\t\t} catch (ex) {\n\t\t\tif (done) return;\n\t\t\tdone = true;\n\t\t\tonRejected(ex);\n\t\t}\n\t}", "function doResolve(fn, onFulfilled, onRejected) {\n\t\t\tvar done = false;\n\t\t\ttry {\n\t\t\t\tfn(function (value) {\n\t\t\t\t\tif (done) return;\n\t\t\t\t\tdone = true;\n\t\t\t\t\tonFulfilled(value);\n\t\t\t\t}, function (reason) {\n\t\t\t\t\tif (done) return;\n\t\t\t\t\tdone = true;\n\t\t\t\t\tonRejected(reason);\n\t\t\t\t})\n\t\t\t} catch (ex) {\n\t\t\t\tif (done) return;\n\t\t\t\tdone = true;\n\t\t\t\tonRejected(ex);\n\t\t\t}\n\t\t}", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return\n done = true\n onFulfilled(value)\n }, function (reason) {\n if (done) return\n done = true\n onRejected(reason)\n })\n } catch (ex) {\n if (done) return\n done = true\n onRejected(ex)\n }\n}", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return\n done = true\n onFulfilled(value)\n }, function (reason) {\n if (done) return\n done = true\n onRejected(reason)\n })\n } catch (ex) {\n if (done) return\n done = true\n onRejected(ex)\n }\n}", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return\n done = true\n onFulfilled(value)\n }, function (reason) {\n if (done) return\n done = true\n onRejected(reason)\n })\n } catch (ex) {\n if (done) return\n done = true\n onRejected(ex)\n }\n}", "function doResolve(fn, onFulfilled, onRejected) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return\n done = true\n onFulfilled(value)\n }, function (reason) {\n if (done) return\n done = true\n onRejected(reason)\n })\n } catch (ex) {\n if (done) return\n done = true\n onRejected(ex)\n }\n}", "function doResolve (fn, onFulfilled, onRejected) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t onFulfilled(value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t onRejected(reason);\n\t })\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t onRejected(ex);\n\t }\n\t }", "async function exampleRejectedAfterResolve() {\n try {\n return await new Promise((resolve, reject) => {\n resolve('exampleRejectedAfterResolve > First call');\n reject('exampleRejectedAfterResolve > Swallowed reject');\n });\n } catch {\n throw new Error('exampleRejectedAfterResolve > Failed');\n }\n}", "async function exampleResolvedMoreThanOnce() {\n try {\n return await new Promise((resolve, reject) => {\n resolve('exampleResolvedMoreThanOnce > First call');\n resolve('exampleResolvedMoreThanOnce > Swallowed resolve');\n });\n } catch {\n throw new Error('exampleResolvedMoreThanOnce > Failed');\n }\n}", "function doResolve(promise, fn, onFulfilled, onRejected) {\r\n var done = false;\r\n try {\r\n fn(function Promise_resolve(value) {\r\n if (done) return;\r\n done = true;\r\n onFulfilled(value);\r\n }, function Promise_reject(reason) {\r\n if (done) return promise._catched;\r\n done = true;\r\n return onRejected(reason);\r\n });\r\n } catch (ex) {\r\n if (done) return;\r\n return onRejected(ex);\r\n }\r\n}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "async function exampleRejectedMoreThanOnce() {\n try {\n return await new Promise((resolve, reject) => {\n reject('exampleRejectedMoreThanOnce > First call');\n reject('exampleRejectedMoreThanOnce > Swallowed reject');\n });\n } catch {\n throw new Error('exampleRejectedMoreThanOnce > Failed');\n }\n}", "function doResolve(fn,self){var done=false;try{fn(function(value){if(done)return;done=true;resolve(self,value);},function(reason){if(done)return;done=true;reject(self,reason);});}catch(ex){if(done)return;done=true;reject(self,ex);}}", "function doResolve(fn,self){var done=false;try{fn(function(value){if(done)return;done=true;resolve(self,value);},function(reason){if(done)return;done=true;reject(self,reason);});}catch(ex){if(done)return;done=true;reject(self,ex);}}", "_propagateFulfilled() {\n this._thenQueue.forEach(([controlledPromise, fulfilledFn]) => {\n if (typeof fulfilledFn === \"function\") {\n const valueOrPromise = fulfilledFn(this._value);\n\n // if valueOrPromise is a Promise\n if (isThenable(valueOrPromise)) {\n valueOrPromise.then(\n value => controlledPromise._onFulfilled(value),\n reason => controlledPromise._onRejected(reason)\n );\n } else {\n controlledPromise._onFulfilled(valueOrPromise);\n }\n } else {\n // if no fulfilledFn provided\n return controlledPromise._onFulfilled(this._value);\n }\n });\n this._finallyQueue.forEach(([controlledPromise, sideEffectFn]) => {\n sideEffectFn();\n controlledPromise._onFulfilled(this._value);\n });\n\n this._thenQueue = [];\n this._finallyQueue = [];\n }", "function resolveFuture(g, h) {\n started = true\n return f( function(a) { rejected = true\n value = a\n invokePending('rejected', a)\n return g(a) }\n\n , function(b) { resolved = true\n value = b\n invokePending('resolved', b)\n return h(b) })\n }", "function PromiseResolveFunction() {\n var F = function(resolution) {\n console.assert(Type(F['[[Promise]]']) === 'object');\n var promise = F['[[Promise]]'];\n var alreadyResolved = F['[[AlreadyResolved]]'];\n if (alreadyResolved['[[value]]']) return undefined;\n set_internal(alreadyResolved, '[[value]]', true);\n\n if (SameValue(resolution, promise)) {\n var selfResolutionError = TypeError();\n return RejectPromise(promise, selfResolutionError);\n }\n if (Type(resolution) !== 'object')\n return FulfillPromise(promise, resolution);\n try {\n var then = resolution['then'];\n } catch(then) {\n return RejectPromise(promise, then);\n }\n if (!IsCallable(then))\n return FulfillPromise(promise, resolution);\n EnqueueJob('PromiseJobs', PromiseResolveThenableJob, [promise, resolution, then]);\n return undefined;\n };\n return F;\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(\n\t function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t },\n\t function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t }\n\t );\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "then(onResolve = function(r) { return r }, onReject = function(e) { throw e }) { return this.wrapped.then(resolve => {\n\t\tif (resolve instanceof Try)\n\t\t\treturn resolve.match(s => onResolve(s), e => onReject(e));\n\t\telse\n\t\t\treturn onResolve(resolve);\n\t}, onReject) }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\r\n\t var done = false;\r\n\t try {\r\n\t fn(function (value) {\r\n\t if (done) return;\r\n\t done = true;\r\n\t resolve(self, value);\r\n\t }, function (reason) {\r\n\t if (done) return;\r\n\t done = true;\r\n\t reject(self, reason);\r\n\t });\r\n\t } catch (ex) {\r\n\t if (done) return;\r\n\t done = true;\r\n\t reject(self, ex);\r\n\t }\r\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n\t var done = false;\n\t try {\n\t fn(function (value) {\n\t if (done) return;\n\t done = true;\n\t resolve(self, value);\n\t }, function (reason) {\n\t if (done) return;\n\t done = true;\n\t reject(self, reason);\n\t });\n\t } catch (ex) {\n\t if (done) return;\n\t done = true;\n\t reject(self, ex);\n\t }\n\t }", "function doResolve(fn, self) {\n var done = false;\n\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\nvar done = false;\ntry {\nfn(function (value) {\nif (done) return;\ndone = true;\nresolve(self, value);\n}, function (reason) {\nif (done) return;\ndone = true;\nreject(self, reason);\n});\n} catch (ex) {\nif (done) return;\ndone = true;\nreject(self, ex);\n}\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) { return; }\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) { return; }\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) { return; }\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) { return; }\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) { return; }\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) { return; }\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) { return; }\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) { return; }\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) { return; }\n done = true;\n reject(self, ex);\n }\n}", "function PromiseResolveFunction () {\n var F = function (resolution) {\n console.assert(Type(F['[[Promise]]']) === 'object')\n var promise = F['[[Promise]]']\n var alreadyResolved = F['[[AlreadyResolved]]']\n if (alreadyResolved['[[value]]']) return undefined\n set_internal(alreadyResolved, '[[value]]', true)\n\n if (SameValue(resolution, promise)) {\n var selfResolutionError = TypeError()\n return RejectPromise(promise, selfResolutionError)\n }\n if (Type(resolution) !== 'object') { return FulfillPromise(promise, resolution) }\n try {\n var then = resolution['then']\n } catch (then) {\n return RejectPromise(promise, then)\n }\n if (!IsCallable(then)) { return FulfillPromise(promise, resolution) }\n EnqueueJob('PromiseJobs', PromiseResolveThenableJob, [promise, resolution, then])\n return undefined\n }\n return F\n }", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return\n done = true\n promise._82(value)\n }, function (reason) {\n if (done) return\n done = true\n promise._67(reason)\n })\n if (!done && res === IS_ERROR) {\n done = true\n promise._67(LAST_ERROR)\n }\n}", "async function resolve (callee, f, options, vargs) {\n try {\n try {\n if (typeof f == 'function') {\n f = f()\n }\n } catch (error) {\n throw construct(Class.options(options, { errors: [ error ] }), vargs, callee)\n }\n const result = await f\n if (Interrupt.auditing) {\n construct(Class.options(options, { errors: [ AUDIT ] }), vargs, resolve)\n }\n return result\n } catch (error) {\n throw construct(Class.options(options, { errors: [ error ] }), vargs, resolve)\n }\n }", "function catchFunc(onRejected) {\n return this.then(undefined, onRejected);\n }", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }", "function doResolve(fn, self) {\n var done = false;\n\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}", "function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done)\n return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done)\n return;\n done = true;\n reject(self, reason);\n });\n }\n catch (ex) {\n if (done)\n return;\n done = true;\n reject(self, ex);\n }\n }", "async function exampleResolveAfterReject() {\n try {\n return await new Promise((resolve, reject) => {\n reject('exampleResolveAfterReject > First call');\n resolve('exampleResolveAfterReject > Swallowed reject');\n });\n } catch {\n throw new Error('exampleResolveAfterReject > Failed');\n }\n}", "function primjer7() {\n Promise.resolve()\n .then(() => {\n // Makes .then() return a rejected promise\n throw 'Oh no!';\n })\n .catch(reason => {\n console.error('onRejected function called: ' + reason);\n })\n .then(() => {\n console.log(\"I am always called even if the prior then's promise rejects\");\n });\n}", "function doResolve(fn, promise) {\n var done = false;\n var res = tryCallTwo(fn, function (value) {\n if (done) return;\n done = true;\n resolve(promise, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(promise, reason);\n });\n\n if (!done && res === IS_ERROR) {\n done = true;\n reject(promise, LAST_ERROR);\n }\n }", "stateChangeHandlerFulfilled(event, actionId) {\n if (this.stateChangeHandlersReservations[event] === undefined ||\n this.stateChangeHandlers[event] === undefined) {\n let err = \"\";\n if (this.stateChangeHandlersReservations[event] === undefined) {\n err += `No promise reservation for event=${event}. `;\n }\n if (this.stateChangeHandlers[event] === undefined) {\n err += `No handler for event=${event}. `;\n }\n logger.error(new StateChangeHandlerReserved_1.StateChangeHandlerReservedException(this.logCtx(actionId, event, err)));\n }\n this.stateChangeHandlersReservations[event] = undefined;\n this.stateChangeHandlers[event] = undefined;\n }", "function resolveWrapper(nRes, nRej, pResFn) {\n return function (value) {\n if (!isFunction(pResFn)) {\n return nRes(value)\n }\n\n try {\n var ret = pResFn(value)\n if (isThenable(ret)) {\n ret.then(nRes, nRej)\n } else {\n nRes(ret)\n }\n } catch (e) {\n nRej(e)\n }\n }\n}" ]
[ "0.70784545", "0.7072046", "0.70421326", "0.7040046", "0.7040046", "0.7040046", "0.7032287", "0.7031542", "0.7031542", "0.7031542", "0.7031542", "0.7031542", "0.7014892", "0.6960407", "0.6960407", "0.6960407", "0.6960407", "0.6807936", "0.6281461", "0.6168566", "0.6023019", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.60179335", "0.5853061", "0.57864714", "0.57864714", "0.5769966", "0.5714991", "0.57135814", "0.5709105", "0.5706726", "0.570042", "0.56974334", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5678754", "0.5671009", "0.56686544", "0.56612325", "0.56612325", "0.56612325", "0.56612325", "0.56612325", "0.56612325", "0.5652427", "0.5652427", "0.5652427", "0.5630041", "0.5627118", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.56241477", "0.5621924", "0.5621057", "0.5621057", "0.56186295", "0.56134784", "0.561325", "0.56070566", "0.56005794", "0.5597628", "0.5585572", "0.5557132", "0.5524363", "0.5509535", "0.54770476", "0.5476242" ]
0.56682354
62
Initializes the fields of this object. This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mixins). Only for internal use.
static initialize(obj, name, photoUrls) { obj['name'] = name; obj['photoUrls'] = photoUrls; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "init() {\n this._super(...arguments);\n this._applyDefaults();\n }", "_init() {\n\t\tthis.life.init();\n\t\tthis.render.init();\n\n\t\tthis.emission.init();\n\t\tthis.trail.init(this.node);\n\n\t\tthis.color.init();\n\t}", "function Constructor() {\n // All construction is actually done in the init method\n if ( this.initialize )\n this.initialize.apply(this, arguments);\n }", "constructor() {\n super()\n self = this\n self.init()\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "_initialize() {\n debug(TRACE_INITIALIZE, this);\n\n this._initState();\n\n // Call subclass lifecycle methods\n this.initializeState(this.context);\n // Initialize extensions\n for (const extension of this.props.extensions) {\n extension.initializeState.call(this, this.context, extension);\n }\n // End subclass lifecycle methods\n\n // initializeState callback tends to clear state\n this.setChangeFlags({\n dataChanged: true,\n propsChanged: true,\n viewportChanged: true,\n extensionsChanged: true\n });\n\n this._updateState();\n }", "function init () {\n // Here below all inits you need\n }", "constructor() {\n this._initialize();\n }", "initialize() {\n // Needs to be implemented by derived classes.\n }", "init() {\n this._super(...arguments);\n }", "constructor() {\n this.initStore(this.constructor.fields());\n this.registerFields();\n }", "function _init() {\n }", "init() {\n this.setResolver();\n this.setValidationAndBehaviour();\n }", "initialize() {\n\t\tthis.updateFaves();\n\t\tthis.CALCULATOR.initialize();\n\t\t\n\t\t// initialize unit converter\n\t\tthis.populateCategories();\n\t\tthis.populateUnitMenus();\n\t\tthis.switchToFaveConv();\n\t\tthis.convertHandler();\n\t\t\n\t\t// initialize constants\n\t\tthis.populateConstants();\n\t\tif(this.m_faves.constant === \"\") {\n\t\t\tthis.constChange();\n\t\t\tthis.constHandler();\n\t\t}\n\t\telse {\n\t\t\tthis.switchToFaveConst();\n\t\t}\n\t\t\n\t\t// initialize formulas\n\t\tthis.populateFormulas();\n\t\tif(this.m_faves.formula === \"\") {\n\t\t\tthis.populateFormulaFields();\n\t\t}\n\t\telse {\n\t\t\tthis.switchToFaveFormula();\n\t\t}\n\t\t\n\t\tthis.setUnloadListener();\n\t}", "function Class(){\n // All construction is actually done in the init method\n if (!initializing && this.init) {\n\t\t\t\tthis.init.apply(this, arguments);\n\t\t\t}\n }", "constructor(props) {\n // TODO: add pitch\n super(props);\n this.init();\n }", "constructor() {\n // Data / properites / state\n // The difference between the properties and regular\n // variables is that the properies are encapsulated variables.\n this.name = null;\n this.age = null;\n }", "constructor() { \n PersonNameCountAndEmailInfoWithIds.initialize(this);MergePersonDealRelatedInfo.initialize(this);\n AdditionalMergePersonInfo.initialize(this);\n }", "function init() {\n getContentTypes();\n getProperties();\n }", "init()\n\t{\n\t\tinitVerticesNormalsTexturesIndexes();\n\n //Converts the values to buffers\n\t\tthis.vertexBuffer = getVertexBufferWithVertices(this.vertices);\n\t\tthis.colorBuffer = getVertexBufferWithVertices(this.colors);\n\t\tthis.indexBuffer = getIndexBufferWithIndices(this.indices);\n\n\t\t//Defines the position matrix of the object\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.translate(this.mvMatrix, this.mvMatrix, vec3.fromValues(this.x, this.y, 0.0));\n\t}", "constructor() {\n this.init();\n }", "constructor() {\n this._Initialize();\n }", "function init() {\n\n }", "function init() {\n\n }", "initialize() {\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this._requestUpdate();\n }", "initialize() {\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this._requestUpdate();\n }", "initialize() {\n //\n }", "constructor()\n {\n this.init();\n }", "function Base() {\n this.init.apply(this, arguments);\n}", "function init() {\n }", "constructor() {\n super(null, null, 0, 0, 0, 0, 0);\n }", "constructor(data = {}) {\n super(data);\n \n this.init(data);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "_initialize() {\n var _a2;\n this.__updatePromise = new Promise((res) => this.enableUpdating = res);\n this._$changedProperties = /* @__PURE__ */ new Map();\n this.__saveInstanceProperties();\n this.requestUpdate();\n (_a2 = this.constructor._initializers) === null || _a2 === void 0 ? void 0 : _a2.forEach((i) => i(this));\n }", "function Class() {\n\t\t\t// All construction is actually done in the init method\n\t\t\tif ( !initializing && this.init )\n\t\t\tthis.init.apply(this, arguments);\n\t\t}", "function Ctor() {\n this.isLoaded = false;\n }", "function init() {\n\t \t\n\t }", "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 _Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n\t\t\t// All construction is actually done in the init method\n\t\t\tif (!initializing && this.init)\n\t\t\t\tthis.init.apply(this, arguments);\n\t\t}", "function Class() {\n\t\t\t// All construction is actually done in the init method\n\t\t\tif (!initializing && this.init)\n\t\t\t\tthis.init.apply(this, arguments);\n\t\t}", "initialize() {\n super.initialize();\n\n this.originalValue = null;\n this.maxLength = this.config.maxLength || null;\n this.required = this.config.required || false;\n this.requiredValidator = this.config.requiredValidator || null;\n }", "function _construct()\n\t\t{;\n\t\t}", "__previnit(){}", "function BaseConstructor() {\n\t this.constructed_objects = {};\n\t this.constructing_nodes = [];\n\t this.deferred_constructors = [];\n\t }", "function _init() {\n }", "function _init() {\n }", "function _init() {\n }", "function init() {\r\n\r\n }", "function BaseClass() {\n this.initialize();\n }", "function Class() {\n\t\t\t// All construction is actually done in the init method\n\t\t\tif ( !initializing && this.init )\n\t\t\t\tthis.init.apply(this, arguments);\n\t\t}", "constructor(props) {\n super(props);\n this.state = {}\n if(this.props.contextText === undefined) {\n this.state.contextText = this.props.headerText;\n } else {\n this.state.contextText = this.props.contextText;\n }\n if(this.props.customField === undefined) {\n this.state.customField = null\n } else {\n this.state.customField = this.props.customField\n }\n }", "function _ctor() {\n\t}", "init(){}", "init() {\n this.isUpdating = false;\n this.errors = {};\n this.copied = null;\n this.isLoading = false;\n this.tracks = [];\n this.einsteinCategories = [];\n\n this.tempUserName = this.user.lastName;\n\n if (!this.user.firstName) {\n this.user.firstName = this.user.name;\n }\n\n this.currentInput = {\n name: null,\n value: null,\n };\n }", "function Class()\n\t\t\t\t{\n\t\t\t\t\t// All construction is actually done in the init method\n\t\t\t\t\tif (!initializing && this.init) this.init.apply(this, arguments);\n\t\t\t\t}", "initialize () {\n this.propsData = {\n campaignHandle: null,\n currentLevel: null,\n capstoneStage: null,\n courseId: null,\n courseInstanceId: null,\n goToNextDirectly: null,\n showShareModal: null,\n supermodel: null\n }\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function init() {\r\n }", "constructor() { \n ActivityObjectFragment.initialize(this);ActivityResponseObjectAllOf.initialize(this);\n ActivityResponseObject.initialize(this);\n }", "init() {\n }", "function Class() {\n // All construction is actually done in the init method\n if (!initializing && this.init)\n this.init.apply(this, arguments);\n }", "constructor() {\n\n\t\t// base constructor\n\n\t\t// the property active is never utilized however\n\n\t\tthis.active = true;\n\t}", "function Initialize()\n\t\t{\n\t\t\t\n\t\t}", "function initialize(){\n\n\t\t//sets all needed components, listeners, etc\n\t\tformatBodyPages();\n\t\tsetBodyTransitions();\n\n\t}", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "_init() {\n this.__lookupTable = new qx.data.Array();\n this.__openNodes = [];\n this.__nestingLevel = [];\n this._initLayer();\n }", "Init()\n {\n this.my_state_machine = new StateMachine();\n this.overlay_manager_inst = new OverlayManager();\n this.level_viewer = null;\n this.information_log = document.getElementById(\"informationLog\");\n this.level_object_manager = new LevelObjectManager();\n this.level_complete = document.getElementById(\"complete\");\n this.stats_manager = new StatManager();\n this.AI_bridge = new AIBridge();\n this.memento = new Memento();\n this.toolbar_manager = new ToolbarManager();\n }", "init() {\n console.log('### init ', this);\n console.log('### init modelItem', this.modelItem);\n if (!this.repeated) {\n super.init();\n }\n this.applyProperties();\n this.attachListeners();\n\n }", "_init() {\n this.floors.all = FloorsJSON\n this.locations.all = LocationsJSON\n this._segregateLocations()\n this._groupFloorsByBuildings()\n }", "function _Class() {\n // All construction is actually done in the init method\n\n this.ctor.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init ) {\n this.init.apply(this, arguments);\n }\n }", "_init() {\n throw new Error('_init not implemented in child class');\n }", "init() {\n\n this.assignPlayer();\n gameView.init(this);\n gameView.hide();\n scoreBoardView.init(this);\n registerView.init(this);\n this.registerSW();\n }", "initialize() {\n this._updateState = 0;\n this._updatePromise =\n new Promise((res) => this._enableUpdatingResolver = res);\n this._changedProperties = new Map();\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdateInternal();\n }", "function Class() {\r\n // All construction is actually done in the init method\r\n if ( !initializing && this.init )\r\n this.init.apply(this, arguments);\r\n }", "_init() {\n throw new TypeError('BaseModel#_init method must be implemented by the class extending BaseModel');\n }", "constructor() {\n\t\tsuper(...arguments);\n\t}", "function Class() {\n\t // All construction is actually done in the init method\n\t if ( !initializing && this.init )\n\t this.init.apply(this, arguments);\n\t }", "init () {\n this._super()\n this.handleNewValues()\n }", "constructor() { \n BaseRole.initialize(this);RoleAssignmentAllOf.initialize(this);\n RoleAssignment.initialize(this);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n \tthis.init.apply(this, arguments);\n }", "function Class() {\n\t\t// All construction is actually done in the init method\n\t\tif ( !initializing && this.init )\n\t\t this.init.apply(this, arguments);\n\t }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }", "function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }" ]
[ "0.71308", "0.6962521", "0.6813377", "0.67452186", "0.67150044", "0.66416204", "0.6633205", "0.6601199", "0.65798515", "0.65623814", "0.64090466", "0.6405055", "0.63343316", "0.6303729", "0.62963045", "0.62827903", "0.62684494", "0.6239129", "0.62390757", "0.62344384", "0.6233991", "0.62279373", "0.6210353", "0.6197409", "0.6197409", "0.61892205", "0.61892205", "0.61793655", "0.6178538", "0.61714697", "0.61504644", "0.61478895", "0.6140302", "0.61301076", "0.61301076", "0.61301076", "0.61301076", "0.6118154", "0.6094116", "0.6093742", "0.6091738", "0.60862035", "0.60752106", "0.6074874", "0.6074874", "0.6062454", "0.6061458", "0.6058112", "0.60502666", "0.604933", "0.604933", "0.604933", "0.60439694", "0.60382164", "0.6037404", "0.6026469", "0.6026223", "0.6022176", "0.6012694", "0.6000103", "0.59971255", "0.59901834", "0.59901834", "0.59868526", "0.59838426", "0.59768015", "0.5974219", "0.59709996", "0.5969298", "0.5962465", "0.5955475", "0.59533", "0.59533", "0.5943256", "0.59378296", "0.592153", "0.5919512", "0.5911693", "0.59078467", "0.59000146", "0.5895779", "0.58933747", "0.5889465", "0.58889073", "0.5886103", "0.5878572", "0.586957", "0.5868909", "0.5856737", "0.5850175", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903", "0.5846903" ]
0.0
-1
function to show list of products
function showProducts(json_url) { if (!json_url) return; // get list of products from the API $.getJSON(json_url, function (data) { // html for listing products readProductsTemplate(data, ""); // chage page title changePageTitle("Read Products"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewProducts() {\n clearConsole();\n connection.query(\"SELECT * FROM products\", function (err, response) {\n if (err) throw err;\n displayInventory(response);\n userOptions();\n })\n}", "function viewProducts(){\n\n\t// Query: Read information from the products list\n\tconnection.query(\"SELECT * FROM products\", function(viewAllErr, viewAllRes){\n\t\tif (viewAllErr) throw viewAllErr;\n\n\t\tfor (var i = 0; i < viewAllRes.length; i++){\n\t\t\tconsole.log(\"Id: \" + viewAllRes[i].item_id + \" | Name: \" + viewAllRes[i].product_name +\n\t\t\t\t\t\t\" | Price: \" + viewAllRes[i].price + \" | Quantity: \" + viewAllRes[i].stock_quantity);\n\t\t\tconsole.log(\"-------------------------------------------------------------------\");\n\t\t}\n\n\t\t// Prompts user to return to Main Menu or end application\n\t\trestartMenu();\n\t});\n}", "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif (err) throw err; \n\t\tconsole.table(res);\n\t\tchooseAction(); \n\t})\n}", "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif (err) throw err;\n\t\tfor (var i = 0; i < res.length; i++) {\n\t\t\tconsole.log(\"---------------------------------------\" + \n\t\t\t\"\\nItem Id: \" + res[i].item_id + \"\\nProduct: \" + \n\t\t\tres[i].product_name + \"\\nPrice: \" + res[i].price + \n\t\t\t\"\\nQuantity in Stock: \" + res[i].stock_quantity);\n\t\t}\n\t\tstartOver();\n\t});\n}", "function viewProducts(){\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n displayTable(res);\n promptManager();\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(err, rows) {\n if (err) throw err;\n console.log(\"\");\n console.table(rows);\n console.log(\"=====================================================\");\n menu();\n });\n}", "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif(err) {\n\t\t\tthrow err\n\t\t};\n\t\tfor (var i =0; i < res.length; i++) {\n\t\t\tconsole.log(\"SKU: \" + res[i].item_id + \" | Product: \" + res[i].product_name \n\t\t\t\t+ \" | Price: \" + \"$\" + res[i].price + \" | Inventory: \" + res[i].stock_quantity)\n\t\t}\n\t\t// connection.end();\n\t\trunQuery();\n\t});\n}", "function displayProducts() {\n\tconnection.query(\"SELECT * FROM products\", function (err, res) {\n\t\tif (err) throw err;\n\n\t\tfor (var i = 0; i < res.length; i++) {\n\t\t\tconsole.log(\"Product Number: \" + res[i].item_id)\n\t\t\tconsole.log(\"Product: \" + res[i].product_name)\n\t\t\tconsole.log(\"Department: \" + res[i].department_name)\n\t\t\tconsole.log(\"Price: $\" + res[i].price)\n\t\t\tconsole.log(\"In Stock: \" + res[i].stock_quantity)\n\t\t\tconsole.log(\"\\n ---------------------- \\n\")\n\t\t}\n\n\n\n\t\t// callback function\n\t\tfirstPrompt()\n\t});\n}", "function viewProducts() {\n connection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products\", function (err, res) {\n console.log(\"Products for sale\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"======================\");\n console.log(\"Id: \" + res[i].item_id + \" || Department: \" + res[i].department_name + \" || Product: \" + res[i].product_name + \" || Price($): \" + parseFloat(res[i].price).toFixed(2) + \" || In stock: \" + res[i].stock_quantity);\n }\n });\n displayChoices();\n}", "function displayProducts(products) {\n let html = \"\";\n products.forEach((product) => {\n html += renderProduct(product, \"cart\");\n });\n document.querySelector(\"#products\").innerHTML = html;\n}", "static list(){\n //console.log('list di ProductController');\n Product.list((err, data) => {\n if(err){\n View.error(err);\n }\n else{\n View.list(data);\n }\n })\n }", "function displayProducts() {\n console.log(\"\\nShowing current inventory...\\n\".info);\n connection.query(\n \"SELECT * FROM products\", \n (err, res) => {\n if (err) throw err;\n console.table(res);\n promptManager();\n }\n )\n}", "function displayProducts() {\n // display product ID, name and price\n var query = \"SELECT * FROM products\";\n connection.query(query, function(err, res) {\n if (err) throw err;\n for (i = 0; i < res.length; i++) {\n console.log(\"Product ID: \" + res[i].item_id + \"\\nName: \" + res[i].product_name +\n \"\\nPrice: $\" + res[i].price + \"\\n\");\n }\n enterToShop();\n });\n}", "function viewProducts() {\n connection.query('SELECT * FROM products', function(err, results){ \n if (err) throw err;\n displayForManager(results);\n promptManager(); \n })\n}", "function viewProducts() {\n database.query(\"SELECT * FROM products\", function (err, itemData) {\n if (err) throw err;\n for (var i = 0; i < itemData.length; i++) {\n console.log(`\n----------------------------------------------------\nID: ${itemData[i].id} | Product: ${itemData[i].product_name} | Price: $${itemData[i].price} | Stock: ${itemData[i].stock_quantity}\n----------------------------------------------------\n`)\n }\n })\n return start();\n}", "function viewProducts() {\n connection.query(\"select * from products\", function (err, res) {\n if (err) throw err;\n console.log(\"\\n\");\n console.table(res);\n quit();\n });\n}", "function showProducts(){\n\tconnection.query('SELECT * FROM products', function(err, res){\n\t\tif (err) throw err;\n\t\tconsole.log('=================================================');\n\t\tconsole.log('=================Items in Store==================');\n\t\tconsole.log('=================================================');\n\n\t\tfor(i=0; i<res.length; i++){\n\t\t\tconsole.log('Item ID:' + res[i].item_id + ' Product Name: ' + res[i].product_name + ' Price: ' + '$' + res[i].price + '(Quantity left: ' + res[i].stock_quantity + ')')\n\t\t}\n\t\tconsole.log('=================================================');\n\t\tstartOrder();\n\t\t})\n}", "function viewProducts(){\n console.log(\"\\nView Every Avalailable Product in format:\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.log(\"'ItemID-->Product Description-->Department Name-->Price-->Product Quantity'\\n\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"Item# \" + res[i].item_id + \"-->\" + res[i].product_name \n + \"-->\" + res[i].department_name + \"-->\" + res[i].price \n + \"-->\" + res[i].stock_quantity);\n }\n // console.table(\"\\nProducts Available:\",[\n // res\n // ])\n })\n setTimeout(function() { startManager(); }, 200);\n}", "function displayProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.table(res);\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n\n // create an array to hold our formatted res data and loop through the res data\n var products = [];\n res.forEach(element => {\n products.push(\"ID#: \" + element.item_id + \" | Product Name: \" + element.product_name + \" | Price: $\" + element.price + \" | Quantity: \" + element.stock_quantity);\n }); // end .forEach\n\n // display the items\n console.log('\\n');\n console.log('《 ALL AVAILABLE PRODUCTS 》');\n console.log(\" -------------------------\" + '\\n');\n products.forEach(element => {\n console.log(element);\n }); // end .forEach\n console.log('\\n');\n start();\n }); // end .query\n} // end viewProductsFunction", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(error, results) {\n if (error) throw error;\n console.log(\"AVAILABLE ITEMS:\");\n for (var i = 0; i < results.length; i++) {\n console.log(results[i].id + ' | ' + results[i].product_name + ' | ' + '$'+results[i].price + ' | ' + results[i].stock_quantity);\n }\n });\n connection.end();\n}", "function viewProducts(){\n var query = connection.query(\"SELECT ID, Product_Name , Price, Stock_QTY FROM products;\", function(err, res) {\n console.log(\"\");\n console.table(res);\n console.log(\"\");\n \n managerAsk();\n });\n }", "function displayProducts() {\n\n // create variable with empty string, it will contain product details HTML\n let productsListingHtml = '';\n \n products.forEach(product => {\n \n productsListingHtml += `<div class=\"product\"><p><b>${product['name']}</b></p><p>${product['description']}</p><p>$${product['price']}</p><p>${product['manufacturer']}</p><button id=\"${product['id']}\" class=\"button\">Delete</button></div>`;\n \n });\n\n // add product html string to document to display on screen\n document.querySelector('.products').innerHTML = productsListingHtml;\n\n products.forEach(product => {\n\n // add event listener for product, this will be used to delete product\n document.getElementById(`${product['id']}`).addEventListener(\"click\", deleteProduct);\n \n });\n\n }", "function getProducts() {\n\n $.get(\"/api/products\", function (data) {\n displayProducts(data);\n });\n }", "function displayProducts(){\n console.log('printing product table... \\n');\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n console.log('Products \\n---------------')\n for(var i = 0; i < res.length; i ++){\n console.log(\n 'ID: ' + res[i].id + '\\n' +\n 'Name: ' + res[i].name + '\\n' +\n 'Department: ' + res[i].department + '\\n' +\n 'Price: ' + (res[i].price/100).toFixed(2) + '\\n' +\n 'Quantity: ' + res[i].quantity + '\\n' +\n '---------------'\n );\n }\n shop();\n })\n}", "function showProducts(payload) {\n var contents = $parent.html();\n\n // Show warnings\n if (payload.length === 0) {\n if (contents === '')\n $parent.append(\"<div class='error'>\" + language.no_products + '</div>');\n // Assume we have hit the end of scrolling\n else if (!contents.includes('<div class=\"error\">'))\n return $parent.append(\n \"<div class='error'>\" + language.no_products + '</div>'\n );\n }\n\n //if search returns one product, redirect to product page on IWP\n if (payload.length === 1) {\n if (store_url == 'iwp') {\n if (contents === '') {\n var product_url = payload[0].url;\n window.location.href = product_url;\n }\n }\n }\n // Render products on collection page\n payload.forEach(function(row) {\n var url = row.url;\n var image = row.image;\n var title = row.title;\n var show_price = row.show_price;\n var price_min = row.price_min;\n var price_max = row.price_max;\n var price = row.price;\n var compare = row.compare;\n var highlight = highlightTitle(row.tags);\n\n // truncate long product titles\n if (title.length > 60) {\n title = title.substr(0, 60) + '...';\n }\n\n if (highlight) {\n var title = '<span class=\"highlight_title\">HOT! </span>' + title;\n }\n\n if (typeof theme == \"object\" && theme.accepted_locations.indexOf(theme.geo_location) == -1) {\n show_price = false;\n }\n\n var string =\n \" \\\n <div class='product_listing desktop-3 tablet-2 mobile-half'> \\\n <div class='product_listing_image'> \\\n <a href='\" +\n url +\n \"'> \\\n <img src='\" +\n image +\n \"' /> \\\n </a> \\\n </div> \\\n <div class='product_listing_title'> \\\n <h5>\" +\n title +\n \"</h5> \\\n </div> \\\n <div class='product_listing_content'>\";\n\n if (show_price || store_url == 'iwp') {\n if (price_min == price_max) {\n // hide prices on KMT-EMEA\n if (store_url != 'kmt_emea') {\n string += '<div class=\"product_listing_price\">' + price + '</div>';\n }\n\n if (price !== compare && compare !== '' && compare > price) {\n string +=\n \"<div class='product_listing_compare'>\" + compare + '</div>';\n }\n } else {\n if (store_url != 'kmt_emea') {\n string +=\n '<div class=\"product_listing_price\">' +\n price_min +\n ' - ' +\n price_max +\n '</div>';\n }\n }\n }\n\n string +=\n \" \\\n <div class='product_listing_button'> \\\n <a href='\" +\n url +\n \"' class='button reverse'>\" +\n language.buy_now +\n '</a> \\\n </div> \\\n </div> \\\n </div>';\n\n var $string = $('<div />')\n .html(string)\n .contents();\n $parent.append($string);\n });\n\n // Disable loading animation\n $loading.hide();\n }", "function displayProducts() {\n // include ids names prices\n connection.query(selectQuery, function (err, res) {\n if (err) throw (err);\n inquirer.prompt([\n {\n type: 'list',\n message: '',\n choices: function () {\n var choiceArray = [];\n let productLabel = '';\n for (let i = 0; i < res.length; i++) {\n productLabel = res[i].item_id + '. ' + res[i].product_name + ' - $' + res[i].price\n choiceArray.push(productLabel)\n }\n choiceArray.push(new inquirer.Separator(), 'Main Menu')\n return choiceArray;\n },\n name: 'products'\n }\n ]).then(function (answer) {\n if (answer.products === 'Main Menu') return mainMenu()\n let selected = answer.products\n productSelected(selected.slice(0, 1))\n })\n })\n}", "function viewProducts() {\n\tconnection.query('SELECT * FROM Products', function(err, result) {\n\t\tcreateTable(result);\n\t})\n}", "function displayItems() {\n\n\tconnection.query(\"SELECT * from products\", function(err, res) {\n\t\tif (err) throw err;\n\t\t\n\t\tconsole.log(\"\\n\");\n\t\tconsole.table(res);\n\t\t\n\t\t//This is a recursive call. Using here by intention assuming this code will not be invoked again and again. Other options could've \n\t\t//been used which avoid recursion.\n\t\tdisplayMgrOptions();\n\t});\n}", "function viewProducts(){\n\n\tvar query = \"SELECT * FROM products\";\n\n\tconnection.query(query, function(err, res){\n\t\tif (err) throw err;\n\t\tconsole.log(\"ALL INVENTORY IN PRODUCTS TABLE\");\n\t\tfor(i=0; i< res.length; i++){\n\t\t\tconsole.log(\"---|| ID \"+ res[i].item_id+\" ---|| NAME: \"+ res[i].product_name+\" ---|| PRICE: $\"+ res[i].price + \" ---|| QUANTITY \" + res[i].stock_quantity);\n\t\t};\n\t\taskAction();\n\t})\n\n}", "function displayItems() {\n\tvar query = \"SELECT * FROM products\";\n\tconnection.query(query, (err,res) => {\n\t\tif (err) {console.log(err)};\n\t\tconsole.log(JSON.stringify(res));\n\t})\n}", "function setupProductList() {\n if(document.getElementById(\"productList\")) {\n for (productSku of Object.keys(products)) {\n\t // products[productSku].name\t\n\t $(\"#productList\").append(\n\t $(\"<a>\").attr(\"href\",\"product.html?sku=\" + productSku).append(\t \n $(\"<div>\").addClass(\"productItem\").append(\n\t $(\"<h2>\").addClass(\"productTitle\").text(products[productSku].name)\n\t ).append(\n\t\t $(\"<span>\").addClass(\"productPrice\").text(products[productSku].price)\n\t ).append(\n $(\"<img>\").addClass(\"productImage\").attr(\"src\", \"img/\" + products[productSku].img)\n\t )\n\t )\n\t );\n }\n }\n}", "function viewProducts() {\n connection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products\", function (err, res) {\n //error occurs\n if (err) {\n throw err;\n }\n\n console.table(\"\\nInventory\", res);\n returnToMenu();\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM bamazon.products\", function (err, res) {\n if (err) throw err;\n console.log(\"\\n\")\n for (let i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].item_id + \" ---- Product: \" + res[i].product_name + \" ---- Price: $\" + res[i].price + \" ---- Quantity: \" + res[i].stock_quantity)\n }\n })\n start();\n}", "function ShowProducts(){ \r\n\tconnection.query('SELECT * FROM product_name', function(err, res){ \r\n\t\tif (err) throw err; \r\n\t\tconsole.log('********************************************************');\r\n\t\tconsole.log('********************************************************');\r\n\t\tconsole.log('** Bamazon Mercantile **');\r\n\t\tconsole.log('** Product list **'); \r\n\t\tconsole.log('********************************************************');\r\n\t\tconsole.log('********************************************************'); \r\n\r\n\t\tfor(i=0;i<res.length;i++){ \r\n\t\t\tconsole.log('Product ID:' + res[i].item_id + ' Product: ' + res[i].product_name + ' Price: ' + '$' + res[i].price + '(Quantity left: ' + res[i].stock_quantity + ')') \r\n\t\t} \r\n\t\tconsole.log('---------------------------------------------------------'); \r\n\t\tPlaceOrder(); \r\n\t\t}) \r\n}", "function listProducts(){\r\n\r\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\r\n\t\tif (err) throw err;\r\n\r\n\t\tconsole.table(res);\r\n\r\n\t});\r\n}", "function displayProducts() {\n console.log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results \n for (var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].id + \" | \" + \"Product: \" + res[i].product_name + \" | \" + \"Department: \" + res[i].department_name + \" | \" + \"Price: \" + res[i].price + \" | \" + \"Quantity: \" + res[i].stock_quantity);\n console.log('------------------------------------------------------------------------------------------------------------')\n };\n selectProducts(res)\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(err, results) {\n if (err) throw err;\n console.log(\"\\n\" + colors.yellow(\"---------------------PRODUCTS FOR SALE---------------------\") + \"\\n\");\n var table = new cliTable({ head: [\"ID\", \"Item\", \"Price\", \"Quantity\"] });\n for (var i = 0; i < results.length; i++) {\n table.push([results[i].id, results[i].productName, results[i].price, results[i].stockQuantity]);\n }\n console.log(table.toString() + \"\\n\");\n actionPrompt();\n });\n}", "function getProducts() {\n // Go fetch the data from displayProducts.php.\n $http.post('./displayProducts.php')\n .success(function(data) {\n $scope.products = data;\n });\n }", "function displayProducts(){\n \n\tconnection.query(sql, function(err, data) {\n\t if (err) {\n\t console.log(err);\n\t }\n\n\t var items = '';\n\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\titems = '';\n\t\t\t\titems += 'ID: ' + data[i].item_id + ' | ';\n\t\t\t\titems += 'Product: ' + data[i].product_name + ' | ';\n\t\t\t\titems += 'Dept: ' + data[i].department_name + ' | ';\n\t\t\t\titems += '$' + data[i].price + ' | ';\n\t\t\t\titems += 'Quantity: ' + data[i].stock_quantity;\n\t\t console.log(\"------------------------------------------------------------------------\");\n\t console.log(items);\n\t\t\t};\n\n\t\tpurchase();\n\n\t});\n\n}", "function displayItems()\n{\n\t//Select All from (products) table within (bamazon) DB\n\tconnection.query(\"SELECT * FROM products\", function(err, res)\n\t{\n\n\t\tif(err) throw err;\n\n\t\t//Display all products in table by looping through each row inside table\n\t\tfor(var i = 0; i < res.length; i++)\n\t\t{\n\t\t\tconsole.log(\"ID: \" + res[i].item_id + \" | \" +\n\t\t\t\t\t\t\"Product Name: \" + res[i].product_name + \" | \" +\n\t\t\t\t\t\t\"Category: \" + res[i].department_name + \" | \" +\n\t\t\t\t\t\t\"Price: \" + res[i].price );\n\t\t}\n\n\t\tconsole.log(\"-----------------------------------------------------------------\\n\");\n\n\t\t//Allow Customer to make purchase\n\t\tbuy();\n\n\t});\n}", "function viewAllProducts() {\n //connection/callback function\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.log(\"All items currently available in marketplace:\\n\");\n console.log(\"\\n-----------------------------------------\\n\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"Id: \".bold + res[i].item_id + \" | Product: \".bold + res[i].product_name + \" | Department: \".bold + res[i].department_name + \" | Price: \".bold + \"$\".bold +res[i].price + \" | QOH: \".bold + res[i].stock_quantity);\n }\n console.log(\"\\n-----------------------------------------\\n\");\n });\n\n}", "function listProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n\n for (var i = 0; i < res.length; i++) {\n var products = res[i];\n\n var productList = [\n \"Product ID: \" + products.id,\n \"Product: \" + products.product_name,\n \"Department: \" + products.department_name,\n \"Price: $\" + products.price,\n \"Stock Quantity: \" + products.stock_quantity\n ].join(\"\\n\");\n\n console.log(\"\\n\");\n console.log(productList);\n }\n });\n promptCustomer()\n }", "function getProducts() {\n\tajax('GET', 'products', null, createProductList);\n}", "function products() {\n var query = connection.query(\"SELECT item_id, department_name, product_name, price, stock_qty, product_sales FROM products ORDER BY item_id\", function(err, results, fields) {\n if(err) throw err;\n console.log(\"\\r\\n\" + \" - - - - - - - - - - - - - - - - - - - - - - - - \" + \"\\r\\n\");\n console.log(\"\\r\\n\" + chalk.yellow(\"-------- \" + chalk.magenta(\"BAMAZON PRODUCTS\") + \" ----------\") + \"\\r\\n\");\n var productsList = [];\n console.table(results);\n for(obj in results) {\n productsList.push(results[obj].products);\n }\n return managerDashboard(productsList);\n })\n}", "function display_products() {\n str = '';\n for (i = 0; i < products.length; i++) {\n str += `\n <section>\n <div>\n <img src=\"/images/${products[i].image}\">\n </div>\n </section>\n <section>\n <div>\n ${products[i].name}:\n $${products[i].price.toFixed(2)}\n </div>\n <div>\n <input type=\"text\" name=\"${products[i].name}\" \n onkeyup=\"checkQuantityTextbox(this);\">\n </div\n </section>\n `;\n }\n return str;\n }", "function viewProducts(){\n connection.query(\"SELECT * FROM products\", function(err, response){\n if(err) throw err;\n printTable(response);\n })\n}", "function showProduct() {\n const title = el('products').value;\n const product = products[title];\n if (product) {\n el('title').innerHTML = title;\n el('price').innerHTML = 'Price: ' + currencyFormatter.format(product.price);\n el('image').src = product.image;\n }\n el('quantity-container').style.display = product ? 'block' : 'none';\n}", "function displayProducts() {\n \n // query/get info from linked sql database/table\n let query = \"SELECT * FROM products\";\n connection.query(query, function (err, res) {\n if (err) throw err;\n\n // map the data response in a format I like, and make it show the info I need it show\n // show the customer the price\n let data = res.map(res => [` ID: ${res.id}\\n`, ` ${res.product_name}\\n`, ` Price: $${res.price} \\n`]);\n console.log(`This is what we have for sale \\n\\n${data}`);\n console.log(\"-----------------\");\n\n userItemChoice();\n quitShopping();\n\n });\n}", "getProducts() {}", "function buildProductList(data) { \n let productsDisplay = document.getElementById(\"productsDisplay\"); \n // Set up the table labels \n let dataTable = '<thead>'; \n dataTable += '<tr><th>Product Name</th><td>&nbsp;</td><td>&nbsp;</td></tr>'; \n dataTable += '</thead>'; \n // Set up the table body \n dataTable += '<tbody>'; \n // Iterate over all products and put each in a row \n data.forEach(function (element) { \n console.log(element.invId + \", \" + element.invName); \n dataTable += `<tr><td>${element.invName}</td>`; \n dataTable += `<td><a href='/acme/products?action=mod&id=${element.invId}' title='Click to modify'>Modify</a></td>`; \n dataTable += `<td><a href='/acme/products?action=del&id=${element.invId}' title='Click to delete'>Delete</a></td></tr>`; \n }) \n dataTable += '</tbody>'; \n // Display the contents in the Product Management view \n productsDisplay.innerHTML = dataTable; \n }", "function listProducts() {\n var products = document.getElementById('products');\n\n for (var i = 0; i < Product.names.length; i++) { //populate product list\n var optionEl = document.createElement('option');\n optionEl.textContent = Product.names[i];\n products.appendChild(optionEl);\n }\n}", "function viewProducts () {\n con.query(\"SELECT * from vw_ProductsForSale\", function (err, result) {\n if (err) {\n throw err;\n }\n else {\n var table = new Table({\n\t\t head: ['Product Id', 'Product Name', 'Department','Price','Quantity'],\n\t\t style: {\n\t\t\t head: ['blue'],\n\t\t\t compact: false,\n\t\t\t colAligns: ['center','left','left','right','right']\n\t\t }\n\t });\n\n\t //loops through each item in the mysql database and pushes that information into a new row in the table\n\t for(var i = 0; i < result.length; i++) {\n\t\t table.push(\n\t\t\t [result[i].Product_Id, result[i].Product_Name, result[i].Department, result[i].Price, result[i].Quantity]\n\t\t );\n\t }\n \n console.log(table.toString());\n runManageBamazon();\n }\n });\n }", "function showProducts() {\n\t\tvar form = document.getElementById(\"formId\");\n\t\tform.setAttribute(\"action\", contextName+\"/application/show\");\n\t\tform.setAttribute(\"method\", \"get\");\n\t\tform.submit();\n\n\t}", "function showProducts() {\n console.log(\"\\nDisplaying All Products....\");\n connection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products \", function (err, res) {\n if (err) throw err;\n // for (var i = 0; i<res.length; i++)\n console.log(JSON.stringify(res) + \"\\n\");\n startMenu();\n });\n}", "function displayProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n console.table(res);\n takeOrder();\n });\n}", "function viewProducts() {\n console.log('Here is the current inventory: ');\n var table = new Table({\n head: ['Item ID', 'Product Name', 'Price', 'Quantity']\n });\n connection.query(\"SELECT * FROM products\", function (err, res) {\n for (let i = 0; i < res.length; i++) {\n table.push(\n [res[i].item_id, res[i].product_name, res[i].price, res[i].stock_quantity]\n );\n }\n console.log(table.toString());\n console.log('\\n*******************');\n managerOptions();\n })\n}", "function displayProducts() {\n connection.query(`\n SELECT item_id, product_name, price \n FROM products \n WHERE stock_quantity > 0`, (err, response) => {\n if(err) console.log(chalk.bgRed(err));\n response.forEach(p => p.price = `$ ${p.price.toFixed(2)}`);\n console.table(response);\n // connection.end();\n start();\n });\n}", "function loadProducts() {\n\treturn products.map(product => {\n\t\treturn `\n\t\t\t<div class=\"product\">\n\t\t\t\t<div class=\"img-product\">\n\t\t\t\t\t<img src=\"${product.img}\" alt=\"table one\">\n\t\t\t\t</div>\n\t\t\t\t<h3 class=\"name-product\">${product.name}</h3>\n\t\t\t\t<p class=\"price-product\">${product.price}</p>\n\t\t\t\t\n\t\t\t\t<div class=\"btn-add-to-cart\">\n\t\t\t\t\t<i class=\"fa fa-cart-plus\"></i>\n\t\t\t\t\t<p>add to cart</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`\n\t}).join('');\n}", "function displayProducts(addInventoryPrompt, redirect) { //invocation with callback used in addToInventory();\n var listedItems = [];\n\n connection.query('SELECT * FROM products', function(err, results) {\n if (err) throw err;\n\n // This loop does the following: \n // 1) Updates the price values to show '$' sign\n // 2) Builds an array of all the listed items (this is returned as a courtesy and used in addToInventory())\n for (var i = 0; i < results.length; i++) {\n results[i].price = \"$\" + results[i].price.toFixed(2);\n listedItems.push(results[i].item_id);\n }\n\n console.table('\\nPRODUCT LIST', results);\n \n if (addInventoryPrompt) {\n addInventoryPrompt(listedItems);\n }\n else if (redirect) {\n redirect();\n }\n });\n }", "function displayProducts(){\n\t$(\".single_product\").remove();\n\t$.get(\"all-products.php?origin=login\", function(sData){\n\t\t//console.log(sData);\n\t\t// Convert string to JSON object\n var oData = JSON.parse(sData);\n\t\tfor(var i = 0 ; i < oData.products.length; i++){\n\t\t\tvar soldOut = \"\";\n\t\t\tvar categories = \"\";\n\t\t\tif(oData.products[i].active == 0){\n\t\t\t\tsoldOut = '<span class=\"soldOut\">SOLD OUT</span>';\n\t\t\t}\n\t\t\tfor(var c = 0; c < oData.products[i].categories.length; c++){\n\t\t\t\tcategories += oData.products[i].categories[c]+\" \";\n\t\t\t}\n\n\t\t\t$(\"#products\").append('<div class=\"'+categories+'single_product col-lg-4\"><div class=\"edit_product\" data-partnerKey=\"'+oData.products[i].partner+'\" data-productId=\"'+oData.products[i].id+'\"><span class=\"glyphicon glyphicon-pencil\" aria-hidden=\"true\"></span></div><div class=\"remove_product\" data-partnerKey=\"'+oData.products[i].partner+'\" data-productId=\"'+oData.products[i].id+'\"><span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span></div>'+soldOut+'<img class=\"img-circle\" src=\"'+oData.products[i].image+'\" alt=\"Generic placeholder image\" style=\"width: 140px; height: 140px;\"><h2>'+oData.products[i].name+'</h2><p class=\"product_description\">'+oData.products[i].description+'</p><h3>'+oData.products[i].price+'kr.</h3></div>');\t\n\t\t}\n\t});\n}", "function displayProducts(productsList) {\n let availableProducts = document.getElementById(\"available\");\n availableProducts.textContent = \"\";\n let availableProductsList = productsList.filter(product => product.quantity > 0);\n availableProductsList.forEach(product => {\n availableProducts.appendChild(createProductCard(product));\n });\n}", "function renderProducts() {\n const promotionalProductsPart = document.querySelector(\".promotion-list\");\n let html = \"\";\n for (const product of productsList) {\n if (product.category === \"promotionalProducts\") {\n html += `<article>\n <div>\n <img src=\"img/${product.image}\" alt=\"${product.alt}\">\n <h3>${product.title}</h3>\n <a href=#>LEARN MORE - - - <span>&#10145;</span></a>\n </div>\n </article>`;\n }\n }\n promotionalProductsPart.innerHTML = html;\n}", "function displayProducts(){\n connection.query(\"SELECT * FROM products\", function(err, res){\n if (err) throw err;\n tableFormat(res);\n })\n\n}", "function viewProducts() {\n connection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products\", function (err, res) {\n if (err) throw err;\n console.log(\"\");\n console.table(res);\n connection.end();\n });\n}", "function showProducts() { //Declaro la funcion showProducts\n let productContent = ``\n for(let i = 0; i < currentProductsArray.length; i++){ //For que recorre el arreglo con los productos\n let product = currentProductsArray[i];\n if (((minPrice == undefined) || (minPrice != undefined && parseInt(product.cost) >= minPrice)) &&\n ((maxPrice == undefined) || (maxPrice != undefined && parseInt(product.cost) <= maxPrice))) { //If que declara las conduciones que definen la forma en la que operara la funcion luego\n\n productContent += ` <a href=\"product-info.html\" class=\"product__link\"><div class=\"products__container-product\"><p class=\"product__name product__text\">${product.name}</p>\n <div class=\"image-container\"><img class=\"product__image\" src=\"${product.imgSrc}\"></div>\n <hr class\"product__line\">\n <p class=\"product__description product__text\">${product.description}</p>\n <p class=\"product__cost product__text\">${product.currency} ${product.cost}</p>\n <p class=\"product__soldcount product__text\"> Cantidad de vendidos: ${product.soldCount}</p></div></a>` //Asigno los datos del productos en forma de string a la variable productContent\n }\n }\n document.getElementById(\"products__list\").innerHTML = productContent; //Introduzco la variable productContent en el elemento del HTML que tiene la id \"products__list\"\n}", "function listProduct(i) {\n if (!products[i].name) {\n products[i].name = \"Tidak ada nama product\";\n } else if (Array.isArray(products[i].name)) {\n products[i].name = products[i].name.join(\" \");\n } else if (typeof products[i].name === \"number\") {\n products[i].name = \"Product \" + products[i].name;\n }\n\n var liEl = document.createElement(\"LI\");\n liEl.innerHTML =\n \"ID:\" + products[i].id + \"</br>\" + \"Name:\" + products[i].name;\n\n ulEl.appendChild(liEl);\n}", "function saleProducts() {\n console.log(\"View Sale Products\");\n connection.query(\"SELECT * FROM `products`\", function(queryError, response) {\n if (queryError)\n throw queryError;\n response.forEach(function(row) {\n console.log(\"id = \", \"'\", row.id, \"'\",\n \"Product Name = \", \"'\", row.product_name, \"'\",\n \"Price \", \"'\", row.price, \"'\",\n \"Quantity \", \"'\", row.stock_quantity, \"'\")\n });\n })\n }", "function displayProducts(product) {\n // Structure HTML\n let productLink = document.createElement(\"a\");\n let productCard = document.createElement(\"figure\");\n let productCardTop = document.createElement(\"div\");\n let productImg = document.createElement(\"img\");\n let productCardLegend = document.createElement(\"figcaption\");\n let productName = document.createElement(\"h3\");\n let productPrice = document.createElement(\"p\");\n\n // Attributs des éléments HTML\n productLink.setAttribute(\"class\", \"card__link\");\n productLink.setAttribute(\"href\", \"pages/products.html?id=\" + product._id);\n productCard.setAttribute(\"class\", \"product-card\");\n productCardTop.setAttribute(\"class\", \"card__top\");\n productImg.setAttribute(\"class\", \"card__img\");\n productImg.setAttribute(\"src\", product.imageUrl);\n productImg.setAttribute(\"alt\", \"photo de \" + product.name);\n productCardLegend.setAttribute(\"class\", \"card__legend\");\n productName.setAttribute(\"class\", \"card__name\");\n productPrice.setAttribute(\"class\", \"card__price\");\n\n // Hierarchie des éléments HTML\n document.getElementById(\"productList\").appendChild(productLink);\n productLink.appendChild(productCard);\n productCard.appendChild(productCardTop);\n productCardTop.appendChild(productImg);\n productCard.appendChild(productCardLegend);\n productCardLegend.appendChild(productName);\n productCardLegend.appendChild(productPrice);\n\n // Ajout de contenu texte selon données récupérées \n productName.textContent = product.name;\n productPrice.textContent = product.price/100 + \".00€\"; \n}", "function viewProducts() {\n connection.connect();\n connection.query(\"SELECT * FROM products\", function (err, rows, fields) {\n if (err) throw err;\n console.log(rows)\n });\n connection.end();\n}", "function listProducts() {\n\n con.query(\"SELECT * FROM products\", (err, result, fields) => {\n if (err) throw err;\n result.forEach(element => {\n table.push(\n [element.item_id, element.product_name, \"$\" + element.price, element.stock_quantity]\n )\n });\n console.log(chalk.green(table.toString()))\n // empty table to be able to push updated stock to it\n table.splice(0, table.length);\n\n startUp();\n })\n}", "async function menu_ViewProductsForSale() {\n console.log(`\\n\\tThese are all products for sale.\\n`);\n\n //* Query\n let products;\n try {\n products = (await bamazon.query_ProductsSelectAll(\n ['item_id', 'product_name', 'department_name', 'price', 'stock_quantity']\n )).results;\n } catch(error) {\n if (error.code && error.sqlMessage) {\n // console.log(error);\n return console.log(`Query error: ${error.code}: ${error.sqlMessage}`);\n }\n // else\n throw error;\n }\n // console.log(products);\n\n //* Display Results\n if (Array.isArray(products) && products.length === 0) {\n return console.log(`\\n\\t${colors.red(\"Sorry\")}, there are no such product results.\\n`);\n }\n\n bamazon.displayTable(products, \n [ bamazon.TBL_CONST.PROD_ID, \n bamazon.TBL_CONST.PROD , \n bamazon.TBL_CONST.DEPT , \n bamazon.TBL_CONST.PRICE , \n bamazon.TBL_CONST.STOCK ], \n colors.black.bgGreen, colors.green);\n\n return;\n}", "function viewProducts() {\n connectionDB.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n //console.log(res);\n var tableFormat = new AsciiTable('PRODUCT LIST');\n tableFormat.setHeading('ITEM ID', 'PRODUCT NAME', 'PRICE', 'QUANTITES');\n for (var index in res) {\n\n tableFormat.addRow(res[index].item_id, res[index].product_name, res[index].price, res[index].stock_quantity);\n }\n console.log(tableFormat.toString());\n\n\n });\n}", "function list() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n let table = new Table({\n head: ['Product ID', 'Product Name', 'Price', 'Stock', 'Department'],\n color: [\"blue\"],\n colAligns: [\"center\"]\n })\n res.forEach(function(row) {\n let newRow = [row.item_id, row.product_name, \"$\" + row.price, row.stock_quantity, row.department_name]\n table.push(newRow)\n })\n console.log(\"Current Bamazon Products\")\n console.log(\"\\n\" + table.toString())\n menu();\n })\n}", "function displayItems() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) {\n throw err;\n } else {\n console.table(res);\n }\n shopping();\n \n });\n \n}", "function showProductCatalog(products) {\n var output = '';\n for (var product in products) {\n var prod = products[product];\n var image = prod.image === '' ? '/image/noimage.png' : prod.image;\n output += '<div class=\"product-layout col-lg-3 col-md-3 col-sm-6 col-xs-12\"><div class=\"product-thumb transition\">' +\n '<div class=\"image\"><img src=\"' + image + '\" alt=\"' + prod.name + '\" title=\"' + prod.name + '\" class=\"img-responsive\"></div>' +\n '<div class=\"caption\"><h4>' + prod.name + '</h4><p>' + prod.description.substring(0, 200) + '...</p><p class=\"price\">$' + prod.price + '</p></div>' +\n '<div class=\"button-group\"><button type=\"button\" onclick=\"addToCart(' + prod.id + ',\\'' + prod.name + '\\',' + prod.price + ');\"><i class=\"fa fa-shopping-cart\"></i> ' +\n '<span class=\"hidden-xs hidden-sm hidden-md\">' + getLocalizedText(\"Add to Cart\", \"Добавить в корзину\") + '</span></button></div></div></div>'\n }\n if (output.length === 0) {\n output = getLocalizedText('Nothing found on your request.', 'Ничего не найдено.');\n }\n document.getElementById(\"productCatalog\").innerHTML = output;\n\n}", "function displayItems() {\n\tconnection.query(\"SELECT * FROM products\", function(error, response) {\n\t\tif (error) throw error;\n\t\t//create new table to push product info into\n\t\tvar itemsTable = new Table({\n\t\t\thead: [\"Item ID\", \"Product Name\", \"Price\", \"Quantity\"]\n\t\t});\n\t\t//loop through response and push each items info into table\n\t\tfor (var i = 0; i < response.length; i++) {\n\t\t\titemsTable.push([response[i].item_id, response[i].product_name, \"$ \"+response[i].price, response[i].stock_quantity]);\n\t\t}\n\t\t//display table\n\t\tconsole.log(itemsTable.toString());\n\t\t//ask if user would like to return to menu\n\t\treturnToMenu();\n\t});\n}", "function showProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n //If Error Occurs\n if (err) {\n throw err;\n }\n\n console.log(\"Our Products: \");\n console.log(\"-----------------\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"ID - \" + res[i].item_id + \" Product - \" + res[i].product_name + \" Price - \" + res[i].price);\n }\n console.log(\"------------------------\");\n\n mainMenu();\n });\n\n}", "render(listProducts) {\n for (const product of listProducts) {\n const divProduct = document.createElement('div');\n divProduct.classList.add('product');\n divProduct.setAttribute('id', product.id);\n\n const image = document.createElement('img');\n image.classList.add('product-image');\n image.src = product.image;\n image.setAttribute('alt', product.name);\n divProduct.append(image);\n\n const title = document.createElement('span');\n title.classList.add('product-title');\n title.innerText = product.name;\n divProduct.append(title);\n\n const price = document.createElement('span');\n price.classList.add('product-price');\n price.innerText = `$ ${product.price}`;\n divProduct.append(price);\n\n this.containerProducts.append(divProduct);\n }\n }", "function showProducts() {\n connection.query(\"SELECT * FROM products ORDER BY 3\", function (err, res) {\n if (err) throw err;\n console.log(\"\\nAll Products:\\n\")\n var table = new Table({\n head: ['ID'.cyan, 'Product Name'.cyan, 'Department'.cyan, 'Price'.cyan, 'Stock'.cyan]\n , colWidths: [5, 25, 15, 10, 7]\n });\n res.forEach(row => {\n table.push(\n [row.item_id, row.product_name, row.department_name, \"$\" + row.price, row.stock_quantity],\n );\n });\n console.log(table.toString());\n console.log(\"\\n~~~~~~~~~~~~~~~~~\\n\\n\");\n start();\n });\n}", "function showProd(){\n\n //Sql statement\n var sql = \"select * from products\";\n conn.query(sql, (err, res) => {\n\n //If error throw error\n if (err) throw err;\n\n //If response length is greater than zero\n if (res.length > 0) {\n\n //Show welcome message and products\n console.log(\"\\nHere are all the current products and their associated information:\");\n console.log(\"\\n ID | Name | Department | Price | Quantity In Stock\");\n console.log(\" --------------------------------------------------\");\n for (i = 0; i < res.length; i++) {\n console.log(' ' +\n res[i].item_id +\n \" | \" +\n res[i].product_name +\n \" | \" +\n res[i].department_name +\n \" | \" +\n '$ '+ parseFloat(res[i].price) +\n \" | \" +\n res[i].stock_quantity\n );\n } \n }\n //Back to the menu\n main();\n })\n}", "function displayProducts(data) {\n for (let i = 0; i < data.length; i++) {\n const productRow = `<div class=\"row\">${data[i].product_name} | ${data[i].department} | $${data[i].price} <div class=\"form-inline\">\n <input type=\"number\" class=\"form-control\" data-id=${data[i].id} placeholder=\"0\" min=\"0\" value=\"0\"></div></div>`\n $(\"#productsPage\").append(productRow);\n }\n\n }", "function viewSaleProduct() {\n connection.query(\"SELECT * FROM store\", function (err, results) {\n if (err) throw err;\n console.table(results);\n })\n}", "function displayProducts() { \n\n connection.query(\"SELECT * FROM products\", function (err, res) {\n console.log(\"=====================================================================\");\n if (err) throw err;\n // Log all results of the SELECT statement\n for (var i = 0; i < res.length; i++) {\n console.log(res[i].item_id + \" | \" + res[i].product_name + \" | \" + res[i].department_name + \" | \" + res[i].price + \"|\" + res[i].stock_quantity);\n }\n console.log(\"=====================================================================\");\n userWants();\n\n\n })\n}", "function getProducts () {\n getRequest('products', onGetProducts);\n }", "function list() {\n\treturn knex(\"products\").select(\"*\");\n}", "function printProducts(filter) {\n // Emptying already printed products\n $(\"#products_list\").empty();\n\n // Verifying if products are filtered\n let products = filter == undefined ? [...shop.products] : filter;\n\n let emptyCol = '<div class=\"col-sm-6 col-md-4 col-lg-3 pb-4\"></div>';\n let card = '<div class=\"card h-100\"><div>';\n let img = '<img src=\"\" class=\"card-img-top\" data-toggle=\"modal\" data-target=\"#product_details\">';\n let cardBody = '<div class=\"card-body\"></div>';\n let cardTitle = '<h5 class=\"card-title\"></h5>';\n let cardText = '<p class=\"card-text\"></p>';\n let productsNumber = products.length;\n\n for (let n = 0; n < productsNumber; n++) {\n $(\"#products_list\").append(\n $(emptyCol).append(\n $(card).append(\n $(img).attr(\"src\", products[0].img).data(\"idProduct\", products[0].id).click(showProduct),\n $(cardBody).append(\n $(cardTitle).text(products[0].title),\n $(cardText).text(products[0].price.toFixed(2) + \" €/pc\")\n )\n )\n )\n )\n products.shift();\n }\n}", "function showProducts() {\n connection.query(\"SELECT * FROM `products`\", function(err, res) {\n var table = new Table({\n head: [\"ID\", \"Product\", \"Department\", \"Price\", \"Stock\"],\n colWidths: [4, 18, 17, 10, 7]\n });\n\n for (var i = 0; i < res.length; i++) {\n table.push([\n res[i].item_id,\n res[i].product_name,\n res[i].department_name,\n res[i].price,\n res[i].stock_quantity\n ]);\n }\n console.log(\"\\n\" + table.toString() + \"\\n\");\n });\n}", "function displayProduct(product) {\n document.getElementById('product').innerHTML = renderHTMLProduct(product, 'single');\n}", "function showProducts() {\n connection.query('SELECT * FROM products', function (error, res) {\n for (var i = 0; i < res.length; i++) {\n console.log('\\n Beer brand: ' + res[i].product_name + \" | \" + 'Department: ' + res[i].department_name + \" | \" + 'Price (6-pack): ' + res[i].price.toString() + \" | \" + 'Stock: ' + res[i].stock_quantity.toString());\n } \n console.log(\"----------------\");\n productDetails();\n });\n\n}", "function getOurProducts() {\n $.ajax({\n type: \"GET\",\n url: \"http://localhost/ger/Product/Get\",\n statusCode: {\n 200: function (response) {\n \n renderProducts(JSON.parse(response));\n }\n }\n });\n }", "function viewAllProducts() {\n connection.query('SELECT * FROM products', function(error, res) {\n if (error) throw error;\n var table = new Table({\n head: ['item_Id', 'Product Name', 'Price Per', 'Stock Qty']\n });\n\n for (i = 0; i < res.length; i++) {\n table.push(\n [res[i].item_id, res[i].product_name, \"$\" + res[i].price, res[i].stock_quantity]\n );\n }\n console.log(table.toString());\n connection.end();\n });\n}", "function products(data){\n\t\t$scope.products = data;\n\t\t$scope.product = {};\n\t}", "function getProductList() {\n console.log(\"google.payments.inapp.getSkuDetails\");\n statusDiv.text(\"Retreiving list of available products...\");\n google.payments.inapp.getSkuDetails({\n 'parameters': {env: \"prod\"},\n 'success': onSkuDetails,\n 'failure': onSkuDetailsFailed\n });\n}", "function readProducts() {\n console.log(\"Products Available...\\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n else { \n // loop through id, product name, price and display \n for (var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].id);\n console.log(\"NAME: \" + res[i].product_name);\n console.log(\"PRICE: \" + res[i].price);\n console.log(\" \");\n }\n select();\n }\n }); \n }", "function showProducts(products) {\n console.log(products)\n let domElement = document.querySelector(\".container-products\")\n for(let product of products){\n domElement.innerHTML +=`\n <div class=\"card text-center\">\n <div class=\"card-picture\">\n <img src=\"${product.imageUrl}\" alt=\"photo\"/>\n </div>\n <a href=\"article.html?${product._id}\" >\n <div class=\"info\">\n <h4>${product.name}</h4>\n <p>${product.description}</p>\n <button>Voir l'article</button>\n </div>\n </div>\n </a>\n \n `;\n }\n}", "function displayProducts() {\n fetch('http://localhost:8080/createproduct')\n .then(res => {\n return res.json()\n })\n .then(prod =>{\n \n for( let i=0; i < prod.length; i++){\n var product = `<figure class=\"individual_row\" id=\"${prod[i].product_typeid}\">\n <a href=\"productdetail.html\">\n <img src=\"img/image${i}.jpg\" alt=\"${prod[i].product_name}\" />\n <figcaption>${prod[i].product_name}<br/>${prod[i].product_price}</figcaption>\n </a>\n </figure>\n `\n document.getElementById(\"arow\").innerHTML += product\n }\n console.log(prod);\n }).catch(error => {\n console.log(error);\n })\n}", "function listProducts () {\n console.log(\"Here's what we have in stock: \");\n connection.query(\"SELECT * FROM products\", function(err, response) {\n if (err) throw err;\n for (var i = 0; i < response.length; i++) {\n console.log(\"| ID: \" + response[i].item_id + \" | \" + response[i].product_name + \" | $\" + response[i].price)\n }\n promptUser();\n })\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n \n //clear out products array\n tableArray = [products];\n var tempArray = [];\n\n //goes through items and lists products in table array\n for (var i = 0; i < res.length; i++) {\n tempArray = [res[i].id, res[i].product_name, res[i].department_name, res[i].price, res[i].stock_quantity];\n tableArray.push(tempArray);\n }\n console.log(\"\\n\" + table(\n tableArray\n ) + \"\\n\")\n doWhat();\n });\n}", "function allProducts(data){\n\t\t$scope.products = data;\n\t\t$scope.product = {};\n\t}" ]
[ "0.8138618", "0.8052649", "0.7848163", "0.7807099", "0.77878237", "0.77833104", "0.77169317", "0.7664556", "0.76641315", "0.7656294", "0.7620802", "0.7610547", "0.76052195", "0.755264", "0.75510865", "0.752558", "0.7524121", "0.75157976", "0.7497201", "0.742989", "0.7418826", "0.74165016", "0.73918504", "0.7382838", "0.7382115", "0.73782384", "0.7368287", "0.73581284", "0.73509187", "0.7348456", "0.73477805", "0.73464334", "0.7343794", "0.7341307", "0.73130023", "0.7312725", "0.7306571", "0.7295934", "0.7287079", "0.7257718", "0.7213957", "0.720781", "0.72003275", "0.7189584", "0.71863633", "0.71760374", "0.7164289", "0.7154004", "0.7131913", "0.71229", "0.710485", "0.7097483", "0.7094672", "0.70902354", "0.70793355", "0.7054824", "0.70456874", "0.7037286", "0.7025238", "0.70221776", "0.70191485", "0.70138943", "0.70076364", "0.70054996", "0.70020145", "0.6995019", "0.69905883", "0.69859076", "0.6980448", "0.6947037", "0.6938068", "0.69262487", "0.6925368", "0.6905838", "0.69028246", "0.6902725", "0.6886526", "0.6882961", "0.6882481", "0.6878996", "0.68736297", "0.68728423", "0.6863818", "0.6847093", "0.68423766", "0.6831778", "0.68195987", "0.681297", "0.6809135", "0.6806936", "0.68029827", "0.6793305", "0.6790075", "0.67631364", "0.67596257", "0.67542255", "0.6752277", "0.6744504", "0.6737001", "0.6735333" ]
0.70844436
54
props title: String title clues: [ Clues clues, ... ]
render() { return ( <div className='clue-holder'> <h3>{this.props.title}</h3> <ol> { this.props.clues.map( (clue, i) => <Clue key={ i } focus={ this.props.clueRow == clue.row && this.props.clueColumn == clue.column && this.props.activeDirection == clue.direction } { ...clue } /> ) } </ol> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formatClues(clues) {\n\t\t\t\tvar retString = \"\";\n\t\t\t\tfor (var i = 0; i < clues.length; i++) {\n\t\t\t\t\tif (clues[i] !== \"\") {\n\t\t\t\t\t\tretString += \"> \" + clues[i] + \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn retString;\n\t\t\t}", "function Title(props) {\n console.log(props);\n return Object.keys(props).map(key => <h1>{props[key].content.title}</h1>);\n}", "function aboutNarrative(){\n alter.innerHTML = '';\n let about = document.createElement('div');\n about.classList.add('about');\n alter.appendChild(about);\n let title = document.createElement('h1');\n title.textContent = aboutHTML.title;\n let p1 = document.createElement('p');\n p1.textContent = aboutHTML.p1;\n let p2 = document.createElement('p');\n p2.textContent = aboutHTML.p2;\n about.appendChild(title);\n about.appendChild(p1);\n about.appendChild(p2);\n}", "constructor({ title }) {\n this.title = title;\n }", "constructor(metadata, cells, words, clues) {\n this.metadata = metadata;\n this.cells = cells;\n this.words = words;\n this.clues = clues;\n }", "constructor(title, author, text) {\n ///Prop for Title\n this.props = {};\n ///Prop for Author\n this.props.author = author;\n ///Prop for Text\n this.props.content = text;\n }", "function propsForTitle(){\t\n\tvar d={}\n\tfor (var i in CAMS){d[CAMS[i].name+'Title']=CAMS[i].title}\n\treturn d\n}", "function displayPropertiesData(props, title)\n{\n\t//if we have properties\n\tif(typeof props != 'undefined')\n\t{\n\t\t//create the string and add a divider\n\t\tvar str = '\\n'\n\t\t\t+ '--[ ' + title + ' ]---------------------------------------------------------------------------\\n\\n'\n\t\t\t+ '';\n\t\n\t\t//stringify the data like a CSS rule\n\t\tfor(var i in props)\n\t\t{\n\t\t\tstr += i + ': ' + props[i] + ';\\n';\n\t\t}\n\t\t\n\t\t//add a divider and output the final string\n\t\tstr += '\\n=================================================================================================\\n\\n';\n\t\ttest.value += str;\n\t}\n\t\n\t//otherwise output a failure message\n\telse\n\t{\n\t\ttest.value += '\\n##[ FAIL: data initialization is not complete ]##################################################\\n\\n'\n\t}\n}", "function HowTo(props) {\n const howto = props.howto;\n console.log(howto)\n return (\n <Card>\n <CardHeader>\n <CardTitle>{howto.title}</CardTitle>\n <CardSubtitle>{howto.author}</CardSubtitle>\n </CardHeader>\n <CardBody> \n {howto.paragraphs.map(paragraph => (\n <CardText>{paragraph}</CardText>\n ))}\n </CardBody>\n </Card>\n )\n}", "function title() {\n push();\n textSize(30);\n fill(0, 198, 201);\n stroke(0);\n strokeWeight(5);\n textAlign(CENTER, CENTER);\n text(`Bubble Popper++`, width / 2, height / 2);\n textSize(15);\n fill(182, 207, 0);\n text(instructions, width / 2, height / 1.5);\n pop();\n}", "function giveNewClue(){\n\tvar message = \"\";\n\tif(openWords.length > 0){\n\t\tmessage = \"Previous clues:\";\n\t\tfor (var i = 0; i < openWords.length; i++){\n\t\t\tmessage = message + \"\\n\" + hintMessage(openWords[i]);\n\t\t}\n\t}\n\tmessage = message + \"\\nNew clue:\";\n\tmessage = message + \"\\n\" + hintMessage(nextWord);\n\tbot.sendMessage(gameChatID,message);\n\topenWords.push(nextWord);\n\tnextWord++;\n\tsaveData();\n}", "function Title(props){\n return <h1>{props.text}</h1>;\n}", "function title(titleinfo) /* (titleinfo : titleinfo) -> string */ {\n return titleinfo.title;\n}", "constructor({\n question_prompt,\n sample_input,\n sample_output,\n difficulty,\n title,\n }) {\n this.question_prompt = question_prompt;\n this.sample_input = sample_input;\n this.sample_output = sample_output;\n this.difficulty = difficulty;\n this.title = title;\n }", "titleDetailConstruct(item, index) {\n var ids = [];\n\n for (var i = 0; i < item.titleIds.length; i++) {\n ids.push(item.titleIds[i]);\n }\n\n if (ids.length > 0) {\n return <TitleNameOverlay disableOverlay={false} data={ids} />;\n }\n }", "title() { return this.owner.name + \" - \" + this.label.replace('\\n', ' ') }", "function DialogTitle(props) {\n return /*#__PURE__*/react_default.a.createElement(Text[\"a\" /* default */], DialogTitle_extends({\n typography: \"h2\",\n color: \"text.primary\",\n caps: true\n }, props));\n}", "function Emoji(props){\r\n\r\n return(\r\n <div className = \"term\">\r\n <Title img = {props.emoji} name = {props.name}/>\r\n <Description content = {props.meaning}/>\r\n </div>\r\n );\r\n\r\n}", "function createTitle(msg){\n _stagefillStyle=\"#000000\";\n _stage.globalAlpha= 0.4;\n _stage.fillRect(100, _puzzleHeight-40, _puzzleWidth-200, 40);\n _stage.fillStyle=\"#ffffff\";\n _stage.globalAlpha=1;\n _stage.textAlign=\"center\";\n _stage.textBaseline=\"middle\";\n _stage.font=\"20px Arial\";\n _stage.fillText(msg, _puzzleWidth/2, _puzzleHeight-20); \n}", "constructor(){\n this.missed = 0;\n this.phrases = [\n 'Beat around the bush',\n 'A piece of cake',\n 'Eureka',\n 'Barking up the wrong tree',\n 'No stones unturned'\n ];\n this.activePhrase = null;\n }", "function GenStats(props) {\n return (\n <Tooltip title={props.description} color=\"#323776\">\n <div className=\"new-stats\">\n <h2 className=\"new-stats-title\">{props.title}</h2>\n <h2 className=\"new-stats-data\">{props.data}%</h2>\n </div>\n </Tooltip>\n );\n}", "render() {\n return (\n <div>\n <Clue\n question={this.state.data.question}\n value={this.state.data.value}\n category={this.state.data.category.title}\n score={this.state.score}\n guess={this.state.formData.guess}\n handleChange={this.handleChange}\n handleSubmit={this.handleSubmit}\n />\n </div>\n );\n }", "constructor() {\n this.missed = 0;\n this.phrases = [\n new Phrase('I am practicing radical self love'),\n new Phrase('I am worthy of rest'),\n new Phrase('I am liberating myself from my inner critic'),\n new Phrase('I am enough and then some'),\n new Phrase('I can make a difference')\n ];\n this.activePhrase = null;\n }", "getDescription() {\n return this.props.descriptionArray.map((description, index) => {\n return (\n <p key={index} className=\"confirmation-modal__description\">\n {description}\n </p>\n );\n });\n }", "createDialogues()\n {\n let sData = currentScene.cache.json.get('dialogues').SingleDialogues;\n let nData = currentScene.cache.json.get('notes').Notes;\n\n this.dialoguesHashTable = new HashTable();\n this.notesHashTable = new HashTable();\n \n sData.forEach(temp => \n {\n let newD = new Dialogue(temp.ID, temp.Character, temp.GameState, temp.Texts, temp.Next);\n this.dialoguesHashTable.add(newD.ID, newD);\n });\n\n nData.forEach(temp => {\n this.notesHashTable.add(temp.ClueName, temp);\n });\n }", "constructor(props) {\n super(props);\n this.state = {\n turtleTooltipTitle: '',\n badHabit: {\n poseConfigs: {},\n storyOutputIdx: 0,\n selHabits: []\n },\n goodHabit: {\n poseConfigs: {},\n selHabits: []\n }\n };\n }", "function generateRemainingTitles() {\n for (let i = 0; i < (3 - acceptedTitleAmount); i++) {\n suggestion();\n addCurrentTitle();\n }\n}", "function getClothingInfo() {\n return {\n title: title\n }\n}", "function finalClueTweaks() {\n for (let clueIndex of allClueIndices) {\n let theClue = clues[clueIndex]\n setClueSolution(clueIndex)\n if (addSolutionToAnno && theClue.solution && !isOrphan(clueIndex) &&\n !roughlyStartsWith(theClue.anno, theClue.solution)) {\n // For orphans, we reveal in their placeholder blanks.\n theClue.anno = '<span class=\"solution\">' + theClue.solution +\n '</span>. ' + theClue.anno;\n }\n if (theClue.anno) {\n hasReveals = true\n }\n if (!theClue.fullDisplayLabel) {\n continue\n }\n let label = theClue.fullDisplayLabel\n let l = label.length\n if (l < 1) {\n continue\n }\n let last = label.charAt(l - 1).toLowerCase()\n if ((last >= 'a' && last <= 'z') || (last >= '0' && last <= '9')) {\n label = label + '. '\n } else {\n label = label + ' '\n }\n if (!allCellsKnown(clueIndex)) {\n theClue.fullDisplayLabel = '<span class=\"clickable\">' +\n '<span id=\"current-clue-label\" ' +\n ' title=\"' + MARK_CLUE_TOOLTIP +\n '\" onclick=\"toggleClueSolvedState(\\'' + clueIndex + '\\')\">' +\n label + '</span></span>';\n } else {\n theClue.fullDisplayLabel = '<span id=\"current-clue-label\">' +\n label + '</span>';\n }\n }\n}", "getTitle() {}", "componentWillReceiveProps(nextProps) {\n if (!(this.props.title === nextProps.title)) this.makeSlug(nextProps.title);\n }", "render() {\n let Whole = new Articles(); \n\n Whole.setTitle('BREAKING TITLE');\n console.log(this.state.trending);\n return (\n <div>\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n <Lower />\n {/* <Lower title={this.state.guardian[0]} link={this.state.guardianLink[0]} />\n <Lower title={this.state.guardian[1]} link={this.state.guardianLink[1]} />\n <Lower title={this.state.guardian[2]} link={this.state.guardianLink[2]} />\n\n */}\n \n </div>\n );\n }", "function RecipeTitle2(props) {\n return (\n <section>\n <h2>{ props.title }</h2>\n </section>\n )\n}", "function displayIntroTitle(){\n push();\n textFont(`Blenny`);\n textAlign(CENTER,CENTER);\n textSize(140);\n fill(breadFill.r, breadFill.g, breadFill.b);\n text(`get this bread`, width/2, height/2);\n pop();\n push();\n textFont(`Blenny`);\n textAlign(CENTER,CENTER);\n textSize(40);\n fill(255);\n text(`press anywhere to continue`, width/2, height/1.5);\n pop();\n}", "get description () {\r\n // checking dialog stage\r\n if (!this.context.dialog) {\r\n this.context.dialog = 0;\r\n }\r\n // displaying text for the current stage\r\n return phrases[this.context.dialog];\r\n }", "function herAbout() { //\"Musician\"\n for (var k = 0; k < data.results.length; k++) {\n var showherAbout = data.results[k].about;\n textSize(12);\n fill(255);\n text(showherAbout, random(0, 400), random(0, 400));\n\n }\n}", "function Title(props){\n return <h4>{props.content}</h4>\n}", "constructor() { \n this.missed = 0;\n this.phrases = [ // the array that holds all of the phrases that will evenutally display while the user is playing the game. \n new Phrase('Sinnerman'), \n new Phrase('What a Wonderful World'),\n new Phrase('Sittin on the Dock of the Bay'),\n new Phrase('Loveable'),\n new Phrase('A Song for you')\n ]\n this.activePhrase = null; // ensures that there is no phrase that is intially selected\n }", "function Titulo(pares, dom) {\n var titulo = '';\n for (var i = 0; i < pares.length; ++i) {\n var parcial = pares[i];\n for (var chave in parcial) {\n titulo += chave + ': ' + StringSinalizada(parcial[chave]) + '\\n';\n }\n }\n if (titulo.length > 0) {\n titulo = titulo.slice(0, -1);\n }\n dom.title = titulo;\n}", "render () {\n return (\n <div>\n <h1> {this.props.title} </h1>\n </div>\n )\n }", "function MyComponentClass (props) {\n\tvar title = props.title;\n return <h1>{title}</h1>;\n}", "countPuzzleStringClues()\n {\n return countPuzzleStringClues(this.puzzleString);\n }", "function Question(props) {\n return (<h1 className=\"question\">{props.dataSet.question}</h1>)\n}", "get title() { return \"Local Coding\"}", "function ParsedNoteSection (props) {\n let { classes, onAddSuggestion, tooltips, text, offset } = props;\n let hasMatch = tooltips.length > 0;\n let frontMatter = text;\n if (hasMatch) {\n var matches = tooltips.sort( (e1, e2) => (e1.start-e2.start) );\n var firstMatch = matches[0];\n // The front matter is the text before the first match begins\n frontMatter = text.substring(0, firstMatch.start-offset);\n var matchID = firstMatch[ONTOLOGY_KEY]; // TODO: Handle more than just HPO\n var matchName = firstMatch[\"names\"][0];\n\n // The contained matter is the text inside the first match\n var containedMatches = matches.filter( (el) => (\n el.start >= firstMatch.start && el.end <= firstMatch.end && !(el.start == firstMatch.start && el.end == firstMatch.end)\n ));\n var containedMatter = text.substring(firstMatch.start-offset, firstMatch.end-offset);\n\n // The uncontained matter is the text after the first match, up until the end of the last match\n // (It still needs to be parsed for more notes)\n var uncontainedMatches = matches.filter( (el) => (el.end > firstMatch.end));\n var lastMatch = Math.max(...(tooltips.map((el) => (el.end))));\n var middleMatter = text.substring(firstMatch.end-offset, lastMatch-offset);\n\n // The end matter is the text after the last match\n var endMatter = text.substring(lastMatch-offset);\n }\n\n // Handle the user clicking on a chip which corresponds to a suggestion\n let addSuggestion = (event) => {\n event.preventDefault();\n onAddSuggestion(firstMatch[ONTOLOGY_KEY].replace(/:/g, \"\"), firstMatch[\"names\"][0])\n }\n\n return (<React.Fragment>\n <Typography display=\"inline\">{frontMatter}</Typography>\n {hasMatch &&\n <React.Fragment>\n <Tooltip title={`Add ${matchName} (${matchID}) to selection`}>\n <Chip\n size=\"small\"\n onClick={addSuggestion}\n color=\"info\"\n label={\n <ParsedNoteSection\n tooltips={containedMatches}\n text={containedMatter}\n offset={firstMatch.start}\n classes={classes}\n onAddSuggestion={onAddSuggestion}\n />\n }\n />\n </Tooltip>\n <ParsedNoteSection\n tooltips={uncontainedMatches}\n text={middleMatter}\n offset={firstMatch.end}\n classes={classes}\n onAddSuggestion={onAddSuggestion}\n />\n <Typography display=\"inline\">{endMatter}</Typography>\n </React.Fragment>}\n </React.Fragment>)\n}", "function Pokemon({ name, props }) {\n return <h1 {...props}>{name}</h1>;\n}", "function Title(props) {\n\treturn <div id=\"title\">\n\t Steve's Neighborhood Map - <span id=\"city-name\">(Bethlehem, PA)</span>\n </div>\n}", "titleDetailConstruct(item, index) {\n\n var ids = [];\n if (item.categories.length > 0) {\n\n for (var i = 0; i < item.categories[0].titleIds.length; i++) {\n ids.push(item.categories[0].titleIds[i]);\n }\n\n if (ids.length > 0) {\n return <TitleNameOverlay disableOverlay={item.categories[0].removed != undefined} data={ids} />;\n }\n }\n }", "function TitleLinks(props) {\n return React.createElement(\n Links,\n Object.assign({ to: '/help' }, props),\n 'Contact Us'\n );\n}", "function placeClues() {\n\tvar game;\n \tgame = Game.instance;\n \t //get available clue data\n \t var currentClueDataArray = [];\n currentClueDataArray = getAvailableClues();\n //create array of objects and add to screen\n var clueLabelArray = [];\n for (var i = 0; i < currentClueDataArray.length; i++) {\n \tclueLabelArray[i] = new clueType(currentClueDataArray[i]);\n \tclueLabelArray[i].x = (i * 60) + 20 - (Math.floor(i/6) * 360);\n \tclueLabelArray[i].y = (Math.floor(i/6) * 60) + 80;\n \tif (clueLabelArray[i].available == 1) {\n \t\tgame.currentScene.addChild(clueLabelArray[i]);\n \t}\n }\n}", "function PrideAndPrejudice() {\n return (\n <article id=\"pride-and-prejudice\" className=\"book-snippet\">\n <div className=\"book-info\">\n <h1 className=\"book-title\">Pride and Prejudice</h1>\n <p className=\"attribution\">\n <span className=\"author\">Jane Austen</span>\n </p>\n </div>\n\n <hr />\n\n <div className=\"chapter\">\n <h3 className=\"chapter-info\">\n <span className=\"chapter-number\">Chapter 1</span>\n </h3>\n\n <p>\n It is a truth universally acknowledged, that a single man in\n possession of a good fortune, must be in want of a wife.\n </p>\n\n <p>\n However little known the feelings or views of such a man may be on his\n first entering a neighbourhood, this truth is so well fixed in the\n minds of the surrounding families, that he is considered the rightful\n property of some one or other of their daughters.\n </p>\n\n <p>\n “My dear Mr. Bennet,” said his lady to him one day, “have you heard\n that Netherfield Park is let at last?”\n </p>\n\n <p>Mr. Bennet replied that he had not.</p>\n\n <p>\n “But it is,” returned she; “for Mrs. Long has just been here, and she\n told me all about it.”\n </p>\n\n <p>Mr. Bennet made no answer.</p>\n\n <p>\n “Do you not want to know who has taken it?” cried his wife\n impatiently.\n </p>\n\n <p>“You want to tell me, and I have no objection to hearing it.”</p>\n\n <p>This was invitation enough.</p>\n\n <p>\n “Why, my dear, you must know, Mrs. Long says that Netherfield is taken\n by a young man of large fortune from the north of England; that he\n came down on Monday in a chaise and four to see the place, and was so\n much delighted with it, that he agreed with Mr. Morris immediately;\n that he is to take possession before Michaelmas, and some of his\n servants are to be in the house by the end of next week.”\n </p>\n\n <p>“What is his name?”</p>\n\n <p>“Bingley.”</p>\n\n <p>“Is he married or single?”</p>\n\n <p>\n “Oh! Single, my dear, to be sure! A single man of large fortune; four\n or five thousand a year. What a fine thing for our girls!”\n </p>\n\n <p>“How so? How can it affect them?”</p>\n\n <p>\n “My dear Mr. Bennet,” replied his wife, “how can you be so tiresome!\n You must know that I am thinking of his marrying one of them.”\n </p>\n\n <p>“Is that his design in settling here?”</p>\n\n <p>\n “Design! Nonsense, how can you talk so! But it is very likely that he\n may fall in love with one of them, and therefore you must visit him as\n soon as he comes.”\n </p>\n\n <p>\n “I see no occasion for that. You and the girls may go, or you may send\n them by themselves, which perhaps will be still better, for as you are\n as handsome as any of them, Mr. Bingley may like you the best of the\n party.”\n </p>\n\n <p>\n “My dear, you flatter me. I certainly have had my share of beauty, but\n I do not pretend to be anything extraordinary now. When a woman has\n five grown-up daughters, she ought to give over thinking of her own\n beauty.”\n </p>\n\n <p>“In such cases, a woman has not often much beauty to think of.”</p>\n\n <p>\n “But, my dear, you must indeed go and see Mr. Bingley when he comes\n into the neighbourhood.”\n </p>\n\n <p>“It is more than I engage for, I assure you.”</p>\n\n <p>\n “But consider your daughters. Only think what an establishment it\n would be for one of them. Sir William and Lady Lucas are determined to\n go, merely on that account, for in general, you know, they visit no\n newcomers. Indeed you must go, for it will be impossible for us to\n visit him if you do not.”\n </p>\n\n <p>\n “You are over-scrupulous, surely. I dare say Mr. Bingley will be very\n glad to see you; and I will send a few lines by you to assure him of\n my hearty consent to his marrying whichever he chooses of the girls;\n though I must throw in a good word for my little Lizzy.”\n </p>\n\n <p>\n “I desire you will do no such thing. Lizzy is not a bit better than\n the others; and I am sure she is not half so handsome as Jane, nor\n half so good-humoured as Lydia. But you are always giving her the\n preference.”\n </p>\n\n <p>\n “They have none of them much to recommend them,” replied he; “they are\n all silly and ignorant like other girls; but Lizzy has something more\n of quickness than her sisters.”\n </p>\n\n <p>\n “Mr. Bennet, how can you abuse your own children in such a way? You\n take delight in vexing me. You have no compassion for my poor nerves.”\n </p>\n\n <p>\n “You mistake me, my dear. I have a high respect for your nerves. They\n are my old friends. I have heard you mention them with consideration\n these last twenty years at least.”\n </p>\n\n <p>“Ah, you do not know what I suffer.”</p>\n\n <p>\n “But I hope you will get over it, and live to see many young men of\n four thousand a year come into the neighbourhood.”\n </p>\n\n <p>\n “It will be no use to us, if twenty such should come, since you will\n not visit them.”\n </p>\n\n <p>\n “Depend upon it, my dear, that when there are twenty, I will visit\n them all.”\n </p>\n\n <p>\n Mr. Bennet was so odd a mixture of quick parts, sarcastic humour,\n reserve, and caprice, that the experience of three-and-twenty years\n had been insufficient to make his wife understand his character. Her\n mind was less difficult to develop. She was a woman of mean\n understanding, little information, and uncertain temper. When she was\n discontented, she fancied herself nervous. The business of her life\n was to get her daughters married; its solace was visiting and news.\n </p>\n </div>\n </article>\n );\n}", "content(props, propName, componentName) {\n const components = ['MuiTitleData'];\n return validComponents(props, propName, componentName, components);\n }", "onGetHint() {\n const {phrase, trials} = this.props.game;\n this.props.getHint(phrase, trials);\n }", "toString() {\n\t\treturn `${this.index}-${this.guesses.join(' ')}-${this.answers.join(' ')}`;\n\t}", "constructor() {\n\t\tthis.missed = 0;\n\t\tthis.phrases = [\n\t\t\tnew Phrase(\"i love you\"),\n\t\t\tnew Phrase(\"i miss you\"),\n\t\t\tnew Phrase(\"you are my life\"),\n\t\t\tnew Phrase(\"you are my breath\"),\n\t\t\tnew Phrase(\"you are my cat\"),\n\t\t];\n\t\tthis.activePhrase = null;\n\t}", "function map_title() {\n current_background = Graphics[\"background2\"];\n actors.push( new TitleCard() );\n actors.push( new Continue(\"Click to play!\", map_level1) );\n playerInstance = new Player(100);\n start_time = 0;\n }", "constructor (){\n \t\tthis.missed = 0;\n \t\tthis.phrases = [];\n \t\tthis.activePhrase = null;\n \t}", "constructor(props) {\n super(props);\n this.state = {\n name:\" \",\n title:\" \",\n artist:\" \",\n comment:\" \"\n }\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 }", "_createTitle(obj) {\n let res = \"\";\n for (let p in obj) {\n res += `${p}=${obj[p]},`;\n }\n return res.substr(0, res.length - 1);\n }", "function getGameDescription()\n{\n\tlet titles = [];\n\tif (!g_GameAttributes.settings.VictoryConditions.length)\n\t\ttitles.push({\n\t\t\t\"label\": translateWithContext(\"victory condition\", \"Endless Game\"),\n\t\t\t\"value\": translate(\"No winner will be determined, even if everyone is defeated.\")\n\t\t});\n\n\tfor (let victoryCondition of g_VictoryConditions)\n\t{\n\t\tif (g_GameAttributes.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1)\n\t\t\tcontinue;\n\n\t\tlet title = translateVictoryCondition(victoryCondition.Name);\n\t\tif (victoryCondition.Name == \"wonder\")\n\t\t\ttitle = sprintf(\n\t\t\t\ttranslatePluralWithContext(\n\t\t\t\t\t\"victory condition\",\n\t\t\t\t\t\"Wonder (%(min)s minute)\",\n\t\t\t\t\t\"Wonder (%(min)s minutes)\",\n\t\t\t\t\tg_GameAttributes.settings.WonderDuration\n\t\t\t\t),\n\t\t\t\t{ \"min\": g_GameAttributes.settings.WonderDuration }\n\t\t\t);\n\n\t\tlet isCaptureTheRelic = victoryCondition.Name == \"capture_the_relic\";\n\t\tif (isCaptureTheRelic)\n\t\t\ttitle = sprintf(\n\t\t\t\ttranslatePluralWithContext(\n\t\t\t\t\t\"victory condition\",\n\t\t\t\t\t\"Capture the Relic (%(min)s minute)\",\n\t\t\t\t\t\"Capture the Relic (%(min)s minutes)\",\n\t\t\t\t\tg_GameAttributes.settings.RelicDuration\n\t\t\t\t),\n\t\t\t\t{ \"min\": g_GameAttributes.settings.RelicDuration }\n\t\t\t);\n\n\t\ttitles.push({\n\t\t\t\"label\": title,\n\t\t\t\"value\": victoryCondition.Description\n\t\t});\n\n\t\tif (isCaptureTheRelic)\n\t\t\ttitles.push({\n\t\t\t\t\"label\": translate(\"Relic Count\"),\n\t\t\t\t\"value\": g_GameAttributes.settings.RelicCount\n\t\t\t});\n\n\t\tif (victoryCondition.Name == \"regicide\")\n\t\t\tif (g_GameAttributes.settings.RegicideGarrison)\n\t\t\t\ttitles.push({\n\t\t\t\t\t\"label\": translate(\"Hero Garrison\"),\n\t\t\t\t\t\"value\": translate(\"Heroes can be garrisoned.\")\n\t\t\t\t});\n\t\t\telse\n\t\t\t\ttitles.push({\n\t\t\t\t\t\"label\": translate(\"Exposed Heroes\"),\n\t\t\t\t\t\"value\": translate(\"Heroes cannot be garrisoned and they are vulnerable to raids.\")\n\t\t\t\t});\n\t}\n\n\tif (g_GameAttributes.settings.RatingEnabled &&\n\t g_GameAttributes.settings.PlayerData.length == 2)\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Rated game\"),\n\t\t\t\"value\": translate(\"When the winner of this match is determined, the lobby score will be adapted.\")\n\t\t});\n\n\tif (g_GameAttributes.settings.LockTeams)\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Locked Teams\"),\n\t\t\t\"value\": translate(\"Players can't change the initial teams.\")\n\t\t});\n\telse\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Diplomacy\"),\n\t\t\t\"value\": translate(\"Players can make alliances and declare war on allies.\")\n\t\t});\n\n\tif (g_GameAttributes.settings.LastManStanding)\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Last Man Standing\"),\n\t\t\t\"value\": translate(\"Only one player can win the game. If the remaining players are allies, the game continues until only one remains.\")\n\t\t});\n\telse\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Allied Victory\"),\n\t\t\t\"value\": translate(\"If one player wins, his or her allies win too. If one group of allies remains, they win.\")\n\t\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Ceasefire\"),\n\t\t\"value\":\n\t\t\tg_GameAttributes.settings.Ceasefire == 0 ?\n\t\t\t\ttranslate(\"disabled\") :\n\t\t\t\tsprintf(translatePlural(\n\t\t\t\t\t\"For the first minute, other players will stay neutral.\",\n\t\t\t\t\t\"For the first %(min)s minutes, other players will stay neutral.\",\n\t\t\t\t\tg_GameAttributes.settings.Ceasefire),\n\t\t\t\t{ \"min\": g_GameAttributes.settings.Ceasefire })\n\t});\n\n\tif (g_GameAttributes.map == \"random\")\n\t\ttitles.push({\n\t\t\t\"label\": translateWithContext(\"Map Selection\", \"Random Map\"),\n\t\t\t\"value\": translate(\"Randomly select a map from the list.\")\n\t\t});\n\telse\n\t{\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Map Name\"),\n\t\t\t\"value\": translate(g_GameAttributes.settings.Name)\n\t\t});\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Map Description\"),\n\t\t\t\"value\": g_GameAttributes.settings.Description ?\n\t\t\t\t\ttranslate(g_GameAttributes.settings.Description) :\n\t\t\t\t\ttranslate(\"Sorry, no description available.\")\n\t\t});\n\t}\n\n\ttitles.push({\n\t\t\"label\": translate(\"Map Type\"),\n\t\t\"value\": g_MapTypes.Title[g_MapTypes.Name.indexOf(g_GameAttributes.mapType)]\n\t});\n\n\tif (typeof g_MapFilterList !== \"undefined\")\n\t\ttitles.push({\n\t\t\t\"label\": translate(\"Map Filter\"),\n\t\t\t\"value\": g_MapFilterList.name[g_MapFilterList.id.findIndex(id => id == g_GameAttributes.mapFilter)]\n\t\t});\n\n\tif (g_GameAttributes.mapType == \"random\")\n\t{\n\t\tlet mapSize = g_MapSizes.Name[g_MapSizes.Tiles.indexOf(g_GameAttributes.settings.Size)];\n\t\tif (mapSize)\n\t\t\ttitles.push({\n\t\t\t\t\"label\": translate(\"Map Size\"),\n\t\t\t\t\"value\": mapSize\n\t\t\t});\n\t}\n\n\tif (g_GameAttributes.settings.Biome)\n\t{\n\t\tlet biome = g_Settings.Biomes.find(b => b.Id == g_GameAttributes.settings.Biome);\n\t\ttitles.push({\n\t\t\t\"label\": biome ? biome.Title : translateWithContext(\"biome\", \"Random Biome\"),\n\t\t\t\"value\": biome ? biome.Description : translate(\"Randomly select a biome from the list.\")\n\t\t});\n\t}\n\n\tif (g_GameAttributes.settings.TriggerDifficulty !== undefined)\n\t{\n\t\tlet difficulty = g_Settings.TriggerDifficulties.find(difficulty => difficulty.Difficulty == g_GameAttributes.settings.TriggerDifficulty);\n\t\ttitles.push({\n\t\t\t\"label\": difficulty.Title,\n\t\t\t\"value\": difficulty.Tooltip\n\t\t});\n\t}\n\n\ttitles.push({\n\t\t\"label\": g_GameAttributes.settings.Nomad ? translate(\"Nomad Mode\") : translate(\"Civic Centers\"),\n\t\t\"value\":\n\t\t\tg_GameAttributes.settings.Nomad ?\n\t\t\t\ttranslate(\"Players start with only few units and have to find a suitable place to build their city.\") :\n\t\t\t\ttranslate(\"Players start with a Civic Center.\")\n\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Starting Resources\"),\n\t\t\"value\": sprintf(translate(\"%(startingResourcesTitle)s (%(amount)s)\"), {\n\t\t\t\"startingResourcesTitle\":\n\t\t\t\tg_StartingResources.Title[\n\t\t\t\t\tg_StartingResources.Resources.indexOf(\n\t\t\t\t\t\tg_GameAttributes.settings.StartingResources)],\n\t\t\t\"amount\": g_GameAttributes.settings.StartingResources\n\t\t})\n\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Population Limit\"),\n\t\t\"value\":\n\t\t\tg_PopulationCapacities.Title[\n\t\t\t\tg_PopulationCapacities.Population.indexOf(\n\t\t\t\t\tg_GameAttributes.settings.PopulationCap)]\n\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Treasures\"),\n\t\t\"value\": g_GameAttributes.settings.DisableTreasures ?\n\t\t\ttranslateWithContext(\"treasures\", \"Disabled\") :\n\t\t\ttranslateWithContext(\"treasures\", \"As defined by the map.\")\n\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Revealed Map\"),\n\t\t\"value\": g_GameAttributes.settings.RevealMap\n\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Explored Map\"),\n\t\t\"value\": g_GameAttributes.settings.ExploreMap\n\t});\n\n\ttitles.push({\n\t\t\"label\": translate(\"Cheats\"),\n\t\t\"value\": g_GameAttributes.settings.CheatsEnabled\n\t});\n\n\treturn titles.map(title => sprintf(translate(\"%(label)s %(details)s\"), {\n\t\t\"label\": coloredText(title.label, g_DescriptionHighlight),\n\t\t\"details\":\n\t\t\ttitle.value === true ? translateWithContext(\"gamesetup option\", \"enabled\") :\n\t\t\t\ttitle.value || translateWithContext(\"gamesetup option\", \"disabled\")\n\t})).join(\"\\n\");\n}", "constructor(data) {\n this.title = data.title\n this.chore = data.chore || []\n }", "constructor(props) {\n super(props);\n this.state = {\n likes: [\n 'Video Games (Fighting games)',\n 'Steak (Medium-Rare)',\n 'Traveling (Anywhere)',\n \"Pets (I don't have any... )\"\n ],\n skills: [\n 'React',\n 'Mongo DB',\n 'Node.js',\n 'jQuery',\n 'Currently learning Python'\n ],\n jumbotronTitles: ['Welcome!'],\n currentTitle: \"\",\n showTitle: false,\n randomNumber: \"\"\n\n }\n }", "function createQuestions() {\n\n const choices = emojis.map((emoji) => {\n return {\n \"name\": `${emoji.display} - ${emoji.description}`,\n \"value\": emoji.tag\n }\n });\n\n return [\n {\n type: 'list',\n name: 'type',\n message: \"Select the type of change you're committing:\",\n choices: choices\n },\n {\n type: 'input',\n name: 'subject',\n message: 'Write a short description:'\n },\n {\n type: 'input',\n name: 'issueNumber',\n message: 'GitHub issue #:'\n },\n {\n type: 'confirm',\n name: 'closesIssue',\n message: 'Does this commit fully resolve and close the related issue?',\n default: false\n }\n ]\n}", "function showResult(){\n let titles = [\"Master\",\"Champion\",\"Average\",\"Bad\"]; \n let nrOfCorrects = document.getElementById(\"nrOfCorrectAnswers\");\n let showTitle = document.getElementById(\"title\");\n let username = document.getElementById(\"username\");\n nrOfCorrects.innerHTML = \"You scored \" + \"<span>\" + quiz.correctAnswers + \"</span>\" + \" of\" + \" <span>\" + quiz.maxScore + \"</span>\" + \" points right!\";\n username.innerHTML = quiz.username;\n if(quiz.correctAnswers == quiz.maxScore){\n showTitle.innerHTML = titles[0];\n }\n else if(quiz.correctAnswers > 3){\n showTitle.innerHTML = titles[1];\n }\n else if(quiz.correctAnswers >= 2){\n showTitle.innerHTML = titles[2];\n }\n else if(quiz.correctAnswers < 2){\n showTitle.innerHTML = titles[3];\n }\n}", "function toCard(item, index) {\n let obj = {\n num: index + 1,\n title2: item.title2,\n img: \"\",\n color: \"\",\n };\n\n //\"descripton4\" is the key which value is the ul of 4 options\n //if we want to extract the image (which is a **part** of the value, by taking just the\n //substring it is in)\n if (item.description4.includes(\"src\")) {\n obj.img = item.description4.substring(\n item.description4.indexOf(\"https:\"),\n item.description4.indexOf(\"jpg\") + 3\n );\n }\n let temp2 = item.description4.split(\"<li>\"); //the 4 options, splitted according to \"li\"\n \n if(pushed){\n console.log(kaka);\n console.log(index);\n obj.color = kaka[index]\n }\n // if(la){\n // obj.color = \"\"\n // }\n for (let i = 1; i < 5; i++) {\n //index 0 is just css\n obj[i] = { answer: temp2[i].replace(/<[^>]+>/g, \"\"), right: false }\n if (temp2[i].includes(\"id\")) {\n //only right answer has id\n obj[i].right = true;\n }\n if (i === 4) {\n obj[i].answer = obj[i].answer.substring(\n 0,\n obj[i].answer.indexOf(\"|\")\n ).substring(0, obj[i].answer.indexof('.')+1)\n \n }\n console.log(obj[i].answer);\n }\n \n\n return (\n <Card\n checkanswer={(a) => {\n array.push(a);\n setArray(array);\n console.log(array);\n }}\n details={obj}\n ></Card>\n ); //every obj is send as props to card\n }", "function HeadlineTitle(props) {\n if (props.query) {\n return <h1>Headlines {props.query} </h1>;\n } else {\n return <h1>Headlines</h1>;\n }\n return null;\n}", "function Score(props) {\n return (\n <h2>\n Your Score: {props.score} | High Score: \n\n \n </h2>\n )\n}", "function updateTitle(label1, label2){\n\t\t\treturn [{\n\t\t\t\t\ttext: 'Difference between ' + label1 + ' and ' + label2\n\t\t\t\t}]\n\t\t}", "function Scoreboard(props) {\n return (\n <div className=\"score-board\">\n <div className=\"score-board__team-name\">{props.yellowTeam}</div>\n <div className=\"score-board__score\">\n {props.yellowTeamScore} : {props.redTeamScore}\n </div>\n <div className=\"score-board__team-name\">{props.redTeam}</div>\n </div>\n )\n}", "get title() { return this.title_; }", "getTitle() {\n return `Title is: ${this.title}`;\n }", "function giveReasoning()\n{\n if(reasons.length > 0)\n {\n let msg = 'Reasons counties are dangerous';\n reasons.forEach(r =>\n {\n msg += '\\n' + r.name + ': ' + r.why;\n });\n alert(msg);\n }\n else\n alert('No counties are dangerous.');\n}", "title() {\n return cy.get(pop_up_title_locator)\n }", "constructor(props) {\n super(props);\n \n this.state= {\n cardLogo : '',\n pairName : '',\n pairPrice : '',\n small_txt : ''\n }\n if(props.title) this.state={\n title : props.title,\n cardLogo : props.cardLogo,\n pairName : props.pairName,\n pairPrice : props.pairPrice\n }\n }", "function _title() {\n var title = \"\";\n\n title =\n \"\" +\n \" ----------------- ----------------- \\n\" +\n \"| A | | 7 |\\n\" +\n \"| | | |\\n\" +\n \"| | | /\\\\ /\\\\ |\\n\" +\n \"| | | \\\\/ \\\\/ |\\n\" +\n \"| / \\\\ | | /\\\\ /\\\\ /\\\\ |\\n\" +\n \"| (_ _) | VS | \\\\/ \\\\/ \\\\/ |\\n\" +\n \"| /_\\\\ | | /\\\\ /\\\\ |\\n\" +\n \"| | | \\\\/ \\\\/ |\\n\" +\n \"| | | |\\n\" +\n \"| A | | 7 |\\n\" +\n \" ----------------- ----------------- \\n\" +\n \"\\n\" +\n \" The Game of War \\n\" +\n \" Game: \" +\n _gameID +\n \" \\n\";\n\n _log(title);\n }", "static make_show_window_title(data, show_window_options){\n let title\n if(show_window_options && show_window_options.title) { title = show_window_options.title }\n else {\n if(data instanceof Job){\n title = \"Path of Job.\" + data.name\n }\n else if (data === Job){\n title = \"Paths of all defined Jobs\"\n }\n else if (this.number_of_jobs_in_array(data) > 0){\n title = \"\"\n for(let job_maybe of data){\n if(job_maybe instanceof Job){\n title += ((title === \"\") ? \"Plot of \" : \", \")\n title += \"Job.\" + job_maybe.name\n }\n }\n }\n else if (this.is_1d_array(data)){\n title = \"1D array of \" + data.length + \" points\"\n }\n else if (this.is_2d_array(data)){\n title = \"2D array of \" + data[0].length + \" points\"\n }\n else if (this.is_3d_array(data)){\n title = \"3D array of \" + data[0].length + \" points\"\n }\n else if(Array.isArray(data) && Array.isArray(data[0].z)){\n title = \"3D array of \" + data[0].z.length + \" points\"\n }\n else if(Array.isArray(data) && Array.isArray(data[0].y)){\n title = \"(\" + data.length + \")\" + \" 2D traces.\"\n }\n else {\n title = \"Plot of data\"\n }\n if((title.length > 32) && !title.includes(\"<\")) { //if it has hhtm in the title, it could well be longer than 32 chars bu still display shorter. Just allow titles with > to be any length\n title = title.substring(0, 32) + \"...\"\n }\n }\n return title\n }", "function Contianer({title,li}){\n return(\n <>\n <div>\n <h1 className=\"Header\">\n <img src={logo} className=\"logo\"></img>\n <h2 className=\"bigTit\">GOAL BRUINS</h2>\n </h1>\n </div>\n <div className=\"cont\">\n <h5 className=\"title\">\n {title}\n </h5>\n {li}\n </div>\n <div className=\"cont2\">\n <h5 className=\"title\">\n TRENDING\n </h5>\n </div>\n </>\n );\n}", "constructor() {\n\t\tthis.missed = 0;\n\t\tthis.phrases = [{\n\t\t\tphrase: \"life is like a box of chocolates\"\n\t\t}, {\n\t\t\tphrase: \"there is no trying\"\n\t\t}, {\n\t\t\tphrase: \"may the force be with you\"\n\t\t}, {\n\t\t\tphrase: \"you have to see the matrix for yourself\"\n\t\t}, {\n\t\t\tphrase: \"you talking to me\"\n },\n ];\n\t\tthis.activePhrase = null;\n }", "function title() {\n //Intro title 1\n if (introState === 0) {\n displayIntroTitle();\n }\n else if(introState === 1) {\n image(imgIntro1, 0, 0,1360,840); //Introduction story image 1\n //Play background music in a loop when loaded\n if (bgMusic.isPlaying() === false) {\n bgMusic.loop();\n }\n }\n else if(introState === 2) {\n image(imgIntro2, 0, 0,1360,840); //Introduction story image 2\n if (bgMusic.isPlaying() === false) {\n bgMusic.loop();\n }\n }\n else if(introState === 3) {\n image(imgIntro3, 0, 0,1360,840); //Introduction story image 3\n if (bgMusic.isPlaying() === false) {\n bgMusic.loop();\n }\n }\n else if(introState === 4) {\n push();\n imageMode(CENTER);\n image(imgIntro4, width/2, height/2+200,250,140); //Introduction story image 4\n pop();\n //Instructions screen\n fill(255); //white\n displayText(`Use the arrow keys to move Antonio!\n 1. Avoid the grey rocks\n 2. Gather 500 points before time runs out!`);\n if (bgMusic.isPlaying() === false) {\n bgMusic.loop();\n }\n }\n else {\n state =`simulation`;\n }\n}", "create(gameObject) {\r\n const title = gameObject.title\r\n const description = gameObject.description\r\n const id = uuidv4();\r\n const values = [title, id, 'https://cdn.factorio.com/assets/img/blog/fff-310-factorio-cover-017-stable-squared.png', 4.99, description]\r\n const text = '';\r\n\r\n }", "constructor(props){\n\t\tsuper(props);\n\t\tthis.pose = yogaData.getPoseById(props.step.id);\n\t\t// english_name\n\t\t// sanskrit_name\n\t\t// id\n\t\t// img_url\n\t}", "changeTitle(event) {\n const generatedQuiz = this.state.submitedQuestions;\n generatedQuiz.quiz.title = event.target.value;\n this.setState({ submitedQuestions: generatedQuiz });\n this.checkCorectnessTitle(generatedQuiz);\n }", "function createReadme(results) {\n return `# ${results.title}\n \n #### Table of contents\n 1. [Project Description](#project-description)\n 2. [Installation Instructions](#installation-instructions)\n 3. [Usage Information](#usage-information)\n 4. [Contributor Guidelines](#contributor-guidelines)\n 5. [Test Instructions](#test-instructions)\n 6. [License](#license)\n 7. [Questions](#questions)\n\n ## Project Description\n * ${results.description}\n \n ## Installation Instructions\n * ${results.installation}\n \n ## Usage Information\n * ${results.usage}\n \n ## Contributor Guidlines\n * ${results.contributions}\n \n ## Test Instructions\n * ${results.test}\n \n ## License\n * ${results.license}\n \n ## Questions\n * Emails me at ${results.email}\n * Find me on GitHub [${results.github}](http://github.com/${results.github})`;\n}", "function Exam(code, name, credits, date, score, laude = false) { //Esame con i suoi attributi\r\n this.code = code;\r\n this.name = name;\r\n this.credits = credits;\r\n this.date = date;\r\n this.score = score;\r\n this.laude = laude;\r\n\r\n this.toString = () => (`${this.code} - ${this.name} = ${this.score} (${this.date})`); //vedi in chiamatam metodo find\r\n\r\n}", "getTitles() {\n let titles = this.state.projects.map(proj => proj.title); \n titles.sort();\n titles.unshift('');\n this.setState({titles: titles}); \n }", "get title() {\r\n return this.i.title;\r\n }", "render() {\n return (\n <h1>{this.props.myTitle}</h1>\n \n );\n }", "checkCorectnessTitle(generatedQuiz) {\n const thisObject = this.state.errors;\n thisObject.quiz.title = '';\n this.setState({ errors: thisObject, attemptsErrors: false, pointsErrors: false });\n if (generatedQuiz.quiz.title === '') {\n thisObject.quiz.title = 'Title is empty! \\n';\n this.setState({ errors: thisObject });\n const thisError = this.state.hasErrors;\n thisError[0] = true;\n this.setState({ hasErrors: thisError });\n }\n if (generatedQuiz.quiz.title !== '') {\n thisObject.quiz.title = '';\n this.setState({ errors: thisObject });\n const thisError = this.state.hasErrors;\n thisError[0] = false;\n this.setState({ hasErrors: thisError });\n }\n }", "function story (items) {\n return items.map(each =>\n typeof each == typeof \"\" ?\n item('paragraph', {text:each}) :\n each\n )\n}", "function revealMistery(solution) {\n \n return solution[0].first_name + \n \" \" + solution[0].last_name + \" killed Mr.Boddy using the \" \n + solution[1].name + \" in the \" + solution[2].name + \"!!!!\";\n}", "function displayTitle(){\n push();\n textFont(`Blenny`);\n textSize(70);\n fill(breadFill.r, breadFill.g, breadFill.b);\n textLeading(53);\n text(`GET\\nTHAT\\nBREAD`, 1050, 612);\n pop();\n}", "function getDesc(desc,speaker,nTargets,relative,pronoun,posspron,relpronoun,spouse,relposs,qud,comb) {\n\tvar txt = \"\";\n\tswitch(desc) {\n\t\tcase \"desc1\":\n\t\t\tswitch(qud) {\n\t\t\t\tcase \"is-all\": txt = speaker+\" is really into collecting marbles. Recently, \"+posspron+\" friends gave \"+datpron+\" a special edition of \"+nTargets.toString()+\" marbles, which \"+pronoun+\" loves. Yesterday, \"+posspron+\" five-year-old \"+relative+\" came to visit and found \"+posspron+\" set of marbles in a drawer. \"+caps(relpronoun)+\" also found some shoe boxes. \"+caps(relpronoun)+\" played with the marbles for a long time and moved them from one box to another until they were all hidden and \"+relpronoun+\" did not remember where \"+relpronoun+\" put them.\"; \n\t\t\t\tbreak;\n\t\t\t\tcase \"is-any\": txt = speaker+\"'s five-year-old \"+relative+\" loves playing with marbles. For when \"+relpronoun+\" comes to visit, \"+speaker+\" keeps a set of \"+nTargets.toString()+\" marbles in a drawer. Yesterday, \"+relpronoun+\" came to visit and found \"+posspron+\" marbles in the drawer. \"+caps(relpronoun)+\" also found some shoe boxes. \"+caps(relpronoun)+\" played with the marbles for a long time and moved them from one box to another until they were all hidden and \"+relpronoun+\" did not remember where \"+relpronoun+\" put them.\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\tbreak;\n\t\tcase \"desc2\":\n\t\t\tswitch(qud) {\n\t\t\t\tcase \"is-all\": txt = \"When \"+speaker+\" later entered the room, \"+pronoun+\" saw that all the marbles were gone and there was a pile of shoe boxes on the floor. \"+caps(pronoun)+\" was upset and complained bitterly to \"+comb+\". \"+caps(pronoun)+\" was determined to find every last one of \"+posspron+\" marbles. \"+caps(pronoun)+\" started opening one box after another, looking for marbles.\";\n\t\t\t\tbreak;\n\t\t\t\tcase \"is-any\": txt = \"When \"+speaker+\" later entered the room, \"+pronoun+\" saw that all the marbles were gone and there was a pile of shoe boxes on the floor. \"+caps(posspron)+\" \"+relative+\" was upset because \"+relpronoun+\" wanted a marble to play with. \"+caps(relpronoun)+\" started to cry and \"+speaker+\"'s \"+spouse+\" tried to console \"+reldat+\" while \"+speaker+\" started opening one box after another, looking for marbles.\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\tbreak;\n\t}\t\t\t\n\treturn txt;\t\n}", "function About() {\n return (\n <div className=\"About\">\n <div className=\"About-content\">\n <h1>\n Visual Workout Planner\n </h1>\n <p>\n Do you want help planning your next workout? This visual workout planner allows you to select any combination of muscles on the front- and back-facing muscle structures below to view exercises targetting those muscle groups. \n </p>\n </div>\n </div>\n );\n}", "function showCardOrSpeak (detail, conv) {\n var hasScreen = conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT'); \n if (hasScreen) {\n var cards = [];\n for(var i = 0; i < detail.length; i++) {\n var d = new Date(0); \n d.setUTCSeconds(detail[i].time);\n var desc = detail[i].score + ' points by ' + detail[i].by + ' ' + ta.ago(d);\n desc += ' | ';\n desc += detail[i].descendants + ' comments';\n var link = detail[i].url;\n if (link === undefined) {\n link = \"https://assistant.google.com\";\n }\n cards.push(new BrowseCarouselItem({\n title: detail[i].title,\n url: link,\n description: desc,\n }));\n }\n conv.ask(new BrowseCarousel({items: cards}));\n conv.ask(new Suggestions(['top 🕶', 'new 🔥', 'best 🎉', 'random 👾']));\n conv.ask(new LinkOutSuggestion({\n name: 'web',\n url: 'https://news.ycombinator.com/',\n }));\n } else {\n let ssml = \"<speak><p>\";\n for(var i = 0; i < detail.length; i++) {\n ssml += '<s><say-as interpret-as=\"ordinal\">' + (i+1) + '</say-as>.<break time=\"0.6s\"/>' + detail[i].title + '.</s><break time=\"0.5s\"/>';\n }\n ssml += \"<s>What else I can help?</s></p></speak>\";\n conv.ask(ssml);\n }\n return;\n}", "function explainHowToMove()\r\n{\r\n\tmessage += \"Red\";\r\n\tmessage += \"\\nBlue\";\r\n\tmessage += \"\\nGreen\";\r\n\tmessage += \"\\nPurple\";\r\n\tmessage += \"\\nCyan\";\r\n\tmessage += \"\\nYellow\";\r\n\taddMessage(message, \"howto\");\r\n}", "tc(result, { args }) {\n result.$title = args[0]\n result.otherSide = args[1] ?? 'Unknown Income/Expense'\n return result\n }", "static get title() {\n return 'Oops! You weren\\'t supposed to see this...';\n }", "function Note(){\n let title = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\"\n let content = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n return <div className=\"note\"><h1>{title}</h1><p>{content}</p></div>\n}", "function apology1() {\n return {text: \"Sorry - I can't find any information for that challenge.\"};\n}" ]
[ "0.5716944", "0.5708059", "0.5614883", "0.54379416", "0.5418277", "0.5367529", "0.53633493", "0.52741313", "0.52683353", "0.5211896", "0.52099293", "0.5188617", "0.5142402", "0.5134222", "0.5080467", "0.506606", "0.5058827", "0.5051715", "0.50195175", "0.50194335", "0.50151896", "0.50135976", "0.4997744", "0.49930415", "0.4984721", "0.49779505", "0.49750912", "0.4968485", "0.4967488", "0.49633268", "0.4954692", "0.49535385", "0.49473554", "0.49472025", "0.49395123", "0.4938865", "0.4931528", "0.4929828", "0.4925268", "0.4897313", "0.4896064", "0.48925862", "0.48918152", "0.4891307", "0.48852968", "0.48827434", "0.48792043", "0.4871059", "0.4861785", "0.48545697", "0.4851585", "0.48493847", "0.4839743", "0.48319793", "0.48227966", "0.4821485", "0.48154575", "0.48137772", "0.48118633", "0.48061758", "0.4802741", "0.48021686", "0.47998852", "0.47995943", "0.47970527", "0.47843117", "0.477486", "0.4765702", "0.47654155", "0.47648707", "0.47620383", "0.47613055", "0.47574326", "0.47551474", "0.47504547", "0.47465578", "0.4746456", "0.47424173", "0.47400177", "0.4739738", "0.47355863", "0.47294986", "0.47220528", "0.47183153", "0.47153944", "0.4712853", "0.47037116", "0.46996495", "0.46970212", "0.46959248", "0.46944734", "0.46925852", "0.468886", "0.46880654", "0.4687354", "0.46864703", "0.4684082", "0.4680225", "0.46788675", "0.46775407" ]
0.49970978
23
increased with the given book price and remove parent
function buttonBuyEvent() { sumAllMoney += Number($(this).text().match(/\d+\.\d+/g)[0]); $('h1:eq(1)').text(`Total Store Profit: ${sumAllMoney} BGN`) $(this).parent().remove() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteItem(obj, category, price) {\n var idx = obj.tabIndex;\n var div = document.getElementById(category);\n var nodes = div.childNodes;\n var itemP = parseFloat(nodes[idx].getAttribute(\"price\")).toFixed(2);\n\n if (itemP > price) {\n nodes[idx].setAttribute(\"price\", itemP - price);\n var count = nodes[idx].firstElementChild;\n var dollar = count.nextElementSibling;\n\n var num = parseInt(count.innerHTML.substr(1, count.innerHTML.length)) - 1;\n var amount = parseFloat(dollar.innerHTML.substr(1, dollar.innerHTML.length));\n amount -= price;\n\n count.innerHTML = \"x\" + num;\n dollar.innerHTML = \"$\" + amount.toFixed(2);\n } else {\n div.removeChild(nodes[idx])\n for (i = idx; i < nodes.length; i++) {\n nodes[i].tabIndex = i;\n }\n\n switch (category) {\n case \"drink\":\n drinkIdx--;\n break;\n case \"breakfast\":\n breakfastIdx--;\n break;\n case \"lunch\":\n lunchIdx--;\n break;\n case \"dinner\":\n dinnerIdx--;\n break;\n case \"sweet\":\n sweetIdx--;\n break;\n }\n }\n clearTotal();\n}", "removeBook(ele){\n ele.parentNode.parentNode.remove();\n }", "function updatePrice(e) {\n var parentID = $(e).parents(\"div.item\").attr(\"id\");\n \n var baseCost = parseFloat($('#' + parentID + ' span.painting.price').attr(\"data-price\"));;\n var quantity = $('#' + parentID + ' input[name^=quantity]').val();\n var frameCost = parseFloat($('#' + parentID + ' select[name^=frame] option:selected').attr(\"data-price\"));\n var glassCost = parseFloat($('#' + parentID + ' select[name^=glass] option:selected').attr(\"data-price\"));\n var mattID = $('#' + parentID + ' select[name^=matt]').val();\n\n $(\"#\" + parentID + \" span.price\").html(calcItemPrice(baseCost, quantity, frameCost, glassCost, mattID));\n }", "function buttonMoveEvent(e) {\r\n let getPrice = $(this).prev().text().match(/\\d+\\.\\d+/g)[0]\r\n $(this).prev().text(`Buy it only for ${(getPrice * 0.85).toFixed(2)} BGN`)\r\n $oldBooksSection.append($(this).parent())\r\n $(this).remove()\r\n }", "function remove(btn){\n\tvar cartItem = btn.parent().children();\n\tvar itemTotPrice = ($(($(($(cartItem[0]).children())[1]).children())[2]).children())[0];\n\tvar oldTotPrice = itemTotPrice.innerHTML;\n\tvar subtotal = $(\"#subTot\")[0];\n\tvar oldSubtotal = $(\"#subTot\")[0].innerHTML;\n\tsubtotal.innerHTML = (parseFloat(oldSubtotal)-parseFloat(oldTotPrice)).toFixed(2);\n\t\n\tbtn.parent().remove();\n\t\n\tvar prevAmount = $('.incart')[0].innerHTML;\n\t$('.incart')[0].innerHTML = parseInt(prevAmount)-1;\n\n}", "updatePrice(){\n if( this.price > 0 ){\n this.price -= 1;\n }\n\n this.sellIn -= 1;\n\n if( this.sellIn < 0 ){\n if( this.price > 0 ) this.price -= 1;\n }\n }", "function calculate(parent, price) {\n var totalTag = parent.find(\".totalItemPrice\");\n var totalText = totalTag.text();\n var total = parseFloat(totalText.substr(3, totalText.length - 1));\n totalTag.html(\"RM \" + (price + total).toFixed(2));\n}", "_updateOrderBook(orderBook, price, newAmount) {\n let oldAmount = orderBook[price];\n if (oldAmount === undefined) {\n oldAmount = 0;\n }\n let amountDiff = newAmount - oldAmount;\n orderBook[price] = newAmount;\n return amountDiff;\n }", "function calculatePrice() {\n var parentRow = event.target.parentNode.parentNode;\n var parentRowId = parentRow.getAttribute(\"id\");\n var itemRate = getElement(\"#rate\" + parentRowId).value;\n var itemQty = event.target.value;\n var itemPrice = itemRate * itemQty;\n getElement(\"#amt\" + parentRowId).value = itemPrice;\n totalAmount();\n}", "function deleteBook(e) {\n e.target.parentElement.remove();\n libraryBooks.splice(e.target.parentElement.getAttribute(\"data-num\"), 1);\n addDataAttr(bookList);\n}", "function update_price() {\n var row = $(this).parents('.item-row');\n var cost = row.find('.rate').val();\n var qty = row.find('.qty').val();\n //console.log(row,cost,qty)\n // console.log(row.find('.price'))\n row.find('.price').val(Number(qty) * Number(cost));\n subTot.textContent = \"Sub Total: \" + summing();\n tot.textContent=\"Total: \"+summing()*1.5;\n\n }", "function removeItem() {\n var parentRow = event.target.parentNode.parentNode;\n parentRow.remove();\n totalAmount();\n}", "static removeBook(el) {\n el.parentElement.parentElement.parentElement.remove();\n }", "function minusNum(obj){\r\n let value = $(obj).prev().val();\r\n let pIdCart;\r\n if(value > 0){\r\n let pId = $(obj).parents('div[class=items]').attr('id');\r\n pIdCart = pId + 'Cart';\r\n value--;\r\n console.log(pIdCart + \" , \" +$('div#'+pIdCart).attr('id'));\r\n $('div#'+pIdCart).find('input#num').val(value);\r\n }\r\n if(value == 0 ){\r\n $('div#'+pIdCart).remove();\r\n }\r\n \r\n $(obj).prev().val(value);\r\n showSumma();\r\n}", "function reCalculateIncrease(id){\n //get price for peice \n // #P_id is id div for price & substring to remove $ sign\n var price = parseInt($(\"#P_\"+id).text().substring(1));\n //get quantity\n var pecies = parseInt($(\"#V_\"+id).val()) + 1 ;\n $(\"#V_\"+id).val(pecies);\n //edit total for pecies \n $(\"#T_\"+id).text(\"$\"+( pecies*price) );\n \n //edit total and sub total price\n var total = parseInt($(\"#subTotal\").text().substring(1));\n $(\"#subTotal\").text(\"$\"+(total + price));\n $(\"#total\").text(\"$\"+(total + price));\n }", "function updateProductAmount(product, price, isIncrease) {\n const productNumber = document.getElementById(product + \"-amount\");\n let productAmount = productNumber.value;\n const productPrice = document.getElementById(product + \"-price\");\n let productAmountVal = parseInt(productAmount);\n\n if (isIncrease) {\n productNumber.value = productAmountVal + 1;\n productPrice.innerText = productNumber.value * price;\n } else if (!isIncrease && productAmountVal > 0) {\n productNumber.value = productAmountVal - 1;\n productPrice.innerText = productNumber.value * price;\n }\n updatePrice();\n}", "function removeBook(book, elementValue, element, totalCostElement){\n $.ajax({\n url: '/cart/delete/' + book.isbn + '/all',\n type: 'POST',\n dataType: 'json'\n }).catch(\n () => {\n var strQtyValue = elementValue.textContent;\n var qty = parseInt(strQtyValue);\n var c = parseFloat(book.price) * qty;\n totalCost = totalCost - (book.price * qty);\n totalCostElement.textContent = totalCost.toFixed(2) + \" €\";\n element.parentNode.removeChild(element);\n }\n )\n}", "function increDecre(inputbox,totalprice,isTrue,price){\n const inputBox = document.getElementById(inputbox);\n const totalPrice = document.getElementById(totalprice);\n \n if(isTrue == true){\n parseInt(inputBox.value++);\n }\n else if(inputBox.value > 0){\n // if(inputBox.value == 1){\n // inputBox.value = 1;\n // }\n // else{\n parseInt(inputBox.value--);\n // }\n }\n totalPrice.innerText = getTotalForItem(inputBox.value,price); //nested function getTotalForItem\n getSubtotalAddTotal('item-total-phone','item-total','subtotal','total')\n}", "function updatePrice(obj) {\n var price = $(obj).val();\n $(obj).closest('tr').find('.p_qtd').attr('data-price',price);\n updateSubtotal($(obj).closest('tr').find('.p_qtd'));\n}", "function removeitemfrombill(event){\n row = event.target.parentNode.parentNode\n document.getElementById(\"total\").innerHTML = parseInt(document.getElementById(\"total\").innerHTML) - parseInt(row.cells[3].innerHTML);\n row.remove();\n}", "function reCalculateDecrease(id){\n //get price for peice \n // #P_id is id div for price & substring to remove $ sign\n var price = parseInt($(\"#P_\"+id).text().substring(1));\n //get quantity\n $(\"#V_\"+id).val($(\"#V_\"+id).val()-1);\n var pecies = parseInt($(\"#V_\"+id).val());\n //edit total for pecies \n $(\"#T_\"+id).text(\"$\"+( pecies*price) );\n \n //edit total and sub total price\n var total = parseInt($(\"#subTotal\").text().substring(1));\n $(\"#subTotal\").text(\"$\"+(total - price));\n $(\"#total\").text(\"$\"+(total - price));\n \n }", "function deleteItem(e){\n var productRow = e.currentTarget.parentNode.parentNode;\n body.removeChild(productRow);\n getTotalPrice();\n }", "function removePrice(id) {\n let quanity = document.getElementById(`input-${id}`).value;\n let rate = document.getElementById(`rate-${id}`).innerHTML;\n totalPrice -= rate * quanity;\n updateDomPrice();\n }", "function handleExcess(origBalance,newBalance,id,qty){\r\n\tif(origBalance<=200){\r\n\t\tvar shelfId = alasql('SELECT * FROM shelves WHERE warehouseid = ? AND productcode = ? ',[findValue('whouse',id),findValue('code',id)])[0].id;\r\n\t\talasql('UPDATE shelves SET quantity = ? WHERE warehouseid = ? AND productcode = ? ',[ newBalance, findValue('whouse',id), findValue('code',id) ] );\r\n\t}else{\r\n\t\tvar rows = alasql('SELECT * FROM shelves WHERE warehouseid = ? AND productcode = ? ORDER BY id DESC',[ findValue('whouse',id), findValue('code',id) ]);\r\n\t\tfor(var i=0;i<rows.length && qty>0;i++){\r\n\t\t\tif(rows[i].quantity>qty){\r\n\t\t\t\talasql('UPDATE shelves SET quantity = ? WHERE id = ? AND warehouseid = ? AND productcode = ? ',[ rows[i].quantity - qty, rows[i].id, rows[i].warehouseid , rows[i].productcode ] );\r\n\t\t\t}else{\r\n\t\t\t\talasql('DELETE FROM shelves WHERE id = ? AND warehouseid = ? AND productcode = ?', [rows[i].id,rows[i].warehouseid, rows[i].productcode]);\r\n\t\t\t}\r\n\t\t\tqty -= rows[i].quantity;\r\n\t\t}\r\n\t}\t\r\n}", "function changeqty(id, opr) {\n var num = Number($('.number' + id).text());\n if (isNaN(opr)) {\n if (opr == 'plus') {\n num++;\n } else if(opr == 'minus' && num > 1) {\n num--;\n } else {\n return false;\n }\n $(\"#select\" + id).val(num);\n } else {\n num = opr;\n }\n $('.number' + id).text(num);\n var price = $('.Mprice'+id).val();\n var new_price = num*Number(price);\n $('.modalprice'+id).text('$'+new_price.toFixed(2));\n showloader();\n}", "function remove (element) {\n element.parentNode.parentNode.removeChild(element.parentNode);\n\n if (document.getElementById(\"cart\").childElementCount == 0) {\n document.getElementById(\"cartGuide\").classList.toggle(\"invisible\");\n document.getElementById(\"price\").innerHTML = \"Such empty!\";\n } else {\n var canceledProduct = element.parentNode.childNodes[1].innerHTML;\n var initPriceElementValue = document.getElementById(\"price\").innerHTML;\n var processedValue = parseFloat(initPriceElementValue.replace(\" kr.\", \"\"));\n var processedPrice = parseFloat(canceledProduct.replace(\" kr.\", \"\"));\n var output = processedValue - parseFloat(processedPrice) + \" kr.\";\n document.getElementById(\"price\").innerHTML = output;\n }\n}", "function totalCost(e) {\n let quantity = e.target\n quantity_parent = quantity.parentElement.parentElement\n price_field = quantity_parent.getElementsByClassName('item-price')[0]\n total_field = quantity_parent.getElementsByClassName('total-price')[0]\n price_field_content = price_field.innerText.replace('€', '')\n total_field.children[0].innerText = '€' + quantity.value * price_field_content\n grandTotal()\n if (isNaN(quantity.value) || quantity.value <= 0) {\n quantity.value = 1\n }\n\n}", "function updateprice(qid) {\t\n\n var rqid = qid.split('_');\n rid = rqid[0];\n id = rqid[0]+rqid[1];\n\t\n var oldqty = $('#oldqty'+id).val();\n var newqty = $('#qty'+id).val();\n\t\n var numprice = $('#item_price'+id).html().replace('$', '');\t\t\t\t\n var numsubtotal = $('#subtotal'+rid).html().replace('$', ''); \n var numtotal = $('#total'+rid).html().replace('$', ''); \t\n\n // get new amount\n var qty2 = + Number(newqty - oldqty);\n var numprice2 = Math.abs(qty2) * numprice;\n\t\t\t\n // minus / plus amount\n if (oldqty < newqty) {\n newSubtotal = Number(numsubtotal) + Number(numprice2);\t\t\n newTotal = Number(numtotal) + Number(numprice2); \t\n } else {\n newSubtotal = Number(numsubtotal) - Number(numprice2);\t\t\n newTotal = Number(numtotal) - Number(numprice2);\t\n }\n\n newSubtotal = newSubtotal.toFixed(2);\n newTotal = newTotal.toFixed(2);\n\t\n $('#subtotal'+rid).html('$' + newSubtotal );\t\n $('#total'+rid).html( '$' + newTotal );\n $('#oldqty'+id).val(newqty);\n \t\n}", "removeOne(item) {\n const newItems = this.state.inventoryItems;\n // let price = newItems[item].price;\n if (newItems[item].quantity === 0) {\n console.log(\"can't go negative\")\n } else {\n newItems[item].quantity = newItems[item].quantity - 1;\n }\n this.setState({\n inventoryItems: newItems\n })\n }", "function deleteFromCart(item){\n item.parentElement.remove();\n showTotals();\n}", "remove(index,price ) {\n \n const removeProduct = this.state.product.filter((element ,i)=>{\n return i !==index \n \n })\n \n this.setState({\n product:removeProduct,\n \n })\n\n let reducePrice= (this.state.price[this.state.price.length - 1] -price);\n let statePrice =this.state.price\n statePrice.push(reducePrice) \n\n this.setState({\n price:statePrice\n })\n \n}", "function quantityChangedminus(event) {\r\n var purchaseClicked = event.target\r\n if(purchaseClicked.nextElementSibling.value >1)\r\n purchaseClicked.nextElementSibling.value = Number(purchaseClicked.nextElementSibling.value) - 1\r\n else\r\n purchaseClicked.nextElementSibling.value = 1\r\n updateCartTotal()\r\n }", "function economyClassHandler(increase) \n {\n const bookingnumber = document.getElementById(\"ebookingNumber\");\n const bookingCount = parseInt(bookingnumber.value);\n let bookingNewCount = 0;\n if(increase==true){\n bookingNewCount = bookingCount + 1;\n }\n if(increase == false && bookingCount>0){\n bookingNewCount = bookingCount - 1;\n }\n ebookingNumber.value = bookingNewCount; \n const nettotal = bookingNewCount *100;\n document.getElementById(\"netPrice\").innerText = '$'+nettotal;\n subtotal();\n }", "function minus(pos, bookid){\n /*\n - if(quantity<=1) => return\n - else :\n + send ajax request to server : minus?book=bookid\n + quantity -= 1\n + total price -= price\n + if(ischeck) => total -= price\n */\n if(Number(quantity[pos].innerHTML) <= 1) return;\n\n //send ajax request :\n let xhttp = new XMLHttpRequest();\n xhttp.open(\"GET\", \"minus?book=\"+bookid, true);\n xhttp.send();\n\n //change quantity :\n quantity[pos].innerHTML = Number(quantity[pos].innerHTML) - 1;\n\n //change total price :\n totalprice[pos].innerHTML = Number(totalprice[pos].innerHTML) - Number(price[pos].innerHTML);\n\n //change total if checked :\n if(checkbox[pos].checked) total.value = Number(total.value) - Number(price[pos].innerHTML);\n}", "function increment(btn) {\n\tvar spanEle = btn.parent().children();\n\tvar quantity = spanEle[1].innerHTML;\n\t\n\tvar cartItem = btn.parent().parent().children();\n\tvar itemPrice = (($(($(($(cartItem[0]).children())[1]).children())[1]).children())[0]).innerHTML;\n\tvar itemTotPrice = ($(($(($(cartItem[0]).children())[1]).children())[2]).children())[0];\n\tvar oldTotPrice = itemTotPrice.innerHTML;\n\tvar subtotal = $(\"#subTot\")[0];\n\tvar oldSubtotal = $(\"#subTot\")[0].innerHTML;\n\t\n\tspanEle[1].innerHTML = parseInt(quantity)+1;\n\titemTotPrice.innerHTML = (parseFloat(oldTotPrice)+parseFloat(itemPrice)).toFixed(2);\n\tsubtotal.innerHTML = (parseFloat(oldSubtotal)+parseFloat(itemPrice)).toFixed(2);\n\t\n\tif(parseInt(quantity)===1) {\n\t\t$(spanEle[2]).css(\"display\", \"block\");\n\t}\n}", "function clearCell(obj, category, price) {\n var idx = obj.tabIndex;\n var div = document.getElementById(category);\n var nodes = div.childNodes;\n var itemP = nodes[idx].getAttribute(\"price\");\n var n = itemP / price;\n for (i = 0; i < n - 1; i++) {\n deleteItem(obj, category, price);\n }\n}", "function decQty(res, mysql, complete, p_id){\n var sql = \"UPDATE Product SET p_qty = p_qty - 1 WHERE p_id =?;\";\n var inserts = [p_id];\n mysql.pool.query(sql, inserts, function(error, results, fields){\n if(error){\n res.write(JSON.stringify(error));\n res.end();\n }\n complete();\n });\n }", "grow() {\n price(this._growthRate * this._price);\n }", "function removeBook() {\n const book = this.parentElement;\n for (let i = 0; i < library.length; i++) {\n if (library[i].timestamp.toString() === book.id) {\n removeBookInStorage(library.splice(i,1)[0]);\n break;\n }\n }\n book.remove();\n}", "function quantityChangedplus(event) {\r\n var purchaseClicked = event.target\r\n purchaseClicked.previousElementSibling.value = Number(purchaseClicked.previousElementSibling.value) + 1\r\n updateCartTotal()\r\n}", "function deleteItem(e) {\n // get weight of item from span\n const weightString = e.target.previousSibling.previousSibling.innerHTML;\n // convert item weight from string to number\n const newNum = parseInt(weightString, 10);\n\n // loop thru array\n for (let i = 0; i < kitArray.length; i++) {\n // find matching value of target\n if (kitArray[i] === newNum) {\n // delete match from array\n kitArray.splice(i, 1);\n // break loop after 1 match\n break;\n }\n }\n \n // recalculate weight for head\n if (kitArray.length > 1) {\n const add = (a, b) =>\n a + b;\n const sum = kitArray.reduce(add);\n weight.innerHTML = (sum + ' oz');\n \n } else if (kitArray.length === 1) {\n let numb = kitArray[0];\n weight.innerHTML = (numb + ' oz');\n } else {\n kitArray = [];\n weight.innerHTML = (0 + ' oz');\n }\n \n // remove li\n e.target.parentNode.parentNode.removeChild(e.target.parentNode);\n\n weightGauge();\n calculateGauge4();\n\n }", "function addItem(e) {\n if(itemName.value === '') {\n alert('Add an item please!');\n } else {\n //create li element\n const li = document.createElement('li');\n //add a class to new li\n li.className = 'kit-item';\n // create text node and append to li\n li.appendChild(document.createTextNode(itemName.value));\n\n // create element for itemweight\n const span = document.createElement('span');\n // add a class to the span\n span.className = 'itemWt';\n // round input\n const spanWeight = Math.round(itemWeight.value);\n // create text node and append to span\n span.appendChild(document.createTextNode(spanWeight + ' oz'));\n // append to li\n li.appendChild(span);\n\n\n // create checkbox\n const check = document.createElement('input');\n // add type to checkbox\n check.type = 'checkbox';\n // add class to checkbox\n check.className = 'check-box';\n // append checkbox to li\n li.appendChild(check);\n\n // create delete element\n const removeLi = document.createElement('input');\n // add class to delete element\n removeLi.className = 'delete-item';\n // add type to button\n removeLi.type = 'button';\n // add value for button\n removeLi.value = 'X';\n // append delete element to li\n li.appendChild(removeLi);\n // add eventlistener to btn\n removeLi.addEventListener('click', deleteItem);\n\n // add li to item_collect\n collection.appendChild(li);\n // clear input field\n itemName.value = '';\n // clear input field\n itemWeight.value = '';\n // place focus on itemName input\n itemName.focus();\n\n\n e.preventDefault();\n\n\n ////////////////////////////////////////////////\n // sum weights of li's for kit head //\n // variables for parameters\n const oz = ' oz';\n const times = 1\n // call the function\n sumArray(spanWeight, oz, weight, kitArray, times);\n\n\n\n }// end addItem else\n\n weightGauge();\n calculateGauge4();\n //////////////////////////////////////////////////\n ////// delete item from kit ////////\n //tried making a public function, could not access previousSibling, moving on, come back later.\n function deleteItem(e) {\n // get weight of item from span\n const weightString = e.target.previousSibling.previousSibling.innerHTML;\n // convert item weight from string to number\n const newNum = parseInt(weightString, 10);\n\n // loop thru array\n for (let i = 0; i < kitArray.length; i++) {\n // find matching value of target\n if (kitArray[i] === newNum) {\n // delete match from array\n kitArray.splice(i, 1);\n // break loop after 1 match\n break;\n }\n }\n \n // recalculate weight for head\n if (kitArray.length > 1) {\n const add = (a, b) =>\n a + b;\n const sum = kitArray.reduce(add);\n weight.innerHTML = (sum + ' oz');\n \n } else if (kitArray.length === 1) {\n let numb = kitArray[0];\n weight.innerHTML = (numb + ' oz');\n } else {\n kitArray = [];\n weight.innerHTML = (0 + ' oz');\n }\n \n // remove li\n e.target.parentNode.parentNode.removeChild(e.target.parentNode);\n\n weightGauge();\n calculateGauge4();\n\n } // end of deleteItem function\n }", "function remove_1() {\n var price1 = document.querySelector('.price').innerHTML;\n var qty_1 = document.querySelector('.quantity').value;\n var total1 = document.querySelector('.total');\n\n document.querySelector('.total').innerHTML = '$0.00';\n var reset = document.querySelector('.quantity');\n reset.value = reset.defaultValue;\n\n var total = document.querySelector('.sumTotal');\n total.innerHTML = window.greatTotal -= checkPrice(price1, qty_1,total1);\n\n\n}", "decreaseQuantity() {\n if (this.state.qty < 2) {\n this.setState({qty: 1})\n } else {\n this.setState({ qty: this.state.qty - 1 }, () => {\n this.updatePrice();\n });\n }\n }", "function update_price() {\n var row = $(this).parents('.line-item');\n var kolicina = parseFloat(row.find('.kolicina>input').val());\n var cena = parseFloat(row.find('.cena>input').val());\n var popust = parseFloat(row.find('.popust>input').val());\n var davek = parseFloat(row.find('.davek>input').val());\n popust = (100-popust)/100;\n davek = (100 + davek)/100;\n skupaj = cena*kolicina*popust*davek;\n row.find('.skupaj').html(skupaj.toFixed(2));\n //update_total();\n}", "function updateSubtot2(e) {\n e.target.parentElement.parentElement.nextSibling.querySelector('span').textContent = ` ${Number($priceNme) * Number(e.target.value)}`;\n }", "_dec () {\n const p = this._currentParent\n // The current parent does not know the epxected child length\n\n if (p.length < 0) {\n return\n }\n\n p.length--\n\n // All children were seen, we can close the current parent\n if (p.length === 0) {\n this._closeParent()\n }\n }", "_dec () {\n const p = this._currentParent\n // The current parent does not know the epxected child length\n\n if (p.length < 0) {\n return\n }\n\n p.length--\n\n // All children were seen, we can close the current parent\n if (p.length === 0) {\n this._closeParent()\n }\n }", "function selling(node,nodeRemains){\r\n \r\n var numRem=$(nodeRemains).find('.bl-numOfRemains');\r\n var valB=parseInt(numRem.text());\r\n \r\n \r\n var number=$(node).find('.bl-label');\r\n \r\n var value =parseInt(number.text());\r\n \r\n if(value-1!=0){\r\n number.text(value-1);\r\n numRem.text(valB-1);\r\n }\r\n \r\n \r\n }", "function add(elem) {\n //get total budget\n let total_budget = document.querySelector(\"#total-budget span\");\n if (total_budget.innerHTML == 0) {\n alert(\"Your budget is insufficient!!\")\n } else {\n //get .product-div\n let parent = elem.parentElement;\n //get .product\n let grandParent = parent.parentElement;\n //get product price\n let price = grandParent.getElementsByClassName(\"price-value\")[0].innerHTML;\n //get quantity\n let input = parent.getElementsByTagName('input')[0];\n //get remaining budget\n let remaining_budget = document.querySelector(\"#remaining-budget span\");\n if (parseInt(remaining_budget.innerHTML) < parseInt(price)) {\n alert(\"You dont have sufficient amount to purchase this fruit!!\");\n } else {\n //set quantity\n input.value = parseInt(input.value) + 1;\n //set remaining budget\n remaining_budget.innerHTML = parseInt(remaining_budget.innerHTML) - parseInt(price);\n }\n }\n}", "_dec () {\n const p = this._currentParent\n // The current parent does not know the epxected child length\n\n if (p.length < 0) {\n return\n }\n\n p.length --\n\n // All children were seen, we can close the current parent\n if (p.length === 0) {\n this._closeParent()\n }\n }", "function calculateCountPrice(element, count, price, singlePrice, num) {\n var priceElement = element.parentNode.parentNode.children[2].children[0];\n var countElement = element.parentNode.children[1];\n count = count + num;\n price = price + singlePrice;\n countElement.value = count;\n priceElement.innerHTML = price;\n}", "function delParent() {\n\tvar parentNum = getLastNum(\"parentNum\");\n\t$(`#p` + parentNum).remove();\n\t$(`#pp` + parentNum).remove();\n\t$(`#ppp` + parentNum).remove();\n}", "function removeAllBooks(parent) {\n while (parent.firstChild) {\n parent.removeChild(parent.firstChild);\n }\n}", "function fastClassBookingHandler(increase)\n {\n const bookingnumber = document.getElementById(\"bookingNumber\");\n const bookingCount = parseInt(bookingnumber.value);\n let bookingNewCount = 0;\n if(increase==true){\n bookingNewCount = bookingCount + 1;\n }\n if(increase == false && bookingCount>0){\n bookingNewCount = bookingCount - 1;\n }\n bookingNumber.value = bookingNewCount; \n const nettotal = bookingNewCount *150;\n document.getElementById(\"netPrice\").innerText = '$'+nettotal;\n subtotal();\n }", "function updatePrice(oldPrice) {\n return Math.floor(oldPrice * 1.25);\n}", "function increase() {\n if (quantity >= 99) {\n return;\n }\n quantity += 1;\n\n if (quantity < 10) {\n counter.setAttribute('value', `0${quantity}`);\n } else {\n counter.setAttribute('value', quantity);\n }\n quantityPrice();\n}", "static deleteBook (el) {\n\t\tif (el.classList.contains('delete')) {\n\t\t\tel.parentElement.parentElement.remove();\n\t\t}\n\t}", "function updateSubtot(productElement) {\n let price = Number(productElement.querySelector('.pu').querySelector('span').innerText) \n\n let quantity = Number(productElement.querySelector('.qty').querySelector('input').value)\n\n let subTot = Number(productElement.querySelector('.subtot').querySelector('span').innerText = price * quantity)\n\n return subTot\n}", "function handleQuantityChange (input) {\r\n // make sure the minimum value is 1\r\n if (input.value < 1) input.value = 1\r\n // make sure the maximum value is 10\r\n if (input.value > 10) input.value = 10\r\n\r\n // get the id(index of item with the modified quantity)\r\n const id = input.id[input.id.length - 1]\r\n // get price element using the id and retrive the price\r\n const priceEl = document.getElementById('price' + id)\r\n let price = priceEl.innerHTML\r\n price = price.substring(1).split(' ').join('') // remove any spaces from the text\r\n price = eval(price + '*' + input.value) // multiply the price by the new quantity value (input)\r\n price = price.toFixed(2) // fix it to 2 decimal places\r\n\r\n // get the price-tag element based on the id and update the price with the new price\r\n const priceTag = document.getElementById('pricetag' + id)\r\n priceTag.innerHTML = String(price)\r\n\r\n // re-calculate the cart total\r\n getCartTotal()\r\n}", "buy() {\n this.amount --;\n this.price ++;\n }", "function updatePriceByProduct(product, productPrice){\n product.querySelector('.total-price span').innerHTML = productPrice;\n}", "function removeBook(book_id) {\n let card = document.getElementById(book_id).parentElement.parentElement\n let cardIndexNum = parseInt(card.dataset.index);\n let parentElement = document.getElementById(book_id).parentElement.parentElement.parentElement\n parentElement.removeChild(card);\n for (var i = 0; i < myLibrary.length; i++) {\n if (i === cardIndexNum) {\n myLibrary.splice(i, 1);\n }\n }\n}", "function updateTotalPriceInCart(clckEle, opr) {\n\t//change the total price\n\t//get the price first\n\tvar totEle = $('#cart-tot'), tot=parseInt(totEle.attr('data-total')),\n\t\tprodPrice=parseInt(clckEle.attr('data-price')), finalPrice;\n\n\t//perform calculation\n\tif(opr === '+')\n\t\tfinalPrice = tot + prodPrice;\n\telse\n\t\tfinalPrice = tot - prodPrice;\n\n\t//add to total\n\ttotEle.text('Total: '+finalPrice).attr('data-total', finalPrice);\n\n}", "function decrimentQuantity(){\n if(quantity > 1){\n let currentCost = (document.getElementById(\"cat-harness-item-cost\").innerHTML).replace( /^\\D+/g, '');\n totalCost = totalCost-(parseInt(currentCost)/(quantity));\n }\n quantity = parseInt(document.getElementById(\"num-items\").innerHTML, 10) - 1;\n if (quantity < 1) { quantity = 1; }\n document.getElementById(\"num-items\").innerHTML = quantity;\n document.getElementById(\"cat-harness-item-cost\").innerHTML = \"$\" + totalCost;\n \n}", "function increaseQuantity(){\n let currentCost = (document.getElementById(\"cat-harness-item-cost\").innerHTML).replace( /^\\D+/g, '');\n if (quantity == 1){\n totalCost = 58;\n }\n else{\n totalCost = totalCost+(parseInt(currentCost)/(quantity));\n }\n quantity = parseInt(document.getElementById(\"num-items\").innerHTML, 10) + 1;\n document.getElementById(\"num-items\").innerHTML = quantity;\n document.getElementById(\"cat-harness-item-cost\").innerHTML = \"$\" + totalCost;\n \n}", "function updateOrder(imgsrc, drinkname, price) {\n\tif(counter < 15) {\n\t\tmenuModal.style.display = \"none\";\n\t\taddToOrder(imgsrc, drinkname, price);\n\t\tvar num = price.replace(' kr','');\n\t\tvar numParse = parseInt(num);\n\t\ttotalOrder += numParse;\n\t\t//$('#orderTotal').text(totalOrder + ' ');\n\t\t\tconsole.log(totalOrder);\n\t}\n\telse {\n\t\talert(\"Maximum drink limit had been reached\");\n\t\tmenuModal.style.display = \"none\";\n\t}\n}", "function decreaseQuantity(eId) {\n //e.g eid=trash-2 where 2 is product id\n let temp = eId.split(\"-\");\n let id = temp[1];\n let rate = parseInt(document.getElementById(`rate-${id}`).innerHTML);\n let input = document.getElementById(`input-${id}`);\n if (input.value > 1) {\n totalPrice -= rate;\n updateDomPrice();\n input.value = parseInt(input.value) - 1;\n sessionStorage.setItem(`quantity-${id}`, input.value);\n } else {\n console.log(\"Quantity cannot be less than 1 \");\n }\n }", "removeProductAmount(id) {\n let product = this.findById(id);\n if (product.amount > 0) {\n product.amount--;\n }\n document.getElementById('foodAmountCart-' + product.id).innerHTML = product.amount + 'x';\n document.getElementById('overall-shopping-cart-price-' + product.id).innerHTML = printPrice(product) + '€';\n }", "function removebtn() {\r\n let removeBtn = document.querySelectorAll('.btn-remove');\r\n for(let i = 0; i < removeBtn.length; i++){\r\n removeBtn[i].addEventListener('click', function(event){\r\n let removeBtn_grandparent = event.target.parentElement.parentElement;\r\n removeBtn_grandparent.remove();\r\n updateCartTotal();\r\n\r\n })\r\n }\r\n }", "function removeItem(itemName) {\n order.subtotal = round(order.subtotal - order.items[itemName].price);\n order.tax = round(order.subtotal * 0.1);\n order.total = round(order.subtotal + order.tax + order.delivery);\n if (order.items[itemName].count > 1) {\n order.items[itemName].count -= 1;\n } else {\n delete order.items[itemName];\n }\n let restaurantDiv = document.getElementById(\"restaurant\");\n // Generate order summary div \n restaurantDiv.replaceChild(createOrderDiv(restaurantData.menu), document.getElementById(\"restaurant\").lastChild);\n}", "function decrease() {\n var holdCount2 = count - 1;\n if(holdCount2 >= 0){\n setCount(holdCount2);\n var holdItem2 = props;\n window.localStorage.setItem(JSON.stringify(holdItem2), holdCount2);\n cartContext.setCartTotal(calTotal());\n }else{\n console.log(\"You can't order negative amount of products\");\n }\n \n }", "handlePriceObjEdited(index, priceObj) {\n //this.props.priceDet[index]=priceObj\n //this.props.updateParent(this.props.priceDet)\n }", "static deleteBook(el) {\n\t\tif (el.classList.contains('delete')) {\n\t\t\tel.parentElement.parentElement.remove();\n\t\t}\n\t}", "function decrement(btn){\n\tvar spanEle = btn.parent().children();\n\tvar quantity = spanEle[1].innerHTML;\n\t\n\tvar cartItem = btn.parent().parent().children();\n\tvar itemPrice = (($(($(($(cartItem[0]).children())[1]).children())[1]).children())[0]).innerHTML;\n\tvar itemTotPrice = ($(($(($(cartItem[0]).children())[1]).children())[2]).children())[0];\n\tvar oldTotPrice = itemTotPrice.innerHTML;\n\tvar subtotal = $(\"#subTot\")[0];\n\tvar oldSubtotal = $(\"#subTot\")[0].innerHTML;\n\t\n\tif(parseInt(quantity)>1) {\n\t\tspanEle[1].innerHTML = parseInt(quantity)-1;\n\t\titemTotPrice.innerHTML = (parseFloat(oldTotPrice)-parseFloat(itemPrice)).toFixed(2);\n\t\tsubtotal.innerHTML = (parseFloat(oldSubtotal)-parseFloat(itemPrice)).toFixed(2);\n\t}\n\tif(parseInt(quantity)<=2) {\t\n\t\tbtn.css(\"display\", \"none\");\n\t}\n\n}", "function upDateTotalPrice() {\n let cartItems = document.getElementsByClassName(\"cart-items\");\n for (let i = 0; i < cartItems.length + 1; i++) {\n const cartItem = cartItems[i];\n if (cartItems.length > 0) {\n const elementPrice = cartItem.getElementsByClassName(\"element-price\")[i].innerHTML;\n const elementPriceInt = parseFloat(elementPrice);\n\n\n\n\n let totalPrices = document.getElementsByClassName(\"Total-prices\")\n for (let j = 0; j < totalPrices.length; j++) {\n const totalPrice = totalPrices[j]\n totalPrice.innerHTML = \"$\" + elementPriceInt\n }\n }\n else {\n let totalPrices = document.getElementsByClassName(\"Total-prices\")\n for (let j = 0; j < totalPrices.length; j++) {\n const totalPrice = totalPrices[j]\n totalPrice.innerHTML = \"$\" + 0\n alert(\"Are you went to remove all product\")\n }\n\n }\n\n\n }\n}", "function removeShoppingCartItem(event){\n const buttonClicked = event.target;\n buttonClicked.closest('.shoppingCartItem').remove();\n //invocamos la funcion q actualizara el total//\n updateShoppingCartTotal();\n}", "static removeBook(el) {\n if(el.classList.contains('remove')) {\n el.parentElement.parentElement.remove();\n EventHandler.showAlertRemoved('Book Removed.', 'book-removed');\n }\n }", "function updatePrice(rate, quantity) {\n totalPrice += rate * quantity;\n console.log(totalPrice);\n updateDomPrice();\n }", "function removeCartItem(event) {\n var buttonClicked = event.target\n buttonClicked.parentElement.parentElement.remove()\n updateCartTotal()\n}", "minusFromTotal (price, optionName, subOptionName) {\n let newStorage = Object.assign({}, this.state.selectionStorage);\n // if selection queue is empty don't dequeue\n if (!newStorage[optionName] || newStorage[optionName].isEmpty()) {\n console.log('you have no selection in this catagory!')\n // if selection queue is with limit dont dequeue\n } else if (newStorage[optionName].length <= this.state.itemOptions.min) {\n console.log('you need to add at lease one option from this catagory.')\n // otherwise dequeue the item\n } else {\n newStorage[optionName].dequeue();\n this.setState({\n selectionStorage: newStorage\n });\n }\n this.setState({\n price: numberCurrency(this.state.price, 2) - numberCurrency(price, 2)\n });\n }", "static deleteBook(el){\n if(el.classList.contains('delete')){\n el.parentElement.parentElement.remove();\n }\n }", "function updatePrice(Id, price) {\n getElement(Id + \"-price\").innerText = price;\n updateTotal();\n}", "function removeCartItem(event) {\r\n var buttonClicked = event.target;\r\n buttonClicked.parentElement.parentElement.remove();\r\n updateCartTotal();\r\n }", "_dec() {\n const p = this._currentParent; // The current parent does not know the epxected child length\n\n if (p.length < 0) {\n return;\n }\n\n p.length--; // All children were seen, we can close the current parent\n\n if (p.length === 0) {\n this._closeParent();\n }\n }", "function updatePrice(price) { \n // first selected click, create price original to return. \n if (!price_o.attr('data-source-price')) {\n var source_price = price_o.attr('data-source-price', price_o.text());\n } \n \n //change price\n price_o.hide();\n price_o.text(price).fadeIn(300);\n // right_side.find('.loading').remove();\n }", "function updateFridgeQty() {\n\tif (event.which === 13) {\n\t\tconsole.log(\"Enter pressed\");\n\t\tconsole.log(this);\n\n\t\tvar id = this.getAttribute(\"id\");\n\t\tvar index = id.substr(\"fridgeQty\".length);\n\n\t\tvar qty = Number(document.getElementById(\"fridgeQty\" + index).value);\n\n\t\t// Removes the item from the page and from the fridge array.\n\t\tif (qty <= 0) {\n\t\t\tconsole.log(\"Removing item\");\n\t\t\tfridge.splice(index, 1)\n\t\t\tconsole.log($(this).parent().remove());\n\n\t\t\tdisplayFridge();\n\t\t}\n\n\t\t// Updates the quantity in the fridge array.\n\t\telse {\n\t\t\tconsole.log(\"Updating quantity\");\n\t\t\tfridge[index][0] = qty;\n\t\t}\n\n\t\t// Saves the updated fridge to local storage.\n\t \tlocalStorage.setItem(\"fridge\", JSON.stringify(fridge));\n\t}\n}", "function deleteEntry(){\n //get the book div and the book's id\n let bookDiv = this.parentElement;\n let bookDivIndex = Number(bookDiv.getAttribute('data-index'));\n //remove the div with the book entry on the HTML\n bookDiv.remove();\n //find the index of the book that has the matching book id and remove it from the library\n let chosenBookIndex = myLib.findIndex(book => book.numID === bookDivIndex);\n myLib.splice(chosenBookIndex, 1);\n}", "function Excluir() {\n var par = $(this).parent().parent(); //tr\n\n par.remove();\n\n $(\"#total\").text(CalcularTotal());\n\n // produtos.splice(i,1);\n }", "function decrease_by_one(qty1) {\n var productQuantity = parseInt(document.getElementById(qty1).value);\n if (productQuantity > 0) {\n if ((productQuantity -1) > 0) {\n document.getElementById(qty1).value = productQuantity -1;\n }\n }\n}", "sub(entry) {\n this.amount.sub(entry.amount);\n this.count -= 1;\n this.dbUpdater.update();\n }", "updateShelf(book, shelf) {\n if(shelf.value === 'none') {\n const bookIndex = this.state.books.findIndex(bk => bk.id === book.id);\n this.state.books.splice(bookIndex, 1);\n } else {\n book.shelf = shelf;\n }\n this.setState(this.state);\n }", "function updateSubtotal(product) {\n const price = product.querySelector('.price span');\n const priceContent = parseInt(price).innerText;\n\n const quantity = product.querySelector('input').value;\n const incrementQuantity = quantity.valueAsNumber;\n\n const subtotalPrice = priceContent * incrementQuantity;\n\n const subTotalcontainer = product.querySelector('.subtotal span');\n const subtotalContent = subTotalcontainer.innerText;\n\n const subTotal = (subtotalContent.innerHTML =\n '<em>' + subtotalPrice + '</em>');\n\n return subTotal;\n}", "function decrementNumGeese() {\n\n\tvar current = document.getElementById(\"geeseInputField\");\n\tvar value = parseInt(current.value);\n\tvalue -= 1;\n\n\ttry {\n\t\tvar numBags = parseInt(document.getElementById(\"bagInputField\").value);\n\t\tvar result = calculateTransportCost(numBags, value);\n\t\tupdateElement(result);\n\t\tcurrent.value = value;\n\n\t} catch (err) {\n\n\t}\n\n\t// if (value - 1 >= MINIMUM_BAGS_OF_CORN) {\n\t// \tcurrent.value = value - 1;\n\t// \tupdateCost(value - 1);\n\t// }\n\n}", "function makePricesAnnually() {\n $('.price-container').each(function() {\n var oldPrice = $(this).find('.price-number').text();\n oldPrice = parseFloat(oldPrice);\n var newPrice = (oldPrice * 12.00) - 80;\n $(this).find('.price-number').text(newPrice)\n })\n}", "function plateorquantitychange(event){\n let row = event.target.parentNode.parentNode;\n let fooditemname = row.cells[0].innerHTML;\n let fooditemquantity = row.cells[2].firstChild.value;\n let oldprice = row.cells[3].innerHTML;\n if(fooditems[fooditemname].kind == 1 ){\n let fooditemplate = row.cells[1].firstChild.value;\n let fooditemprice = (parseInt(fooditemquantity) * parseInt(fooditems[fooditemname][\"price\"+fooditemplate]));\n row.cells[3].innerHTML = fooditemprice;\n }\n else{\n let fooditemprice = (parseInt(fooditemquantity) * parseInt(fooditems[fooditemname][\"price\"]));\n row.cells[3].innerHTML = fooditemprice;\n }\n let ttl = document.getElementById(\"total\");\n ttl.innerHTML = parseInt(ttl.innerHTML) - parseInt(oldprice) + parseInt(row.cells[3].innerHTML);\n}", "function updatePrices() {\n}", "decrement(itemData) {\n if (itemData.quantity == 0) return;\n itemData.quantity -= 1\n this.props.setItemQuantity(itemData);\n }", "increaseQuantity() {\n this.setState({ qty: this.state.qty + 1 }, () => {\n this.updatePrice();\n });\n }", "cartPlusOne(product) {\r\n product.quantity = product.quantity + 1;\r\n }" ]
[ "0.63764364", "0.62728", "0.6121901", "0.61014324", "0.60415024", "0.60409045", "0.5965791", "0.59542316", "0.57475066", "0.56899923", "0.5689891", "0.56670296", "0.5666331", "0.5660913", "0.5656683", "0.56531686", "0.56417906", "0.5633309", "0.56284803", "0.5608721", "0.5589339", "0.55636805", "0.5537282", "0.5533714", "0.55232936", "0.55221266", "0.5519273", "0.5486495", "0.5486267", "0.54784125", "0.5467747", "0.544817", "0.54426634", "0.543687", "0.5417682", "0.54147553", "0.5414551", "0.53967255", "0.5395025", "0.53928554", "0.5387716", "0.5373512", "0.5371006", "0.5365512", "0.5350311", "0.53428614", "0.5323322", "0.5323322", "0.53178614", "0.53075945", "0.5292667", "0.52794003", "0.5278935", "0.5271173", "0.52686644", "0.5267444", "0.52664006", "0.52632916", "0.5263109", "0.5258723", "0.5258602", "0.52492845", "0.52441823", "0.5237719", "0.52308685", "0.52249014", "0.5214076", "0.5209484", "0.52086407", "0.52086395", "0.52054465", "0.5201049", "0.5200573", "0.5200507", "0.5196821", "0.51920223", "0.51879036", "0.51862365", "0.5185423", "0.5183988", "0.5178343", "0.51737034", "0.51701796", "0.5168265", "0.51521325", "0.5149642", "0.5149279", "0.5147016", "0.5142532", "0.513753", "0.5122865", "0.5117012", "0.51144105", "0.51094246", "0.51071036", "0.5102918", "0.5096039", "0.5093358", "0.50911885", "0.508851" ]
0.509282
98
moved from the new books section to the old books section.
function buttonMoveEvent(e) { let getPrice = $(this).prev().text().match(/\d+\.\d+/g)[0] $(this).prev().text(`Buy it only for ${(getPrice * 0.85).toFixed(2)} BGN`) $oldBooksSection.append($(this).parent()) $(this).remove() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "moveTo(shelf, book) {\n // we update the status of the books\n BooksAPI.update(book, shelf).then(() => {\n this.fetchBooks();\n });\n }", "function move_books_between_lists(old_list, new_list, book_title){\n for (var i = 0; i < old_list.length; i++){\n if (old_list[i][\"book_title\"] == book_title){\n new_list.push(old_list[i]);\n\n //Apparently this is the best way to remove something from a list in Javascript.\n //http://stackoverflow.com/questions/5767325/remove-a-particular-element-from-an-array-in-javascript\n old_list.splice(i, 1);\n break;\n }\n }\n}", "function shiftSection(){\n $brandSection.remove().insertAfter($productWrapper);\n }", "moveBook(bookToChange, toWhere) {\n const { id } = bookToChange;\n update(bookToChange, toWhere);\n if (toWhere === 'none') {\n this.setState({ books: this.state.books.filter(book => book.id !== id) });\n return;\n }\n // map over all books and return all parts of the book object, only\n // modifing the shelf attribute that the backend uses to know which\n // shelf to display on\n const newBooks = this.state.books.map((book) => {\n if (book.id === id) {\n return {\n ...book,\n shelf: toWhere,\n };\n }\n return book;\n });\n this.setState({ books: newBooks });\n }", "submitBook(book) {\n const { books } = this.state;\n const { title, author, date } = book;\n let newBooks = books.slice();\n newBooks.unshift({\n title,\n author,\n date\n });\n const newBookTitles = this.mapTitles(newBooks);\n this.setState({\n books: newBooks,\n bookTitles: newBookTitles\n });\n }", "changeBookShelf(updatedBook, newReadState) {\n BooksAPI.update(updatedBook, newReadState)\n .then((books) => {\n const book = this.state.books.filter((book) => book.id === updatedBook.id)\n book[0].shelf = newReadState\n const unchangedBooks = this.state.books.filter((book) => book.id !== updatedBook.id)\n this.setState({books: [...unchangedBooks, book[0]]})\n })\n }", "updateShelf(currentShelf) {\n if (this.props.bookShelf === 'none') {\n this.props.books.push(this.props.book);\n this.props.book.shelf = currentShelf;\n }\n else {\n this.props.books.forEach((book, index) => {\n if (book.id === this.props.bookId) {\n this.props.books.splice(index, 1);\n this.props.books.push(this.props.book);\n }\n }\n );\n this.props.book.shelf = currentShelf;\n }\n }", "async changeSectionOrder (section, change) {\n const parent = this.PAC.find((p) => {\n return p !== section &&\n section.dir.includes(p.path.replace(/\\/intro$/, '')) &&\n p.depth + 1 === section.depth\n })\n\n const newIndex = section.ordre + change\n\n if (newIndex >= 0 && newIndex < parent.children.length) {\n // This interchange position of items in array in one operation.\n [\n parent.children[section.ordre],\n parent.children[newIndex]\n ] = [\n parent.children[newIndex],\n parent.children[section.ordre]\n ]\n\n if (this.table) {\n const updatedSections = parent.children.map((s, i) => {\n return Object.assign({\n id: s.id || uuidv4(), // if a section from a lower level was never changed it need an id to be upsert.\n path: s.path,\n dir: s.dir,\n ordre: i\n }, this.tableKeys)\n })\n\n await this.$supabase.from(this.table).upsert(updatedSections)\n }\n }\n }", "changeBookShelf(book, shelf) {\n BooksAPI.update(book, shelf).then(() => {\n book.shelf = shelf;\n // this.getCurrentBooks();\n this.setState(state => ({\n // currentBooks: state.currentBooks.filter(currentBook => currentBook.id !== book.id).concat([book])\n currentBooks: [...state.currentBooks.filter(currentBook => currentBook.id !== book.id), book]\n }))\n });\n }", "changeSection(sectionId) {\n this.section = sectionId;\n this.resetValues();\n }", "function removeBook(e) {\n let bookIndex = e.target.dataset.index;\n library.splice(bookIndex, 1);\n createTable();\n saveLibrary(library);\n}", "static _restoreSectionBackup(sectionsBackup, currentIndexBackup) {\n // Persist\n this._sections = sectionsBackup;\n // Persit in viewer controller - not sure why it's needed TODO\n this.prototype.__proto__.constructor._sections = sectionsBackup;\n app.data.sections = sectionsBackup;\n\n // Reorder the DOM\n for (let sectionIndex = this._sections.length - 1; sectionIndex >= 0; sectionIndex--) {\n var section = this._sections[sectionIndex];\n this._container.prepend(section._node);\n }\n\n $.each(this._container.children(), function(i, sectionNode) {\n var foundNode = false;\n\n for (let section of this._sections) {\n if ($(section._node).is(sectionNode)) {\n foundNode = true;\n }\n }\n\n if (! foundNode) {\n sectionNode.remove();\n }\n }.bind(this));\n\n topic.publish('builder-section-update');\n // do an issue check\n topic.publish('builder-should-check-story');\n\n if (this._currentSectionIndex != currentIndexBackup) {\n window.requestAnimationFrame(function() {\n // Some clean up of references to the current section to make sure\n // the section will be activated properly at it's new location\n // especially an issue with Immersive\n this._currentSectionIndex = -1;\n this._currentSection = null;\n this._$currentSection = null;\n\n this.navigateToSection({\n index: currentIndexBackup,\n animate: false\n });\n }.bind(this));\n }\n }", "function moveEditSection(){\n\tif (window.oldEditsectionLinks) return;\n\tfor (var i=1;i<7;i++){\n\t\tfor (var j=0,hs=document.getElementsByTagName('h'+i.toString());j<hs.length;j++){\n\t\t\tvar ss=$UT.getElementsByClassName('editsection', 'span', hs[j]);\n\t\t\tif (ss.length !== 0){\n\t\t\t\tss[0].className+=' editsection-nf';\n\t\t\t\tss[0].removeAttribute('style'); // BigButton fix\n\t\t\t\ths[j].appendChild(ss[0]);\n\t\t\t}\n\t\t}\n\t}\n}", "function moveEditSection(){\n\tif (window.oldEditsectionLinks) return;\n\tfor (var i=1;i<7;i++){\n\t\tfor (var j=0,hs=document.getElementsByTagName('h'+i.toString());j<hs.length;j++){\n\t\t\tvar ss=$UT.getElementsByClassName('editsection', 'span', hs[j]);\n\t\t\tif (ss.length !== 0){\n\t\t\t\tss[0].className+=' editsection-nf';\n\t\t\t\tss[0].removeAttribute('style'); // BigButton fix\n\t\t\t\ths[j].appendChild(ss[0]);\n\t\t\t}\n\t\t}\n\t}\n}", "function removeBook(bookId) {\n// var db = ScriptDb.getMyDb();\n Logger.log(\"removing \"+bookId);\n var db_inst = ParseDb.getMyDb(applicationId, restApiKey, \"book_instance\");\n var db_gen = ParseDb.getMyDb(applicationId, restApiKey, \"book_generic\");\n// var db_cat = ParseDb.getMyDb(applicationId, restApiKey, \"list_categories\");\n var db_shelf = ParseDb.getMyDb(applicationId, restApiKey, \"bookshelf\");\n \n var book = db_inst.load(bookId);\n \n if (book != null){\n var generic = db_gen.load(book.generic);\n var bookshelf = db_shelf.load(book.owner);\n \n for (var i = 0; i < bookshelf.instances.length; i++) {\n if (bookshelf.instances[i] == bookId) {\n var tmp = bookshelf.instances[0];\n bookshelf.instances[0] = bookshelf.instances[i];\n bookshelf.instances[i] = tmp;\n bookshelf.instances.shift();\n break;\n }\n }\n \n var wasLast = true;\n for (var i = 0; i < bookshelf.instances.length; i++) {\n if (db_inst.load(bookshelf.instances[i]).generic == generic.getId()) {\n wasLast = false;\n }\n }\n if (wasLast) {\n for (var i = 0 ; i < bookshelf.books.length ; i++) {\n if (bookshelf.books[i] == generic.getId()) {\n var tmp = bookshelf.books[0];\n bookshelf.books[0] = bookshelf.books[i];\n bookshelf.books[i] = tmp;\n bookshelf.books.shift();\n break;\n }\n }\n }\n db_shelf.save(bookshelf);\n \n \n for (var i = 0; i < generic.instances.length; i++) {\n if (generic.instances[i] == bookId) {\n var tmp = generic.instances[0];\n generic.instances[0] = generic.instances[i];\n generic.instances[i] = tmp;\n generic.instances.shift();\n break;\n }\n }\n \n if (generic.instances.length > 0) {\n db_gen.save(generic);\n } else {\n \n db_gen.remove(generic) ;\n \n var category = generic.category;\n deleteCategory(category);\n }\n \n db_inst.remove(book);\n \n return 1;\n }\n \n return 0;\n}", "function addBookToLibrary(newBook){\n if (myLibrary.some((book) => book.title.trim() === newBook.title.trim())) return false;\n\n myLibrary.push(newBook);\n saveLocal();\n return true;\n }", "function removeBookFromLibrary(e){\n let bookIndex = e.target.parentNode.dataset.index;\n myLibrary.splice(bookIndex,1);\n }", "changeIndices(sourceId, sourceIndex, targetIndex, targetId) {\n const nextState = swap(this.props.bookmarks, sourceIndex, targetIndex);\n this.props.setBookmarks(nextState);\n saveBookmarks(nextState);\n }", "function rollbackDocuments() {\n\tswDocuments = rbDocuments.slice(0);\n}", "function updateBook(book) {\n Logger.log(\"updating book \");\n Logger.log(book.getId());\n \n var db = ParseDb.getMyDb(applicationId, restApiKey, \"book_generic\");\n \n var catOut = db.load(book.getId()).category;\n Logger.log(catOut);\n \n try {\n book = db.save(book);\n Logger.log(\"book updated\");\n } catch (error) {\n Logger.log(\"error updating\");\n Logger.log(error);\n }\n deleteCategory(catOut);\n addCategory(book.category);\n \n Logger.log(\"done\");\n return book;\n}", "function changeBookStatus(id) {\n const bookData = getListOfBook();\n let index;\n for (let i = 0; i < bookData.length; i++) {\n if (bookData[i].id == id) {\n index = i;\n }\n }\n const switchBookStatus = {\n id: new Date().valueOf(),\n title: bookData[index].title,\n author: bookData[index].author,\n year: bookData[index].year,\n isComplete: bookData[index].isComplete == true ? false : true\n }\n bookData.splice(index, 1);\n bookData.unshift(switchBookStatus);\n localStorage.setItem(localBook, JSON.stringify(bookData));\n renderBookList(getListOfBook());\n}", "function updateBook(e){\n\n\t// let gather our data\n\tvar editbuffer= {\n\t\t\tname: $.name.value,\n\t\t\tisbn: $.isbn.value,\n\t\t\tauthor: $.author.value,\n\t\t\tgenre: $.genre.value\n\t};\n\n\t// New Book opton\n\tif(!mybook){\n\t\tvar book = Alloy.createModel('PeppaBook'); \n\t\tbooks.add(book);\n\t\tbook.save( editbuffer,{\n\t\t\n\t\t\tsuccess: function(){\n\t\t\t\talert('You book details have been recorded');\n\t\t\t\t$.trigger('save');\n\t\t\t},\n\t\t\n\t\t\terror: function(){\n\t\t\t\talert('There was an error saving your book details');\n\t\t\t\t$.trigger('save');\n\t\t\t}\n\t\t});\n\t}\n\telse{\n\t\tmybook.set(editbuffer).save({},{\n\t\t\t\t\t\n\t\t\terror: function(){\n\t\t\t\talert('There was an error updating your book details');\n\t\t\t}\t\t\t\n\t\t});\n\t}\n\n\t\n}", "function pageChanged(newPage){\n\t\t$state.go(\"root.sectionList\" , {pageId:newPage});\n\t}", "function flushBook() {\n book = null;\n }", "function restoreState() {\n if (load()) {\n for (let i = 0; i < myLibrary.length; i++) {\n insertBookHTML(myLibrary[i]);\n }\n return true;\n } else {\n return false;\n }\n}", "moveBook(book, shelf) {\n return new Promise((resolve, reject) => {\n // Make and API call to the BooksAPI to change the shelf of this particular book\n BooksAPI.update(book, shelf).then((result) => {\n // Retrieve the updated information\n this.getAllBooks().then(() => {\n resolve()\n }).catch((err) => {\n reject(err)\n })\n }).catch((err) => {\n reject(err)\n })\n })\n }", "function updateBookNumbers ( book, index ) {\r\n book[bookNumberProperty] = index;\r\n}", "goToSection(newIndex) {\n\t\tif (this.activeIndex === newIndex) return;\n\n\t\tthis.blockEvents();\n\t\tthis.updateClasses(this.activeIndex, newIndex);\n\t\tthis.updateExternalComponents(this.activeIndex, newIndex);\n\t\tthis.activeIndex = newIndex;\n\t}", "updateShelf(book, shelf) {\n if(shelf.value === 'none') {\n const bookIndex = this.state.books.findIndex(bk => bk.id === book.id);\n this.state.books.splice(bookIndex, 1);\n } else {\n book.shelf = shelf;\n }\n this.setState(this.state);\n }", "function addBook2 (title, id) {\n const newBookList = books.filter(book => book.id !== id);\n const chosenBook = books.filter(book => book.id === id);\n setBooks (newBookList);\n setBookcase ([...bookcase, ...chosenBook]);\n }", "function updateBook() {\n let id = $('#updatebookId').text();\n let title = $('#updatebookTitle').val();\n let author = $('#updatebookAuthor').val();\n let isbn = $('#updatebookIsbn').val();\n\n let book = { title, author, isbn };\n request.put(id, JSON.stringify(book), updateCurrentBookInList, onError);\n\n $('#updatebookId').text('');\n $('#updatebookTitle').val('');\n $('#updatebookAuthor').val('');\n $('#updatebookIsbn').val('');\n\n showAddForm();\n}", "function addBookToLibrary(){\n let bookTitle = document.getElementById(\"book-title\").value;\n let bookAuthor = document.getElementById(\"book-author\").value;\n let bookPages = document.getElementById(\"book-pages\").value;\n let booksLibrary = document.getElementById(\"library\");\n let error;\n let readOrNot;\n let inputText = document.querySelectorAll(\".book-info\");\n let readCheck = document.getElementById(\"have-read-check\").checked;\n if(readCheck === true){\n readOrNot = \"Read\";\n }else{\n readOrNot = \"Not Read\";\n }\n //checks to make sure all fields are filled\n if(bookPages < 1 || bookTitle === \"\" || bookAuthor === \"\" || bookPages === \"\"){\n error = document.querySelector(\"#error\"); \n error.textContent =\"Please fill in all fields!\";\n setInterval(function(){\n error.textContent = \" \";\n }, 2800)\n\n }else{\n aNewBook = new Book(inputText[0].value,inputText[1].value,inputText[2].value,inputText[3].value,readOrNot);\n myLibrary.push(aNewBook);\n let eachBookDiv = document.createElement(\"div\");\n let currentBook = myLibrary[myLibrary.length - 1];\n let deleteButton = document.createElement(\"button\");\n deleteButton.textContent = \"Delete\";\n deleteButton.setAttribute(\"data-index\", myLibrary.length - 1);\n deleteButton.classList.add(\"delete-button\");\n deleteButton.addEventListener(\"click\",function(){\n let index = deleteButton.getAttribute(\"data-index\");\n let divToRemove = document.querySelector(`[data-index = \"${index}\"]`);\n divToRemove.remove();\n });\n\n eachBookDiv.classList.add(\"book-div\");\n console.log(currentBook);\n//adds book to display\n inputText.forEach(function(el){\n let para = document.createElement(\"p\");\n para.textContent = el.value;\n para.classList.add(\"book\");\n eachBookDiv.setAttribute(\"data-index\", myLibrary.length - 1);\n eachBookDiv.appendChild(para);\n booksLibrary.appendChild(eachBookDiv);\n eachBookDiv.appendChild(deleteButton);\n })\n form.reset();\n }\n \n }", "changeSection(nextSection) {\r\n for (const key in this._section) {\r\n if (this._section.hasOwnProperty(key)) {\r\n if (this._section[key] === nextSection) {\r\n //hide \"old\" current section\r\n this.hideCurrentSection();\r\n this._currentSection = nextSection;\r\n //show \"old\" current section\r\n this._currentSection.classList.remove('hide');\r\n\r\n return;\r\n }\r\n }\r\n }\r\n console.error(\"changeSection: No valid section\");\r\n }", "function removeBook(event){\n const bookId = event.target.id\n myLibrary.splice(bookId, 1)\n displayBooks()\n \n}", "function changeProperties(e) {\n if (e.target.classList.contains(\"deleteBtn\")) {\n let bookindex = e.target.attributes[\"data-index\"].value;\n myLibrary.splice(bookindex, 1);\n const parent = e.target.parentElement.parentElement;\n parent.remove();\n } else if (e.target.classList.contains(\"change-read\")) {\n if (e.target.innerText === \"Yes\") e.target.innerText = \"No\";\n else e.target.innerText = \"Yes\";\n }\n}", "function updateBook(request, response, next) {\n bookDb.put(request.params.id, request.body)\n .then(() => {\n response.redirect(`/books/${request.params.id}`);\n })\n .catch( next );\n}", "function toBOOKS() {\n oldBookSel = bookSelect;\n cleanVideos();\n OLDSUBMODE = \"BOOKS\";\n SUBMODE = \"BOOKS\";\n removeListeners();\n listenersList = new Array(booksdown, booksup, booksmove);\n assignListeners();\n Offsset = 0;\n tween(theCanvas, \"fade\", {alpha: 100}, velFade, showListBookCollection, Quad_easeInOut, \"VISOR\", showListBookCollection);\n}", "function lendBook() {\r\n if (displayAvailableBooks()) {\r\n let lendIndex = prompt('To lend a book, input it\\'s index ');\r\n lentBooks.push(bookStore.splice(lendIndex - 1, 1));\r\n console.log('Books Lending Succesfull')\r\n }\r\n }", "function removeBook (e) {\n removeBtn = e.srcElement;\n let removedRow = removeBtn.id;\n for (i = 0; i < myLibrary.length; i++) {\n if (i == removedRow) {\n myLibrary.splice(i, 1);\n break;\n }\n }\n viewBooks();\n\n}", "function addBookToLibrary(e) {\n\te.preventDefault();\n\n\tif($title.value == '' || $author.value =='' || $pages.value == '' ){\n\t\talert('please input');\n\n\t}else{\n\t\tconst newTitle = $title.value;\n\t\tconst newAuthor = $author.value;\n\t\tconst newPages = $pages.value;\n\t\tconst newRead = getReadStatus();\n\t\tconst newBook = new Book(newTitle,newAuthor,newPages,newRead);\n\t\tmyLibrary.push(newBook)\n\t\tupdateLocalStorage(myLibrary);\n\t\tclearForm();\n\t\tdisplayLibrary();\n\t\ttoggleForm();\n\t}\n\n\t\n}", "restoreSavedBooks() {\n const savedBooks = localStorage.getItem(storageKey);\n savedBooks && this.setBooks(JSON.parse(savedBooks));\n }", "function removeNoteBooks(titleToRemove) {\n //titleToRemove is a button event bound to the object when created\n\n for (let i = 0; i < existingNoteBooks.length; i++) {\n if (existingNoteBooks[i].titleOfObject == titleToRemove.titleOfObject) {\n existingNoteBooks.splice(i, 1);\n if (existingNoteBooks.length == 1) {\n localStorage.removeItem(\"books\");\n //Testar om bara dashboard är kvar och tar bort nyckeln helt.\n }\n saveNotesToLocalStorage();\n saveNoteBooksToLocalStorage();\n break;\n }\n }\n\n updateCurrentNoteBooks();\n}", "function removeBook(book_id) {\n if (confirm(\"This book will be deleted from the list\")) {\n var rem = bookInStore.findIndex(\n (remove, index) => remove.BookID == book_id\n );\n\n bookInStore.splice(rem, 1);\n console.log(bookInStore);\n localStorage.setItem(\"BookSelf\", JSON.stringify(bookInStore));\n self();\n }\n}", "function addBookToPage(book) {\n let newBook = bookTemplate.clone(true, true);\n newBook.attr('data-id', book.id);\n newBook.find('.book-img').attr('src', book.image_url);\n newBook.find('.bookTitle').text(book.title);\n newBook.find('.bookDesc').text(book.description);\n if (book.borrower_id) {\n newBook.find('.bookBorrower').val(book.borrower_id);\n }\n bookTable.append(newBook);\n}", "function removeBook() {\n $(this).parent().attr('style', 'display: none');\n var isbnRetrieval = $(this).siblings().eq(2).prevObject[1].innerHTML;\n for (var i = 0; i < storageArr.length; i++) {\n if (isbnRetrieval === storageArr[i]) {\n var indexRemoval = storageArr.indexOf(isbnRetrieval);\n storageArr.splice(indexRemoval, 1);\n localStorage.setItem('book', JSON.stringify(storageArr));\n }\n }\n}", "updateBook(book, shelf) {\n BooksAPI.update(book, shelf)\n .then(() => {\n this.setState(previousState => {\n let books = previousState.books;\n for(let i = 0; i < books.length; i++) {\n if (book.id === books[i].id) {\n books[i].shelf = shelf;\n // Book is already there\n return {books: books};\n }\n }\n // this is a new book\n book.shelf = shelf;\n books.push(book);\n return {books: books};\n }\n )\n })\n }", "changeSection (section, data) {\n if (data) {\n _this.props.setMenuNavigation({ data })\n }\n if (!section) return\n if (_this.state.section === section) return\n _this.activeItemById(section)\n _this.setState({\n section: section\n })\n _this.hideMenu()\n }", "static removeBooks(isbn){\n const books=Store.getBooks();\n books.forEach((book , index) => {\n if(book.isbn === isbn){\n books.splice(index,1);\n }\n });\n //update the books in local storage\n localStorage.setItem('books',JSON.stringify(books));\n }", "function updateBookInDOM(book) {\n const bookElement = document.querySelector(`[id=\"${book.timestamp}\"]`);\n bookElement.querySelector(\".title\").textContent = book.title;\n bookElement.querySelector(\".author\").textContent = book.author;\n if (book.pages > 0) bookElement.querySelector(\".pages\").textContent = book.pages + \" pp\";\n if (book.status === \"read\") {\n bookElement.querySelector(\".status\").textContent = \"Already read\";\n } else {\n bookElement.querySelector(\".status\").textContent = \"Not read\";\n }\n updateBookInStorage(book);\n clearModalTimestamp();\n}", "function restoreEditItems(){\r\n\t\t $currentArticle.find(\".ownedImgs\").append($(\".bg .cl\").find(\"li\")).parent()\r\n\t\t .find(\".ownedMusics\").append($(\".music .cl\").find(\"li\"));\r\n\t}", "function addBookToLibrary(bookToAdd) {\n myLibrary.push(bookToAdd);\n updateLocalStorage();\n}", "function removeBook() {\n const book = this.parentElement;\n for (let i = 0; i < library.length; i++) {\n if (library[i].timestamp.toString() === book.id) {\n removeBookInStorage(library.splice(i,1)[0]);\n break;\n }\n }\n book.remove();\n}", "moveCourse(oldPosition, newPosition){\n this.setState((prevState) => {\n\n let courseSequenceObjectCopy = JSON.parse(JSON.stringify(prevState.courseSequenceObject));\n\n let courseToMove = courseSequenceObjectCopy.yearList[oldPosition.yearIndex][oldPosition.season].courseList[oldPosition.courseListIndex];\n\n // remove course from old position and insert at new position\n courseSequenceObjectCopy.yearList[oldPosition.yearIndex][oldPosition.season].courseList.splice(oldPosition.courseListIndex, 1);\n courseSequenceObjectCopy.yearList[newPosition.yearIndex][newPosition.season].courseList.splice(newPosition.courseListIndex, 0, courseToMove);\n\n // set new state based on changes\n return {\n \"courseSequenceObject\": courseSequenceObjectCopy\n };\n });\n }", "function removeBook(a) {\n\n myLibrary.splice(a,1);\n organize();\n store();\n total();\n}", "function handleEdit(){\r\n\t\thistory.push({ \r\n\t\t\tpathname: `/search/editDocument/${props.doc._id}`,\r\n\t\t\tstate: { fromButtonEdit: true, type: \"book\" }\r\n\t\t });\r\n\r\n\t}", "function addBookToLibrary(title, author, pages, read) {\n let newBook = new Book(title, author, pages, read)\n myLibrary.push(newBook)\n saveLibraryInStorage(myLibrary)\n renderBook(newBook)\n}", "static removeBook(isbn){\n const books = Store.getBooks();\n // looping through the books to find proper book-isbn to remove\n books.forEach((book,index) => {\n if(book.isbn === isbn){\n // delete that 1 book from the mentioned index\n books.splice(index, 1);\n }\n });\n\n localStorage.setItem('books', JSON.stringify(books));\n }", "function updateLibraryDisplay() {\n const library = document.getElementById('library');\n let index = 0;\n library.innerHTML = '';\n\n myLibrary.forEach(book => {\n let card = document.createElement('div');\n card.classList.add('card');\n card.setAttribute('data-index', index);\n book.index = index;\n\n card.innerHTML = `\n <div class=\"tools\">\n <button class=\"dlt-button-card\"><i class=\"fa fa-trash\"></i></button>\n </div>\n <div class=\"main\">\n <label for=\"title\">Title</label>\n <div class=\"main-title\"></div>\n\n <label for=\"author\">Author</label>\n <div class=\"main-author\"></div>\n\n <label for=\"pages\">Number of pages</label>\n <div class=\"main-pages\"></div>\n\n <label for=\"reading\">I have already read it</label>\n <label class=\"switch\">\n <input class=\"input-label\" type=\"checkbox\" name=\"read\">\n <span class=\"slider round\"></span>\n </label>\n </div>\n `;\n\n //book main part\n const main = card.querySelector('.main');\n let mainTitle = main.querySelector('.main-title');\n let mainAuthor = main.querySelector('.main-author');\n let mainPages = main.querySelector('.main-pages');\n\n mainTitle.innerHTML = book.title;\n mainAuthor.innerHTML = book.author;\n mainPages.innerHTML = book.pages;\n\n //toggle read part\n const readlabel = card.querySelector('.switch');\n readlabel.setAttribute(\"for\", (\"read\" + index));\n const inputlabel = card.querySelector('.input-label');\n inputlabel.setAttribute(\"id\", (\"read\" + index));\n inputlabel.addEventListener(\"change\", updateReadChange);\n if (book.read) inputlabel.setAttribute(\"checked\", \"checked\");\n\n //delete button part\n const deleteButton = card.querySelector('.dlt-button-card');\n deleteButton.addEventListener('click', deleteCard);\n\n //add card to library\n library.prepend(card);\n index++;\n });\n}", "postBook(evt) {\n if (this.selectedBook === null) {\n this.postNewBook(evt);\n } else {\n this.postEditBook(evt);\n }\n }", "function returnBook(id,indx) {\nconsole.log(id ,indx) \nunAvailableBooks.forEach(element=>{\n if(element.id === id){\n console.log(element.id , id)\n element.howTakeIt = \"Available\";\n addBookToAvaBooks(element)\n }\n })\n removeFromUnAvailableBooks(id ,indx)\n display()\n}", "function undo() {\n\t\tif (actionHistory.length) {\n\t\t\tlet lastAction = actionHistory.pop(),\n\t\t\ttermId = lastAction[0], //indicates term moved\n\t\t\tsourceId = lastAction[1], //indicates where it was moved from\n\t\t\tdestinationId = lastAction[2]; //indicates where it was moved to\n\t\t\tvar term = $.get(termId);\n\n\t\t\tif (sourceId.includes(\"termsContainer\")) { //A->B\n\t\t\t\trestoreTerm(term);\n\t\t\t\t$.get(\"new_\"+termId).remove();\n\t\t\t}\n\t\t\telse if (destinationId.includes(\"termsContainer\")) { //B->A\n\t\t\t\t$.get(sourceId).appendChild(copyTerm(term));\n\t\t\t\thideTerm(term);\n\t\t\t}\n\t\t\telse //B -> B\n\t\t\t{\n\t\t\t\t$.get(sourceId).appendChild($.get(\"new_\"+termId));\n\t\t\t}\n\t\t}\n\t}", "bookShelfUpdate(moveBook,shelf){\n BooksAPI.update(moveBook,shelf).then(()=>{\n const updatedBook = {\n ...moveBook,\n shelf\n } \n this.setState( oldState => ({books: oldState.books.filter(bk => bk.id !== moveBook.id).concat([updatedBook])\n }))\n }).catch((error)=>{\n alert('Bookshelfupdate',error) \n })\n }", "function removeBook(e){\n index = e.target.dataset.index;\n console.log(e.target);\n library.splice(index, 1);\n displayLibrary();\n}", "function addBookToLibrary(book) {\n let bookList = document.querySelector('.bookList');\n \n const newBook = new Book();\n myLibrary.push(newBook);\n }", "function reload_book_page() {\n\twrapper.reload_book_page();\n}", "function changeStatus(e) {\n let bookIndex = e.target.dataset.index;\n let chosenBook = library[bookIndex];\n\n if (chosenBook.readStatus == \"already read\") {\n chosenBook.readStatus = \"unread\";\n } else {\n chosenBook.readStatus = \"already read\";\n }\n createTable();\n saveLibrary(library);\n }", "function removeBook(event) {\n const button = event.target;\n const libraryIndex = button.parentElement.dataset.index;\n myLibrary.splice(libraryIndex, 1);\n displayLibrary();\n}", "reloadBookCount()\n {\n this.getNumberOfAvailableBooks();\n }", "function addBooksToLibrary(title, author, pages) {\r\n let newItem = new book(title, author, pages); \r\n myLibrary.push(newItem);\r\n }", "function removeBook(e) {\n let i = document.getElementById('selected-book').dataset.index\n let div = document.querySelector(`div[data-index='${i}']`)\n\n div.remove();\n updateIndexAttributes(i)\n library.splice(i, 1)\n exitWindows() \n}", "function saveBook(e) {\n var newAuthor;\n var index;\n\n // loop to find the book object id that matches the id of the save button clicked\n for (var i=0; i<books.length; i++) {\n if ( books[i].id === e.target.id ) {\n index = i;\n break;\n }\n }\n\n // check if there are authors returned from google\n if(!books[index].volumeInfo.authors) {\n // if no authors, save a text string\n newAuthor = \"No Author provided.\";\n }\n // check if multiple authors, then join them together as one string to save\n else if(books[index].volumeInfo.authors.length > 1) {\n newAuthor = books[index].volumeInfo.authors.join(\", \");\n }\n // only a single author to save\n else {\n newAuthor = books[index].volumeInfo.authors[0];\n };\n // save the index of the book save button clicked\n bookIndex = books[index].id;\n // call save book route to save the book to database\n API.saveBook({\n title: books[index].volumeInfo.title,\n // sometimes no thumbnail image returned from google and need to handle this\n image: books[index].volumeInfo.imageLinks ? books[index].volumeInfo.imageLinks.thumbnail : \"https://dummyimage.com/128x206/c4bfb2/051421.jpg&text=No+Image+\",\n link: books[index].volumeInfo.infoLink,\n // sometimes no book description returned from google and need to handle this\n synopsis: books[index].volumeInfo.description ? books[index].volumeInfo.description : \"No description available for this book.\",\n author: newAuthor\n })\n .then(res => {\n // call update books to remove the just saved book from page\n updateBooks(bookIndex);\n })\n .catch(err => console.log(err));\n }", "function returnBookToStore() {\r\n if (displayLentBooks()) {\r\n let returnIndex = prompt('To return a book, INPUT IT\\'S INDEX');\r\n bookStore.push(lentBooks.splice(returnIndex - 1, 1));\r\n console.log('Book Returned Successfull');\r\n } \r\n }", "function bkmkMoved (bnId, curParentId, targetParentId, targetIndex) {\n//console.log(\"Move event on: \"+bnId+\" from: <<\"+curParentId+\">> to: <<\"+targetParentId+\", \"+targetIndex+\">>\");\n if (!isDisplayComplete) // If we get an event while not yet ready, ignore\n\treturn;\n\n // Retrieve the real BookmarkNode and all its children, and its new parent\n let BN = curBNList[bnId];\n // Remember current trash state (from curParentId BN, since BN was already modified - except in private page)\n let curInBSP2Trash = curBNList[curParentId].inBSP2Trash;\n let targetParentBN = curBNList[targetParentId];\n let tgtInBSP2Trash = targetParentBN.inBSP2Trash;\n if (backgroundPage == undefined) { // Redo change in our own copy of curBNList\n\t// Remove item and its children from its current parent, but keep them in list\n\t// as this is only a move.\n\tBN_delete(BN, curParentId, false);\n\t// Then insert it at new place, again not touching the list\n\tif (options.trashEnabled) { // Maintain inBSP2Trash and trashDate fields\n\t BN_markTrash(BN, tgtInBSP2Trash);\n\t}\n\tBN_insert(BN, targetParentBN, targetIndex, false);\n }\n\n // Get move description in current (= old) reference\n if ((tgtInBSP2Trash == true) && !options.trashVisible) { // Simply remove source row, there is no visible target where to insert\n\tif (curInBSP2Trash != true) { // If source is also in trash, nothing wisible to do ..\n\t let movedRow = curRowList[bnId];\n\t removeBkmks(movedRow, true); // remove from cur lists, as there is no visible targets\n\t}\n }\n else if ((curInBSP2Trash == true) && !options.trashVisible) { // Simply insert tartget row, there is no wisible source to remove from\n\tlet targetParentRow = curRowList[targetParentId];\n\n\t// Find insertion point, in current (= old) reference\n\tlet targetRow;\n\t// Introduce robustness in case the BN tree is empty and index is not 0, as that seems to occur some times\n\tlet children = targetParentBN.children;\n\tif ((targetIndex == 0) || (children == undefined)) { // Insert just after parent row\n\t // Note that this also takes care of the case where parent had so far no child\n\t targetRow = targetParentRow.nextElementSibling; // Can be null if we move at end\n\t}\n\telse { // Insert just after previous row\n\t\t // ASSUMPTION (true so far): when multiple moves / creates to same parent, like in multi-select move\n\t\t // or reorder or ..., items are sent to us in increasing row/index order, so previous\n\t\t // rows to current item under process are always already at the right place.\n\t\t // Note that in such multi operations, things have been all processed in background first or the copy,\n\t\t // so the BN tree is not any more in sync with display.\n\t let previousSibblingBN = children[targetIndex-1];\n\t if (previousSibblingBN.inBSP2Trash && !options.trashVisible) { // Protect against inserting just after BSP2 trash when not visible\n\t\tif (targetIndex < 2) {\n\t\t targetRow = targetParentRow.nextElementSibling; // Can be null if we move at end\n\t\t}\n\t\telse {\n\t\t let previousBN = BN_lastDescendant(children[targetIndex-2]);\n\t\t targetRow = curRowList[previousBN.id].nextElementSibling; // Can be null if we move at end\n\t\t}\n\t }\n\t else {\n\t\tlet previousBN = BN_lastDescendant(previousSibblingBN);\n\t\ttargetRow = curRowList[previousBN.id].nextElementSibling; // Can be null if we move at end\n\t }\n\t}\n\n\t// We got the insert point in targetRow (null if at end), proceed to move\n\t// Insert the item at its new place (with its children) using global variable insertRowIndex\n\t// and get the last inserted row in return.\n\tif (targetRow == null) // Moving at end of bookmarks table\n\t insertRowIndex = bookmarksTable.rows.length;\n\telse insertRowIndex = targetRow.rowIndex; // Get the updated row index of target\n\tinsertBkmks(BN, targetParentRow);\n }\n else { // Normal case\n\tlet movedRow = curRowList[bnId];\n\tlet curRowIndex = movedRow.rowIndex;\n\tlet targetParentRow = curRowList[targetParentId];\n\tlet targetCurIndex = targetIndex;\n\n\t// Find insertion point, in current (= old) reference\n\tlet targetCurRowIndex;\n\tlet targetRow;\n\t// Introduce robustness in case the BN tree is empty and index is not 0, as that seems to occur some times\n\tlet children = targetParentBN.children;\n\tif ((targetCurIndex == 0) || (children == undefined)) { // Insert just after parent row\n\t // Note that this also takes care of the case where parent had so far no child\n\t targetCurRowIndex = targetParentRow.rowIndex + 1;\n\t targetRow = targetParentRow.nextElementSibling; // Can be null if we move at end\n\t}\n\telse { // Insert just after previous row\n\t\t // ASSUMPTION (true so far): when multiple moves / creates to same parent, like in multi-select move\n\t\t // or reorder or ..., items are sent to us in increasing row/index order, so previous\n\t\t // rows to current item under process are always already at the right place.\n\t\t // Note that in such multi operations, things have been all processed in background first or the copy,\n\t\t // so the BN tree is not any more in sync with display.\n\t let previousSibblingBN = children[targetIndex-1];\n\t if (previousSibblingBN.inBSP2Trash && !options.trashVisible) { // Protect against inserting just after BSP2 trash when not visible\n\t\tif (targetIndex <= children.length) { // Remember that the child was already added in the BN tree in the background task\n\t\t targetCurRowIndex = targetParentRow.rowIndex + 1;\n\t\t targetRow = targetParentRow.nextElementSibling; // Can be null if we move at end\n\t\t}\n\t\telse {\n\t\t let previousBN = BN_lastDescendant(children[targetIndex-2]);\n\t\t targetRow = curRowList[previousBN.id];\n\t\t targetCurRowIndex = targetRow.rowIndex + 1; // Can be at end of bookmarks table\n\t\t targetRow = targetRow.nextElementSibling; // Can be null if we move at end\n\t\t}\n\t }\n\t else {\n\t\tlet previousBN = BN_lastDescendant(previousSibblingBN);\n\t\ttargetRow = curRowList[previousBN.id];\n\t\ttargetCurRowIndex = targetRow.rowIndex + 1; // Can be at end of bookmarks table\n\t\ttargetRow = targetRow.nextElementSibling; // Can be null if we move at end\n\t }\n\t}\n\n\t// We got the move point in targetRow (null if at end), and its position in\n\t// targetCurRowIndex, proceed to move\n//console.log(\"curRowIndex: \"+curRowIndex+\" targetCurRowIndex: \"+targetCurRowIndex);\n\n\t// Remove item and its children from display, but keep them in their cur lists\n\t// as this is only a move.\n\t// The returned value is the row which took its place in the table (or null if\n\t// removed at end).\n\tlet deletePos = removeBkmks(movedRow, false);\n\n\t// Insert the item at its new place (with its children) using global variable insertRowIndex\n\t// and get the last inserted row in return.\n\tif (curRowIndex == targetCurRowIndex) { // targetRow has disappeared, it was the moved row\n\t // We are then visually inserting where it was deleted\n\t if (deletePos == null) { // This is the end of the bookmark table\n\t\tinsertRowIndex = bookmarksTable.rows.length;\n\t }\n\t else {\n\t\tinsertRowIndex = deletePos.rowIndex;\n\t }\n\t}\n\telse {\n\t if (targetRow == null) // Moving at end of bookmarks table\n\t\tinsertRowIndex = bookmarksTable.rows.length;\n\t else insertRowIndex = targetRow.rowIndex; // Get the updated row index of target\n\t}\n\tinsertBkmks(BN, targetParentRow);\n }\n\n // State of parent folders may change, so save folder open state\n saveFldrOpen();\n\n if (options.showPath || options.trashEnabled) {\n\t// Trigger an update as results can change, if there is a search active\n\ttriggerUpdate();\n }\n}", "function addBookToLibrary() {\n const title = document.querySelector('#title-input').value;\n const author = document.querySelector('#author-input').value;\n const pages = document.querySelector('#pages-input').value;\n let read = document.querySelector('#read-input').checked;\n if (read == true) {\n read = \"read\";\n } else {\n read = \"unread\";\n } ;\n addForm.reset();\n addForm.hidden = true;\n addBtn.hidden = false;\n submitBtn.hidden = true;\n myLibrary.push(new Book(title, author, pages, read));\n clearTable();\n displayBooks();\n}", "function deletePage() {\n var $wp = $('.write-pages li'); // the list of book pages\n var $page = $($wp.get(editIndex)); // the current page\n $page.remove(); // remove it\n setupEditContent();\n setModified();\n }", "removeFromLS(isbn) {\n const books = getFromLocalStore();\n\n books.forEach((book, index) => {\n if (book.isbn === isbn) {\n books.splice(index, 1);\n }\n });\n\n localStorage.setItem(\"book\", JSON.stringify(books));\n }", "function addBookToLibrary() {\n let Num = myLibrary.length;\n const name = document.getElementById('name').value;\n const author = document.getElementById('author').value;\n const pages = document.getElementById('pages').value;\n const read = \"Have Not Read\"\n const bookNum = \"book\" + Num;\n\n myLibrary.push(new Book(name, author, pages, read, bookNum))\n\n let myLibraryEnd = myLibrary.length - 1;\n addBookHTML(myLibraryEnd);\n}", "function displayBooks(){\n\t//Clear the existing bookcards before populating new list\n\tbookshelf.innerHTML=\"\";\n\n\tmyLibrary.forEach((book, index)=>{\n\tbook.index = index;\n\tlet bookCard = document.createElement(\"div\");\n\tbookCard.classList.add(\"bookCard\");\n\t\t\n\t// create erase button and add a function to delete a element from \n\t//\t'myLibrary' array upon click\t\n\tlet deleteButton = document.createElement(\"span\");\n\tdeleteButton.innerHTML = \"&times;\";\n\tdeleteButton.classList.add(\"close\");\n\tdeleteButton.classList.add(\"delete\");\n\tdeleteButton.addEventListener(\"click\", function(){\n\t\tmyLibrary.splice(book.index, 1);\n\t\tdisplayBooks();\n\t});\t\n\t\t\n\tlet bookTitle = document.createElement(\"div\");\n\tbookTitle.classList.add(\"bookTitle\");\n\tlet bookAuthor = document.createElement(\"div\");\n\tlet bookPages = document.createElement(\"div\");\n\tlet bookLang = document.createElement(\"div\");\n\tbookTitle.innerHTML = book.title;\n\tbookAuthor.innerHTML = \"Author: \" + book.author;\n\tbookPages.innerHTML = \"Number of Pages: \" + book.pages;\n\tbookLang.innerHTML = \"Language: \" + book.lang;\n\t\n\tlet bookReadInfo = document.createElement(\"div\");\n\tbookReadInfo.innerHTML = \"Mark as Read: \";\n\tlet bookRead = document.createElement(\"input\");\n\tbookRead.setAttribute(\"type\", \"checkbox\");\n\tbookRead.addEventListener(\"click\", function(){\n\t\tif(bookRead.checked){\n\t\t\tbookCard.classList.add(\"read\");\n\t\t} else {\n\t\t\tbookCard.classList.remove(\"read\");\n\t\t}\n\t\t\n\t})\n\t\n\t\t\n\tbookReadInfo.appendChild(bookRead);\n\t\t\n\tbookCard.appendChild(deleteButton);\n\tbookCard.appendChild(bookTitle);\n\tbookCard.appendChild(bookAuthor);\n\tbookCard.appendChild(bookPages);\n\tbookCard.appendChild(bookLang);\n\tbookCard.appendChild(bookReadInfo);\n\n\tbookshelf.appendChild(bookCard);\n\t})\n\t\n}", "function addBookToLibrary() {\n library.push(new Book(form.elements[0].value, //title\n form.elements[1].value, //author\n parseInt(form.elements[2].value), //pages\n form.elements[3].checked)) //read \n clearLibrary()\n sortLibrary()\n createStoredCards()\n saveLocal()\n}", "async function HandleUpload() {\n /*let newBook={id:bookId, title, genre, sinopsis, coverImageData:imageData, price, author, comments};\n let books=await AsyncStorage.getItem('books');\n books=JSON.parse(books);\n const index=books.findIndex(book=>book.id===bookId);\n books[index]=newBook;\n books=JSON.stringify(books);\n await AsyncStorage.setItem('books', books);*/\n var book=new Book(title, sinopsis, author, genre, price, imageData, comments, bookId);\n var result=await book.Update();\n if(result) {\n ClearFields();\n navigation.navigate('Store');\n }\n else {\n Alert.alert(\"Error:\", \"Couldn't Save the edits to the book...\");\n }\n }", "setBooks(state, val) {\n state.books = val\n }", "updateBook(obj){\n\t\tconst book = this.getBook(obj.id);\n\t\tbook.updateProperties(obj);\n\t\tthis.notifySubscribers();\n\t}", "static removeBook(isbn){\r\n const books = Store.getBooks()\r\n\r\n // books aris titon object xolo index ukve misi mdebareoba listshi \r\n books.forEach((book, index) => {\r\n if(book.isbn === isbn){\r\n\r\n books.splice(index, 1)\r\n }\r\n })\r\n // varestartebt yvelafris shemdeg local storages\r\n localStorage.setItem('books', JSON.stringify(books))\r\n }", "function resetToLibraryIndexPage () {\n //console.log(\"Sending back to Library Index Page...\");\n $location.path(\"/library\");\n }", "function remove(localBookList, bookName) {\n\tlet newBookList = localBookList.slice(); //This will create a new copy of a entered bookList\n\tvar book_index = localBookList.indexOf(bookName);\n\tif (book_index >= 0) {\n\t\tnewBookList.splice(book_index, 1);\n\t\treturn newBookList;\n\n\t\t// Change code above this line\n\t}\n}", "function addBookToLibrary()\n{\n \n}", "function addBookToLibrary(newObj) {\n myLibrary.push(newObj);\n}", "removeBook(currentShelf) {\n if (currentShelf === 'none') {\n this.props.books.forEach((book, index) => {\n if (book.id === this.props.bookId) {\n this.props.books.splice(index, 1);\n }\n }\n );\n }\n }", "function remove (bookName) {\n if (bookList.indexOf(bookName) >= 0) {\n let updatedList = bookList\n return updatedList.splice(0, 1, bookName);\n \n // Add your code above this line\n }\n}", "function addBookToLibrary(book){\n\tmyLibrary.push(book);\n\tdisplayBooks();\n}", "updateSearchResult(books){\n\t\tconst booksMap = books.reduce(\n\t\t\t(map, book) => map.set(book.id, book),\n\t\t\tnew Map()\n\t\t);\n\n\t\tif (!this.state.searchResult.length || this.state.searchResult.some(book => !booksMap.has(book.id)))\n\t\t{\n\t\t\tbooks = books.map(book => {\n\t\t\t\tconst existedBook = this.state.books.find(b => b.id === book.id);\n\t\t\t\treturn existedBook ? existedBook : Object.assign({}, book, {\n\t\t\t\t\tshelf: \"none\"\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tthis.setState({ searchResult: books });\n\t\t}\n\t}", "function changeNav( $section ) {\n config.$navlinks.eq( config.currentLink ).removeClass( 'scenario-current' );\n config.currentLink = $section.index( 'section' );\n config.$navlinks.eq( config.currentLink ).addClass( 'scenario-current' );\n }", "function pushBookToLibrary(book) {\n myLibrary.push(book)\n render(myLibrary)\n}", "function addBooksToPage(libraryToDisplay) {\n libraryToDisplay.forEach(function (book) {\n const singleBook = document.createElement('div');\n\n const bookTitle = document.createElement('p');\n bookTitle.classList.add('book-title');\n bookTitle.textContent = book.title + \"\\r\\n\";\n\n const bookContent = document.createElement('p');\n singleBook.setAttribute('style', 'white-space: pre;');\n bookContent.textContent += \"By: \" + book.author + \"\\r\\n\";\n bookContent.textContent += \"Number of pages: \" +book.pages + \"\\r\\n\";\n bookContent.classList.add('book-content');\n singleBook.classList.add((book.isRead == 'Read' ? 'books' : 'books-unread'));\n\n /* add delete button */\n const deleteBtn = document.createElement('button');\n deleteBtn.textContent = \"Delete\";\n deleteBtn.classList.add('delete-button');\n\n /* add a status button */\n const statusBtn = document.createElement('button');\n statusBtn.textContent = book.isRead;\n statusBtn.classList.add('status-button');\n\n /* create data attributes that saves index of current book so we can delete and update it later */\n deleteBtn.setAttribute('data-index', libraryToDisplay.indexOf(book));\n statusBtn.setAttribute('data-status', libraryToDisplay.indexOf(book));\n\n singleBook.appendChild(bookTitle)\n singleBook.appendChild(bookContent)\n singleBook.appendChild(statusBtn); // add status button to book\n singleBook.appendChild(deleteBtn); // add delete button to book\n bookContainer.appendChild(singleBook); // add book to the container\n });\n}", "finishCurrentBook(){\n for(var i=0; i<=this.lista.length-1;i++){\n if(this.lista[i].title==this.actualRead){\n this.lista[i].read=true\n this.booksRead++;\n this.booksUnread--;\n this.lista[i].readDate=Date.now();\n this.lastBook();\n this.actualBook();\n this.nextBook();\n console.log(\"e\");\n break;\n }else{\n console.log(\"El libro ya estaba marcado como leido, operacion fallida con exito\")\n }\n }\n }", "function newBook(doc) {\n let book = document.createElement('div');\n let list = document.createElement('ul');\n let name = document.createElement('li');\n let author = document.createElement('li');\n let pages = document.createElement('li');\n let read = document.createElement('li');\n let closeButton = document.createElement('button');\n let changeStatus = document.createElement('button');\n\n book.classList.add('book');\n closeButton.classList.add('button-remove-book')\n changeStatus.classList.add('change-status-button')\n read.classList.add('read-status')\n\n book.setAttribute('data-id', doc.id);\n name.textContent = `Name: ${doc.data().name}`;\n author.textContent = `Author: ${doc.data().author}`;\n pages.textContent = `Pages: ${doc.data().pages}`;\n read.textContent = `Read: ${doc.data().read}`;\n closeButton.textContent = 'x';\n changeStatus.textContent = '';\n\n list.appendChild(name);\n list.appendChild(author);\n list.appendChild(pages);\n list.appendChild(read);\n read.appendChild(changeStatus);\n\n book.appendChild(list);\n book.appendChild(closeButton);\n\n main.appendChild(book);\n\n if (doc.data().read == 'yes') {\n book.classList.add('status-read');\n }\n\n closeButton.addEventListener('click', (e) => {\n e.stopPropagation();\n\n let id = e.target.parentElement.getAttribute('data-id');\n db.collection('books').doc(id).delete();\n });\n\n changeStatus.addEventListener('click', (e) => {\n e.stopPropagation();\n\n e.target.parentElement.parentElement.parentElement.classList.toggle('status-read');\n let id = e.target.parentElement.parentElement.parentElement.getAttribute('data-id');\n if (doc.data().read == 'yes') {\n db.collection('books').doc(id).update({read: 'no'})\n setTimeout(() => {window.location.reload()}, 150)\n } else {\n db.collection('books').doc(id).update({read: 'yes'})\n setTimeout(() => {window.location.reload()}, 150)\n }\n })\n}", "function removeBook(id){\n if(Number.isInteger(parseInt(id))){\n myLibrary.splice(id, 1)\n updateTable()\n }\n}", "function deleteBook(e) {\n e.target.parentElement.remove();\n libraryBooks.splice(e.target.parentElement.getAttribute(\"data-num\"), 1);\n addDataAttr(bookList);\n}", "static removeBook(isbn) {\n\t\tconst books = Store.getBooks();\n\n\t\tbooks.forEach(function (book, index) {\n\t\t\tif (book.isbn == isbn) {\n\t\t\t\t//this will remove 1 book form the current index\n\t\t\t\tbooks.splice(index, 1);\n\t\t\t}\n\t\t});\n\t\tlocalStorage.setItem(\"books\", JSON.stringify(books));\n\t\tconsole.log(isbn);\n\t}", "static removeBook(isbn) {\r\n const books = Store.getBooks();\r\n\r\n books.forEach((book, index) => {\r\n if (book.isbn === isbn) {\r\n books.splice(index, 1);\r\n }\r\n });\r\n\r\n localStorage.setItem('books', JSON.stringify(books));\r\n }", "remove() {\r\n this.page.sections = this.page.sections.filter(section => section._memId !== this._memId);\r\n reindex(this.page.sections);\r\n }" ]
[ "0.607682", "0.6066685", "0.603767", "0.6022925", "0.5861498", "0.58340627", "0.5763548", "0.57497007", "0.57463616", "0.57012933", "0.56788296", "0.5678186", "0.566025", "0.566025", "0.5647908", "0.55991626", "0.55944294", "0.5585154", "0.5569484", "0.5551819", "0.5549817", "0.5531912", "0.5505953", "0.5486411", "0.5461989", "0.5441647", "0.54401237", "0.543917", "0.5437105", "0.5413961", "0.5405133", "0.53990114", "0.5390184", "0.53820777", "0.53735715", "0.5361273", "0.53561586", "0.5356036", "0.53386825", "0.53294593", "0.5329348", "0.53282326", "0.5323365", "0.5316691", "0.53112966", "0.53099436", "0.52994716", "0.5298563", "0.5286276", "0.52832246", "0.52710164", "0.52626854", "0.52609736", "0.525865", "0.52531874", "0.52505445", "0.52395916", "0.5222656", "0.52180165", "0.52035254", "0.5164858", "0.51523393", "0.5152227", "0.514659", "0.5146236", "0.5145966", "0.51452106", "0.5144618", "0.51443654", "0.5123681", "0.51136017", "0.51099795", "0.5109871", "0.5105582", "0.5099801", "0.5091561", "0.50842226", "0.5081023", "0.50799626", "0.5078123", "0.50751066", "0.5071618", "0.50693804", "0.50666916", "0.5058434", "0.50581366", "0.50491774", "0.50443494", "0.50424993", "0.50424516", "0.504021", "0.5038411", "0.50327295", "0.50241387", "0.50192285", "0.5010674", "0.5009397", "0.5006265", "0.5006099", "0.5002054", "0.50001705" ]
0.0
-1
Mouseover function to fade chords
function mouseover(d, i) { chord.classed("fade", function(p) { return p.source.index != i && p.target.index != i; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseover(d, i) {\n chord.classed('fade', function(p) {\n return p.source.index != i && p.target.index != i;\n });\n }", "function mouseOn() {\n $(this).fadeTo(20,1);\n }", "function mouseover(d, i) {\n chord.transition()\n .delay(function(p, j) {\n return j;\n })\n .duration(500)\n .style(\"opacity\",function(p) {\n if (p.source.index != i && p.target.index != i) {\n return 0;\n } else {\n return 1;\n }\n });\n }", "CrossFade() {}", "function fade(opacity, event) {\n return function (g, i) {\n if (event === 'mouseover') {\n //set chord data\n let chordData = {\n group: groups[getGroupIndex(slices[g.index])],\n sourceValue: slices[g.index],\n measureValue: g.value\n };\n\n //get text content\n let textContent = diagram.getContent(getExpressionedValue(chordData), currentSerie, diagram.tooltip.format);\n\n //show tooltip content\n diagram.showTooltip(textContent);\n } else if (event === 'mouseout') {\n //hide popup\n diagram.hideTooltip();\n }\n\n //gover event\n diagramG.selectAll('.chord path')\n .filter(function (d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style('fill-opacity', opacity);\n };\n }", "function mouseOver(ev) {\n ev.target.style.opacity = 0.5;\n}", "onMouseOver(i){\n document.getElementById(i.toString()).classList.remove(\"hidden\")\n document.getElementById(i.toString()).classList.add(\"oppacityTransition\")\n }", "function fade_arrow(arrowInt) {\r\n highlight_element(document.getElementById(\"arrow\" + String(arrowInt)), clickedOpacity);\r\n}", "function fade(opacity) {\r\n\t return function(d,i) {\r\n\t \tsvg.selectAll(\".chord path\")\r\n\t \t\t.filter(function(d) { return d.source.index != i && d.target.index != i; })\r\n\t \t\t.transition()\r\n\t \t.style(\"opacity\", opacity);\r\n\t };\r\n\t}", "function fade(opacity) {\n return function(d, i) {\n\twrapper.selectAll(\"path.chord\")\n\t\t.filter(function(d) { return d.source.index != i && d.target.index != i && Names[d.source.index] != \"\"; })\n\t\t.transition()\n\t\t.style(\"opacity\", opacity);\n };\n}//fade", "function fade(opacity) {\n return function(d, i) {\n wrapper.selectAll(\"path.chord\")\n .filter(function(d) { return d.source.index !== i && d.target.index !== i && Names[d.source.index] !== \"\"; })\n .transition()\n .style(\"opacity\", opacity);\n };\n }//fade", "function mouseoverArc(d) {\n d3.selectAll('path.chord').classed('fade', function(p) {\n return d.index !== p.source.index && d.index !== p.target.index;\n });\n }", "function mouseReleased() {\n osc.fade(0, 0.5);\n}", "function mouseReleased() {\n osc.fade(0,0.5);\n}", "function mouseReleased() {\n osc.fade(0,0.5);\n}", "function mouseReleased() {\n osc.fade(0, 0.5);\n}", "function fademeup(thistext,layer, startalpha, endalpha, duration) {\n\t//var alpha = thistext.getAlpha();\n\tvar alpharange = endalpha-startalpha;\n\t //convert from sec to ms\n\tvar val = 0.05;\n\tvar incr = Math.floor((duration*1000)/(alpharange/val));\n\tvar fadeupvar;\n\tfadeupvar = setInterval(function() {if (thistext.getAlpha() < endalpha ) {thistext.setAlpha(thistext.getAlpha()+val);layer.draw();} else clearInterval(fadeupvar); layer.draw(); }, incr);\n}", "function fade(opacity) {\n\treturn function(d, i) {\n\t svg.selectAll(\"path.chord\")\n\t\t .filter(function(d) { return d.source.index != i && d.target.index != i; })\n\t\t .transition()\n\t\t .style(\"stroke-opacity\", opacity)\n\t\t .style(\"fill-opacity\", opacity);\n\t};\n }", "function fade(opacity) {\r\n\treturn function(d,i) {\r\n\t\tsvg.selectAll(\"path.chord\")\r\n\t\t.filter(function(d) { return d.source.index != i && d.target.index != i; })\r\n\t\t.transition()\r\n\t\t.style(\"opacity\", opacity);\r\n\t};\r\n}", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"opacity\", opacity);\n };\n }", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"opacity\", opacity);\n };\n }", "function mouseoverChord(d) {\n svg.selectAll('path.chord').classed('fade', function(p) {\n return !(p.source.orgindex === d.source.orgindex && p.target.orgindex === d.target.orgindex);\n });\n }", "setupFade(fadeTime, from, to, onFadeDone) {}", "function fade(opacity) {\n return function(d, i) {\n svg.selectAll(\"path.chord\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n\t\t.transition()\n .style(\"stroke-opacity\", opacity)\n .style(\"fill-opacity\", opacity);\n };\n}", "function fade(opacity) {\n return function(d, i) {\n svg.selectAll(\"path.chord\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n\t\t.transition()\n .style(\"stroke-opacity\", opacity)\n .style(\"fill-opacity\", opacity);\n };\n}", "function mouseOverCircle() {\n $(this).css(\"opacity\", \"0.5\");\n }", "function fade(opacity) {\n return function(g, i) {\n\n console.log(\"Test\");\n\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"fill\", \"#FF0000\");\n };\n}", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"opacity\", opacity);\n };\n}", "function FadeHover(element) {\n\t\towl.Each(owl.Array.Make(element), function(e) {\n\t\t\ttimerNew(e, Config.Timer.FadeHover, Config.Frame.End, Config.FadeHover.Min, -Config.Frame.Step, Config.Frame.Pause, 0, 0, function(t) { owl.Css.Opacity(e, t.Value); });\n\t\t});\n\t\tnew owl.Event(element, \"mouseover\", FadeHoverEffect);\n\t\tnew owl.Event(element, \"mouseout\", FadeHoverEffect);\n\t}", "function ws_fade(c,a,b){var e=jQuery,g=e(this),d=e(\".ws_list\",b),h={position:\"absolute\",left:0,top:0,width:\"100%\",height:\"100%\",maxHeight:\"none\",maxWidth:\"none\",transform:\"translate3d(0,0,0)\"},f=e(\"<div>\").addClass(\"ws_effect ws_fade\").css(h).css(\"overflow\",\"hidden\").appendTo(b);this.go=function(i,j){var k=e(a.get(i)),m={width:k.width(),height:k.height()};k=k.clone().css(h).css(m).appendTo(f);if(!c.noCross){var l=e(a.get(j)).clone().css(h).css(m).appendTo(f);wowAnimate(l,{opacity:1},{opacity:0},c.duration,function(){l.remove()})}wowAnimate(k,{opacity:0},{opacity:1},c.duration,function(){g.trigger(\"effectEnd\");k.remove()})}}", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"opacity\", opacity);\n };\n }", "function fade(opacity) {\n return function(d, i) {\n console.log(d);\n console.log(i);\n chsvg.selectAll(\"path.chord\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"stroke-opacity\", opacity)\n .style(\"fill-opacity\", opacity);\n };\n}", "function fade(opacity) {\n\t\treturn function(g, i) {\n\t\t\tsvg.selectAll(\".chord path\")\n\t\t\t\t.filter(function(d) { return d.source.index != i && d.target.index != i; })\n\t\t\t\t.transition()\n\t\t\t\t.style(\"opacity\", opacity);\n\t\t};\n\t}", "function mouseOver(ref)\r\n{\r\n ref.style.background = \"#eeeeee\";\r\n}", "function mouseoutChord(opacityIn, opacityOut) {\r\n \treturn function (d, i) {\r\n \t\td3.select(this.ownerSVGElement)\r\n \t\t.selectAll(\"path.chord\")\r\n \t\t.transition()\r\n \t\t.style(\"opacity\", opacityOut);\r\n \t};\r\n //Set opacity back to default for all\r\n } //function mouseoutChord", "function mouseover() {\n focusText.style(\"opacity\",1)\n focus.style(\"opacity\", 1)\n focusText2.style(\"opacity\",1)\n focusText3.style(\"opacity\",1)\n focus2.style(\"opacity\", 1)\n}", "function fade(opacity) {\n return function (g, i) {\n svg.selectAll(\".chord path\")\n .filter(function (d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .style(\"opacity\", opacity);\n };\n }", "function fadeDetail() {\n //return transition function\n return function (d, i) {\n diagramG.selectAll('.chord path').transition().style('fill-opacity', function (a, k) {\n //check whether the target indexes are matching\n if (d.target.index == a.target.index) {\n //check whether the source indexes are matching\n if (d.source.index == a.source.index) {\n //get tooltip\n currentGroupIndex = getGroupIndex(slices[a.source.index]);\n\n //update data\n d.group = groups[currentGroupIndex];\n d.sourceValue = slices[a.source.index];\n d.targetValue = slices[d.target.index];\n d.measureValue = d.source.value;\n\n //show tooltip content\n diagram.showTooltip(diagram.getContent(d, currentSerie, diagram.tooltip.format));\n\n //return full opacity\n return 1;\n } else {\n //return full opacity\n return 0.1;\n }\n } else {\n //return full opacity\n return 0.1;\n }\n });\n };\n }", "function mouseover() {\nfocus.style(\"opacity\", 1)\nfocusText.style(\"opacity\",1)\n}", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index !== i && d.target.index !== i; })\n .transition()\n .style(\"opacity\", opacity);\n };\n}", "function mouseReleased() {\n osc.fade(0,0.5);\n }", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .style(\"opacity\", opacity);\n };\n }", "startFade(){\n this.last_update = Date.now();\n this.color = \"#f4d742\";\n this.fade_rate = .2; //fades 20% every 100 ms\n this.transparency = 1;\n }", "function fade(t) { return t * t * t * (t * (t * 6 - 15) + 10); }", "function fadeOnChord(d) {\n\tvar chosen = d;\n\twrapper.selectAll(\"path.chord\")\n\t\t.transition()\n\t\t.style(\"opacity\", function(d) {\n\t\t\tif (d.source.index == chosen.source.index && d.target.index == chosen.target.index) {\n\t\t\t\treturn opacityDefault;\n\t\t\t} else { \n\t\t\t\treturn opacityLow; \n\t\t\t}//else\n\t\t});\n}//fadeOnChord", "function fade() {\n fadeObj.style.opacity = count;\n}", "function mouseOff() {\n $(this).fadeTo(500,0.2);\n }", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\"g.chord path\")\n .filter(function(d) {\n return d.source.index != i && d.target.index != i;\n })\n .transition()\n .style(\"opacity\", opacity);\n };\n }", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\"g.chord path\")\n .filter(function(d) {\n return d.source.index != i && d.target.index != i;\n })\n .transition()\n .style(\"opacity\", opacity);\n };\n }", "function mouseover() {\n focus.style(\"opacity\", 1)\n focusText.style(\"opacity\",1)\n }", "function gradient (){\n\t\t$('.one').mouseenter(function(){\n\t\t\t$(this).addClass('grad')\n\t\t\t$(this).fadeTo('fast','-=0.1');\n\t\t});\n\t}", "function mouseover() {\n focus.style(\"opacity\", 1);\n focusText.style(\"opacity\", 1);\n }", "function opacityFx(num){\n var $sm = $(\"#sm\" + num.toString());\n $sm.mouseenter(function() {\n //$(this).fadeTo(\"fast\",0.7);\n for (var i = 1; i < 6; i ++){\n if (i !== num){\n $media = $(\"#sm\" + i.toString());\n $media.fadeTo(\"fast\",0.4)\n }\n }\n });\n $sm.mouseleave(function() {\n //$(this).fadeTo(\"fast\",1);\n for (var i = 1; i < 6; i ++){\n if (i !== num){\n $media = $(\"#sm\" + i.toString());\n $media.fadeTo(\"fast\",1)\n }\n }\n });\n}", "function myFade(elem) {\n if (elem.fadePower == 1) {\n elem.fadePower = 0.3;\n } else {\n elem.fadePower = 1;\n }\n elem.fadeTo('fast', elem.fadePower);\n }", "function effectFade () {\n pauseSlideshow();\n effect = 1;\n runSlideshow();\n }", "function Asth() {\n $('#B1').mouseover(function () {\n $('#B1').fadeOut('400');\n $('#B1').fadeIn('400');\n });\n $('#B2').mouseover(function () {\n $('#B2').fadeOut('400');\n $('#B2').fadeIn('400');\n });\n $('#B3').mouseover(function () {\n $('#B3').fadeOut('400');\n $('#B3').fadeIn('400');\n });\n $('#B4').mouseover(function () {\n $('#B4').fadeOut('400');\n $('#B4').fadeIn('400');\n });\n }", "function ws_fade(c, a, b) {\n var e = jQuery, g = e(this),\n d = e(\".ws_list\", b),\n h = { position: \"absolute\", left: 0, top: 0, width: \"100%\", height: \"100%\", maxHeight: \"none\", maxWidth: \"none\", transform: \"translate3d(0,0,0)\" },\n f = e(\"<div>\").addClass(\"ws_effect ws_fade\").css(h).css(\"overflow\", \"hidden\").appendTo(b);\n this.go = function (i, j) {\n var k = e(a.get(i)), m = { width: k.width(), height: k.height() };\n k = k.clone().css(h).css(m).appendTo(f);\n if (!c.noCross) {\n var l = e(a.get(j)).clone().css(h).css(m).appendTo(f);\n wowAnimate(l,\n { opacity: 1 },\n { opacity: 0 },\n c.duration,\n function() {\n l.remove();\n });\n }\n wowAnimate(k,\n { opacity: 0 },\n { opacity: 1 },\n c.duration,\n function() {\n g.trigger(\"effectEnd\");\n k.remove();\n });\n }\n}", "function fade() {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) {\n if(isFilteredLanguage(d)) {\n return true;\n } else {\n return d.source.index != i && d.target.index != i;\n } \n })\n .transition()\n .style(\"opacity\", 0.1);\n };\n}", "function mouseOverHandle(){\n circle.transition().duration(200).attr('opacity',1);\n caption.transition().duration(200).attr('opacity',1);\n curYear.transition().duration(200).attr('opacity',1);\n d3.selectAll(\".x.axis\")\n .transition()\n .duration(500)\n .attr('opacity',0);\n }", "function dragenter(ev) {\n ev.target.style.opacity = \"0.4\";\n}", "function mouseover(d, i) {\n d3.select(this).style(\"opacity\", \"1\");\n }", "function AnimateHit():void {\n\tcharDummy.animation.CrossFade(\"hit\", 0.1);\n}", "function rect_mouseover() {\n\t\t\tpercentText.style(\"opacity\", 1)\n\t\t\tapproveText.style(\"opacity\", 1)\n\t\t\tfocusDate.style(\"opacity\", 1)\n\t\t}", "function trail(){\n\tvar num = 10\n trailGridSize(num);\n $('.square').css(\"background-color\", \"#CFCFCF\")\n $('.square').hover(function () {\n $(this).css(\"background-color\", \"#CFCFCF\")\n $(this).fadeTo(\"fast\",0.5, function(){$(this).fadeTo(\"fast\", 1)\n });\n });\n}", "function mouseover(d) {\n // Change element opacity to 0.2\n d3.select(this).style('opacity', 0.2);\n }", "CrossFadeQueued() {}", "function fade(opacity, d, i) {\n\t\tsvg.selectAll('path.chord')\n\t\t\t\t.filter(d => d.source.index != i && d.target.index != i)\n\t\t\t\t.transition()\n\t\t\t\t.duration(70)\n\t\t\t\t.style('stroke-opacity', opacity)\n\t\t\t\t.style('fill-opacity', opacity)\n\t}", "function slide_fadeFromForeToBack() {\n var delay = 100;\n var i = 0;\n var bgop=0;\n var fgop=1;\n\n document.getElementById(backImage).style.visibility = 'visible';\n\n if (fade_cursor < 1.01) {\n bgop = fade_cursor;\n fgop = 1-fade_cursor;\n setOpacity(foreImage,fgop);\n setOpacity(backImage,bgop);\n fade_cursor += 0.2;\n window.setTimeout(slide_fadeFromForeToBack, delay);\n }\n else {\n // End of the effect, we put backImage on the foreground\n fade_cursor = 0;\n\n slide_switchFgBg();\n\n setOpacity(foreImage,1);\n setOpacity(backImage,0);\n }\n}", "function fade(opacity) {\n return function(g, i) {\n svg.selectAll(\".chord path\")\n .filter(function(d) { return d.source.index != i && d.target.index != i; })\n .transition()\n .duration(500)\n .style(\"opacity\", opacity);\n\n svg.selectAll(\".text2\")\n .filter(function(d) { return acres(d.index); })\n .transition()\n .duration(500)\n .attr(\"opacity\", 1 - opacity)\n .attr(\"style\", \"font-size: 9; font -family: Helvetica, sans-serif\");\n\n svg.selectAll(\".text3\")\n .filter(function(d) { return acres(d.index); })\n .transition()\n .duration(500)\n .attr(\"opacity\", 1 - opacity)\n .attr(\"style\", \"font-size: 13; font -family: Helvetica, sans-serif\");\n };\n }", "function mouseOver(opacity) {\r\n return function(d) {\r\n // fade\r\n node.style(\"stroke-opacity\", function(o) {\r\n thisOpacity = isConnected(d, o) ? 1 : opacity;\r\n return thisOpacity;\r\n });\r\n node.style(\"fill-opacity\", function(o) {\r\n thisOpacity = isConnected(d, o) ? 1 : opacity;\r\n return thisOpacity;\r\n });\r\n // also style link accordingly\r\n link.style(\"stroke-opacity\", function(o) {\r\n return o.source === d || o.target === d ? 1 : opacity;\r\n });\r\n };\r\n }", "function movieCoverHover() {\n\t$(\".viewport\").on(\"mouseenter\", function() {\n\t\t$(this).children('a').children('img').animate({\n\t\t\theight: '310',\n\t\t\tleft: '0', \n\t\t\ttop: '0', \n\t\t\twidth: '255'\n\t\t}, 100);\n\t\t$(this).children('a').children('span').fadeIn(200);\n\t}).on(\"mouseleave\", function() {\n\t\t$(this).children('a').children('img').animate({\n\t\t\theight: '230',\n\t\t\tleft: '-20',\n\t\t\ttop: '-20',\n\t\t\twidth: '175'\n\t\t}, 100);\n\t\t$(this).children('a').children('span').fadeOut(200);\n\t});\n}", "function fade(t) {\n return t * t * t * (t * (t * 6 - 15) + 10);\n}", "function highlight() {\n $section.prev('h3').css('background', 'linear-gradient(#226758, #32957B)').fadeOut(1000, function() {\n $section.prev('h3').css('background', 'linear-gradient(#272822, #3B3A32)').fadeIn(400);\n });\n }", "function animate(element) {\n var animateIntervalId;\n\n var opacity = 0.1; // initial opacity\n element.style.display = \"block\";\n\n function fadeAnimation() {\n if (opacity >= 1){\n clearInterval(animateIntervalId);\n }\n\n element.style.opacity = opacity;\n element.style.filter = \"alpha(opacity=\" + opacity * 100 + \")\";\n opacity += 0.1 * opacity;\n soundTheColor(element);\n }\n\n animateIntervalId = setInterval(fadeAnimation, 10);\n}", "function fadeOnChord(d) {\n var chosen = d;\n wrapper.selectAll(\"path.chord\")\n .transition()\n .style(\"opacity\", function(d) {\n return d.source.index === chosen.source.index && d.target.index === chosen.target.index ? opacityDefault : opacityLow;\n });\n }", "function blink(currentColour) {\n currentColour.fadeOut(100).fadeIn(100);\n}", "function modArrowOpacity(evt) {\n if (evt.type == 'mouseout') {\n arrows[0].className = 'subtle-arrow';\n arrows[1].className = 'subtle-arrow';\n\n } else if (evt.type == 'mouseover') {\n arrows[0].className = 'arrow';\n arrows[1].className = 'arrow';\n }\n}", "function fadeIn() {\n\n if (ctx.globalAlpha < 1) {\n ctx.globalAlpha += 0.001;\n paint(); }\n }", "function onHover(div) {\n\n unHighLight(div);\n highLight(div);\n\n\n}", "function onMouseElement(opacity){\n return function () {\n if(rightEar!=null) rightEar.transition().duration(p.animdur).attr(\"opacity\", opacity);\n if (leftEar != null) leftEar.transition().duration(p.animdur).attr(\"opacity\", opacity);\n };\n }", "function fade(fadeElem, cachedElem) {\n\t\topacityUp += 0.01;\n\t\topacityDown -= 0.01;\n\t\t\n\t\t\n\t\tfadeElem.style.opacity = opacityUp.toFixed(2); \n\t\tlastElem.style.opacity = opacityDown.toFixed(2);\n\t\n\t\tif (opacityUp.toFixed(2) == 1.00) \n\t\t {\n\t\t\t clearInterval(opct);\n\t\t\t lastElem.style.display = 'none';\n\t\t }\t\t \n\t }// end fade function\t ", "function over(event) {\n window[event.key].alpha = 1;\n document.body.style.cursor = \"pointer\";\n }", "function over(event) {\n window[event.key].alpha = 1;\n document.body.style.cursor = \"pointer\";\n }", "function OnMouseEnter() {\n if (!animation.IsPlaying(\"mouseOverEffect\"))\n animation.Play(\"mouseOverEffect\");\n}", "function mouseClicked() {\n background(0);\n if (myalpha > backFade) {\n myalpha = backFade;\n lineStroke = 20;\n } else { \n myalpha = 255;\n lineStroke = 120;\n }\n}", "#listen() {\n this.#vanillaFade();\n this.#jqueryFade();\n }", "function makeOpacity(event) {\n // projectsImg.forEach(item => item.classList.add(\"opacity\"));\n // highlight the mouseover target\n // event.target.style.background = \"rgba(0,0,0,.5)\";\n}", "function mouseover(d) {\n // call the update function of histogram with new data.\n hG.update(fData.map(function(v) {\n return [v.State, v.freq[d.data.type]];\n }), segColor(d.data.type));\n }", "function Effect() {\n for (var i = 0; i < nrImg; i++) {\n Vect[i].style.opacity = \"0\"; //to add the fade effect\n Vect[i].style.visibility = \"hidden\";\n }\n Vect[nrShown].style.opacity = \"1\";\n Vect[nrShown].style.visibility = \"visible\";\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}", "function towerHover(towerMesh){\n\tif(CURRENT_HOVER_MODE == HOVER_ACTIVATE){\n\t\tvar hexColor;\n\t\tif( towerList[towerMesh.towerArrayPosition].onCooldown == 1){hexColor = 0xaa30b5;}\n\t\telse{hexColor = 0xff0000;}\n\t\tfor(var i = 0; i < towerMesh.material.materials.length; i++){\n\t\t\ttowerMesh.material.materials[i].emissive.setHex( hexColor );\n\t\t}\n\t\t//towerMesh.material.emissive.setHex( 0xff0000 );\n\t}\n\telse if(CURRENT_HOVER_MODE == HOVER_DESTROY){\n\t\tfor(var i = 0; i < towerMesh.material.materials.length; i++){\n\t\t\ttowerMesh.material.materials[i].emissive.setHex( 0xae1f1f );\n\t\t}\n\t\t//towerMesh.material.emissive.setHex( 0xae1f1f );\n\t}\n}", "function mouseover(d){\n // call the update function of histogram with new data.\n hGW.update(fData.map(function(v){ \n return [v.State,v.freq[d.data.type]];}),segColor(d.data.type));\n hGR.update(fData.map(function(v){ \n return [v.State,v.rate[d.data.type]];}),segColor(d.data.type));\n hGC.update(fData.map(function(v){ \n return [v.State,v.count[d.data.type]];}),segColor(d.data.type));\n }", "function HandleFade ( fadeAction : String )\n\t{\n\t\t// Temporary float to hold our modifier for our color.a\n\t\tvar alphaMod : float;\n\n\t\t// Based on our fadeAction, we will modify our alphaMod for use\n\t\tif( fadeAction == \"Touched\" )\n\t\t\talphaMod = fadeTouched;\n\t\telse if( fadeAction == \"Untouched\" )\n\t\t\talphaMod = fadeUntouched;\n\t\telse\n\t\t\talphaMod = 1.0f;\n\n\t\t// We need to check if both these are assigned\n\t\tif( joystickBase != null && joystick != null )\n\t\t{\n\t\t\t// And get a temporary color that is the same as our joystickBase, then change the alpha to our alphaMod\n\t\t\tvar joystickColor : Color = joystickBase.color;\n\t\t\tjoystickColor.a = alphaMod;\n\n\t\t\t// Now apply the temporary color to our joystickBase and joystick\n\t\t\tjoystickBase.color = joystickColor;\n\t\t\tjoystick.GetComponent( UnityEngine.UI.Image ).color = joystickColor;\n\t\t}\n\n\t\t// Check if we are truely using our highlights\n\t\tif( showHighlight == true )\n\t\t{\n\t\t\t// We want our fade to scale correctly with our current highlightColor.a\n\t\t\tvar hlAlphaMod : float = highlightColor.a * alphaMod;\n\t\t\t\n\t\t\t// Check our highlightBase Image\n\t\t\tif( highlightBase != null )\n\t\t\t{\n\t\t\t\t// Temporary Color variable\n\t\t\t\tvar highlightBaseColor : Color = highlightBase.color;\n\n\t\t\t\t// If we are using Fade, then we want to change to our alphaMod\n\t\t\t\tif( useFade == true )\n\t\t\t\t\thighlightBaseColor.a = hlAlphaMod;\n\t\t\t\t// However, if we are not, then we want our HL to be the same as our highlightColor option\n\t\t\t\telse\n\t\t\t\t\thighlightBaseColor.a = highlightColor.a;\n\n\t\t\t\t// Apply our new color to our highlightBase\n\t\t\t\thighlightBase.color = highlightBaseColor;\n\t\t\t}\n\t\t\t\n\t\t\t// Repeat the steps we just did for our highlightBase\n\t\t\tif( highlightJoystick != null )\n\t\t\t{\n\t\t\t\tvar highlightJoyColor : Color = highlightJoystick.color;\n\t\t\t\tif( useFade == true )\n\t\t\t\t\thighlightJoyColor.a = hlAlphaMod;\n\t\t\t\telse\n\t\t\t\t\thighlightJoyColor.a = highlightColor.a;\n\n\t\t\t\thighlightJoystick.color = highlightJoyColor;\n\t\t\t}\n\t\t}\n\t}", "function pinkButtonOver() {\n pinkButton.alpha = 0.8;\n}", "function opacity(id, opacStart, opacEnd, millisec) {\r\n\t //speed for each frame\r\n\t var speed = Math.round(millisec / 100);\r\n\t var timer = 0;\r\n\t //determine the direction for the blending, if start and end are the same nothing happens\r\n\t if(opacStart > opacEnd) {\r\n\t for(i = opacStart; i >= opacEnd; i--) {\r\n\t setTimeout(opacity_change,(timer * speed),i,id);\r\n\t timer++;\r\n\t }\r\n\t }\r\n\t\telse if(opacStart < opacEnd) {\r\n\t for(i = opacStart; i <= opacEnd; i++) {\r\n\t setTimeout(opacity_change,(timer * speed),i,id);\r\n\t timer++;\r\n\t }\r\n\t }\r\n\t}", "function fadeEffect() {\n $(\".selectPlayer\")\n .fadeOut(100)\n .fadeIn(100)\n .fadeOut(100)\n .fadeIn(100);\n}", "function blMouseOver(e){\n //on mouse over, add class which lighten color of arrows and slide them right\n e.children[0].classList.add('bl-hover');\n}", "function showHover(event) {\n seekBarPos = sArea.offset();\n seekT = event.clientX - seekBarPos.left;\n seekLoc = song.duration * (seekT / sArea.outerWidth());\n\n sHover.width(seekT);\n\n cM = seekLoc / 60;\n\n ctMinutes = Math.floor(cM);\n ctSeconds = Math.floor(seekLoc - ctMinutes * 60);\n\n if ((ctMinutes < 0) || (ctSeconds < 0))\n return;\n if ((ctMinutes < 0) || (ctSeconds < 0))\n return;\n\n if (ctMinutes < 10)\n ctMinutes = '0' + ctMinutes;\n if (ctSeconds < 10)\n ctSeconds = '0' + ctSeconds;\n\n if (isNaN(ctMinutes) || isNaN(ctSeconds))\n insTime.text('--:--');\n else\n insTime.text(ctMinutes + ':' + ctSeconds);\n\n insTime.css({ 'left': seekT, 'margin-left': '-21px' }).fadeIn(0);\n}", "function highlight(d, i) {\n if (highlightedPlayerIndex === i) {\n // if stored index is the same as clicked player\n chordPaths.classed({\"fade\": false });\n highlightedPlayerIndex = null;\n } else {\n // if no index is stored or the index isn't the stored one\n chordPaths.classed(\"fade\", function(p) {\n return p.source.index != i && p.target.index != i; \n });\n highlightedPlayerIndex = i;\n }\n }", "function animatePress(currentColour)\n{\n $(\"#\"+currentColour).addClass(\"pressed\");\n $(\"#\"+currentColour).fadeIn(100).fadeOut(100).fadeIn(100);\n setTimeout(function(){\n $(\"#\"+currentColour).removeClass(\"pressed\")},100);\n // $(\"#\"+currentColour).addClass(\"pressed\");\n}" ]
[ "0.735987", "0.7315627", "0.71498156", "0.69519866", "0.6897097", "0.6749533", "0.67389995", "0.65818816", "0.6567849", "0.6518331", "0.6455477", "0.64237785", "0.6420958", "0.64196914", "0.64196914", "0.6408425", "0.6407685", "0.640569", "0.64036644", "0.63735694", "0.63735694", "0.6372719", "0.6363642", "0.6347637", "0.6347637", "0.6312016", "0.6306236", "0.6300467", "0.6297883", "0.6295339", "0.6288865", "0.627881", "0.62762666", "0.6276202", "0.62599945", "0.62567496", "0.62547666", "0.62451154", "0.6237779", "0.62321323", "0.62186575", "0.62130183", "0.6193563", "0.6190772", "0.6185699", "0.6183768", "0.61783844", "0.61781776", "0.61781776", "0.6154507", "0.61451596", "0.6118827", "0.60925317", "0.60779244", "0.6077046", "0.6058614", "0.60488623", "0.6041859", "0.6038596", "0.60132873", "0.6002422", "0.5989522", "0.59865546", "0.59772086", "0.5970456", "0.59671277", "0.5944365", "0.59420836", "0.5935224", "0.59340215", "0.5888315", "0.5887745", "0.58850145", "0.5884624", "0.58827174", "0.58806497", "0.58774203", "0.5863923", "0.58611697", "0.5860273", "0.5855492", "0.5854616", "0.5854616", "0.5852221", "0.58496755", "0.58474034", "0.5839195", "0.5834938", "0.5829284", "0.5823777", "0.58208907", "0.5818461", "0.5809925", "0.58070004", "0.5801573", "0.57985705", "0.5784825", "0.5777325", "0.5771143", "0.57590437" ]
0.728012
2
Clickers & Pass to PV selection and highlight
function group_click(d, i) { // Single Residue var resViewName = 'pickedRes_' + nodes[i].seg + nodes[i].resi pickedRes = window.structure.select({ chain: nodes[i].seg, rnum: nodes[i].resi }) if (viewer.get(resViewName) === null) { viewer.ballsAndSticks(resViewName, pickedRes); d3.select("#group" + i) .classed("highlight", true); } else { // Hide Spheres viewer.rm(resViewName); // Highlight Group d3.select("#group" + i) .classed("highlight", false); } viewer.requestRedraw(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseClick(p) {\n }", "function clickProc(d, textclicked) {\n \n if (CheckSelectionClick()) {\n return;\n } //exit function if it was a panning click, instead of a selection click\n \n \n if (d.expertise_intern) {//zuklappen\n d._expertise_intern = d.expertise_intern;\n d.expertise_intern = null;\n expertise_intern_shown=false;\n \n \n } else { //aufklappen\n d.expertise_intern = d._expertise_intern;\n d._expertise_intern = null;\n \n }\n if (d.expertise_extern) {//zuklappen\n d._expertise_extern = d.expertise_extern;\n d.expertise_extern = null;\n expertise_extern_shown=false;\n \n \n } else { //aufklappen\n d.expertise_extern = d._expertise_extern;\n d._expertise_extern = null;\n \n }\n collapseExpertise(getRoot(d),d);\n // console.log(d);\n updateproc(d);\n\n\n\n\n /* vis.attr(\"transform\",\n \"translate(\" + d.y + \",\" + d.x + \")\"\n );*/\n\n\n}", "function UISelection(){\n\n }", "function clickFunction(e){\n var currLine = getCurrentLine(this);\n num_lines_selected = 1; //returns to default, in case just clicking, if it is selected that's taken care of in subsequent onselect\n prevLine = currLine;\n}", "function o(a){a.click(p).mousedown(ka)}", "function highlightSelected()\n\t{\n\t\t// selected pileups (mutations) on the diagram\n\t\tvar selected = getSelectedPileups();\n\n\t\t// highlight residues\n\t\thighlight3dResidues(selected);\n\t}", "mouseDown(pt) {}", "mouseDown(pt) {}", "selectionTool(e) {\n //find the cropper\n let cropper = this.state.cropper;\n //trigger the crop/selection tool\n cropper.setDragMode(\"crop\");\n //reset active buttons\n this.clearActiveButtons();\n this.setActiveButton(\"selectionTool\");\n }", "function selectionChange(e) {\n var pointRng;\n\n // Check if the button is down or not\n if (e.button) {\n // Create range from mouse position\n pointRng = rngFromPoint(e.pageX, e.pageY);\n\n if (pointRng) {\n // Check if pointRange is before/after selection then change the endPoint\n if (pointRng.compareEndPoints('StartToStart', startRng) > 0)\n pointRng.setEndPoint('StartToStart', startRng);\n else\n pointRng.setEndPoint('EndToEnd', startRng);\n\n pointRng.select();\n }\n } else {\n endSelection();\n }\n }", "function mouseclick(){\n\n\t\tvar stage = cmngl1.getStage();\n\t\tvar clickedresno;\n\t\tvar rectnamelist = cmsvg.rectnamelist();\n\t\tvar colorlist = cmsvg.colorlist();\n\t\tvar alignToSeq = cmsvg.alignToSeq();\n\t\tvar clickedatom = clickedatom1;\n\n\t\tstage.signals.clicked.add(\n\t\t\tfunction( pickingData ){\t\n\t\t\t\tif(pickingData && pickingData.atom){\n\t\t\t\t\tclickedresno = pickingData.atom.residueIndex;\n\n\n\t\t\t\t\tvar atominfo = \"\";\n\n\t\t\t\t\tif(alignArr[0].length === 0){\n\t\t\t\t\t\td3.selectAll(\".blue\").selectAll(\"rect\").style(\"fill\", \"steelblue\");\n\t\t\t\t\t\td3.selectAll(\"rect\").each(function(d){\t\n\t\t\t\t\t\t\tif(d[0] === clickedresno || d[1] === clickedresno){\n\t\t\t\t\t\t\t\td3.select(this).style(\"fill\",\"orange\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tatominfo = \"Clicked atom: \"+ \"[\" + pickingData.atom.resname + \"]\" + pickingData.atom.resno + pickingData.atom.inscode + \":\" + pickingData.atom.chainname + \".CA\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t\tif(alignArr[0].length !== 0){\n\t\t\t\t\t\tfor(var i = 0 ; i < rectnamelist.length; i++){\n\t\t\t\t\t\t\tvar classname = \".\"+rectnamelist[i];\n\t\t\t\t\t\t\td3.selectAll(classname).selectAll(\"rect\").style(\"fill\", colorlist[i]).style(\"opacity\", 0.5);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar clickedprotein = pickingData.atom.residue.structure.name;\n\n\t\t\t\t\t\tvar proteinindex = -1;\n\t\t\t\t\t\tfor(var i = 0; i < pdbidlist.length; i++){\n\t\t\t\t\t\t\tvar currname = pdbidlist[i];\n\t\t\t\t\t\t\tif(currname === clickedprotein){\n\t\t\t\t\t\t\t\tproteinindex = i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar curraligntoseq = alignToSeq[proteinindex];\n\t\t\t\t\t\t//i = id of the rect\n\t\t\t\t\t\t//d = data insert into rect \n\t\t\t\t\t\td3.selectAll(\"rect\").each(function(d){\n\t\t\t\t\t\t\tif(curraligntoseq[d[0]] === clickedresno || curraligntoseq[d[1]] === clickedresno){\n\t\t\t\t\t\t\t\td3.select(this).style(\"fill\",\"black\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tatominfo =\"Clicked protein: \" + clickedprotein + \", Clicked atom: \"+ \"[\" + pickingData.atom.resname + \"]\" + pickingData.atom.resno + pickingData.atom.inscode + \":\" + pickingData.atom.chainname + \".CA\";\n\t\t\t\t\t}\n\n\t\t\t\t\tdocument.getElementById(clickedatom).innerHTML= atominfo;\n\t\t\t\t}\n\n\t\t\t\telse{\n\t\t\t\t\tif(alignArr[0].length === 0){\n\t\t\t\t\t\td3.selectAll(\".blue\").selectAll(\"rect\").style(\"fill\", \"steelblue\");\n\t\t\t\t\t}\n\t\t\t\t\t\n\n\t\t\t\t\tif(alignArr[0].length !== 0){\n\t\t\t\t\t\tfor(var i = 0 ; i < rectnamelist.length; i++){\n\t\t\t\t\t\t\tvar classname = \".\"+rectnamelist[i];\n\t\t\t\t\t\t\td3.selectAll(classname).selectAll(\"rect\").style(\"fill\", colorlist[i]).style(\"opacity\", 0.5);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById(clickedatom).innerHTML = \"Clicked nothing\";\n\t\t\t\t}\n\t\t\t} \n\t\t);\n\t}", "function scribblePoser() {\n\tvar $elt = $(\"#poser_chooser\");\n\t$elt.click();\n}", "function selectButtonOnClick(ev)\n{\n\t//console.log(\"selectButtonOnClick(\", ev, \")\");\n\tstopPointTable.toggleCheckBoxVisibility();\n}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function select () {\r\n\t\t\t\tthis.tool.select();\r\n\t\t\t}", "function selectHandler() \n {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) \n {\n var selectedLevel = data.getValue(selectedItem.row, 0);\n var hidData = $(\"#hid\"+title+\"PieChartContainer\").val();\n \n if(hidData != undefined){\n var hid_ids = JSON.parse(hidData); \n var selected_ele_ids = hid_ids[selectedLevel];\n ViewerHighLight(selected_ele_ids);\n }\n }\n }", "handleContextClick(args){\n if(this.shapeSelectionEnabled) {\n this.selectShape(args);\n }\n }", "function CALCULATE_TOUCH_DOWN_OR_MOUSE_DOWN() {\r\n \r\nif (GLOBAL_CLICK.CLICK_TYPE == \"right_button\") {\r\n \r\nfor (var x=0;x<HOLDER.length;x++){\r\n \r\n\tif (GET_DISTANCE_FROM_OBJECT.VALUE(x) < HOLDER[x].FI ) {\r\n\t\r\n\tHOLDER[x].FOKUS('R');\r\n HOLDER[x].SHOW_MENU();\r\n GLOBAL_CLICK.CLICK_PRESSED = true;\r\n \r\n E(\"NAME_OF_SELECTED\").value = HOLDER[x].NAME;\r\n E(\"NAME_OF_SELECTED\").dataset.index_ = x;\r\n \r\n VOICE.SPEAK(\"Object \" + HOLDER[x].NAME + \" SELECTED . \");\r\n \r\n }else {\r\n HOLDER[x].HIDE_MENU(x);\r\n }\r\n \r\n}\r\n/////////////\r\n//right\r\n//////////// \r\n}\r\nelse if (GLOBAL_CLICK.CLICK_TYPE == \"left_button\"){\r\n\r\nfor (var x=0;x<HOLDER.length;x++){\r\n if (GET_DISTANCE_FROM_OBJECT.VALUE(x) < HOLDER[x].FI ) {\r\n \r\n\t\r\n\tHOLDER[x].FOKUS('L');\r\n\t HOLDER[x].SHOW_MENU('L');\r\n HOLDER[x].SELECTED = true;\r\n \r\n \r\n \r\n \r\n GLOBAL_CLICK.CLICK_PRESSED = true;\r\n \r\n \r\n \r\n E(\"NAME_OF_SELECTED\").value = HOLDER[x].NAME;\r\n E(\"NAME_OF_SELECTED\").dataset.index_ = x;\r\n \r\n //VOICE.SPEAK(\"Object \" + HOLDER[x].NAME + \" SELECTED . \");\r\n \r\n }else {\r\n \r\n HOLDER[x].HIDE_MENU(x);\r\n \r\n \r\n }\r\n }\r\n}\r\n \r\n\r\n\r\n\r\n\r\n }", "_onLabelClick(ev) {\n const $target = $(ev.currentTarget);\n this.trigger('revisionSelected', [0, $target.data('revision')]);\n }", "selectItem (i) { this.toggSel(true, i); }", "activeClick() {\n var $_this = this;\n var action = this.options.dblClick ? 'dblclick' : 'click';\n\n this.$selectableUl.on(action, '.SELECT-elem-selectable', function () {\n $_this.select($(this).data('SELECT-value'));\n });\n this.$selectionUl.on(action, '.SELECT-elem-selection', function () {\n $_this.deselect($(this).data('SELECT-value'));\n });\n\n }", "selectedClickListener(d, i){\n var self = this;\n // ID Is selected from the the element tag field\n var id = self.selectedExtractID(d).split(\" \").join(\"-\");\n self.boxZoom(self.path.bounds(d), self.path.centroid(d), 20);\n self.applyStateSelection(id);\n self.ui.setDistrictInfo(id);\n self.ui.addLabel(); \n self.ui.retrievePoliticianImages(id);\n }", "function q(a){a.click(u).mousedown(V)}", "onPageClick_() {\n this.pageClicks_++;\n this.lastSelection_ = this.win_.document.activeElement;\n }", "function ClickBarra() {\n\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var planta = data.getValue(selectedItem.row, 0);\n click_grafica(planta);\n\n\n }\n }", "function SelectionChange() { }", "function SelectionChange() { }", "function highlightFeature(fid){\n layers[fid].fireEvent('click');\n}", "function buttonClicked(e) {\n\tvar element = e.memo.element;\n\tif (this.options.singleSelect) {\n\t\tthis.select(element);\n\t} else {\n\t\tif (this.isSelected(element)) {\n\t\t\tthis.deselect(element);\t\n\t\t} else {\n\t\t\tthis.select(element);\n\t\t}\n\t}\n}", "function run() {\n app.selection = null;\n btnsState = [bezierBtn.value, flushBtn.value, cornerBtn.value, brokenBtn.value, flatBtn.value];\n processPoints(btnsState, selPaths, tolValue.text * 1);\n sPoints.text = 'Selected Points: ' + getSelectedPoints(selPaths);\n }", "_onHandleMouseDown(ev) {\n ev.preventDefault();\n ev.stopPropagation();\n\n this._activeValues = [];\n\n for (let i = 0; i < this._values.length; i++) {\n this._activeValues.push(i);\n }\n\n this._mouseActive = true;\n this._activeHandle = $(ev.currentTarget).data('handle-id');\n\n document.addEventListener('mouseup', this._onHandleMouseUp, true);\n document.addEventListener('mousemove', this._onHandleMouseMove, true);\n\n $('body').addClass('revision-selector-grabbed');\n }", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function selectionChange(e) {\n\t\t\t\tvar pointRng;\n\n\t\t\t\t// Check if the button is down or not\n\t\t\t\tif (e.button) {\n\t\t\t\t\t// Create range from mouse position\n\t\t\t\t\tpointRng = rngFromPoint(e.x, e.y);\n\n\t\t\t\t\tif (pointRng) {\n\t\t\t\t\t\t// Check if pointRange is before/after selection then change the endPoint\n\t\t\t\t\t\tif (pointRng.compareEndPoints('StartToStart', startRng) > 0) {\n\t\t\t\t\t\t\tpointRng.setEndPoint('StartToStart', startRng);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpointRng.setEndPoint('EndToEnd', startRng);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpointRng.select();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tendSelection();\n\t\t\t\t}\n\t\t\t}", "function select() {\n getElements()[selection].getElementsByTagName('a')[0].click();\n\n}", "enableUserSelection() {\n this[addDivListener]('mousedown', this[userSelectionDragListenerSym]);\n }", "function xcustom_makeActionOnObjectSelection() {\r\n var currentSelectedObject = xcustom_getCurrentSelectedObject();\r\n if (null === currentSelectedObject) {\r\n // console.log('Nothing Selected...');\r\n xcustom_resetAndClosePanelSelectedObjectContent();\r\n $('#xcustom-div-right-panel').hide();\r\n return;\r\n }\r\n // console.log('The Selected Object Is : ', currentSelectedObject);\r\n xcustom_showSelectedObjectDataOnViewer(currentSelectedObject);\r\n}", "handleJDotterClick() {}", "function SELECT_AND_ZOOM(e) {\n\t\trequire([\"controllers/ArtboardController\"],function(ArtboardController){\n\t\t\tvar thisController = ArtboardController.getArtboardController(e.drawingAreaId || APP_CANVAS_CONTAINER_NODE_ID);\n\t\t\tif(e.noZoom) {\n\t\t\t\tthisController.selectNodes(e.newVal,e.AppendToSelection);\n\t\t\t} else {\n\t\t\t\tthisController.selectNodesOnCanvasAndZoom(e.newVal,e.AppendToSelection);\n\t\t\t}\n\t\t});\t\t\t\n\t}", "function highlightNodepathsOnclick(){\n //ADD ACTIONS THE NODE RECTANGLES\n d3.select('.interactive_diagram.' + view).selectAll('.node')\n .select('rect')\n .attr('class', 'nodeRect')\n .on('click', function(){\n thisClass = d3.select(this.parentNode).attr('id')\n parent = d3.select(this.parentNode)\n if(!parent.classed('selected')){\n unlightRelations()\n highlightRelations(thisClass)\n d3.select('.interactive_diagram.' + view)\n .selectAll('.node.selected')\n .classed('selected', false)\n\n d3.select(this.parentNode)\n .classed('selected', true)\n }else{\n unlightRelations()\n d3.select(this.parentNode)\n .classed('selected', false)\n }\n })\n }", "function OnMouseDownDiagram(e) {\n if (multipleSelectionMode == true) {\n var multipleSelectorDiv = document.getElementById('multipleSelectorDiv');\n multipleSelectorDiv.hidden = 0;\n x1mDiv = e.screenX - 365;\n y1mDiv = e.screenY - 85;\n reCalc();\n }\n}", "function setupMouseEvents(parent, canvas, selection) {\n function mousedownHandler(evt) {\n var mousePos = selection\n .geometry()\n .m2v(multiselect_utilities.offsetMousePos(parent, evt));\n switch (multiselect.modifierKeys(evt)) {\n case multiselect.NONE:\n selection.click(mousePos);\n break;\n case multiselect.CMD:\n selection.cmdClick(mousePos);\n break;\n case multiselect.SHIFT:\n selection.shiftClick(mousePos);\n break;\n default:\n return;\n }\n\n selection.geometry().drawIndicators(selection, canvas, true, true, false);\n\n document.addEventListener(\"mousemove\", mousemoveHandler, false);\n document.addEventListener(\"mouseup\", mouseupHandler, false);\n evt.preventDefault();\n evt.stopPropagation();\n }\n\n function mousemoveHandler(evt) {\n evt.preventDefault();\n evt.stopPropagation();\n var mousePos = selection\n .geometry()\n .m2v(multiselect_utilities.offsetMousePos(parent, evt));\n selection.shiftClick(mousePos);\n selection.geometry().drawIndicators(selection, canvas, true, true, true);\n }\n\n function mouseupHandler(evt) {\n document.removeEventListener(\"mousemove\", mousemoveHandler, false);\n document.removeEventListener(\"mouseup\", mouseupHandler, false);\n selection\n .geometry()\n .drawIndicators(selection, canvas, true, true, false, false);\n }\n\n parent.addEventListener(\"mousedown\", mousedownHandler, false);\n}", "function doSelections(event, selectedEles, cols) {\n // Select elements in a range, either across rows or columns\n function selectRange() {\n var frstSelect = selectedEles[0];\n var lstSelect = selectedEles[selectedEles.length - 1];\n if (cols) {\n var flipStart = flipFlipIdx(Math.min(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n var flipEnd = flipFlipIdx(Math.max(flipIdx(selectionMinPivot), flipIdx(selectionMaxPivot),\n flipIdx(frstSelect), flipIdx(lstSelect)));\n selectElemsDownRows(Math.min(flipStart, flipEnd), Math.max(flipStart, flipEnd));\n } else {\n var start = Math.min(selectionMinPivot, frstSelect);\n var end = Math.max(selectionMaxPivot, lstSelect);\n selectElemRange(start, end);\n }\n }\n // If not left mouse button then leave it for someone else\n if (event.which != LEFT_MOUSE_BUTTON) {\n return;\n }\n // Just a click - make selection current row/column clicked on\n if (!event.ctrlKey && !event.shiftKey) {\n clearAll();\n selectEles(selectedEles);\n selectionMinPivot = selectedEles[0];\n selectionMaxPivot = selectedEles[selectedEles.length - 1];\n return;\n }\n // Cntrl/Shift click - add to current selections cells between (inclusive) last single selection and cell\n // clicked on\n if (event.ctrlKey && event.shiftKey) {\n selectRange();\n return;\n }\n // Cntrl click - keep current selections and add toggle of selection on the single cell clicked on\n if (event.ctrlKey) {\n toggleEles(selectedEles);\n selectionMinPivot = selectedEles[0];\n selectionMaxPivot = selectedEles[selectedEles.length - 1];\n return;\n }\n // Shift click - make current selections cells between (inclusive) last single selection and cell clicked on\n if (event.shiftKey) {\n clearAll();\n selectRange();\n }\n }", "clicked(x, y) {}", "function mouse(kind, pt, id) {\n \n}", "function Cheaperkindles(){\r\n\t\r\n\r\n\ttitle.html(\"Do you need to read books at night?\");\r\n\r\n\tfirstOption.html(\"Yes\");\r\n\tsecondOption.html(\"No\");\r\n\r\n\tfirstOption.mousePressed(Paperwhite);\r\n\tsecondOption.mousePressed(Kindle);\r\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 leftButtonSelect(cm, e, start, type, addNew) {\n\t\t var display = cm.display, doc = cm.doc;\n\t\t e_preventDefault(e);\n\t\t\n\t\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t\t if (addNew && !e.shiftKey) {\n\t\t ourIndex = doc.sel.contains(start);\n\t\t if (ourIndex > -1)\n\t\t ourRange = ranges[ourIndex];\n\t\t else\n\t\t ourRange = new Range(start, start);\n\t\t } else {\n\t\t ourRange = doc.sel.primary();\n\t\t ourIndex = doc.sel.primIndex;\n\t\t }\n\t\t\n\t\t if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n\t\t type = \"rect\";\n\t\t if (!addNew) ourRange = new Range(start, start);\n\t\t start = posFromMouse(cm, e, true, true);\n\t\t ourIndex = -1;\n\t\t } else if (type == \"double\") {\n\t\t var word = cm.findWordAt(start);\n\t\t if (cm.display.shift || doc.extend)\n\t\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t\t else\n\t\t ourRange = word;\n\t\t } else if (type == \"triple\") {\n\t\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t\t if (cm.display.shift || doc.extend)\n\t\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t\t else\n\t\t ourRange = line;\n\t\t } else {\n\t\t ourRange = extendRange(doc, ourRange, start);\n\t\t }\n\t\t\n\t\t if (!addNew) {\n\t\t ourIndex = 0;\n\t\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t\t startSel = doc.sel;\n\t\t } else if (ourIndex == -1) {\n\t\t ourIndex = ranges.length;\n\t\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t\t {scroll: false, origin: \"*mouse\"});\n\t\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t\t {scroll: false, origin: \"*mouse\"});\n\t\t startSel = doc.sel;\n\t\t } else {\n\t\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t\t }\n\t\t\n\t\t var lastPos = start;\n\t\t function extendTo(pos) {\n\t\t if (cmp(lastPos, pos) == 0) return;\n\t\t lastPos = pos;\n\t\t\n\t\t if (type == \"rect\") {\n\t\t var ranges = [], tabSize = cm.options.tabSize;\n\t\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t\t line <= end; line++) {\n\t\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t\t if (left == right)\n\t\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t\t else if (text.length > leftPos)\n\t\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t\t }\n\t\t if (!ranges.length) ranges.push(new Range(start, start));\n\t\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t\t {origin: \"*mouse\", scroll: false});\n\t\t cm.scrollIntoView(pos);\n\t\t } else {\n\t\t var oldRange = ourRange;\n\t\t var anchor = oldRange.anchor, head = pos;\n\t\t if (type != \"single\") {\n\t\t if (type == \"double\")\n\t\t var range = cm.findWordAt(pos);\n\t\t else\n\t\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t\t if (cmp(range.anchor, anchor) > 0) {\n\t\t head = range.head;\n\t\t anchor = minPos(oldRange.from(), range.anchor);\n\t\t } else {\n\t\t head = range.anchor;\n\t\t anchor = maxPos(oldRange.to(), range.head);\n\t\t }\n\t\t }\n\t\t var ranges = startSel.ranges.slice(0);\n\t\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t\t }\n\t\t }\n\t\t\n\t\t var editorSize = display.wrapper.getBoundingClientRect();\n\t\t // Used to ensure timeout re-tries don't fire when another extend\n\t\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t\t // least on Chrome, the timeouts still happen even when cleared,\n\t\t // if the clear happens after their scheduled firing time).\n\t\t var counter = 0;\n\t\t\n\t\t function extend(e) {\n\t\t var curCount = ++counter;\n\t\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t\t if (!cur) return;\n\t\t if (cmp(cur, lastPos) != 0) {\n\t\t cm.curOp.focus = activeElt();\n\t\t extendTo(cur);\n\t\t var visible = visibleLines(display, doc);\n\t\t if (cur.line >= visible.to || cur.line < visible.from)\n\t\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t\t } else {\n\t\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t\t if (outside) setTimeout(operation(cm, function() {\n\t\t if (counter != curCount) return;\n\t\t display.scroller.scrollTop += outside;\n\t\t extend(e);\n\t\t }), 50);\n\t\t }\n\t\t }\n\t\t\n\t\t function done(e) {\n\t\t cm.state.selectingText = false;\n\t\t counter = Infinity;\n\t\t e_preventDefault(e);\n\t\t display.input.focus();\n\t\t off(document, \"mousemove\", move);\n\t\t off(document, \"mouseup\", up);\n\t\t doc.history.lastSelOrigin = null;\n\t\t }\n\t\t\n\t\t var move = operation(cm, function(e) {\n\t\t if (!e_button(e)) done(e);\n\t\t else extend(e);\n\t\t });\n\t\t var up = operation(cm, done);\n\t\t cm.state.selectingText = up;\n\t\t on(document, \"mousemove\", move);\n\t\t on(document, \"mouseup\", up);\n\t\t }", "function updateSelection_(e) {\n\t\t\t\tmyGuests.model.selectedNodeData = null;\n\t\t\t\tvar it = myGuests.selection.iterator;\n\t\t\t\twhile (it.next()) {\n\t\t\t\t\tvar selnode = it.value;\n\t\t\t\t\t// ignore a selected link or a deleted node\n\t\t\t\t\tif (selnode instanceof go.Node && selnode.data !== null) {\n\t\t\t\t\t\tmyGuests.model.selectedNodeData = selnode.data;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscope.$apply();\n\t\t\t}", "click(event){\n if(event.target.tagName === \"MULTI-SELECTION\"){\n const onContainerMouseClick = this.onContainerMouseClick;\n\n if(onContainerMouseClick){\n onContainerMouseClick();\n }\n }\n }", "function edgeClickHDX(i) {\n\n // handle edge control selection\n hdxEdgeSelector.select(i);\n}", "setupVisitListeners($document, $scope) {\n function onClick(event) {\n const item = angular__default['default'].element(event.target).closest('[fl-item]').eq(0);\n\n if (item) {\n item.addClass('fl-item-selected');\n }\n\n angular__default['default'].element('[fl-item]').not(item).removeClass('fl-item-selected');\n }\n\n $document.on('click', onClick);\n\n $scope.$on('$destroy', () => {\n $document.off('click', onClick);\n });\n }", "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 enablePointSelection(){\r\n\taddPointMode = true;\r\n}", "function mousePressed()\n{\n\tvar page = story.getCurrentPage();\n\tpage.mouseP();\n}", "function onClickEvent() {\n if (selectedElements.length == 0) {\n selectedElements.push($(this));\n $(selectedElements[0]).addClass('open show');\n $(selectedElements[0]).off('click');\n } else if (selectedElements.length == 1) {\n selectedElements.push($(this));\n matchingEngine();\n }\n}", "mouseUp(pt) {}", "mouseUp(pt) {}", "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\t\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\t\n\t if (e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\t\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\t\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\t\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\t\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\t\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\t\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\t\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "function clickOptiontoSelect(){\n\n}", "function selectionsHandler() {\n logger.info('selection handler');\n\n if ($.currentProduct.isProductSelected()) {\n $.store_availability_button.setColor(Alloy.Styles.color.text.mediumdark);\n } else {\n $.store_availability_button.setColor(Alloy.Styles.color.text.light);\n }\n\n $.pdp_header_controller.setProductID($.currentProduct.getSelectedProductId());\n}", "function showSelection() {\n navigationBrowse(memSelection);\n}", "function clickSolve(){\n env.click.render() ;\n env.clickCopy.render() ;\n refreshDisplay() ;\n}", "handleClickOnContext(evt) {\n if (evt.altKey) {\n // panning\n return;\n }\n // if (isMouseEventPlatformModifierKey(evt)) \n // ctrl(meta) + click: select trace\n this.remote.selectFirstTrace();\n document.getSelection().removeAllRanges();\n // else {\n // // click: show trace\n // this.remote.goToFirstTrace();\n // }\n }", "_handleMouseInteraction() {\n const that = this;\n\n that._handleTextSelection();\n\n that._changeCheckState('pointer');\n that.focus();\n that._updateHidenInputNameAndValue();\n }", "_handleMouseInteraction() {\n const that = this;\n\n that._handleTextSelection();\n\n that._changeCheckState('pointer');\n that.focus();\n that._updateHidenInputNameAndValue();\n }", "selectPointTrigger(selectedIndices){\n const data = this.data\n\n // define selectedPoints\n let selectedPoints = []\n\n for (let i in selectedIndices) selectedPoints.push(data[i])\n\n // dispatch POINT SELECT event\n this.dispatch[EVENTS.POINT.SELECT](selectedPoints, selectedIndices)\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 fireSelectedEvent(){\n\t\t\tvar x1 = (selection.first.x <= selection.second.x) ? selection.first.x : selection.second.x;\n\t\t\tvar x2 = (selection.first.x <= selection.second.x) ? selection.second.x : selection.first.x;\n\t\t\tvar y1 = (selection.first.y >= selection.second.y) ? selection.first.y : selection.second.y;\n\t\t\tvar y2 = (selection.first.y >= selection.second.y) ? selection.second.y : selection.first.y;\n\t\t\t\n\t\t\tx1 = xaxis.min + x1 / hozScale;\n\t\t\tx2 = xaxis.min + x2 / hozScale;\n\t\t\ty1 = yaxis.max - y1 / vertScale;\n\t\t\ty2 = yaxis.max - y2 / vertScale;\n\n\t\t\ttarget.fire('flotr:select', [ { x1: x1, y1: y1, x2: x2, y2: y2 } ]);\n\t\t}", "function PARSE_AND_SEL_ZOOM(e) {\n\t\trequire([\"views/BioTapestryCanvas\"],function(BTCanvas){\n\t\t\tGET_SELECTION_OBJECTS(e.newVal,BTCanvas.getBtCanvas(e.drawingAreaId || APP_CANVAS_CONTAINER_NODE_ID)).then(function(nodes){\n\t\t\t\tif(e.newVal.set) {\n\t\t\t\t\trequire([\"widgets/LowerLeftComponents\"],function(LowerLeftComponents){\n\t\t\t\t\t\tSET_NETWORK_MODULES({\n\t\t\t\t\t\t\toverlay: null,modules: nodes, enable: true, enable_other: \"INVERSE\", reveal: \"NO_CHANGE\"\n\t\t\t\t\t\t}).then(function(){\n\t\t\t\t\t\t\te.moduleZoom = \"ACTIVE\";\n\t\t\t\t\t\t\tZOOM_TO_MODULES(e);\t\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\te.newVal = nodes;\n\t\t\t\t\tSELECT_AND_ZOOM(e);\t\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function resultsMouseDownHandler (e) {\n let target = e.target; // Type depends ..\n let className = target.className;\n//console.log(\"Result mouse down event: \"+e.type+\" button: \"+e.button+\" shift: \"+e.shiftKey+\" target: \"+target+\" class: \"+className);\n if ((className != undefined) && (className.length > 0)) {\n\t// The click target is one of .brow cell,\n\t// .rbkmkitem_x div, .rtwistieac div, favicon img or .favttext span\n\t// Find cell, for selection\n\tlet cell;\n\tif (className.includes(\"fav\") || className.startsWith(\"rtwistie\")) {\n\t cell = target.parentElement.parentElement;\n\t}\n\telse if (className.startsWith(\"rbkmkitem_\")) {\n\t cell = target.parentElement;\n\t}\n\telse if (className.includes(\"brow\")) {\n\t cell = target;\n\t}\n\n\t// Select result item if recognized\n\t// , and if not already selected=> keep bigger multi-items selection area if right click inside it \n\tif (cell != undefined) {\n\t let button = e.button;\n\t // Do nothing on selection if this is a right click inside a selection range\n\t if ((button != 2) || !cell.classList.contains(rselection.selectHighlight)) {\n//\t\tsetCellHighlight(rcursor, rlastSelOp, cell, rselection.selectIds);\n\t\tif (button == 1) { // If middle click, simple select, no multi-select\n\t\t addCellCursorSelection(cell, rcursor, rselection);\n\t\t}\n\t\telse {\n\t\t let is_ctrlKey = (isMacOS ? e.metaKey : e.ctrlKey);\n\t\t addCellCursorSelection(cell, rcursor, rselection, true, is_ctrlKey, e.shiftKey);\n\t\t}\n\t }\n\t}\n }\n}", "function onDocumentMouseDown( event ) { \n // event.preventDefault();\n event.stopPropagation();\n raycaster.setFromCamera( mouse, camera );\n \n // calculate objects intersecting the picking ray\n //var intersects = raycaster.intersectObjects( scene.children);\n objects = pivotPoint.children.concat([cubeMesh]);\n\n console.log(objects);\n\n var intersects = raycaster.intersectObjects( objects );\n // intersects[0].object.material.color.set( 0xff0000 );\n \n //validate if has objects intersected\n if (intersects.length>0){\n // pick first intersected object\n selected_object = intersects[0].object;\n\n // change gui color\n shape_params.color = selected_object.material.color.getHex();\n \n control.setMode(shape_params.picking);\n control.attach( selected_object ); \n }\n}", "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\n\t if (e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "function buttonClick(e) {\n\tvar element = e.memo.element;\n\tif (this.options.singleSelect) {\n\t\tthis.select(element);\n\t} else {\n\t\tif (this.isSelected(element)) {\n\t\t\tthis.deselect(element);\t\n\t\t} else {\n\t\t\tthis.select(element);\n\t\t}\n\t}\n}", "function evtHandler() {\n // console.log(\"event handler initialized\");\n //jQuery('#editbox').dialog({'autoOpen': false});\n\n jQuery('#list-usePref li').click(function () {\n\n resetClass(jQuery(this), 'active');\n jQuery(this).addClass('active');\n // console.log(\"colorSelector: \",colorSelector);\n triggerViz(styleVal);\n\n });\n\n }", "click (event) {\n this.onSelectionChange([])\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n\t var display = cm.display, doc = cm.doc;\n\t e_preventDefault(e);\n\n\t var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n\t if (addNew && !e.shiftKey) {\n\t ourIndex = doc.sel.contains(start);\n\t if (ourIndex > -1)\n\t ourRange = ranges[ourIndex];\n\t else\n\t ourRange = new Range(start, start);\n\t } else {\n\t ourRange = doc.sel.primary();\n\t ourIndex = doc.sel.primIndex;\n\t }\n\n\t if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n\t type = \"rect\";\n\t if (!addNew) ourRange = new Range(start, start);\n\t start = posFromMouse(cm, e, true, true);\n\t ourIndex = -1;\n\t } else if (type == \"double\") {\n\t var word = cm.findWordAt(start);\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n\t else\n\t ourRange = word;\n\t } else if (type == \"triple\") {\n\t var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n\t if (cm.display.shift || doc.extend)\n\t ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n\t else\n\t ourRange = line;\n\t } else {\n\t ourRange = extendRange(doc, ourRange, start);\n\t }\n\n\t if (!addNew) {\n\t ourIndex = 0;\n\t setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n\t startSel = doc.sel;\n\t } else if (ourIndex == -1) {\n\t ourIndex = ranges.length;\n\t setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n\t {scroll: false, origin: \"*mouse\"});\n\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n\t setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t {scroll: false, origin: \"*mouse\"});\n\t startSel = doc.sel;\n\t } else {\n\t replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n\t }\n\n\t var lastPos = start;\n\t function extendTo(pos) {\n\t if (cmp(lastPos, pos) == 0) return;\n\t lastPos = pos;\n\n\t if (type == \"rect\") {\n\t var ranges = [], tabSize = cm.options.tabSize;\n\t var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n\t var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t line <= end; line++) {\n\t var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n\t if (left == right)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n\t else if (text.length > leftPos)\n\t ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n\t }\n\t if (!ranges.length) ranges.push(new Range(start, start));\n\t setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t {origin: \"*mouse\", scroll: false});\n\t cm.scrollIntoView(pos);\n\t } else {\n\t var oldRange = ourRange;\n\t var anchor = oldRange.anchor, head = pos;\n\t if (type != \"single\") {\n\t if (type == \"double\")\n\t var range = cm.findWordAt(pos);\n\t else\n\t var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n\t if (cmp(range.anchor, anchor) > 0) {\n\t head = range.head;\n\t anchor = minPos(oldRange.from(), range.anchor);\n\t } else {\n\t head = range.anchor;\n\t anchor = maxPos(oldRange.to(), range.head);\n\t }\n\t }\n\t var ranges = startSel.ranges.slice(0);\n\t ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n\t setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n\t }\n\t }\n\n\t var editorSize = display.wrapper.getBoundingClientRect();\n\t // Used to ensure timeout re-tries don't fire when another extend\n\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t // least on Chrome, the timeouts still happen even when cleared,\n\t // if the clear happens after their scheduled firing time).\n\t var counter = 0;\n\n\t function extend(e) {\n\t var curCount = ++counter;\n\t var cur = posFromMouse(cm, e, true, type == \"rect\");\n\t if (!cur) return;\n\t if (cmp(cur, lastPos) != 0) {\n\t cm.curOp.focus = activeElt();\n\t extendTo(cur);\n\t var visible = visibleLines(display, doc);\n\t if (cur.line >= visible.to || cur.line < visible.from)\n\t setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n\t } else {\n\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t if (outside) setTimeout(operation(cm, function() {\n\t if (counter != curCount) return;\n\t display.scroller.scrollTop += outside;\n\t extend(e);\n\t }), 50);\n\t }\n\t }\n\n\t function done(e) {\n\t cm.state.selectingText = false;\n\t counter = Infinity;\n\t e_preventDefault(e);\n\t display.input.focus();\n\t off(document, \"mousemove\", move);\n\t off(document, \"mouseup\", up);\n\t doc.history.lastSelOrigin = null;\n\t }\n\n\t var move = operation(cm, function(e) {\n\t if (!e_button(e)) done(e);\n\t else extend(e);\n\t });\n\t var up = operation(cm, done);\n\t cm.state.selectingText = up;\n\t on(document, \"mousemove\", move);\n\t on(document, \"mouseup\", up);\n\t }", "click_extra() {\r\n }", "function updateSelection(e) {\n diagram.model.selectedNodeData = null;\n var it = diagram.selection.iterator;\n while (it.next()) {\n var selnode = it.value;\n // ignore a selected link or a deleted node\n if (selnode instanceof go.Node && selnode.data !== null) {\n diagram.model.selectedNodeData = selnode.data;\n break;\n }\n }\n $scope.$apply();\n }", "function mousePressed() {\n nuova_poesia();\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 mousePressed() {\n\t\t_redraw = true\n\t\tlet cellId = voronoiGetSite(mouseX, mouseY, false);\n\t\t//Get ids of voronoi cells neighboring cellId\n\t\t//Ctrl+Shift+I on Chrome to open the console\n\t\tconsole.log(cellId + \": \" + voronoiNeighbors(cellId));\n\n\t\t//Get color of selected voronoi cell\n\t\tconsole.log(\"Color: \" + voronoiGetColor(cellId));\n\n\t\t//Draw a specific voronoi cell using different centers\n\n\t\t//Draw cell from top left without jitter\n\t\tvoronoiDrawCell(800, 10, cellId,VOR_CELLDRAW_BOUNDED, true, false);\n\t\t//Draw cell frame from top left with jitter\n\t\tvoronoiDrawCell(1000, 10, cellId,VOR_CELLDRAW_BOUNDED, false, true);\n\n\t\t//Draw cell from site without jitter\n\t\tvoronoiDrawCell(800, 300, cellId,VOR_CELLDRAW_SITE, true, false);\n\t\t//Draw cell frame from site with jitter\n\t\tvoronoiDrawCell(1000, 300, cellId,VOR_CELLDRAW_SITE, false, true);\n\n\t\t//Draw cell from geometric center without jitter\n\t\tvoronoiDrawCell(800, 610, cellId,VOR_CELLDRAW_CENTER, true, false);\n\t\t//Draw cell frame from geometric center with jitter\n\t\tvoronoiDrawCell(1000, 610, cellId,VOR_CELLDRAW_CENTER, false, true);\n\n\t}", "function selectonchartfloodinc(){\r\n\tvar seriesfloodincarray=seriesfloodinc.xe.FN;\r\n\tvar i =seriesfloodincarray.indexOf(clickmap);\r\n\t\tseriesfloodinc.select([i]);\r\n}", "function onSelect()\n\t{\n\t\tunit.div.toggleClass(\"selected\", unit.movePoints > 0);\n\t}", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\") {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n }\n\n if (e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\") {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0));\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n ensureFocus(cm);\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n counter = Infinity;\n e_preventDefault(e);\n focusInput(cm);\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }", "function highlightSelection(e) \n{\n selection = window.getSelection();\n \n //Skip this section if mouse event is undefined\n if (e != undefined)\n {\n \n //Ignore right clicks; avoids odd behavior with CTRL key\n if (e.button == 2)\n {\n return;\n }\n\n //Exit if CTRL key is held while auto highlight is checked on\n if(imedBool && e.ctrlKey)\n {\n return;\n }\n \n //Exit if CTRL key not held and auto highlight is checked off\n if(!imedBool && !e.ctrlKey)\n {\n return;\n }\n }\n \n var selectionTagName;\n //Avoid inputs like the plague..\n try {\n selectionTagName = selection.anchorNode.childNodes[0].tagName.toLowerCase();\n } catch (err) {\n //fail silently :-D\n }\n if (selectionTagName == \"input\") {\n return;\n }\n \n // Clear all highlights if requested\n if (clearBetweenSelections && highlightedPage == true)\n {\n clearHighlightsOnPage();\n }\n \n var selectedText = window.getSelection().toString().replace(/^\\s+|\\s+$/g, \"\");\n var testText = selectedText.toLowerCase();\n \n //Exit if selection is whitespace or what was previously selected\n if (selectedText == '' || lastText == testText)\n {\n return;\n }\n \n if (selection.toString() != '') {\n var mySpan = document.createElement(\"span\");\n var prevSpan = document.getElementById(\"mySelectedSpan\");\n if (prevSpan != null) {\n prevSpan.removeAttribute(\"id\");\n }\n mySpan.id = \"mySelectedSpan\";\n var range = selection.getRangeAt(0).cloneRange();\n mySpan.appendChild(range.extractContents());\n range.insertNode(mySpan);\n }\n \n //Perform highlighting\n localSearchHighlight(selectedText, singleSearch);\n highlightedPage = true;\n \n //Store processed selection for next time this method is called\n lastText = testText;\n if (selection.toString() != '') {\n if (!triggeredOnce) {\n triggeredOnce = !triggeredOnce;\n }\n }\n}", "function mouseClick (e) {\r\n\r\n var radWorkMode=document.getElementsByName(\"radWorkMode\"),\r\n // workMode = null,\r\n clickTarget = null;\r\n \r\n for(var i=0; i< radWorkMode.length; i++)\r\n if(radWorkMode[i].checked){\r\n workMode = radWorkMode[i].value;\r\n break;\r\n }\r\n \r\n if(e.target.nodeName == \"text\")\r\n clickTarget=e.target.under;\r\n else\r\n clickTarget = e.target;\r\n \r\n\r\n switch (workMode) {\r\n case \"drawVertex\":\r\n if(clickTarget==svg){\r\n drawVertex(e.clientX, e.clientY);\r\n }\r\n break;\r\n\r\n case \"drawEdge\":\r\n if(clickTarget.nodeName==\"circle\") {\r\n if(!isDrawingEdge){\r\n edgeVertex1 = clickTarget;\r\n isDrawingEdge=true;\r\n }\r\n else if(clickTarget != edgeVertex1){ //edge cannot be from a vertex to itself\r\n edgeVertex2 = clickTarget;\r\n drawEdge(edgeVertex1, edgeVertex2);\r\n edgeVertex1 = null;\r\n edgeVertex2 = null;\r\n isDrawingEdge = false;\r\n }\r\n }\r\n break;\r\n\r\n case \"delVertexEdge\":\r\n if(clickTarget.nodeName == \"circle\") \r\n delVertex(clickTarget);\r\n\r\n if(clickTarget.nodeName==\"line\")\r\n delEdge(clickTarget);\r\n break; \r\n\r\n case \"setCostLabel\":\r\n if(clickTarget.nodeName == \"circle\") {\r\n\t\t\t\tvar vertex = clickTarget;\r\n showDialogVertexLabel(vertex);\r\n }\r\n\r\n if(clickTarget.nodeName == \"line\") {\r\n\t\t\t\tvar edge = clickTarget;\r\n showDialogEdgeCost(edge);\r\n }\r\n break; \r\n\r\n case \"setStart\":\r\n if(clickTarget.nodeName == \"circle\") {\r\n setVertexNeighbors();\r\n var vertex = clickTarget;\r\n vertex.isSource = true;\r\n bellman(vertex);\r\n }\r\n break; \r\n\r\n }\r\n\r\n}", "externalClick() {\n this._strikeClick();\n this._localPointer.x = this.getPointer().x;\n this._localPointer.y = this.getPointer().y;\n }", "function cust_MouseDown() {\n\n}", "function $A(){var t=this;ze(this);var e=ki(this.$interaction,\"select\");this.subscribeTo(e,function(e){var n=e.selected,i=e.deselected,r=e.mapBrowserEvent;++t.rev,i.forEach(function(e){return t.$emit(\"unselect\",{feature:e,mapBrowserEvent:r})}),n.forEach(function(e){return t.$emit(\"select\",{feature:e,mapBrowserEvent:r})}),t.$emit(\"update:features\",t.$features.map(t.writeFeatureInDataProj.bind(t)))})}", "onMouseDown(e) {}", "function leftButtonSelect(cm, event, start, behavior) {\n\t\t if (ie) { delayBlurEvent(cm); }\n\t\t var display = cm.display, doc$1 = cm.doc;\n\t\t e_preventDefault(event);\n\n\t\t var ourRange, ourIndex, startSel = doc$1.sel, ranges = startSel.ranges;\n\t\t if (behavior.addNew && !behavior.extend) {\n\t\t ourIndex = doc$1.sel.contains(start);\n\t\t if (ourIndex > -1)\n\t\t { ourRange = ranges[ourIndex]; }\n\t\t else\n\t\t { ourRange = new Range(start, start); }\n\t\t } else {\n\t\t ourRange = doc$1.sel.primary();\n\t\t ourIndex = doc$1.sel.primIndex;\n\t\t }\n\n\t\t if (behavior.unit == \"rectangle\") {\n\t\t if (!behavior.addNew) { ourRange = new Range(start, start); }\n\t\t start = posFromMouse(cm, event, true, true);\n\t\t ourIndex = -1;\n\t\t } else {\n\t\t var range = rangeForUnit(cm, start, behavior.unit);\n\t\t if (behavior.extend)\n\t\t { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n\t\t else\n\t\t { ourRange = range; }\n\t\t }\n\n\t\t if (!behavior.addNew) {\n\t\t ourIndex = 0;\n\t\t setSelection(doc$1, new Selection([ourRange], 0), sel_mouse);\n\t\t startSel = doc$1.sel;\n\t\t } else if (ourIndex == -1) {\n\t\t ourIndex = ranges.length;\n\t\t setSelection(doc$1, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n\t\t {scroll: false, origin: \"*mouse\"});\n\t\t } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n\t\t setSelection(doc$1, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n\t\t {scroll: false, origin: \"*mouse\"});\n\t\t startSel = doc$1.sel;\n\t\t } else {\n\t\t replaceOneSelection(doc$1, ourIndex, ourRange, sel_mouse);\n\t\t }\n\n\t\t var lastPos = start;\n\t\t function extendTo(pos) {\n\t\t if (cmp(lastPos, pos) == 0) { return }\n\t\t lastPos = pos;\n\n\t\t if (behavior.unit == \"rectangle\") {\n\t\t var ranges = [], tabSize = cm.options.tabSize;\n\t\t var startCol = countColumn(getLine(doc$1, start.line).text, start.ch, tabSize);\n\t\t var posCol = countColumn(getLine(doc$1, pos.line).text, pos.ch, tabSize);\n\t\t var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n\t\t for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n\t\t line <= end; line++) {\n\t\t var text = getLine(doc$1, line).text, leftPos = findColumn(text, left, tabSize);\n\t\t if (left == right)\n\t\t { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n\t\t else if (text.length > leftPos)\n\t\t { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n\t\t }\n\t\t if (!ranges.length) { ranges.push(new Range(start, start)); }\n\t\t setSelection(doc$1, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n\t\t {origin: \"*mouse\", scroll: false});\n\t\t cm.scrollIntoView(pos);\n\t\t } else {\n\t\t var oldRange = ourRange;\n\t\t var range = rangeForUnit(cm, pos, behavior.unit);\n\t\t var anchor = oldRange.anchor, head;\n\t\t if (cmp(range.anchor, anchor) > 0) {\n\t\t head = range.head;\n\t\t anchor = minPos(oldRange.from(), range.anchor);\n\t\t } else {\n\t\t head = range.anchor;\n\t\t anchor = maxPos(oldRange.to(), range.head);\n\t\t }\n\t\t var ranges$1 = startSel.ranges.slice(0);\n\t\t ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc$1, anchor), head));\n\t\t setSelection(doc$1, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n\t\t }\n\t\t }\n\n\t\t var editorSize = display.wrapper.getBoundingClientRect();\n\t\t // Used to ensure timeout re-tries don't fire when another extend\n\t\t // happened in the meantime (clearTimeout isn't reliable -- at\n\t\t // least on Chrome, the timeouts still happen even when cleared,\n\t\t // if the clear happens after their scheduled firing time).\n\t\t var counter = 0;\n\n\t\t function extend(e) {\n\t\t var curCount = ++counter;\n\t\t var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n\t\t if (!cur) { return }\n\t\t if (cmp(cur, lastPos) != 0) {\n\t\t cm.curOp.focus = activeElt(doc(cm));\n\t\t extendTo(cur);\n\t\t var visible = visibleLines(display, doc$1);\n\t\t if (cur.line >= visible.to || cur.line < visible.from)\n\t\t { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n\t\t } else {\n\t\t var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n\t\t if (outside) { setTimeout(operation(cm, function () {\n\t\t if (counter != curCount) { return }\n\t\t display.scroller.scrollTop += outside;\n\t\t extend(e);\n\t\t }), 50); }\n\t\t }\n\t\t }\n\n\t\t function done(e) {\n\t\t cm.state.selectingText = false;\n\t\t counter = Infinity;\n\t\t // If e is null or undefined we interpret this as someone trying\n\t\t // to explicitly cancel the selection rather than the user\n\t\t // letting go of the mouse button.\n\t\t if (e) {\n\t\t e_preventDefault(e);\n\t\t display.input.focus();\n\t\t }\n\t\t off(display.wrapper.ownerDocument, \"mousemove\", move);\n\t\t off(display.wrapper.ownerDocument, \"mouseup\", up);\n\t\t doc$1.history.lastSelOrigin = null;\n\t\t }\n\n\t\t var move = operation(cm, function (e) {\n\t\t if (e.buttons === 0 || !e_button(e)) { done(e); }\n\t\t else { extend(e); }\n\t\t });\n\t\t var up = operation(cm, done);\n\t\t cm.state.selectingText = up;\n\t\t on(display.wrapper.ownerDocument, \"mousemove\", move);\n\t\t on(display.wrapper.ownerDocument, \"mouseup\", up);\n\t\t }", "openOnwerFilter(){\n\n var selected = this.template.querySelector(\".selected-owner\");\n var optionsContainer = this.template.querySelector(\".options-container-owner\");\n var optionsList =this.template.querySelectorAll(\".option-owner\");\n selected.addEventListener(\"click\", () => {\n optionsContainer.classList.toggle(\"active\");\n }); \n //selected.addEventListener(\"click\", () => {\n //});\n\n /* optionsList.forEach(o => {\n o.addEventListener(\"click\", () => {\n selected.innerHTML = o.querySelector(\"label\").innerHTML;\n optionsContainer.classList.remove(\"active\");\n });\n });\n */\n }", "function clickRender(){\n switch( env['clicker']){\n case 'Conduction Block':\n env.click.setUniform('clickValue', env.conductionValue) ;\n clickSolve() ;\n requestAnimationFrame(clickSolve) ;\n break ;\n case 'Pace Region':\n env.click.setUniform('clickValue',env.paceValue) ;\n clickSolve() ;\n requestAnimationFrame(clickSolve) ;\n break ;\n case 'Signal Loc. Picker':\n env.plot.setProbePosition( env.clickPosition ) ;\n env.disp.setProbePosition( env.clickPosition ) ;\n env.plot.init() ;\n refreshDisplay() ;\n break ;\n case 'Autopace Loc. Picker':\n ///pacePos = new THREE.Vector2(clickPos.x, env.clickPosition[1]) ;\n paceTime = 0 ;\n }\n return ;\n}", "highlight(on) { }", "function selectPoint(){\n//alert(this.id + \" - \" + this.selectedIndex);\n// var circle = paper.circle(320, 240, 90).attr({ fill: '#3D6AA2', stroke: '#000000', 'stroke-width': 8 });\n \n var ID = this.selectedIndex;\nif (text[ID] == null) {\n\n\t//to highlight, I also want to redraw the dot...\n\t//circle[ID].hide();\n\tvar cir_x = circle[ID].attr('cx');\n\tvar cir_y = circle[ID].attr('cy');\n\tvar cir_r = circle[ID].attr('r');\t\n\tvar cir_opa = circle[ID].attr(\"fill-opacity\");\n\tvar cir_title = circle[ID].attr(\"title\");\n\t\n\t\n\tvar anim = Raphael.animation({r: cir_r*3, \"fill-opacity\":0.25}, 300);\n\tcircle[ID].animate(anim);\n\tvar anim2 = Raphael.animation({r: cir_r, \"fill-opacity\":cir_opa}, 600);\n\tcircle[ID].animate(anim2.delay(300));\n\n\tcircle[ID].toFront();\n\t\n\tif(isCircleColorAnnotated ==0){\n\tcircle[ID].attr({fill: AnnotationColor});//don't change the color to read\n\t}\n \t//text[ID] = paper.text(cir_x - 5, cir_y - 10, data[0][1 + 2 * cir_title] ).attr({'font-size': 12,fill: '#003300', cursor: 'pointer'});\n \ttext[ID] = paper.text(cir_x - 5, cir_y - 10, virusName[cir_title] ).attr({'font-size': textSizeLabel,fill: '#003300', cursor: 'pointer'});\n\ttext[ID].drag(move, start, up);\n\ttext[ID].dblclick(promptRename);\n\t//\n}\n\n\n\n\n}" ]
[ "0.63947594", "0.6387656", "0.6298107", "0.62438524", "0.62195814", "0.6207204", "0.616908", "0.616908", "0.6158776", "0.6148406", "0.6116233", "0.6107618", "0.6105225", "0.60965323", "0.60965323", "0.60965323", "0.60965323", "0.6081099", "0.60737526", "0.6067152", "0.60571176", "0.6045314", "0.6035352", "0.6029886", "0.60282993", "0.60265857", "0.59998184", "0.5976104", "0.5974968", "0.5974968", "0.59651023", "0.595648", "0.5953394", "0.5950634", "0.5946443", "0.5946443", "0.5946443", "0.593894", "0.59291834", "0.5925614", "0.59117776", "0.589382", "0.58881694", "0.58827394", "0.5865509", "0.5859425", "0.58592016", "0.5858839", "0.58588356", "0.58583575", "0.5858206", "0.5855786", "0.58493876", "0.58414805", "0.58409905", "0.5827652", "0.5827652", "0.58200264", "0.58110344", "0.5805439", "0.5801653", "0.5801653", "0.57985735", "0.57947826", "0.5777964", "0.5776615", "0.57619077", "0.57547873", "0.5751145", "0.5751145", "0.574431", "0.57424515", "0.57363474", "0.5732177", "0.57294077", "0.5727231", "0.5722301", "0.5720196", "0.5719539", "0.57191485", "0.5699175", "0.56928325", "0.5690751", "0.5690681", "0.56849027", "0.5683698", "0.5682933", "0.5676072", "0.56749785", "0.56749785", "0.5672364", "0.5670066", "0.56648743", "0.566466", "0.56635845", "0.5657994", "0.56573474", "0.56487167", "0.5645475", "0.56383294", "0.56379145" ]
0.0
-1
Transitions TODO Ramp TODO Function to scale raw data Scales each data point to the % of total absolute energy This means both highly favourable and unfavourable values will have similar percentages Sort out between them using color.
function scale_data(mtx) { var _abs_array = mtx.map(function(subArray) { return subArray.map(function(el) { return Math.abs(el) }) }) var _abs_total_ene = d3.sum(_abs_array.map(function(subArray) { return d3.sum(subArray) })) var _scaled_array = mtx.map(function(subArray) { return subArray.map(function(el) { return (Math.abs(el) / _abs_total_ene) }) }) var _flattened_raw_array = [].concat.apply([], mtx) var _flattened_scaled_array = [].concat.apply([], _scaled_array) var _mapping = [] for (var i = 0; i < _flattened_raw_array.length; i++) { _mapping[_flattened_scaled_array[i]] = _flattened_raw_array[i] } return [_scaled_array, _mapping] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeColorScale(data){\n\n var colorScale=d3.scale.quantile()//use quantile for scale generator\n .range(objectColors[expressed]);//incorporate objectColors array to change depending on variable\n\n//creating equal interval classifcation\n var minmax = [\n d3.min(data, function(d) { return parseFloat(d[expressed]); }),\n d3.max(data, function(d) { return parseFloat(d[expressed]); })\n ];\n //assign two-value array as scale domain\n colorScale.domain(minmax);\n return colorScale;\n}", "function updateScale() {\n //Color scale rectangles based on mortality or incidence color scales\n d3.selectAll(\".scalerect\")\n .attr(\"fill\", function (d) {\n if (incidentMortality == \"m\") {\n return mortalityScale((d / 200) * 250);\n } else if (incidentMortality == \"i\") {\n return incidenceScale((d / 200) * 1000);\n }\n })\n\n //Update scale labels\n d3.select(\"#scaleunits\")\n .text(function () {\n if (incidentMortality == \"m\") {\n return \"(per 100,000 population)\";\n } else if (incidentMortality == \"i\") {\n return \"(per 1,000 at risk)\"\n }\n })\n\n d3.select(\"#scalelabel\")\n .text(function () {\n if (incidentMortality == \"m\") {\n return \"Mortality Rate\";\n } else if (incidentMortality == \"i\") {\n return \"Incidence Rate\"\n }\n })\n\n //Update axis on bottom of scale\n if (incidentMortality == \"m\") {\n d3.select(\"#scaleaxis\")\n .call(mortalityAxis);\n } else if (incidentMortality == \"i\") {\n d3.select(\"#scaleaxis\")\n .call(incidenceAxis)\n }\n\n}", "function makeColorScale(data){\n\n // default colorScale\n var colorClasses = colorbrewer.PuBuGn[5];\n\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n var domainArray = [];\n for (var i = 0; i < data.length; i++){\n\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n colorScale.domain(domainArray);\n\n return colorScale;\n\n }", "function quantileColorScale(data){\r\n var colorClasses = ['#edf8e9','#c7e9c0','#a1d99b','#74c476','#31a354','#006d2c'];\r\n\r\n //create color scale generator\r\n var colorScale = d3.scaleQuantile()\r\n .range(colorClasses);\r\n\r\n //build array of all values of the expressed attribute\r\n var domainArray = [];\r\n for (var i=0; i<data.length; i++){\r\n var val = parseFloat(data[i][expressed]);\r\n if (typeof val == 'number' && !isNaN(val)){\r\n domainArray.push(val);\r\n } \r\n };\r\n \r\n wScale = d3.scalePow()\r\n .exponent(0.25)\r\n .range([0, chartWidth])\r\n .domain([d3.min(domainArray), d3.max(domainArray)]);\r\n\r\n //assign array of expressed values as scale domain\r\n colorScale.domain(domainArray);\r\n\r\n return colorScale;\r\n }", "function makeColorScale2(data, color){\n\n var colorClasses = getColorClasses(color);\n\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n var domainArray = [];\n for (var i = 0; i < data.length; i++){\n\n var val = parseFloat(data[i][1]);\n domainArray.push(val);\n };\n\n colorScale.domain(domainArray);\n\n return colorScale;\n\n }", "function makeColorScale(data){\n var colorClasses = [\n \"#66D6F2\",\n \"#00A1C7\",\n \"#0086A6\",\n \"#00596E\",\n \"#002F3B\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile()\n .range(colorClasses);\n\n //build array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n //assign array of expressed values as scale domain\n colorScale.domain(domainArray);\n\n return colorScale;\n }", "function makeColorScale(data){\r\n var colorClasses = [\r\n \r\n \"#FFEED5\",\r\n \"#FFDDAA\",\r\n \"#FFCC80\",\r\n \"#FFBB55\",\r\n \"#FFAA2A\"\r\n\r\n ];\r\n\r\n //create color scale generator\r\n var colorScale = d3.scaleQuantile()\r\n .range(colorClasses);\r\n\r\n //build array of all values of the expressed attribute\r\n var domainArray = [];\r\n for (var i=0; i<data.length; i++){\r\n var val = parseFloat(data[i][expressed]);\r\n domainArray.push(val);\r\n };\r\n\r\n //assign array of expressed values as scale domain\r\n colorScale.domain(domainArray);\r\n\r\n return colorScale;\r\n}", "function normalizeValues() {\r\n\t\t// each row\r\n\t\tfor (var y=0; y<height; y++) {\r\n\t\t\t// each column\r\n\t\t\tfor (var x=0; x<width; x++) {\r\n\t\t\t\t// Adjust the value based on how far it is from the minimum as a percentage of the range.\r\n\t\t\t\theatMap[x][y] = ((heatMap[x][y]-min)/(max-min));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function setScales(data)\n{\n console.log('setting scales.');\n\n const xValue = d => d.x;\n const yValue = d => d.y;\n const durationValue = d => d.duration; // plot size\n const pupilValue = d => +d.avg_dilation; // plot color\n const timeValue = d => d.time;\n xMax = d3.max(data, xValue);\n xMin = d3.min(data, xValue);\n console.log('x '+xMin+' : '+xMax);\n yMax = d3.max(data, yValue);\n yMin = d3.min(data, yValue);\n console.log('y '+yMin+' : '+yMax);\n durationMax = d3.max(data, durationValue);\n durationMin = d3.min(data, durationValue);\n console.log('duration '+durationMin+' : '+durationMax);\n pupilMax = d3.max(data, pupilValue);\n pupilMin = d3.min(data, pupilValue);\n console.log('pupil '+pupilMin+' : '+pupilMax);\n timeMax = d3.max(data, timeValue);\n timeMin = d3.min(data, timeValue);\n console.log('time '+timeMin+' : '+timeMax);\n\n xScale = d3.scaleLinear()\n .domain([0, xMax])\n .range([0+20, svgWidth-50])\n .nice();\n yScale = d3.scaleLinear()\n .domain([0, yMax])\n .range([0+20, svgHeight-50])\n .nice();\n rScale.domain([100, durationMax]).nice();\n colorScale.domain([0, 0.4, 1]); //fixed with exagerated changes\n // .domain([0, (pupilMin+pupilMax)/2, pupilMax]) //show the distribution as it is\n // .domain([0, pupilMax*0.4, pupilMax]) //bit distorted\n timeScale = d3.scaleLinear()\n .domain([0, timeMax])\n .range([0, 10])\n .nice();\n \n timeSlider.attr('max',timeMax/1000); //set time slider range\n}", "function makeColorScale(data){\r\n\t\tvar colorClasses = [\r\n\t\t\t\"#ffffcc\",\r\n\t\t\t\"#c2e699\",\r\n\t\t\t\"#78c679\",\r\n\t\t\t\"#31a354\",\r\n\t\t\t\"#006837\"\r\n\t\t];\r\n\r\n\t\t//create color scale generator\r\n\t\tvar colorScale = d3.scaleQuantile()\r\n\t\t\t.range(colorClasses);\r\n\r\n\t\t//build array of all values of the expressed attribute\r\n\t\tvar domainArray = [];\r\n\t\tfor (var i=0; i<data.length; i++){\r\n\t\t\tvar val = parseFloat(data[i][expressed]);\r\n\t\t\tdomainArray.push(val);\r\n\t\t};\r\n\r\n\t\t//cluster data using ckmeans clustering algorithm to create natural breaks\r\n\t\tvar clusters = ss.ckmeans(domainArray, 5);\r\n\t\t//reset domain array to cluster minimums\r\n\t\tdomainArray = clusters.map(function(d){\r\n\t\t\treturn d3.min(d);\r\n\t\t});\r\n\t\t//remove first value from domain array to create class breakpoints\r\n\t\tdomainArray.shift();\r\n\r\n\t\t//assign array of last 4 cluster minimums as domain\r\n\t\tcolorScale.domain(domainArray);\r\n\t\t\r\n\t\treturn colorScale;\r\n\t}", "function rescale() {\n //reset value for tops\n var tops = new Object();\n for (i = 1983; i < 2019; i++) {\n tops[i] = 0;\n }\n //make non-checked hist rects hidden\n slider_svg.selectAll('.bar')\n .attr(\"visibility\", function(d) {\n if (selected_types.includes(d.type)) {\n tops[d.year] += d.total + 2;\n return \"visible\"; \n } else {\n return \"hidden\";\n }\n })\n\n //get max value for a year\n var max = max_top(tops);\n hist_y.domain([0, max]).range([hist_height, 0]);\n\n bin_y.domain([0, max]).range([0, hist_height]);\n\n slider_svg\n .select('.hist-y-axis')\n .call(d3.axisRight(hist_y))\n .attr(\"transform\",\"translate(\" + (slider_width + slider_margin.left) + \",\" + 160 + \")\");\n \n //reset value for tops\n var tops = new Object();\n for (i = 1983; i < 2019; i++) {\n tops[i] = 0;\n }\n slider_svg.selectAll('.bar')\n .attr('y', function(d) {\n if (selected_types.includes(d.type)) {\n tops[d.year] += d.total;\n return hist_y(tops[d.year]);\n }\n })\n //make height match bin number\n .attr('height', function(d) {\n\n return bin_y(d.total)\n })\n\n \n}", "function calculateScaledValue (elementData, minValue, maxValue) {\n var performanceBarScale = d3.scale.linear()\n .domain([minValue, maxValue]) // get input domain min max values\n .range([0, 100]) // set output range\n .clamp(true); // force values outside the range to nearest min max values\n for (var index = 0, len = elementData.length; index < len; index++) {\n elementData[index].scaledValue = performanceBarScale(elementData[index].dataValue);\n }\n }", "function changeRange() {\n\t\t\t\t// var v = range.max - range.value;\n\t\t\t\tvar v = range.value;\n\t\t\t\tdispatcher.fire('update.scale', v);\n\t\t\t}", "function changeMaxRange(value) {\n let maxQuantity = sortedData[0].quantity;\n let minQuantity = sortedData[sortedData.length - 1].quantity;\n heatmap.setData(\n getWeightedPoints(sortedData, minQuantity, maxQuantity, value)\n );\n document.getElementById(\"sliderLabel\").innerHTML = value;\n}", "function makeColorScale3(data, color){\n\n var colorClasses = getColorClasses(color);\n\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n var domainArray = [];\n for (var i = 0; i < data.length; i++){\n var val = parseFloat(data[i][1]);\n domainArray.push(val);\n };\n\n colorScale.domain(domainArray);\n\n return colorScale;\n\n }", "function makeColorScale(data){\n var colorClasses = [\n // I tried a bunch of options\n /*\n \"#D4B9DA\",\n \"#C994C7\",\n \"#DF65B0\",\n \"#DD1C77\",\n \"#980043\"\n */\n /*\n \"#fee5d9\",\n \"#fcae91\",\n \"#fb6a4a\",\n \"#de2d26\",\n \"#a50f15\"\n */\n /*\"#ffffb2\",\n \"#fecc5c\",\n \"#fd8d3c\",\n \"#f03b20\",\n \"#bd0026\" */\n // brown/oranges\n \"#ffffd4\",\n \"#fed98e\",\n \"#fe9929\",\n \"#d95f0e\",\n \"#993404\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile()\n .range(colorClasses);\n\n //build array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n //assign array of expressed values as scale domain\n colorScale.domain(domainArray);\n //console.log(colorClasses)\n return colorScale;\n}", "function makeColorScale(data){\n var colorClasses = [\n \"#f7de9c\",\n \"#e1bf61\",\n \"#b59334\",\n \"#7c5f10\",\n \"#56420c\"\n ];\n\n //create color scale generator\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n console.log(data.length);\n\n //build array of all values of the expressed attribute\n var domainArray = data[expressed];\n\n console.log(csvArray);\n\n for (var j=0; j<csvArray.length; j++) {\n\n }\n\n //assign array of expressed values as scale domain\n colorScale.domain(csvArray);\n\n console.log(colorScale.quantiles());\n\n return colorScale;\n\n }", "function colorScale(frequenciesArray){ \n\t//accepts an array of all frequency values and defines the class breaks based on the lowest and highest \n\t\n\t//create quantile classes with color scale \n\tvar color = d3.scale.pow() //designate quantile scale \n\t\t.range ([\n\t\t \"#000\",\n\t\t\t//\"#302C29\", //grey-ish\n\t\t\t//\"#45455C\",\t\t\t\n\t\t\t//\"#4C61A2\", \n\t\t\t\"#057FFE\" //bright blue\n\t\t]); \n\t\n\t//set min and max data values as domain \n\tcolor.domain ( //[0,1]\n\t\t[\n\t\t\td3.min(frequenciesArray), //lowest \n\t\t\td3.max(frequenciesArray) //highest \n\t\t]\n\t); \n\t\n\t//var low = d3.min(frequenciesArray); //lowest \n\t//var high = d3.max(frequenciesArray); //highest \n\t//console.log(\"colorscale:\"+low+\" to \"+high);\n\t\n\treturn color; //return the color scale generator \t\n}", "update()\n {\n this.scale += this.ds;\n\n if(this.scale <= SMIN)\n {\n this.scale = SMIN;\n this.ds = -this.ds;\n }\n\n if(this.scale >= SMAX)\n {\n this.scale = SMAX;\n this.ds = -this.ds;\n }\n }", "function buildScales() {\n a = alpha(data, v),\t //scale factor between value and bar width\n mid = Midi(data, v, a),\t//mid-point displacement of bar i\n w = Wi(data, v, a);\t\t //width of bar i\n\n let percentageAxis = Math.min(percentageAxisToMaxRatio * d3Array.max(data, getValue))\n\n xScale = d3Scale.scaleLinear()\n .domain([0, percentageAxis])\n .rangeRound([0, chartWidth]);\n\n yScale = d3Scale.scaleOrdinal()\n .domain(data.map(getName))\n .range(data.map(mid)); //force irregular intervals based on\n // value\n\n\n if (shouldReverseColorList) {\n colorList = data.map(d => d)\n .reverse()\n .map(({name}, i) => ({\n name,\n color: colorSchema[i % colorSchema.length]}\n ));\n } else {\n colorList = data.map(d => d)\n .map(({name}, i) => ({\n name,\n color: colorSchema[i % colorSchema.length]}\n ));\n }\n\n colorMap = (item) => colorList.filter(({name}) => name === item)[0].color;\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 makeColorScale(data){\n\t\tvar colorClasses=[\n\t\t\t\"#ffffb2\",\n\t\t\t\"fecc5c\",\n\t\t\t\"fb8d3c\",\n\t\t\t\"f03b20\",\n\t\t\t\"bd0026\"\n\n\t\t];\n\t\t//create color scale generator\n\t\tvar colorScale=d3.scaleThreshold()\n\t\t\t.range(colorClasses);\n\n\t\t//build arrary of all values of the expressed attribute\n\t\tvar domainArray= [];\n\t\tfor (var i=0; i<data.length; i++){\n\t\t\tvar val=parseFloat(data[i][expressed]);\n\t\t\tdomainArray.push(val);\n\t\t};\n\n\t\t//cluster data using ckmeans clustering algorithm to create natural breaks\n\t\tvar clusters=ss.ckmeans(domainArray,5);\n\n\t\t//reset domain arrary to cluster minimums\n\t\tdomainArray=clusters.map(function(d){\n\t\t\treturn d3.min(d);\n\t\t});\n\n\t\t//remove first value from domain arrary to create class breakpoints\n\t\tdomainArray.shift();\n\n\t\t//assign array of last 4 cluster minimyms as domain\n\t\tcolorScale.domain(domainArray);\n\t\t// return the varibale colorScale for easier referencing\n\t\treturn colorScale;\n\t}", "rescale(min, max) {\n if(min === 0){\n min = min + \"\";\n }\n if(max === 0){\n max = max + \"\";\n }\n this.x.domain([min || 30, max || 80]);\n\n this.xAxisElement\n .transition().duration(1500).ease(easeSinInOut) // https://github.com/mbostock/d3/wiki/Transitions#wiki-d3_ease\n .call(this.xAxis);\n\n for (let k in this.data) {\n // Add the valueline path.\n this.lineSvg.select(\".MECU\"+k)\n .transition().duration(1500).ease(easeSinInOut)\n .attr(\"d\", this.valueline(this.data[k].r));\n }\n }", "function makeColorScale(data){\n var colorClasses = [\n \"#fef0d9\",\n \"#fdcc8a\",\n \"#fc8d59\",\n \"#e34a33\",\n \"#b30000\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile()\n .range(colorClasses);\n\n //build two-value array of minimum and maximum expressed attribute values\n var minmax = [\n d3.min(data, function(d) { return parseFloat(d[expressed]); }),\n d3.max(data, function(d) { return parseFloat(d[expressed]); })\n ];\n //assign two-value array as scale domain\n colorScale.domain(minmax);\n\n return colorScale;\n}", "function _updateScales() {\r\n xScale.domain(d3.extent([].concat.apply([], data.map(function(d) {\r\n return d.data.map(function(pointData) {\r\n return new Date(pointData.timestamp);\r\n });\r\n }))));\r\n yScale.domain([ _getMinY(), _getMaxY() / 100 * 105 ]);\r\n\r\n navXScale.domain(d3.extent([].concat.apply([], data.map(function(d) {\r\n return d.data.map(function(pointData) {\r\n return new Date(pointData.timestamp);\r\n });\r\n }))));\r\n\r\n navYScale.domain([ _getMinY(), _getMaxY() / 100 * 110 ]);\r\n }", "function makeColorScale(data){\n\t\tlet colorClasses = [\n\t\t\t\"#D4B9DA\",\n\t\t\t\"#C994C7\",\n\t\t\t\"#DF65B0\",\n\t\t\t\"#DD1C77\",\n\t\t\t\"#980043\"\n\t\t];\n\n\t\t//Create color scale generator\n\t\tlet colorScale = d3.scaleThreshold()\n\t\t\t.range(colorClasses);\n\n\t\t//Build array of all values of the expressed attribute\n\t\tlet domainArray = [];\n\t\tfor (let i=0; i<data.length; i++){\n\t\t\tlet val = parseInt(data[i][expressed]);\n\t\t\tdomainArray.push(val);\n\t\t};\n\n\t\t//Cluster data using ckmeans clustering algorithm to create natural breaks\n\t\tlet clusters = ss.ckmeans(domainArray, 5);\n\t\t//Reset domain array to cluster minimums\n\t\tdomainArray = clusters.map(function(d){\n\t\t\treturn d3.min(d);\n\t\t});\n\n\t\t//Remove first value from the domain array to create class breakpoints\n\t\tdomainArray.shift();\n\n\t\t//Assign array last 4 cluster minimums as domain\n\t\tcolorScale.domain(domainArray);\n\n\t\treturn colorScale;\n\t}", "function colorScale() {\n var linearScale = d3.scaleLinear()\n .domain([d3.min(happinessData, d => d[chosenColor]),\n d3.max(happinessData, d => d[chosenColor])])\n .range([\"rgb(46, 73, 123)\", \"rgb(71, 187, 94)\"]);\n\n return linearScale;\n}", "function scale(array){\n assessmentScale.total=0;\n assessmentScale.satisfactory=0;\n assessmentScale.developing=0;\n assessmentScale.unsatisfactory=0;\n\n for(var i=0; i<=array.length-1;i++){\n switch(array[i]){\n case \"A\":\n assessmentScale.satisfactory++;\n assessmentScale.total++;\n break;\n case \"B\":\n assessmentScale.satisfactory++;\n assessmentScale.total++;\n break;\n case \"C\":\n assessmentScale.developing++;\n assessmentScale.total++;\n break;\n case \"D\":\n assessmentScale.unsatisfactory++;\n assessmentScale.total++;\n break;\n case \"F\":\n assessmentScale.unsatisfactory++;\n assessmentScale.total++;\n break;\n }\n }\n}//end of scale function.", "function seventyPercent(evt) {\n\twb.cm_percent = 0.7;\n\twb.drawRectForViewPort();\n\tvar element = document.querySelector('.code_map');\n\tvar transfromString = (\"scale(0.7, 0.7)\");\n // now attach that variable to each prefixed style\n element.style.webkitTransform = transfromString;\n element.style.MozTransform = transfromString;\n element.style.msTransform = transfromString;\n element.style.OTransform = transfromString;\n element.style.transform = transfromString;\n}", "scaleTo() {}", "function calculateScales() {\n //iterate nodes to create their colors\n diagram.data.nodes.forEach(function (n, i) {\n n.color = i >= e.colors.length ? e.randColor() : e.colors[i];\n });\n\n //set total measure\n totalMeasure = d3.sum(diagram.data.links, function (d) { return +d[currentSerie.measureField]; });\n maxNodeLength = d3.max(diagram.data.nodes, function (d) { return d.name.toString().length; });\n maxTextLength = maxNodeLength > totalMeasure.toString().length ? maxNodeLength : totalMeasure.toString().length;\n\n //set label font size\n if (currentSerie.labelFontSize === 'auto')\n currentSerie.labelFontSize = 11;\n\n //set label font color\n if (currentSerie.labelFontColor === 'auto')\n currentSerie.labelFontColor = '#333333';\n\n //calculate auto margins\n autoMarginSides = 10;\n autoMarginTop = diagram.xAxis.labelFormat ? diagram.xAxis.labelFontSize * 2 : 10;\n margin.left = autoMarginSides;\n margin.right = autoMarginSides;\n margin.top = autoMarginTop + diagram.xAxis.labelFontSize;\n margin.bottom = autoMarginTop;\n\n //calculate dimension\n width = diagram.plot.width - margin.left - margin.right;\n height = diagram.plot.height - margin.top - margin.bottom;\n }", "function calculateScales() {\n //clear items\n nodes = [];\n links = [];\n\n //set dimension\n width = diagram.plot.width - diagram.plot.left - diagram.plot.right;\n height = diagram.plot.height - diagram.plot.top - diagram.plot.bottom;\n\n //get sources, targets and groups\n sources = e.getUniqueValues(diagram.data, currentSerie.sourceField);\n targets = e.getUniqueValues(diagram.data, currentSerie.targetField);\n groups = e.getUniqueValues(diagram.data, currentSerie.groupField);\n\n //calculates measures\n let calculateMeasures = function () {\n //iterate all sources to set measures\n sources.forEach(function (s) {\n //get filtered sources and measure value\n let filteredSources = diagram.data.filter(function (d) { return d[currentSerie.sourceField] === s; });\n let measureValue = d3.sum(filteredSources, function (d) { return +d[currentSerie.measureField]; });\n\n //set measure\n measures[s] = measureValue;\n\n //check whether the measure value is less than min value\n if (measures[s] < minMeasure)\n minMeasure = measures[s];\n\n //check whether the measure value is greater than max value\n if (measures[s] > maxMeasure)\n maxMeasure = measures[s];\n });\n\n //iterate all targets to set measures\n targets.forEach(function (s) {\n //get filtered sources and measure value\n let filteredTargets = diagram.data.filter(function (d) { return d[currentSerie.targetField] === s; });\n let measureVal = d3.sum(filteredTargets, function (d) { return +d[currentSerie.measureField]; });\n\n //set measure\n if (measures[s])\n measures[s] += measureVal;\n else\n measures[s] = measureVal;\n\n //check whether the measure value is less than min value\n if (measures[s] < minMeasure)\n minMeasure = measures[s];\n\n //check whether the measure value is greater than max value\n if (measures[s] > maxMeasure)\n maxMeasure = measures[s];\n });\n\n //set max bullet size\n if (!currentSerie.maxBulletSize)\n currentSerie.maxBulletSize = Math.sqrt(((width * height) / diagram.data.length) / Math.PI) - 5;\n\n //set min bullet size\n if (!currentSerie.minBulletSize)\n currentSerie.minBulletSize = (currentSerie.maxBulletSize * minMeasure) / maxMeasure;\n\n //set r scale for circle diameters\n rScale = d3.scalePow().exponent(0.5).domain([minMeasure, maxMeasure]).range([currentSerie.minBulletSize, currentSerie.maxBulletSize]);\n\n //create color scale\n colorScale = d3.scaleLinear().range(diagram.legend.gradientColors).domain([minMeasure, maxMeasure]);\n };\n\n //creates nodes and links\n let createNodesAndLinks = function () {\n //declare needed variables\n let nodeNames = [];\n\n //iterate all data to set nodes and links\n for (let i = 0; i < diagram.data.length; i++) {\n let currentData = diagram.data[i];\n let sourceValue = currentData[currentSerie.sourceField];\n let targetValue = currentData[currentSerie.targetField];\n let measureValue = +currentData[currentSerie.measureField];\n let groupValue = currentSerie.groupField ? currentData[currentSerie.groupField] : \"\";\n let groupIndex = (groups.length > 0 && groupValue) ? groups.indexOf(groupValue) : 0;\n let nodeColor = colorScale(measureValue);\n let expValue = getDataValue(sourceValue, targetValue);\n\n //set current source value as node\n if (nodeNames.indexOf(sourceValue) === -1) {\n //set current node\n let currentNode = {\n id: sourceValue,\n group: groupIndex,\n measure: measures[sourceValue],\n color: colorScale(measures[sourceValue]),\n sourceValue: sourceValue,\n targetValue: targetValue,\n groupValue: groupValue,\n measureValue: measureValue\n };\n\n //set node color\n nodeColor = groupIndex >= e.colors.length ? e.randColor() : e.colors[groupIndex];\n\n //check whether the legend is not enabled\n if (!diagram.legend.enabled)\n currentNode.color = nodeColor;\n\n //push to stack\n nodes.push(currentNode);\n nodeNames.push(sourceValue);\n }\n\n //set current target value as node\n if (nodeNames.indexOf(targetValue) === -1) {\n //set current node\n let currentNode = {\n id: targetValue,\n group: groupIndex,\n measure: measures[targetValue],\n color: colorScale(measures[targetValue]),\n sourceValue: sourceValue,\n targetValue: targetValue,\n groupValue: groupValue,\n measureValue: measureValue\n };\n\n //set node color\n nodeColor = groupIndex >= e.colors.length ? e.randColor() : e.colors[groupIndex];\n\n //check whether the legend is not enabled\n if (!diagram.legend.enabled)\n currentNode.color = nodeColor;\n\n //push to stack\n nodes.push(currentNode);\n nodeNames.push(targetValue);\n }\n\n //create the link\n links.push({\n source: sourceValue,\n target: targetValue,\n measure: measureValue,\n sourceValue: sourceValue,\n targetValue: targetValue,\n measureValue: measureValue,\n groupValue: groupValue,\n value: i,\n expressionedDataValue: currentSerie.expression ? expValue : measureValue\n });\n }\n\n //sort nodes\n nodes.sort(function (a, b) {\n //extract the type of the value\n let valueType = typeof a.id;\n if (valueType === \"string\") {\n if (a.id < b.id) { return -1; } if (a.id > b.id) { return 1; } return 0;\n } else if (valueType === \"number\") {\n return a.id - b.id;\n } else {\n return new Date(a.id) - new Date(b.id);\n }\n });\n\n //sort links\n links.sort(function (a, b) {\n //extract the type of the value\n let valueType = typeof a.source;\n if (valueType === \"string\") {\n if (a.source < b.source) { return -1; } if (a.source > b.source) { return 1; } return 0;\n } else if (valueType === \"number\") {\n return a.source - b.source;\n } else {\n return new Date(a.source) - new Date(b.source);\n }\n });\n };\n\n //create nodes and links\n calculateMeasures();\n createNodesAndLinks();\n }", "adjustHighAndLow() {\n if (this.red + this.green > 510 - MAX_DATABITS) {\n this.red = 255 - (MAX_DATABITS >>> 1)\n this.green = 255 - (MAX_DATABITS - (MAX_DATABITS >>> 1))\n } else if (this.red + this.green < MAX_DATABITS) {\n this.red = MAX_DATABITS >>> 1\n this.green = MAX_DATABITS - (MAX_DATABITS >>> 1)\n }\n }", "function updateAccelRange() {\n accelRange.scaleX = accelRange.hiX - accelRange.loX; // find full range of raw values\n accelRange.scaleY = accelRange.hiY - accelRange.loY;\n}", "function Scale () {}", "function setScales() {\n // Get set of all values\n var allValues = [];\n selectedData.forEach(function (d) {\n d.values.forEach(function (d) {\n allValues.push(+d.value);\n });\n });\n\n // Reset xScale\n var xExtent = d3.extent(selectedData[0].values, function (d) {\n return +d.year;\n });\n xScale.domain([xExtent[0], xExtent[1]]).rangeRound([0, drawWidth]);\n\n // Reset yScale\n var yExtent = d3.extent(allValues);\n yScale.domain([yExtent[0] * 0.9, yExtent[1] * 1.1]).rangeRound([drawHeight, 0]);\n\n // Reset color scale to current set of countries\n console.log(selectedStates)\n colorScale.domain(selectedStates);\n }", "function computeValues() {\n\t\t\t\n\t\t\tvar scaler;\n\t\t\t// deal with loop\n\t\t\tif (repeat > 0) {\n\t\t\t\t// not first run, save last scale ratio\n\t\t\t\txFrom = xTo;\n\t\t\t\tyFrom = yTo;\n\t\t\t\tratioFrom = ratioTo;\n\t\t\t} else {\n\t\t\t\t// get the scaler using conf options\n\t\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"out\" ? \"fill\" : \"none\",align.w,align.h,w,h,tw,th);\n\t\t\t\txFrom = scaler.offset.w;\n\t\t\t\tyFrom = scaler.offset.h;\n\t\t\t\tratioFrom = scaler.ratio;\n\t\t\t}\n\t\t\t\n\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"in\" ? \"fill\" : \"none\",pan.w,pan.h,w,h,tw,th);\n\t\t\txTo = scaler.offset.w;\n\t\t\tyTo = scaler.offset.h;\n\t\t\tratioTo = scaler.ratio;\n\t\t\t\n\t\t\txPrev = 0;\n\t\t\tyPrev = 0;\n\t\t\t\n\t\t\tduration = parseFloat(normalized)*33;\n\t\t\t\n\t\t\t// reset counter\n\t\t\tcounter = 0;\n\t\t\t\n\t\t\t// update runs count\n\t\t\trepeat++;\n\t\t\t\n\t\t}", "scaleBackPoint(point) {\n let newPoint = point.map((vs, i)=>{\n let v = this.rangeD[i]*vs + this.minD[i];\n return v;\n });\n return newPoint;\n }", "scaleUpdated() {\n\t\tthis.pointCoords = this.data.map(d=>[this.xaxis.scale(d[0]), this.yscale(d[1])]);\n\t}", "rescale(scale) {\n this.scale = scale;\n }", "function scaleToRange(data, maxRange) {\n\n let min = data[0];\n let max = min;\n\n data.forEach((value) => {\n if(value < min) min = value;\n if(value > max) max = value;\n });\n\n let diff = (max - min);\n\n data.forEach((value, index) => {\n data[index] = Math.floor( (value - min) / diff * maxRange );\n });\n\n return data;\n}", "function fiftyPercent(evt) {\n\twb.cm_percent = 0.5;\n\twb.drawRectForViewPort();\n\tvar element = document.querySelector('.code_map');\n\tvar transfromString = (\"scale(0.5, 0.5)\");\n // now attach that variable to each prefixed style\n element.style.webkitTransform = transfromString;\n element.style.MozTransform = transfromString;\n element.style.msTransform = transfromString;\n element.style.OTransform = transfromString;\n element.style.transform = transfromString;\n}", "function makeColorScale(data)\n {\n var colorClasses = \n [\n \"#eff3ff\",\n \"#bdd7e7\",\n \"#6baed6\",\n \"#3182bd\",\n \"#08519c\"\n ];\n\n //create color scale\n var colorScale = d3.scale.threshold()\n .range(colorClasses);\n\n //create array of values for expressed attribute\n var domainArray = [];\n\n for (var i=0; i<data.length; i++)\n {\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n \n scaleMax = d3.max(domainArray);\n scaleMax = scaleMax + 2;\n\n //use ckmeans clustering algorithm to create natural breaks\n var clusters = ss.ckmeans(domainArray, 5);\n\n //reset domain array to cluster minimums\n domainArray = clusters.map(function(d)\n {\n return d3.min(d);\n });\n\n //remove first value from domain array to create class breakpoints\n domainArray.shift();\n\n //assign array of last 4 cluster minimums as domain\n colorScale.domain(domainArray);\n \n return colorScale;\n }", "function scaleData(data) {\n return new Float32Array(data).map((i) => i / 255.0);\n}", "function makeColorScale(data){\n var colorClasses = [\n //\"#f2d0e0\",\n \"ffffdf\",\n \"fffbf\",\n //\"#e373a8\",\n \"#ffff52\",\n \"#cbcf00\",\n ];\n\n //create color scale generator\n var colorScale = d3.scaleThreshold()\n .range(colorClasses);\n\n //build array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n var clusters = ss.ckmeans(domainArray, 5);\n //console.log(clusters);\n //reset domain array to cluster minimums\n domainArray = clusters.map(function(d) {\n return d3.min(d);\n });\n //remove first value from domain array to create class breakpoints\n domainArray.shift();\n\n //assign array of last 4 cluster minimums as domain\n colorScale.domain(domainArray);\n\n return colorScale;\n}", "function scale(scale)\n{\n // Loop through each value pair\n for (var i = 0, size = positions.length; i < size; i+=2)\n {\n // Get x and y coordinates\n var x = positions[i];\n var y = positions[i+1];\n\n // Multiply x and y valu by scale value\n x += x * scale;\n y += y * scale;\n\n // Set position values\n positions[i] = x;\n positions[i+1] = y;\n }\n\n // Redraw the image\n loadImage();\n}", "updateScale(args) {\n if (args !== null) {\n if (UtilsNew.isNotUndefinedOrNull(args.height)) {\n this.histogramHeight = args.height * 0.95;\n }\n if (UtilsNew.isNotUndefinedOrNull(args.histogramMaxFreqValue)) {\n this.maxValue = args.histogramMaxFreqValue;\n }\n }\n this.multiplier = this.histogramHeight / this.maxValue;\n }", "function uc1_rescaleX(data, g, binSize, range, mutationTypes, stacked, showTotal, normalize) {\n\n // uc1(data, binSize, range, mutationTypes);\n //return;\n\n console.log(\"rescaling x\");\n g.xAxisScale = d3.scaleLinear().domain([range.min,range.max]).range([0, g.width]);\n\n // g.xAxisScale.domain([range.min,range.max]) \n g.xAxis\n .transition()\n .duration(1000)\n .call(d3.axisBottom(g.xAxisScale).tickFormat(function(d) { return d3.format(\".2s\")(d); }));\n\n uc1_update(data, g, binSize, range.minY, mutationTypes,stacked, showTotal, normalize);\n}", "function hundredPercent(evt) {\n\twb.cm_percent = 1;\n\twb.drawRectForViewPort();\n\tvar element = document.querySelector('.code_map');\n\tvar transfromString = (\"scale(1, 1)\");\n // now attach that variable to each prefixed style\n element.style.webkitTransform = transfromString;\n element.style.MozTransform = transfromString;\n element.style.msTransform = transfromString;\n element.style.OTransform = transfromString;\n element.style.transform = transfromString;\n}", "function scaleAll2(newScale){\r\n if(newScale>MIN_SCALE && newScale<MAX_SCALE){\r\n canvas.forEachObject(function(item, index, arry){\r\n if(!item.isTag){\r\n item.scale(newScale);\r\n if(item != fabImg){\r\n //When scaling move element so that distance of elements for center is always in portion wiht scale\r\n var x = ((item.getLeft() - AnnotationTool.originX)/AnnotationTool.SCALE) * newScale + AnnotationTool.originX;\r\n var y = ((item.getTop() - AnnotationTool.originY)/AnnotationTool.SCALE) * newScale + AnnotationTool.originY;\r\n if(item.elementObj){\r\n item.elementObj.setItemPos(x, y, newScale);\r\n }\r\n }\r\n \r\n }\r\n });\r\n canvas.renderAll();\r\n AnnotationTool.SCALE = newScale;\r\n }\r\n }", "function makeColorScaleNatural(data){\n var colorClasses = [\n \"#C4BDB1\",\n \"#94856D\",\n \"#ACC77D\",\n \"#889E63\",\n \"#4F5C3A\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile() //possibly use .scaleThreshold .scaleQuantile\n .range(colorClasses);\n\n //build an array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n //the following is needed only for Natural Breaks\n //cluster data using ckmeans clustering algorithm to create natural breaks\n //var clusters = ss.ckmeans(domainArray, 5);\n //reset domain array to cluster minimums\n //domainArray = clusters.map(function(d) {\n // return d3.min(d);\n //});\n //remove first value from domain array to create class breakpoints\n //domainArray.shift();\n\n //assign array of expressed values as scale domain\n colorScale.domain(domainArray);\n\n return colorScale;\n }", "function _GetNewScale(event)\n\t{\n\t\t//compute the scale\n\t\tvar newScale = Math.max(_MinScale, Math.min(_MaxScale, event.scale * _StartScale));\n\t\t//boost it by 100 and divide it again\n\t\treturn Math.round(newScale * 100) / 100;\n\t}", "scaleCompany(d) {\n let minMcap = d3.min(this.companyData, function (d) {\n return parseInt(d.market_cap)\n });\n let maxMcap = d3.max(this.companyData, function (d) {\n return parseInt(d.market_cap)\n });\n let scale = d3.scaleLinear()\n .domain([minMcap, maxMcap])\n .range([2, 10]);\n return scale(d.market_cap);\n }", "function rescale() {\n\t\ttrans = d3.event.translate\n\t\tscale = d3.event.scale\n\t\tsvg.attr(\"transform\", \"translate(\" + trans + \")\" + \" scale(\" + scale + \")\")\n\t}", "function configureScales(data) {\n\n SCALES.x = d3.scale.linear()\n .domain([0, data.lapCount])\n .range([INSETS.left, WIDTH - INSETS.right]);\n\n SCALES.y = d3.scale.linear()\n .domain([0, data.laps.length - 1])\n .range([INSETS.top, HEIGHT - INSETS.bottom]);\n\n SCALES.clr = d3.scale.category20();\n}", "function changeAttribute(attribute, data){\n //change the expressed attribute\n currentFood = attribute;\n var valArray = [];\n data.forEach(function(element) {\n valArray.push(parseInt(element[currentFood]));\n });\n \n var currentMax = Math.max.apply(null, valArray.filter(function(n) { return !isNaN(n); }));\n\n \n var color = d3.scaleQuantile()\n .domain(d3.range(0, currentMax))\n .range(d3.schemeReds[7]); \n \n //recolor enumeration units\n //drawMap(currentMax);\n //reset chart bars\n setChart(data, data2, currentMax, valArray);\n setAllFoodsChart(data, valArray);\n setParameters(data, data2, data3, currentFood, attrArray);\n\n }", "function makeResponsive() {\n //Import data\n d3.csv(\"assets/data/data.csv\")\n .then(function(data) {\n // Parse Data/Cast as numbers\n // ==============================\n data.forEach(function(response) {\n response.poverty = +response.poverty;\n response.healthcare = +response.healthcare;\n response.smokes = +response.smokes;\n response.ageMoe = +response.age;\n response.incomeMoe = +response.income;\n response.obesity = +response.obesity;\n });\n \n scale(xscale,yscale,data); \n });\n}", "function update_edge_stroke_scale() {\n edge_stroke_scale = {}\n\n edge_stroke_scale_most_activated()\n edge_stroke_scale_most_changed()\n\n function edge_stroke_scale_most_activated() {\n\n // Initialize the stroke scale\n edge_stroke_scale['activated'] = {}\n \n // Get max and min influence value of benign\n var min_inf = {}\n var max_inf = {}\n layers.slice(1).forEach(layer => {\n min_inf[layer] = 10000\n max_inf[layer] = 0\n edge_data[0][layer].forEach(d => {\n var inf = d['inf']\n min_inf[layer] = d3.min([min_inf[layer], inf])\n max_inf[layer] = d3.max([max_inf[layer], inf])\n })\n })\n\n // Edge stroke of benign\n edge_stroke_scale['activated'][0] = {}\n layers.slice(1).forEach(layer => {\n edge_stroke_scale['activated'][0][layer] = d3\n .scaleLinear()\n .domain([min_inf[layer], max_inf[layer]])\n .range([edge_style['min-stroke'], edge_style['max-stroke']])\n })\n\n // Get max and min influence value of attacked\n min_inf = {}\n max_inf = {}\n attack_strengths[selected_attack_info['attack_type']].forEach(strength => {\n layers.slice(1).forEach(layer => {\n min_inf[layer] = 10000\n max_inf[layer] = 0\n edge_data[strength][layer].forEach(d => {\n var inf = d['inf']\n min_inf[layer] = d3.min([min_inf[layer], inf])\n max_inf[layer] = d3.max([max_inf[layer], inf])\n })\n }) \n })\n\n // Edge stroke of attacked\n attack_strengths[selected_attack_info['attack_type']].forEach(strength => {\n edge_stroke_scale['activated'][strength] = {}\n layers.slice(1).forEach(layer => {\n edge_stroke_scale['activated'][strength][layer] = d3\n .scaleLinear()\n .domain([min_inf[layer], max_inf[layer]])\n .range([edge_style['min-stroke'], edge_style['max-stroke']])\n })\n })\n }\n\n function edge_stroke_scale_most_changed() {\n\n // Initialize the stroke scale\n edge_stroke_scale['inhibited'] = {}\n edge_stroke_scale['excited'] = {}\n edge_stroke_scale['changed'] = {}\n \n // Get max changes in influence value of attacked\n attack_strengths[selected_attack_info['attack_type']].forEach(strength => {\n\n edge_stroke_scale['inhibited'][strength] = {}\n edge_stroke_scale['excited'][strength] = {}\n edge_stroke_scale['changed'][strength] = {}\n\n\n layers.slice(1).forEach(layer => {\n var max_inf = {}\n max_inf['inhibited'] = 0\n max_inf['excited'] = 0\n max_inf['changed'] = 0\n\n edge_data[strength][layer].forEach(d => {\n var inf = d['inf']\n var inf_benign = get_benign_edge_inf(d['curr'], d['next'])\n var inf_inhibited = inf_benign - inf\n var inf_excited = inf - inf_benign\n var inf_changed = Math.abs(inf_excited)\n max_inf['inhibited'] = d3.max([max_inf['inhibited'], inf_inhibited])\n max_inf['excited'] = d3.max([max_inf['excited'], inf_excited])\n max_inf['changed'] = d3.max([max_inf['changed'], inf_changed])\n \n })\n\n edge_stroke_scale['inhibited'][strength][layer] = d3\n .scaleLinear()\n .domain([0, max_inf['inhibited'][layer]])\n .range([edge_style['min-stroke'], edge_style['max-stroke']])\n\n edge_stroke_scale['excited'][strength][layer] = d3\n .scaleLinear()\n .domain([0, max_inf['excited'][layer]])\n .range([edge_style['min-stroke'], edge_style['max-stroke']])\n\n edge_stroke_scale['changed'][strength][layer] = d3\n .scaleLinear()\n .domain([0, max_inf['changed'][layer]])\n .range([edge_style['min-stroke'], edge_style['max-stroke']])\n }) \n })\n }\n \n}", "function scaleValue(value){\n //Assuming army size is between \n}", "colorScale(color) {\n if (color !== 'red' && color !== 'blue' && color !== 'green') {\n throw new Error('please enter either red, green, or blue')\n } else {\n this.transformType = `${color}-scale`;\n\n let i;\n\n if (color === 'red')\n i = 2;\n if (color === 'green')\n i = 1;\n if (color === 'blue')\n i = 0;\n\n for(i; i < this.colorTableBuffer.length; i+=4) {\n this.colorTableBuffer[i] = this.colorTableBuffer[i] +\n Math.floor(.8 * (255-this.colorTableBuffer[i]));\n }\n }\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 }", "static setScaleV3(xyz, s) {\nxyz[0] *= s;\nxyz[1] *= s;\nxyz[2] *= s;\nreturn xyz;\n}", "scaleUniversity(d) {\n let minMcap = d3.min(this.univData, function (d) {\n return parseInt(d.n_grad)\n });\n let maxMcap = d3.max(this.univData, function (d) {\n return parseInt(d.n_grad)\n });\n let scale = d3.scaleLinear()\n .domain([minMcap, maxMcap])\n .range([2, 10]);\n return scale(d.n_grad);\n }", "function zoomHandler() {\n svg.attr(\"transform\", \"translate(\" + d3.event.translate + \")scale(\" + d3.event.scale + \")\");\n /*$.each(pies, function(k, pie) {\n pie.attr(\"transform\", \"scale(-\" + d3.event.scale + \")\");\n });*/\n}", "_applyScale() {\n // adjust textures size\n for(let i = 0; i < this.textures.length; i++) {\n this.textures[i].resize();\n }\n\n // we should update the plane mvMatrix\n this._updateMVMatrix = true;\n }", "function setScaling(hsclasses, theClass, theScore, i) {\n var colour;\n var plusminus;\n var change;\n\tvar score_weighting\n\tvar j;\n\tvar scaled;\n\n\tif (theClass.substring(0, 3) == \"VV-\") {\n\t\t// VET-Other\n\t\t//No Score required, gets 10% of top 4 classes\n\t\t\n\t\tvar newScore = -1;\n\t\t\n\t\t// Write out the changes\n document.getElementById(\"scaling\" + i).innerHTML = \"<span class='grey'> N/a </span>\";\n document.getElementById(\"class\" + i + \"result\").value = newScore;\n return newScore;\n\t\t\n } else if(theClass.substring(0, 3) == \"HE-\") {\n\t\t// Higher Education class\n\t\t// Score just gets transferred as a 10% class. No scaling.\n\t\tif(theScore < 0 || theScore > 5) {\n\t\t\t// The score is invalid\n\t\t\tsendAlert(\"Higher Education scores are only between 0 and 5\");\n\t\t}\n\t\t\n\t\t// Write out the changes\n document.getElementById(\"scaling\" + i).innerHTML = \"<span class='grey'> N/a </span>\";\n document.getElementById(\"class\" + i + \"result\").value = parseInt(theScore*100)/100;\n return theScore;\n\t\n\t} else if (theScore < 0 || theScore > 50) {\n\t\t// If score is invalid, notify user\n sendAlert(\"Raw scores are only between 0 and 50\");\n\t\n\t} else if (theClass === \"\") {\n\t\tlog(\"Error: Class sent to setScaling() was null\");\n\t\treturn 0;\n\t} else {\n\t\n\t\t// Look up the nearest scales in hsclasses to get the scaled score\n\t\tvar upper = 0;\n\t\tvar lower = 0;\n\t\tvar scaled_lower = 0;\n\t\tvar scaled_upper = 0;\n\t\t\n\t\t// Find the upper and lower min_agg's\n\t\tfor (j = 20; j <= 50; j += 5) {\n\t\t\tif (theScore < j && upper == 0) {\n\t\t\t\tupper = j;\n\t\t\t\tscaled_upper = hsclasses['raw_' + j][theClass];\n\t\t\t}\n\t\t\t\t\n\t\t\tif (theScore >= j) {\n\t\t\t\tlower = j;\n\t\t\t\tscaled_lower = hsclasses['raw_' + j][theClass];\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (lower == theScore)\n\t\t{\n\t\t\tscaled = scaled_lower;\n\t\t} else if (lower == 0) {\n\t\t\t// Score is < 20\n\t\t\t// Assume that 0 is scaled to 0 and use that as the lower value\n\t\t\tscore_weighting = (theScore - lower) / (upper - lower);\n\t\t\tscaled = score_weighting * scaled_upper + (1 - score_weighting) * scaled_lower;\n\t\t} else if (upper == 0) {\n\t\t\t// Score of 50\n\t\t\t// Should already have been sorted.\n\t\t\tsendAlert(\"Logic error 634\");\n\t\t} else {\n\t\t\t// Score is 20 or above, but less than or equal to 50\n\t\t\t\n\t\t\t// Gives percentage of weighing\n\t\t\tscore_weighting = (theScore - lower) / (upper - lower);\n\t\t\t\n\t\t\t// Takes the weightings and applies to to the scaled score linearly\n\t\t\tscaled = score_weighting * scaled_upper + (1 - score_weighting) * scaled_lower;\n\t\t}\n \n // Set appropriate colour and value\n if (scaled == theScore) {\n colour = \"grey\";\n plusminus = \"+\";\n change = 0;\n } else if (scaled < theScore) {\n colour = \"red\";\n plusminus = \"\";\n change = scaled - theScore;\n } else {\n colour = \"green\";\n plusminus = \"+\";\n change = scaled - theScore;\n }\n \n // Check score is not negative\n if (+theScore + +change < 0) {\n change = - theScore;\n }\n \n // Write out the changes\n document.getElementById(\"scaling\" + i).innerHTML = \"<span class='\" + colour + \"'>\" + plusminus + Math.round(change) + \"</span>\";\n document.getElementById(\"class\" + i + \"result\").value = parseInt(100 * (+theScore + +change)) / 100;\n return parseInt(100 * (+theScore + +change)) / 100;\n }\n \n return 0;\n\n}", "function normalize (number, currentScaleMin, currentScaleMax, newScaleMin, newScaleMax) {\n // First, normalize the value between 0 and 1.\n const standardNormalization =\n (number - currentScaleMin) / (currentScaleMax - currentScaleMin);\n\n // Next, transpose that value to our desired scale.\n return (newScaleMax - newScaleMin) * standardNormalization + newScaleMin;\n}", "scaleData(data, in_min, in_max, out_min, out_max) {\n let scaledData = new Array()\n for (let i = 0; i < data.length; i++) {\n scaledData[i] = new Array();\n for (let j = 0; j < data[i].length; j++) {\n scaledData[i][j] = this.mapDataPoint(data[i][j], in_min, in_max, out_min, out_max)\n }\n }\n return scaledData;\n }", "function generateColourScale() {\n\t\t\tlet categoryToColourDict = Database.categoryToColourDictForEachNominalAttr[attributeName];\n\t\t\tlet allCategories = Object.keys(categoryToColourDict).sort();\n\t\t\tlet filteredCategories = []\n\t\t\tlet colourCodeList = [];\n\t\t\tlet filterName = attributeName + ':nominal';\n\t\t\tlet checkedItemList = allCategories;\n\t\t\tlet needToRemoveMissingValues = false;\n\n\t\t\tif (filterName in Filter) {\n\t\t\t\tcheckedItemList = Filter[filterName].getCheckedItemList();\n\t\t\t\tneedToRemoveMissingValues = Filter[filterName].isMissingValueButtonSelected();\n\t\t\t}\n\t\t\tfor (let i = 0; i < allCategories.length; i++) {\n\t\t\t\tlet currentCategory = allCategories[i];\n\t\t\t\tlet currentCategoryFoundInCheckedItemList = checkedItemList.indexOf(currentCategory) != -1;\n\t\t\t\tif (currentCategory == '##missing' && needToRemoveMissingValues) continue;\n\t\t\t\tif (!currentCategoryFoundInCheckedItemList) continue;\n\t\t\t\tfilteredCategories.push(currentCategory);\n\t\t\t}\n\t\t\tfor (let i = 0; i < filteredCategories.length; i++) {\n\t\t\t\tlet currentCategory = filteredCategories[i];\n\t\t\t\tlet currentColourCode = categoryToColourDict[currentCategory];\n\t\t\t\tcolourCodeList.push(currentColourCode);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdomain: filteredCategories,\n\t\t\t\trange: colourCodeList \n\t\t\t};\n\t\t}", "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 }", "scale() {\n this.p.scale(this._scaleFactor);\n }", "scale() {\n this.p.scale(this._scaleFactor);\n }", "scale() {\n this.p.scale(this._scaleFactor);\n }", "function setQuantileColorScale (domainArr, rangeArr) {\n return d3.scale.quantile()\n .domain(domainArr)\n .range(rangeArr);\n }", "function upScaleLabel(i){\n\tvar currentScale = $(\"#size_group_\" + i).attr(\"size_scale\");\n\tvar currentX = $(\"#size_group_\" + i).attr(\"translate_x\");\n\tvar currentY = $(\"#size_group_\" + i).attr(\"translate_y\");\n\t\n\tvar newScale = parseFloat(currentScale) + filterScale;\n\tvar newX = parseFloat(currentX) - filterTransformX;\n\tvar newY = parseFloat(currentY) - filterTransformY;\n\tif(parseFloat(newScale).toFixed(3) > parseFloat(minimumSize).toFixed(3)){\n\t\tnewTransform = \"translate(\" + newX + \" \" + newY + \") scale(\" + newScale + \")\";\n\t\t$(\"#size_group_\" + i).attr(\"translate_x\", newX);\n\t\t$(\"#size_group_\" + i).attr(\"translate_y\", newY);\n\t}\n\telse{\n\t\tnewTransform = \"translate(\" + currentX + \" \" + currentY + \") scale(\" + minimumSize + \")\";\n\t}\t\t\n\t$(\"#size_group_\" + i).attr(\"transform\", newTransform);\n\t$(\"#size_group_\" + i).attr(\"size_scale\", newScale);\n}", "function normalizeAndRescale(obj, newScale)\r\n{\r\n var scale = getMaxSize(obj); // Available in 'utils.js'\r\n obj.scale.set(newScale * (1.0/scale),\r\n newScale * (1.0/scale),\r\n newScale * (1.0/scale));\r\n return obj;\r\n}", "function normalizeAndRescale(obj, newScale)\r\n{\r\n var scale = getMaxSize(obj); // Available in 'utils.js'\r\n obj.scale.set(newScale * (1.0/scale),\r\n newScale * (1.0/scale),\r\n newScale * (1.0/scale));\r\n return obj;\r\n}", "function updateChart() {\n d3elements.rows\n .selectAll('rect')\n .style('fill', function(d) {return colorScale(d);});\n }", "function updateScales(width,height){\n\t\tscales[state].x.range([0, width]);\n\n\t\tscales[state].y.range([height,0]);\n\t}", "function normalizeAndRescale(obj, newScale)\n{\n var scale = getMaxSize(obj); \n obj.scale.set(newScale * (1.0/scale),\n newScale * (1.0/scale),\n newScale * (1.0/scale));\n return obj;\n}", "function applyScale(normalVal, scale) {\n if (scale < 1) {\n return normalVal * Math.round(1 / scale);\n }\n return normalVal / scale;\n }", "function resample(range) {\n svg.attr(\"data-range\", '[' + range[0].getTime() + ',' + range[1].getTime() + ']');\n dataNestUnsampled.forEach(function (event, i) {\n var data = event.values;\n // Calculate visible data for main chart\n var bisector = d3.bisector(function (d) { return d[time]; });\n var visibleData = data.slice(\n bisector.left(data, range[0]),\n Math.min(data.length, bisector.right(data, range[1] - 1))\n );\n\n\n var bucketSize = Math.ceil(visibleData.length / numBuckets);\n sampler.bucketSize(bucketSize);\n\n dataNest[i].values = sampler(visibleData);\n\n focus.select(\"#\" + cleanID(event.key) + \"-data\").selectAll(\".bar\")\n .data(dataNest[i].values)\n .attr(\"cx\", function (d) { return x(d[time]); })\n .attr(\"cy\", function (d) { return y(d[value]); })\n });\n }", "calculateTransformPercent(data) {\n return ((this.interactiveDomWidth - this.characterWidth) / this.characterWidth) * data;\n }", "_toSliderScale(value) {\n const trackToRange = (this.props.max - this.props.min) / this._trackTotalLength;\n return (value * trackToRange) + this.props.min;\n }", "function convertScaleToStartFromFrequency(scale, freq){\n var ratio = freq / scale[0]\n for (var i = 0; i<scale.length; i++) {\n scale[i] *= ratio;\n }\n return scale;\n }", "clampScale(){\n\t\tif(this.status > .674)\n\t\t\tthis.status = .674;\n\t\telse if(this.status < 0)\n\t\t\tthis.status = 0;\n\t}", "function updateTrendValue() {\n\t if (!$scope.trendMap) return;\n\t var av = $scope.aggregateValueAsXrp;\n\t for (var cur in $scope.trendMap) {if ($scope.trendMap.hasOwnProperty(cur)){\n\t var rate = ($scope.exchangeRates[cur] || 0);\n\t var sbAsXrp = $scope.trendMap[cur] * rate;\n\t av -= sbAsXrp;\n\t }}\n\t $scope.trendValueAsPercentage = ($scope.aggregateValueAsXrp - av) / av;\n\t }", "function createColorScale(data){\n var colorClasses = [\n \"#9ECAE1\",\n \"#6BAED6\",\n \"#4292C6\",\n \"#2171B5\",\n \"#084594\"\n ];\n \n var colorScale = d3.scaleThreshold()\n .range(colorClasses);\n \n var domainArray = [];\n \n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n \n var clusters = ss.ckmeans(domainArray, 5);\n \n domainArray = clusters.map(function(d){\n return d3.min(d);\n });\n \n domainArray.shift();\n \n colorScale.domain(domainArray);\n \n return colorScale;\n }", "function applyScale(tree, last) {\n let horizontal = graph.scale.horizontal\n tree.eachBefore(d => {\n if (tree.data.id === d.data.id) return\n if (last) d.x *= graph.scale.vertical.value / last\n if (d.parent) {\n if (!graph.style.align) {\n d.y = d.data.data.value * horizontal.value * horizontal.scalingFactor + d.parent.y\n } else d.y = d.depth * horizontal.scalingFactor * horizontal.value\n }\n })\n }", "_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 convertOthers(data) {\n // Get max value to plot\n var maxX = 0\n for(var i = 0; i < data.length; i++) {\n var d = data[i]\n if(d.limit > maxX) maxX = d.limit\n if(d.max > maxX) maxX = d.max\n if(d.cpu > maxX) maxX = d.cpu\n if(d.ewma > maxX) maxX = d.ewma\n if(d.reject > maxX) maxX = d.reject\n }\n // Convert all values to a [0,1] range\n for(var i = 0; i < data.length; i++) {\n var d = data[i]\n d.limit /= maxX\n d.max /= maxX\n d.cpu /= maxX\n d.ewma /= maxX\n d.reject /= maxX\n }\n return data\n}", "function thirtyPercent(evt) {\n\twb.cm_percent = 0.3;\n\twb.drawRectForViewPort();\n\tvar element = document.querySelector('.code_map');\n\tvar transfromString = (\"scale(0.3, 0.3)\");\n // now attach that variable to each prefixed style\n element.style.webkitTransform = transfromString;\n element.style.MozTransform = transfromString;\n element.style.msTransform = transfromString;\n element.style.OTransform = transfromString;\n element.style.transform = transfromString;\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}", "getMetresToInternal() {\nreturn this.scaleFromMetres;\n}", "scale_final_win_prob_100(scale) {\n const min = scale[0]\n const max = scale[1]\n\n const x = this.dem_win_prob_with_adjustment_and_undecided\n\n return (x - min) / (max - min)\n }", "function percentChange (oldArr) {\n var newArr = [0];\n for (var i = 0; i < oldArr.length - 1; i++) {\n var x = oldArr[i+1] - oldArr[i];\n newArr.push(Math.round(oldArr[i] / x));\n }\n return newArr;\n }", "function normalizeAndRescale(obj, newScale) {\n var scale = getMaxSize(obj); // Available in 'utils.js'\n obj.scale.set(newScale * (1.0 / scale),\n newScale * (1.0 / scale),\n newScale * (1.0 / scale));\n return obj;\n}", "scale(s) {\r\n this.forEach((x, i, a) => a[i] *= s);\r\n }", "normalize() {\r\n this.scale(1 / this.norm());\r\n }", "function progressScale(scalePercent, previousScale, startTime, endTime, totalTime) {\n var easeChoice = getRandomInt(0,3);\n\n if(easeChoice == 0) {\n easeChoice = 'linear';\n }\n if(easeChoice == 1) {\n easeChoice = 'ease-in';\n }\n if(easeChoice == 2) {\n easeChoice = 'ease-out';\n }\n if(easeChoice == 3) {\n easeChoice = 'ease';\n }\n var stepStartPercent = Math.round((startTime/totalTime)*1000)/10;\n var stepEndPercent = Math.round((endTime/totalTime)*1000)/10;\n\n // If the scale percent is more than 96, change it to be only a few more than previous percent, this allows us to have an 'unfinished load bar'\n if(previousScale > 0) {\n previousScale = previousScale - 4;\n }\n if(scalePercent > 0) {\n if(scalePercent >= 97) {\n scalePercent = previousScale + 4;\n } else {\n scalePercent = scalePercent - 4;\n }\n }\n\n var stepStart = '\\t' + stepStartPercent + '% {clip-path: polygon(0% 0%, ' + previousScale + '% 0%, ' + previousScale + '% 100%, 0% 100%); animation-timing-function: ' + easeChoice + ';}';\n var stepEnd = '\\t' + stepEndPercent + '% {clip-path: polygon(0% 0%, ' + scalePercent + '% 0%, ' + scalePercent + '% 100%, 0% 100%); animation-timing-function: linear;}';\n var stepAll = [stepStart, stepEnd];\n return stepAll.join(\"\\n\");\n}", "function rescale() {\n // reset yscales, preserving inverted state\n dimensions.forEach(function(d,i) {\n if (yscale[d].inverted) {\n yscale[d] = d3.scale.linear()\n .domain(d3.extent(data, function(p) { return +p[d]; }))\n .range([0, h]);\n yscale[d].inverted = true;\n } else {\n yscale[d] = d3.scale.linear()\n .domain(d3.extent(data, function(p) { return +p[d]; }))\n .range([h, 0]);\n }\n });\n\n update_ticks();\n\n // Render selected data\n paths(data, foreground, brush_count);\n}" ]
[ "0.6359075", "0.61668444", "0.61649287", "0.61486435", "0.61207885", "0.61167806", "0.60648435", "0.6060987", "0.6026693", "0.599695", "0.598829", "0.5969576", "0.5960287", "0.590953", "0.58693135", "0.58676225", "0.5862624", "0.5840806", "0.5821923", "0.5808932", "0.58082294", "0.5805238", "0.57985437", "0.5782208", "0.5777988", "0.5745613", "0.5742942", "0.5731427", "0.569724", "0.5681081", "0.5679429", "0.5667969", "0.5663308", "0.5643811", "0.56429684", "0.5642152", "0.56186676", "0.56156564", "0.561405", "0.5613645", "0.56129545", "0.55937266", "0.5585758", "0.55630136", "0.55584896", "0.55534846", "0.5550302", "0.55470496", "0.5542334", "0.5536661", "0.55348", "0.5526097", "0.55252105", "0.5518844", "0.55155593", "0.5506501", "0.55042535", "0.549014", "0.5489079", "0.5487118", "0.5459696", "0.544933", "0.5448995", "0.5433714", "0.54291165", "0.5419236", "0.5412263", "0.54114753", "0.54113895", "0.5410842", "0.54086816", "0.54086816", "0.54086816", "0.5402265", "0.540214", "0.5397818", "0.5397818", "0.5395241", "0.53945345", "0.5388056", "0.53843147", "0.53840154", "0.5383508", "0.5380134", "0.5365435", "0.536505", "0.5361166", "0.5357372", "0.5355186", "0.5348132", "0.5347886", "0.53437847", "0.5341558", "0.5339181", "0.53294945", "0.5320394", "0.5309628", "0.53074366", "0.53069574", "0.52933633", "0.52913797" ]
0.0
-1
Build color scale from energy values
function get_color_scale(mtx) { var _flattened_array = [].concat.apply([], mtx) var extremes = d3.extent(_flattened_array) var c = d3.scale.linear() .domain([extremes[0], 0, extremes[1]]) // .range(["blue", "white", "red"]) // Flat .range(["#138BFF", "#fff", "#FF0007"]) // Vivid // .range(["#356089", "#fff", "#D1464A"]) // Pastel return c }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_createColorScale() {\n\t\t\treturn new d3.scaleSequential((t) => {\n\t\t\t\t//const saturation = t * 0.2 + 0.4; // 50–60%\n\t\t\t\tconst saturation = 0.7;\n\t\t\t\tconst lightness = (1 - t) * 0.6 + 0.4; // 30–80%\n\t\t\t\t//const lightness = 0.5;\n\t\t\t\t// Hue needs values between 40 and 90\n\t\t\t\tconst hue = t * 100;\n\t\t\t\t//console.warn(t.toFixed(3), hue.toFixed(3), saturation.toFixed(3), lightness.toFixed(3));\n\t\t\t\tconst hsl = d3.hsl(hue, saturation, lightness);\n\t\t\t\treturn hsl.toString();\n\t\t\t});\n\t\t}", "function makeColorScale(data){\n var colorClasses = [\n \"#66D6F2\",\n \"#00A1C7\",\n \"#0086A6\",\n \"#00596E\",\n \"#002F3B\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile()\n .range(colorClasses);\n\n //build array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n //assign array of expressed values as scale domain\n colorScale.domain(domainArray);\n\n return colorScale;\n }", "function colorScale() {\n var linearScale = d3.scaleLinear()\n .domain([d3.min(happinessData, d => d[chosenColor]),\n d3.max(happinessData, d => d[chosenColor])])\n .range([\"rgb(46, 73, 123)\", \"rgb(71, 187, 94)\"]);\n\n return linearScale;\n}", "function buildColorScale(min, mid, max, minColor, midColor, maxColor) {\n //return scale of colors for min to mid to max values\n var colors = d3.scale.linear()\n .domain([min, mid, max])\n .range([minColor, midColor, maxColor]);\n return colors;\n }", "function makeColorScale(data){\n\t\tvar colorClasses=[\n\t\t\t\"#ffffb2\",\n\t\t\t\"fecc5c\",\n\t\t\t\"fb8d3c\",\n\t\t\t\"f03b20\",\n\t\t\t\"bd0026\"\n\n\t\t];\n\t\t//create color scale generator\n\t\tvar colorScale=d3.scaleThreshold()\n\t\t\t.range(colorClasses);\n\n\t\t//build arrary of all values of the expressed attribute\n\t\tvar domainArray= [];\n\t\tfor (var i=0; i<data.length; i++){\n\t\t\tvar val=parseFloat(data[i][expressed]);\n\t\t\tdomainArray.push(val);\n\t\t};\n\n\t\t//cluster data using ckmeans clustering algorithm to create natural breaks\n\t\tvar clusters=ss.ckmeans(domainArray,5);\n\n\t\t//reset domain arrary to cluster minimums\n\t\tdomainArray=clusters.map(function(d){\n\t\t\treturn d3.min(d);\n\t\t});\n\n\t\t//remove first value from domain arrary to create class breakpoints\n\t\tdomainArray.shift();\n\n\t\t//assign array of last 4 cluster minimyms as domain\n\t\tcolorScale.domain(domainArray);\n\t\t// return the varibale colorScale for easier referencing\n\t\treturn colorScale;\n\t}", "function makeColorScale(data){\n\n var colorScale=d3.scale.quantile()//use quantile for scale generator\n .range(objectColors[expressed]);//incorporate objectColors array to change depending on variable\n\n//creating equal interval classifcation\n var minmax = [\n d3.min(data, function(d) { return parseFloat(d[expressed]); }),\n d3.max(data, function(d) { return parseFloat(d[expressed]); })\n ];\n //assign two-value array as scale domain\n colorScale.domain(minmax);\n return colorScale;\n}", "function makeColorScale(data){\n\n // default colorScale\n var colorClasses = colorbrewer.PuBuGn[5];\n\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n var domainArray = [];\n for (var i = 0; i < data.length; i++){\n\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n colorScale.domain(domainArray);\n\n return colorScale;\n\n }", "function makeColorScale(data){\n\t\tlet colorClasses = [\n\t\t\t\"#D4B9DA\",\n\t\t\t\"#C994C7\",\n\t\t\t\"#DF65B0\",\n\t\t\t\"#DD1C77\",\n\t\t\t\"#980043\"\n\t\t];\n\n\t\t//Create color scale generator\n\t\tlet colorScale = d3.scaleThreshold()\n\t\t\t.range(colorClasses);\n\n\t\t//Build array of all values of the expressed attribute\n\t\tlet domainArray = [];\n\t\tfor (let i=0; i<data.length; i++){\n\t\t\tlet val = parseInt(data[i][expressed]);\n\t\t\tdomainArray.push(val);\n\t\t};\n\n\t\t//Cluster data using ckmeans clustering algorithm to create natural breaks\n\t\tlet clusters = ss.ckmeans(domainArray, 5);\n\t\t//Reset domain array to cluster minimums\n\t\tdomainArray = clusters.map(function(d){\n\t\t\treturn d3.min(d);\n\t\t});\n\n\t\t//Remove first value from the domain array to create class breakpoints\n\t\tdomainArray.shift();\n\n\t\t//Assign array last 4 cluster minimums as domain\n\t\tcolorScale.domain(domainArray);\n\n\t\treturn colorScale;\n\t}", "function computeColorScale() {\n var blue = chroma('darkblue');\n var red = chroma('darkred');\n var white = chroma('white');\n return scale = [[0, blue.css()], [0.35, white.css()], [0.5, white.css()], [0.65, white.css()], [1, red.css()]];\n}", "function makeColorScale(data){\r\n\t\tvar colorClasses = [\r\n\t\t\t\"#ffffcc\",\r\n\t\t\t\"#c2e699\",\r\n\t\t\t\"#78c679\",\r\n\t\t\t\"#31a354\",\r\n\t\t\t\"#006837\"\r\n\t\t];\r\n\r\n\t\t//create color scale generator\r\n\t\tvar colorScale = d3.scaleQuantile()\r\n\t\t\t.range(colorClasses);\r\n\r\n\t\t//build array of all values of the expressed attribute\r\n\t\tvar domainArray = [];\r\n\t\tfor (var i=0; i<data.length; i++){\r\n\t\t\tvar val = parseFloat(data[i][expressed]);\r\n\t\t\tdomainArray.push(val);\r\n\t\t};\r\n\r\n\t\t//cluster data using ckmeans clustering algorithm to create natural breaks\r\n\t\tvar clusters = ss.ckmeans(domainArray, 5);\r\n\t\t//reset domain array to cluster minimums\r\n\t\tdomainArray = clusters.map(function(d){\r\n\t\t\treturn d3.min(d);\r\n\t\t});\r\n\t\t//remove first value from domain array to create class breakpoints\r\n\t\tdomainArray.shift();\r\n\r\n\t\t//assign array of last 4 cluster minimums as domain\r\n\t\tcolorScale.domain(domainArray);\r\n\t\t\r\n\t\treturn colorScale;\r\n\t}", "function makeColorScale(data){\r\n var colorClasses = [\r\n \r\n \"#FFEED5\",\r\n \"#FFDDAA\",\r\n \"#FFCC80\",\r\n \"#FFBB55\",\r\n \"#FFAA2A\"\r\n\r\n ];\r\n\r\n //create color scale generator\r\n var colorScale = d3.scaleQuantile()\r\n .range(colorClasses);\r\n\r\n //build array of all values of the expressed attribute\r\n var domainArray = [];\r\n for (var i=0; i<data.length; i++){\r\n var val = parseFloat(data[i][expressed]);\r\n domainArray.push(val);\r\n };\r\n\r\n //assign array of expressed values as scale domain\r\n colorScale.domain(domainArray);\r\n\r\n return colorScale;\r\n}", "function makeColorScale(data){\n var colorClasses = [\n // I tried a bunch of options\n /*\n \"#D4B9DA\",\n \"#C994C7\",\n \"#DF65B0\",\n \"#DD1C77\",\n \"#980043\"\n */\n /*\n \"#fee5d9\",\n \"#fcae91\",\n \"#fb6a4a\",\n \"#de2d26\",\n \"#a50f15\"\n */\n /*\"#ffffb2\",\n \"#fecc5c\",\n \"#fd8d3c\",\n \"#f03b20\",\n \"#bd0026\" */\n // brown/oranges\n \"#ffffd4\",\n \"#fed98e\",\n \"#fe9929\",\n \"#d95f0e\",\n \"#993404\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile()\n .range(colorClasses);\n\n //build array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n //assign array of expressed values as scale domain\n colorScale.domain(domainArray);\n //console.log(colorClasses)\n return colorScale;\n}", "function makeColorScale(data){\n var colorClasses = [\n \"#fef0d9\",\n \"#fdcc8a\",\n \"#fc8d59\",\n \"#e34a33\",\n \"#b30000\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile()\n .range(colorClasses);\n\n //build two-value array of minimum and maximum expressed attribute values\n var minmax = [\n d3.min(data, function(d) { return parseFloat(d[expressed]); }),\n d3.max(data, function(d) { return parseFloat(d[expressed]); })\n ];\n //assign two-value array as scale domain\n colorScale.domain(minmax);\n\n return colorScale;\n}", "function colorScale(frequenciesArray){ \n\t//accepts an array of all frequency values and defines the class breaks based on the lowest and highest \n\t\n\t//create quantile classes with color scale \n\tvar color = d3.scale.pow() //designate quantile scale \n\t\t.range ([\n\t\t \"#000\",\n\t\t\t//\"#302C29\", //grey-ish\n\t\t\t//\"#45455C\",\t\t\t\n\t\t\t//\"#4C61A2\", \n\t\t\t\"#057FFE\" //bright blue\n\t\t]); \n\t\n\t//set min and max data values as domain \n\tcolor.domain ( //[0,1]\n\t\t[\n\t\t\td3.min(frequenciesArray), //lowest \n\t\t\td3.max(frequenciesArray) //highest \n\t\t]\n\t); \n\t\n\t//var low = d3.min(frequenciesArray); //lowest \n\t//var high = d3.max(frequenciesArray); //highest \n\t//console.log(\"colorscale:\"+low+\" to \"+high);\n\t\n\treturn color; //return the color scale generator \t\n}", "function makeColorScale(data)\n {\n var colorClasses = \n [\n \"#eff3ff\",\n \"#bdd7e7\",\n \"#6baed6\",\n \"#3182bd\",\n \"#08519c\"\n ];\n\n //create color scale\n var colorScale = d3.scale.threshold()\n .range(colorClasses);\n\n //create array of values for expressed attribute\n var domainArray = [];\n\n for (var i=0; i<data.length; i++)\n {\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n \n scaleMax = d3.max(domainArray);\n scaleMax = scaleMax + 2;\n\n //use ckmeans clustering algorithm to create natural breaks\n var clusters = ss.ckmeans(domainArray, 5);\n\n //reset domain array to cluster minimums\n domainArray = clusters.map(function(d)\n {\n return d3.min(d);\n });\n\n //remove first value from domain array to create class breakpoints\n domainArray.shift();\n\n //assign array of last 4 cluster minimums as domain\n colorScale.domain(domainArray);\n \n return colorScale;\n }", "function makeColorScale2(data, color){\n\n var colorClasses = getColorClasses(color);\n\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n var domainArray = [];\n for (var i = 0; i < data.length; i++){\n\n var val = parseFloat(data[i][1]);\n domainArray.push(val);\n };\n\n colorScale.domain(domainArray);\n\n return colorScale;\n\n }", "createColorScales() {\r\n this.options.mapConfig.layers.map((layer) => {\r\n let colorScale;\r\n\r\n layer.properties.map((property) => {\r\n colorScale = chroma.scale(property.colors).mode('lch').colors(property.step.length);\r\n\r\n property['colorScale'] = colorScale;\r\n });\r\n\r\n });\r\n }", "function thisColor(i) { \n colors = ['#001f3f', '#0074D9', '#B10DC9', '#AAAAAA', '#39CCCC', '#FFDC00', '#FF851B', \n '#01FF70', '#F012BE', '#7FDBFF', '#3D9970', '#85144b', '#2ECC40', '##FF4136', '#F012BE', \n \"#3366cc\", \"#dc3912\", \"#ff9900\"];\n\n cc = d3.scaleLinear()\n .domain([-2, 17])\n .range([1, 0]);\n\n return d3.interpolateSpectral(cc(i));\n}", "function createColorScale(data){\n var colorClasses = [\n \"#9ECAE1\",\n \"#6BAED6\",\n \"#4292C6\",\n \"#2171B5\",\n \"#084594\"\n ];\n \n var colorScale = d3.scaleThreshold()\n .range(colorClasses);\n \n var domainArray = [];\n \n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n \n var clusters = ss.ckmeans(domainArray, 5);\n \n domainArray = clusters.map(function(d){\n return d3.min(d);\n });\n \n domainArray.shift();\n \n colorScale.domain(domainArray);\n \n return colorScale;\n }", "function getColor(val) {\n\t\tconst colorScale = d3.scaleLinear().domain([0, max]).range(['rgb(245, 254, 169)', 'rgb(147, 21, 40)']);\n\t\treturn colorScale(val);\n\t}", "function makeColorScale(data){\n var colorClasses = [\n \"#f7de9c\",\n \"#e1bf61\",\n \"#b59334\",\n \"#7c5f10\",\n \"#56420c\"\n ];\n\n //create color scale generator\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n console.log(data.length);\n\n //build array of all values of the expressed attribute\n var domainArray = data[expressed];\n\n console.log(csvArray);\n\n for (var j=0; j<csvArray.length; j++) {\n\n }\n\n //assign array of expressed values as scale domain\n colorScale.domain(csvArray);\n\n console.log(colorScale.quantiles());\n\n return colorScale;\n\n }", "color(data) {\n\t\treturn d3\n\t\t\t.scaleLinear()\n\t\t\t.domain([0, Math.round(data.length / 2), data.length])\n\t\t\t.range(['#BBE4A0', '#52A8AF', '#00305C'])\n\t}", "function getColor(valueIn, valuesIn) {\r\n // create a linear scale\r\n if (valueIn< (valuesIn[1]-valuesIn[0])/4){\r\n var color = d3.scaleSequential(d3.interpolateYlGnBu)\r\n .domain([-(valuesIn[1]-valuesIn[0])/8, (valuesIn[1]-valuesIn[0])/4]) // input uses min and max values; // output for opacity between .3 and 1\r\n return color(valueIn); } // return that number to the caller\r\n else{\r\n var color = d3.scaleSequential(d3.interpolatePlasma)\r\n .domain([(valuesIn[1]-valuesIn[0])/4, 2*valuesIn[1]])\r\n return color(valueIn);\r\n }\r\n }", "colorScale(color) {\n if (color !== 'red' && color !== 'blue' && color !== 'green') {\n throw new Error('please enter either red, green, or blue')\n } else {\n this.transformType = `${color}-scale`;\n\n let i;\n\n if (color === 'red')\n i = 2;\n if (color === 'green')\n i = 1;\n if (color === 'blue')\n i = 0;\n\n for(i; i < this.colorTableBuffer.length; i+=4) {\n this.colorTableBuffer[i] = this.colorTableBuffer[i] +\n Math.floor(.8 * (255-this.colorTableBuffer[i]));\n }\n }\n }", "createColors(color, num) {\n //receive hex color from parent, return array of colors for gradient\n //num is # of generated color in return array\n let a = []\n let red = parseInt( color.substring(1, 3), 16)\n let green = parseInt(color.substring(3, 5), 16)\n let blue = parseInt(color.substring(5,7), 16)\n \n let k = 0.8 \n //from lighter colder to darker warmer\n // console.log(red, green, blue)\n for (i=0;i<num;i++) {\n let new_red = (Math.floor(red*k)).toString(16)\n let new_green = (Math.floor(green*k)).toString(16)\n let new_blue = (Math.floor(blue*k)).toString(16)\n let new_color = '#'+new_red+new_green+new_blue\n k += 0.1\n a.push(new_color)\n }\n return a\n\n }", "function getColor(valueIn, valuesIn)\r\n{\r\n // create a linear scale\r\n var color = d3.scaleLinear()\r\n .domain([valuesIn[0], valuesIn[1]]) // input uses min and max values\r\n .range(d3.schemeBlues[9]);\r\n return color(valueIn); // return that number to the caller\r\n}", "function variaceColor(){\n\n\treturn d3.scale.linear()\n\t\t\t\t\t.domain([0, 1])\n\t\t\t\t\t.range(['#fee0d2', '#de2d26']);\n}", "function makeColorScale3(data, color){\n\n var colorClasses = getColorClasses(color);\n\n var colorScale = d3.scale.quantile()\n .range(colorClasses);\n\n var domainArray = [];\n for (var i = 0; i < data.length; i++){\n var val = parseFloat(data[i][1]);\n domainArray.push(val);\n };\n\n colorScale.domain(domainArray);\n\n return colorScale;\n\n }", "function quantileColorScale(data){\r\n var colorClasses = ['#edf8e9','#c7e9c0','#a1d99b','#74c476','#31a354','#006d2c'];\r\n\r\n //create color scale generator\r\n var colorScale = d3.scaleQuantile()\r\n .range(colorClasses);\r\n\r\n //build array of all values of the expressed attribute\r\n var domainArray = [];\r\n for (var i=0; i<data.length; i++){\r\n var val = parseFloat(data[i][expressed]);\r\n if (typeof val == 'number' && !isNaN(val)){\r\n domainArray.push(val);\r\n } \r\n };\r\n \r\n wScale = d3.scalePow()\r\n .exponent(0.25)\r\n .range([0, chartWidth])\r\n .domain([d3.min(domainArray), d3.max(domainArray)]);\r\n\r\n //assign array of expressed values as scale domain\r\n colorScale.domain(domainArray);\r\n\r\n return colorScale;\r\n }", "function makeColorScale(data){\n var colorClasses = [\n //\"#f2d0e0\",\n \"ffffdf\",\n \"fffbf\",\n //\"#e373a8\",\n \"#ffff52\",\n \"#cbcf00\",\n ];\n\n //create color scale generator\n var colorScale = d3.scaleThreshold()\n .range(colorClasses);\n\n //build array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n var clusters = ss.ckmeans(domainArray, 5);\n //console.log(clusters);\n //reset domain array to cluster minimums\n domainArray = clusters.map(function(d) {\n return d3.min(d);\n });\n //remove first value from domain array to create class breakpoints\n domainArray.shift();\n\n //assign array of last 4 cluster minimums as domain\n colorScale.domain(domainArray);\n\n return colorScale;\n}", "function colorScale(color, parties) {\n color.domain(parties.map(d => d.name));\n color.range(parties.map(d => d.color));\n}", "function makeColorScaleNatural(data){\n var colorClasses = [\n \"#C4BDB1\",\n \"#94856D\",\n \"#ACC77D\",\n \"#889E63\",\n \"#4F5C3A\"\n ];\n\n //create color scale generator\n var colorScale = d3.scaleQuantile() //possibly use .scaleThreshold .scaleQuantile\n .range(colorClasses);\n\n //build an array of all values of the expressed attribute\n var domainArray = [];\n for (var i=0; i<data.length; i++){\n var val = parseFloat(data[i][expressed]);\n domainArray.push(val);\n };\n\n //the following is needed only for Natural Breaks\n //cluster data using ckmeans clustering algorithm to create natural breaks\n //var clusters = ss.ckmeans(domainArray, 5);\n //reset domain array to cluster minimums\n //domainArray = clusters.map(function(d) {\n // return d3.min(d);\n //});\n //remove first value from domain array to create class breakpoints\n //domainArray.shift();\n\n //assign array of expressed values as scale domain\n colorScale.domain(domainArray);\n\n return colorScale;\n }", "function interpolateColors (dataLength, colorScale, colorRangeInfo) {\n var { colorStart, colorEnd } = colorRangeInfo\n var colorRange = colorEnd - colorStart\n var intervalSize = colorRange / dataLength\n var i, colorPoint\n var colorArray = []\n\n for (i = 0; i < dataLength; i++) {\n colorPoint = calculatePoint(i, intervalSize, colorRangeInfo)\n colorArray.push(colorScale(colorPoint))\n }\n console.log(colorArray)\n return colorArray\n}", "function generateScale(hexColor, numColors) {\n\treturn chroma.scale(getRange(hexColor)).mode(\"lab\").colors(numColors);\n}", "function buildColorArray(colorScale, data, header) {\n var colorArray = [];\n for(var key in data) {\n\n var tempFloat = parseFloat(data[key]);\n var colorScaled = colorScale(tempFloat);\n\n tempColor = d3.color(colorScaled);\n\n // We want a 0 to 1 scale for the colors.\n red = tempColor.r / 256;\n green = tempColor.g / 256;\n blue = tempColor.b / 256;\n\n colorArray[key] = [red, green, blue];\n }\n return colorArray;\n }", "function colorthis(measurement) {\r\n\t\r\n\tM = parseFloat(measurement)\r\n\t//rgb to hex conversion function borrowed from https://campushippo.com/lessons/how-to-convert-rgb-colors-to-hexadecimal-with-javascript-78219fdb\r\n\tfunction rgbToHex(rgb){ \r\n\t\tvar hex = Number(rgb).toString(16);\r\n\t\tif (hex.length < 2) {\r\n\t\t hex = \"0\" + hex;\r\n\t\t}\r\n\t\treturn hex;\r\n\t\t};\r\n\t\r\n\t//map the measurement domain on the the RGB color range\r\n\tvar\tcolorScale = d3.scaleLinear()\r\n\t\t.domain([d_min,d_max])\r\n\t\t.range([0,255]);\r\n\t\r\n\t//starting at (0,255,0); for values less than the midpoint we need to add the red channel until we get to (255,255,0)\r\n\tif(M < d_midpt){\r\n\t\tvar red = Math.round(2 * colorScale(M))\r\n\t\tvar green = 255\r\n\t\tvar blue = 0\r\n\t\tvar hexcolor = \"#\"+rgbToHex(red)+rgbToHex(green)+rgbToHex(blue)\r\n\t\treturn hexcolor\r\n\t\r\n\t//for values greater than the midpoint we need to subtract from the green channel until we get to (255,0,0)\r\n\t} else {\r\n\t\tred = 255 \r\n\t\tgreen = (255-Math.round(colorScale(M)))\r\n\t\tblue = 0\r\n\t\tvar hexcolor = \"#\"+rgbToHex(red)+rgbToHex(green)+rgbToHex(blue)\r\n\t\treturn hexcolor\r\n\t};\r\n}", "constructor() {\n super();\n\n this.colorOptions = [\n ['#c51b7d','#de77ae','#f1b6da','#fde0ef','#e6f5d0','#b8e186','#7fbc41','#4d9221'],\n ['#fff5eb','#fee6ce','#fdd0a2','#fdae6b','#fd8d3c','#f16913','#d94801','#a63603','#7f2704'],\n ['#fcfbfd','#efedf5','#dadaeb','#bcbddc','#9e9ac8','#807dba','#6a51a3','#54278f','#3f007d'],\n ['#f7fbff','#deebf7','#c6dbef','#9ecae1','#6baed6','#4292c6','#2171b5','#08519c','#08306b'],\n ['#f7fcf5','#e5f5e0','#c7e9c0','#a1d99b','#74c476','#41ab5d','#238b45','#006d2c','#00441b'],\n ['#ffffff','#f0f0f0','#d9d9d9','#bdbdbd','#969696','#737373','#525252','#252525','#000000']\n ];\n this.baseScaleSteps = [,-30,-20,-10,0,10,20,30]//[0,1,2,3,5,10,25,50,75];\n this.colorScale = d3.scaleThreshold()\n .domain(this.baseScaleSteps)\n .range(this.colorOptions[0]);\n }", "function generateColourScale() {\n\t\t\tlet categoryToColourDict = Database.categoryToColourDictForEachNominalAttr[attributeName];\n\t\t\tlet allCategories = Object.keys(categoryToColourDict).sort();\n\t\t\tlet filteredCategories = []\n\t\t\tlet colourCodeList = [];\n\t\t\tlet filterName = attributeName + ':nominal';\n\t\t\tlet checkedItemList = allCategories;\n\t\t\tlet needToRemoveMissingValues = false;\n\n\t\t\tif (filterName in Filter) {\n\t\t\t\tcheckedItemList = Filter[filterName].getCheckedItemList();\n\t\t\t\tneedToRemoveMissingValues = Filter[filterName].isMissingValueButtonSelected();\n\t\t\t}\n\t\t\tfor (let i = 0; i < allCategories.length; i++) {\n\t\t\t\tlet currentCategory = allCategories[i];\n\t\t\t\tlet currentCategoryFoundInCheckedItemList = checkedItemList.indexOf(currentCategory) != -1;\n\t\t\t\tif (currentCategory == '##missing' && needToRemoveMissingValues) continue;\n\t\t\t\tif (!currentCategoryFoundInCheckedItemList) continue;\n\t\t\t\tfilteredCategories.push(currentCategory);\n\t\t\t}\n\t\t\tfor (let i = 0; i < filteredCategories.length; i++) {\n\t\t\t\tlet currentCategory = filteredCategories[i];\n\t\t\t\tlet currentColourCode = categoryToColourDict[currentCategory];\n\t\t\t\tcolourCodeList.push(currentColourCode);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdomain: filteredCategories,\n\t\t\t\trange: colourCodeList \n\t\t\t};\n\t\t}", "function buildScales() {\n a = alpha(data, v),\t //scale factor between value and bar width\n mid = Midi(data, v, a),\t//mid-point displacement of bar i\n w = Wi(data, v, a);\t\t //width of bar i\n\n let percentageAxis = Math.min(percentageAxisToMaxRatio * d3Array.max(data, getValue))\n\n xScale = d3Scale.scaleLinear()\n .domain([0, percentageAxis])\n .rangeRound([0, chartWidth]);\n\n yScale = d3Scale.scaleOrdinal()\n .domain(data.map(getName))\n .range(data.map(mid)); //force irregular intervals based on\n // value\n\n\n if (shouldReverseColorList) {\n colorList = data.map(d => d)\n .reverse()\n .map(({name}, i) => ({\n name,\n color: colorSchema[i % colorSchema.length]}\n ));\n } else {\n colorList = data.map(d => d)\n .map(({name}, i) => ({\n name,\n color: colorSchema[i % colorSchema.length]}\n ));\n }\n\n colorMap = (item) => colorList.filter(({name}) => name === item)[0].color;\n }", "function heatMapColorforValue(value, maxValue){\n var h = (1.0 - value /maxValue) * 130;\n return \"hsl(\" + h + \", 100%, 50%)\";\n}", "function computeColor(heat){\n\n /*\n var scaledForce = 50000 * heat;\n // clamp values to < 255\n if( Math.abs(scaledForce) > 255 ) {\n scaledForce = 255 * (scaledForce/Math.abs(scaledForce));\n }\n\n var ratio = 2 * (scaledForce+255) / 510;\n colors.b = ~~(Math.max(0, 255*(ratio - 1)));\n colors.r = ~~(Math.max(0, 255*(1 - ratio)));\n colors.g = 255 - colors.b - colors.r;\n */\n\n cycle+=0.1;\n if(cycle>100){\n cycle = 0;\n }\n colors.r = ~~(Math.sin(.3*cycle + 0) * 127+ 128);\n colors.g = ~~(Math.sin(.3*cycle + 2) * 127+ 128);\n colors.b = ~~( Math.sin(.3*cycle + 4) * 127+ 128);\n}", "function paint (value, colscale){\n svg.selectAll(\"circle\")\n .attr(\"title\", function(d) {return d;})\n .style(\"fill\", function (d, i){\n return d3.rgb(colscale(value[i]));});\n}", "function ColorScale(opts) {\n var c, col, cols, me, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;\n me = this;\n me.colors = cols = (_ref2 = opts.colors) != null ? _ref2 : ['#ddd', '#222'];\n for (c = 0, _ref3 = cols.length - 1; 0 <= _ref3 ? c <= _ref3 : c >= _ref3; 0 <= _ref3 ? c++ : c--) {\n col = cols[c];\n if (type(col) === \"string\") cols[c] = new Color(col);\n }\n if (opts.positions != null) {\n me.pos = opts.positions;\n } else {\n me.pos = [];\n for (c = 0, _ref4 = cols.length - 1; 0 <= _ref4 ? c <= _ref4 : c >= _ref4; 0 <= _ref4 ? c++ : c--) {\n me.pos.push(c / (cols.length - 1));\n }\n }\n me.mode = (_ref5 = opts.mode) != null ? _ref5 : 'hsv';\n me.nacol = (_ref6 = opts.nacol) != null ? _ref6 : '#ccc';\n me.setClasses((_ref7 = opts.limits) != null ? _ref7 : [0, 1]);\n me;\n }", "function getColor(value, scale, reverse = false) {\n var color;\n var offset;\n if (reverse) {\n scale = 1-scale;\n }\n color = { r: 255, g: 255, b: 255 };\n if (value > 0) {\n color = { r: Math.round(255-(255-153)*scale), g: Math.round(255-(255-153)*scale), b: Math.round(255-(255-153)*scale) }; //gray\n }\n return color;\n}", "calculateColors() {\n // find node with the maximum stress\n let max_stress = 0;\n for (let i = 0; i < this.n * this.m; ++i) {\n if (this.stress[i] > max_stress) max_stress = this.stress[i];\n }\n\n // normilize coefficient\n let coeff = 1 / max_stress;\n\n let color_row_delta = 3 * this.m;\n let color_column_delta = 3;\n\n // iterate over colours array and set colour between blue and red based on stress value\n for (let i = 0; i < this.n; ++i) {\n for (let j = 0; j < this.m; ++j) {\n this.color[i * color_row_delta + j * color_column_delta] = this.stress[i * this.m + j] * coeff;\n this.color[i * color_row_delta + j * color_column_delta + 1] = 0;\n this.color[i * color_row_delta + j * color_column_delta + 2] = 1 - this.stress[i * this.m + j] * coeff;\n }\n }\n }", "function getColor(val) {\n switch (true) {\n case val > 90:\n return colorScale[5];\n case val > 70:\n return colorScale[4];\n case val > 50:\n return colorScale[3];\n case val > 30:\n return colorScale[2];\n case val > 10:\n return colorScale[1];\n default:\n return colorScale[0];\n\n }\n}", "function getScale() {\n for (var _len = arguments.length, colors = new Array(_len), _key = 0; _key < _len; _key++) {\n colors[_key] = arguments[_key];\n }\n return function (n) {\n var lastIndex = colors.length - 1;\n var lowIndex = guard(0, lastIndex, Math.floor(n * lastIndex));\n var highIndex = guard(0, lastIndex, Math.ceil(n * lastIndex));\n var color1 = colors[lowIndex];\n var color2 = colors[highIndex];\n var unit = 1 / lastIndex;\n var weight = (n - unit * lowIndex) / unit;\n return mix(color1, color2, weight);\n };\n}", "function singleHueScaleFactory(a){return(0,_scale.scaleOrdinal)({range:[].concat(_theme.allColors[a]||_theme.grayColors).reverse()})}", "function heatMapColorforValue(value){\n const h = (1.0 - value) * 240;\n return \"hsl(\" + h + \", 100%, 50%)\";\n }", "function colorgenerator() {\n let colours = [],\n i;\n for (i = 0; i < 372; i++){\n colours[i] = 'hsl(' + i + ', 100%, 50%)';\n if (i > 359) {\n colours[i] = 'hsl(0, 100%, 100%)';\n }\n }\n colours = colours.toString();\n //console.log(colours);\n root.style.setProperty(\"--colours\", colours);\n}", "function createColorizer(breaks, colorRange) {\n const colors = colorRange.map((c) => [\n c.r,\n c.g,\n c.b,\n Math.floor(c.opacity * 255)\n ])\n return (v) => {\n const floored = Math.floor(v)\n for (let i = 0; i < breaks.length; i++) {\n if (floored <= breaks[i]) return colors[i]\n }\n return [255, 255, 255, 0]\n }\n}", "getColor(value) {\n // Test Max\n if (value === 255) {\n console.log(\"MAX!\");\n }\n let percent = (value) / 255 * 50;\n // return 'rgb(V, V, V)'.replace(/V/g, 255 - value);\n return 'hsl(H, 100%, P%)'.replace(/H/g, 255 - value).replace(/P/g, percent);\n }", "function getColorFromSpectrum(value) {\n const clampedValue = clamp(value);\n if (.4 <= clampedValue && clampedValue <= 1) {\n const normalizedValue = (clampedValue - 0.4) / 0.6;\n return lerpRGB([248/255, 177/255, 149/255, 1], [240/255, 248/255, 255/255, 1], normalizedValue);\n } else if (.2 <= clampedValue && clampedValue < .4) {\n const normalizedValue = (clampedValue - 0.2) / 0.2;\n return lerpRGB([246/255, 114/255, 128/255, 1], [248/255, 177/255, 149/255, 1], normalizedValue);\n } else if (.1 <= clampedValue && clampedValue < .2) {\n const normalizedValue = (clampedValue - 0.1) / 0.1;\n return lerpRGB([192/255, 108/255, 132/255, 1], [246/255, 114/255, 128/255, 1], normalizedValue);\n } else if (-.1 <= clampedValue && clampedValue < .1) {\n const normalizedValue = (clampedValue + 0.1) / 0.2;\n return lerpRGB([108/255, 91/255, 123/255, 1], [192/255, 108/255, 132/255, 1], normalizedValue);\n } else if (-.2 <= clampedValue && clampedValue < -.1) {\n const normalizedValue = (clampedValue + .2) / 0.1;\n return lerpRGB([53/255, 92/255, 125/255, 1], [108/255, 91/255, 123/255, 1], normalizedValue);\n } else if (-1 <= clampedValue && clampedValue < -0.2) {\n const normalizedValue = (clampedValue + 1) / .8;\n return lerpRGB([25/255, 25/255, 50/255, 1], [53/255, 92/255, 125/255, 1], normalizedValue);\n }\n return [0, 0, 0, 1];\n}", "function mapColors(data) {\n let strValue = [];\n for (let i = 0; i < data.length; i ++){\n strValue.push(String(JSON.stringify(data[i]))); // particolare tipo di hashing \n }\n oScale.domain(strValue);\n}", "function magnitudeColors(color) {\n if (color < 1){return \"red\"}\n else if (color < 2){return \"orange\"}\n else if (color < 3){return \"yellow\"}\n else if (color < 4){return \"green\"} \n else if (color < 5 ){return \"blue\"}\n else {return \"indigo\"}\n}", "adjustHighAndLow() {\n if (this.red + this.green > 510 - MAX_DATABITS) {\n this.red = 255 - (MAX_DATABITS >>> 1)\n this.green = 255 - (MAX_DATABITS - (MAX_DATABITS >>> 1))\n } else if (this.red + this.green < MAX_DATABITS) {\n this.red = MAX_DATABITS >>> 1\n this.green = MAX_DATABITS - (MAX_DATABITS >>> 1)\n }\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}", "function waveLengthToRGB(Wavelength) {\r\n\t\tvar factor;\r\n\t\tvar Red,Green,Blue;\r\n\t\tvar Gamma = 0.80;\r\n\t\tvar IntensityMax = 255;\r\n\t\t/*if((Wavelength >= 380) && (Wavelength<440)){\r\n\t\t\tRed = -(Wavelength - 440) / (440 - 380);\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = 1.0;\r\n\t\t}else*/ \r\n\t\tif((Wavelength >= 380) && (Wavelength<440)){\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = (Wavelength - 380) / (440 - 380);;\r\n\t\t}else if((Wavelength >= 440) && (Wavelength<490)){\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = (Wavelength - 440) / (490 - 440);\r\n\t\t\tBlue = 1.0;\r\n\t\t}else if((Wavelength >= 490) && (Wavelength<510)){\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = 1.0;\r\n\t\t\tBlue = -(Wavelength - 510) / (510 - 490);\r\n\t\t}else if((Wavelength >= 510) && (Wavelength<580)){\r\n\t\t\tRed = (Wavelength - 510) / (580 - 510);\r\n\t\t\tGreen = 1.0;\r\n\t\t\tBlue = 0.0;\r\n\t\t}else if((Wavelength >= 580) && (Wavelength<645)){\r\n\t\t\tRed = 1.0;\r\n\t\t\tGreen = -(Wavelength - 645) / (645 - 580);\r\n\t\t\tBlue = 0.0;\r\n\t\t}else if((Wavelength >= 645) && (Wavelength<781)){\r\n\t\t\tRed = 1.0;\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = 0.0;\r\n\t\t}else{\r\n\t\t\tRed = 0.0;\r\n\t\t\tGreen = 0.0;\r\n\t\t\tBlue = 0.0;\r\n\t\t}\r\n\r\n\t\t// Let the intensity fall off near the vision limits\r\n\t\tif((Wavelength >= 380) && (Wavelength<420)){\r\n\t\t\tfactor = 0.3 + 0.7*(Wavelength - 380) / (420 - 380);\r\n\t\t}else if((Wavelength >= 420) && (Wavelength<701)){\r\n\t\t\tfactor = 1.0;\r\n\t\t}else if((Wavelength >= 701) && (Wavelength<781)){\r\n\t\t\tfactor = 0.3 + 0.7*(780 - Wavelength) / (780 - 700);\r\n\t\t}else{\r\n\t\t\tfactor = 0.0;\r\n\t\t}\r\n\r\n\r\n\t\tvar rgb =[];\r\n\r\n\t\t// Don't want 0^x = 1 for x <> 0\r\n\t\trgb[0] = (Red==0.0) ? 0 : (Math.round(IntensityMax * Math.pow(Red * factor, Gamma)));\r\n\t\trgb[1] = (Green==0.0) ? 0 : (Math.round(IntensityMax * Math.pow(Green * factor, Gamma)));\r\n\t\trgb[2] = (Blue==0.0) ? 0 : (Math.round(IntensityMax * Math.pow(Blue * factor, Gamma)));\r\n\t\t\r\n\t\t/*if((Wavelength >= 300) && (Wavelength<380)){\r\n\t\t\trgb[0] = 0;\r\n\t\t\trgb[1] = 0;\r\n\t\t\trgb[2] = Math.round((Wavelength - 300) / 80) * 255;\r\n\t\t}*/\r\n\t\t\r\n\t\treturn rgb;\r\n}", "function coloredScaleAltitudeMap(noiseval) {\n let result;\n\n // // Snow Mountain\n // if (noiseval <= 0.3) {\n // result = '#F0F8FF';\n // }\n // // Mountain\n // else if (noiseval > 0.3 && noiseval <= 0.5) {\n // result = '#696969';\n // }\n // // Forest\n // else if (noiseval > 0.5 && noiseval <= 0.75) {\n // result = '#228B22';\n // }\n // // Plains\n // else if (noiseval > 0.75 && noiseval <= 0.9) {\n // result = '#00FF00';\n // }\n // // Sand \n // else if (noiseval > 0.9 && noiseval <= 1) {\n // result = '#FFFF00';\n // }\n // // Water\n // else if (noiseval > 1 && noiseval <= 1.1) {\n // result = '#1E90FF';\n // } \n // // Deep water\n // else {\n // result = '#0000ff';\n // }\n\n // Mountain\n if (noiseval <= 0.5) {\n result = '#F0F8FF';\n }\n // Land\n else if (noiseval > 0.5 && noiseval <= 1) {\n result = '#939393';\n }\n // Shallow Water\n else if (noiseval > 1 && noiseval <= 1.1) {\n result = '#3f3f3f';\n }\n // Deep water\n else {\n result = '#000000';\n }\n\n // Debug\n if (noiseval == 15) {\n result = '#ff0000';\n }\n\n return result;\n }", "function wavelengthToColor(wavelength) {\n var r, g, b, alpha, colorSpace,\n wl = wavelength,\n gamma = 1;\n // UV to indigo:\n if (wl >= 380 && wl < 440) {\n R = -1 * (wl - 440) / (440 - 380);\n G = 0;\n B = 1;\n // indigo to blue:\n } else if (wl >= 440 && wl < 490) {\n R = 0;\n G = (wl - 440) / (490 - 440);\n B = 1;\n // blue to green:\n } else if (wl >= 490 && wl < 510) {\n R = 0;\n G = 1;\n B = -1 * (wl - 510) / (510 - 490);\n // green to yellow:\n } else if (wl >= 510 && wl < 580) {\n R = (wl - 510) / (580 - 510);\n G = 1;\n B = 0;\n // yellow to orange:\n } else if (wl >= 580 && wl < 645) {\n R = 1;\n G = -1 * (wl - 645) / (645 - 580);\n B = 0.0;\n // orange to red:\n } else if (wl >= 645 && wl <= 780) {\n R = 1;\n G = 0;\n B = 0;\n // IR:\n } else {\n R = 0;\n G = 0;\n B = 0;\n }\n\n // intensity is lower at the edges of the visible spectrum.\n if (wl > 780 || wl < 380) {\n alpha = 0;\n } else if (wl > 700) {\n alpha = (780 - wl) / (780 - 700);\n } else if (wl < 420) {\n alpha = (wl - 380) / (420 - 380);\n } else {\n alpha = 1;\n }\n // combine it all:\n colorSpace = \"rgba(\" + (R * 100) + \"%,\" + (G * 100) + \"%,\" + (B * 100) + \"%, \" + alpha + \")\";\n return colorSpace;\n}", "function getColor(magnitude) {\r\n if (magnitude > 5) {\r\n return \"#ea2c2c\";\r\n }\r\n if (magnitude > 4) {\r\n return \"#ea822c\";\r\n }\r\n if (magnitude > 3) {\r\n return \"#ee9c00\";\r\n }\r\n if (magnitude > 2) {\r\n return \"#eecc00\";\r\n }\r\n if (magnitude > 1) {\r\n return \"#d4ee00\";\r\n }\r\n return \"#98ee00\";\r\n}", "function cardColorScale(units, temp) {\n\tif (units == 'us') {\n\t\tif (temp >= 100) { var scale = 10; } else\n\t\tif (temp >= 90) { var scale = 9; } else\n\t\tif (temp >= 80) { var scale = 8; } else\n\t\tif (temp >= 70) { var scale = 7; } else\n\t\tif (temp >= 60) { var scale = 6; } else\n\t\tif (temp >= 50) { var scale = 5; } else\n\t\tif (temp >= 40) { var scale = 4; } else\n\t\tif (temp >= 30) { var scale = 3; } else\n\t\tif (temp >= 20) { var scale = 2; } else\n\t\tif (temp >= 10) { var scale = 1; } else\n\t\tif (temp < 10) { var scale = 0; }\n\t} else if (units == 'si') {\n\t\tif (temp >= 37.7) { var scale = 10; } else\n\t\tif (temp >= 32.2) { var scale = 9; } else\n\t\tif (temp >= 26.7) { var scale = 8; } else\n\t\tif (temp >= 21.1) { var scale = 7; } else\n\t\tif (temp >= 15.6) { var scale = 6; } else\n\t\tif (temp >= 10) { var scale = 5; } else\n\t\tif (temp >= 4.4) { var scale = 4; } else\n\t\tif (temp >= -1.1) { var scale = 3; } else\n\t\tif (temp >= -6.7) { var scale = 2; } else\n\t\tif (temp >= -12.2) { var scale = 1; } else\n\t\tif (temp < -17.8) { var scale = 0; }\n\t}\n\n\t// Return a CSS class name\n\treturn 'temp-' + scale;\n}", "_prepareColorShades(min, max) {\n let step = (max - min) / 5;\n this._shades = [];\n for (let i = 0; i < 5; i++) {\n this._shades.push(max - i * step);\n }\n }", "function getScale(hexColor, numberOfColors) {\n return chroma.scale(getRange(hexColor)).mode(\"lab\").colors(numberOfColors);\n}", "function getColor(magnitude) {\n if (magnitude > 5) {\n return \"#ea2c2c\";\n }\n if (magnitude > 4) {\n return \"#ea822c\";\n }\n if (magnitude > 3) {\n return \"#ee9c00\";\n }\n if (magnitude > 2) {\n return \"#eecc00\";\n }\n if (magnitude > 1) {\n return \"#d4ee00\";\n }\n return \"#98ee00\";\n}", "function getColor(magnitude) {\n if (magnitude > 5) {\n return \"#ea2c2c\";\n }\n if (magnitude > 4) {\n return \"#ea822c\";\n }\n if (magnitude > 3) {\n return \"#ee9c00\";\n }\n if (magnitude > 2) {\n return \"#eecc00\";\n }\n if (magnitude > 1) {\n return \"#d4ee00\";\n }\n return \"#98ee00\";\n}", "function colorMap(fraction,rgbarray){\n\n if (fraction<0.33) { rgbarray[0] = 0.0; }\n else if (fraction>0.67) { rgbarray[0] = 255.0; }\n else { rgbarray[0] = interpolate(fraction,0.33,0.67,0.0,255.0); }\n \n if (fraction<0.33) { rgbarray[1] = interpolate(fraction,0.0,0.33,0.0,255.0); }\n else if (fraction>0.67) { rgbarray[1] = interpolate(fraction,0.67,1.0,255.0,0.0); }\n else { rgbarray[1] = 255.0; }\n \n if (fraction<0.33) { rgbarray[2] = 255.0; }\n else if (fraction>0.67) { rgbarray[2] = 0.0; }\n else { rgbarray[2] = interpolate(fraction,0.33,0.67,255.0,0.0); }\n\n}", "function magnitudeColor(depth) {\n switch (true) {\n case (depth >= 90):\n return \"#ff0000\";\n case (depth > 70):\n return \"#ff8000\";\n case (depth > 50):\n return \"#ffbf00\";\n case (depth > 30):\n return \"#ffff00\";\n case (depth > 10):\n return \"#bfff00\";\n case (depth > -10):\n return \"#66ff8c\";\n \n }\n\n}", "function getColor(d) {\n var magnitude = +d;\n switch (true) {\n case (magnitude <= 1):\n return '#00FF00';\n case (magnitude > 1 && magnitude <= 2):\n return '#ADFF2F';\n case (magnitude > 2 && magnitude <= 3):\n return '#FFFF00';\n case (magnitude > 3 && magnitude <= 4):\n return '#F4A460';\n case (magnitude > 4 && magnitude <= 5):\n return '#FF8C00';\n default:\n return '#FF4500';\n }\n}", "function getColor(value) {\n if( value >= 0 && value < 5242880 ) {\n return \"rgb(0, 0, 255)\";\n }\n else if( value >= 5242880 && value < 10485760 ) {\n return \"rgb(0, 85, 255)\";\n }\n else if( value >= 10485760 && value < 52428800) {\n return \"rgb(0, 170, 255)\"; \n }\n else if( value >= 52428800 && value < 104857600 ) {\n return \"rgb(0, 255, 255)\";\n }\n else if( value >= 104857600 && value < 524288000 ) {\n return \"rgb(0, 255, 170)\";\n }\n else if( value >= 524288000 && value < 1073741824 ) {\n return \"rgb(0, 255, 0)\";\n }\n else if( value >= 1073741824 && value < 2147483648 ) {\n return \"rgb(85, 255, 0)\";\n }\n else if( value >= 2147483648 && value < 3221225472 ) {\n return \"rgb(170, 255, 0)\";\n }\n else if( value >= 3221225472 && value < 4294967296 ) {\n return \"rgb(255, 255, 0)\";\n }\n else if( value >= 4294967296 && value < 5368709120 ) {\n return \"rgb(255, 170, 0)\"; \n }\n else if( value >= 5368709120 && value < 6442450944 ) {\n return \"rgb(255, 85, 0)\";\n }\n else if( value >= 6442450944 && value < 7516192768 ) {\n return \"rgb(255, 0, 0)\";\n }\n else if( value >= 7516192768 && value < 8589934592 ) {\n return \"rgb(255, 0, 85)\";\n }\n else if( value >= 8589934592 && value < 9663676416 ) {\n return \"rgb(255, 0, 170)\";\n }\n else if( value >= 9663676416 && value < 10737418240 ) {\n return \"rgb(255, 0, 255)\";\n }\n else if( value >= 10737418240 ) {\n return \"rgb(170, 0, 255)\";\n }\n else if( value == -1 ) {\n //gray\n return \"rgb(128,128,128)\";\n }\n else if( value == -2 ) {\n //white\n return \"rgb(255,255,255)\";\n }\n else {\n //black \n return \"rgb(0,0,0)\";\n }\n}", "function multiHueScaleFactory(a,b){return(0,_scale.scaleOrdinal)({range:(0,_theme.getPaletteForBrightness)(a,b)})}// returns an ordinal scale of single-hue colors with varying brightness (dark to light)", "function wavelengthToColor(wavelength) {\n var r,g,b,alpha,\n colorSpace,\n wl = wavelength,\n gamma = 1;\n \n if (wl >= 380 && wl < 440) {\n R = -1 * (wl - 440) / (440 - 380);\n G = 0;\n B = 1;\n } else if (wl >= 440 && wl < 490) {\n R = 0;\n G = (wl - 440) / (490 - 440);\n B = 1; \n } else if (wl >= 490 && wl < 510) {\n R = 0;\n G = 1;\n B = -1 * (wl - 510) / (510 - 490);\n } else if (wl >= 510 && wl < 580) {\n R = (wl - 510) / (580 - 510);\n G = 1;\n B = 0;\n } else if (wl >= 580 && wl < 645) {\n R = 1;\n G = -1 * (wl - 645) / (645 - 580);\n B = 0.0;\n } else if (wl >= 645) { //if (wl >= 645 && wl <= 780)\n R = 1;\n G = 0;\n B = 0;\n } else {\n R = 1;\n G = 1;\n B = 1;\n }\n \n // intensty is lower at the edges of the visible spectrum.\n if (wl > 780 || wl < 380) {\n alpha = 0;\n } else if (wl > 700) {\n alpha = (780 - wl) / (780 - 700);\n } else if (wl < 420) {\n alpha = (wl - 380) / (420 - 380);\n } else {\n alpha = 1;\n }\n \n // colorSpace = [\"rgba(\" + (R * 100) + \",\" + (G * 100) + \",\" + (B * 100) + \", \" + alpha + \")\", R, G, B, alpha]\n colorSpace = [\"rgb(\" + Math.floor(R * 255) + \",\" + Math.floor(G * 255) + \",\" + Math.floor(B * 255) + \")\", R, G, B, alpha];\n\n return colorSpace;\n}", "function generateColorFromValue(value) {\n\tnormalizedValue = value / 100; // Normalize\n\tvar hue=((1-normalizedValue)*120).toString(10);\n\t\n\t// Get alpha gradient from 0 to 50\n\tvar alpha = normalizedValue * 3;\n\talpha = alpha > 1 ? 1 : alpha;\n\n return [\"hsla(\" + hue + \",100%,50%,\" + alpha + \")\"].join(\"\");\n}", "function colorRange(magnitude) {\n\n switch (true) {\n case magnitude >= 5:\n return '#ff0000';\n break;\n\n case magnitude >= 4:\n return '#ff5900';\n break;\n \n case magnitude >= 3:\n return '#ee9c00';\n break;\n\n case magnitude >= 2:\n return '#eecc00';\n break;\n\n case magnitude >= 1:\n return '#d4ee00';\n break;\n\n default:\n return '#98ee00';\n };\n}", "function _createColorVariations() {\n var colors = { waveColor: [], progressColor: [] };\n for (var c in colors) {\n var tmp = WP.UTILS.hex2rgb(this._params[c]);\n colors[c].push(tmp);\n tmp = WP.UTILS.rgb2hsv(tmp);\n colors[c].push(WP.UTILS.hsv2rgb({ h: tmp.h, s: tmp.s, v: tmp.v*1.4 }));\n }\n colors.dc = {\n r: (colors.waveColor[0].r - colors.progressColor[0].r),\n g: (colors.waveColor[0].g - colors.progressColor[0].g),\n b: (colors.waveColor[0].b - colors.progressColor[0].b)\n };\n return colors;\n }", "vaxiColor(n) {\n return n >= 100 ? 'hsl(139, 100%, 17%)':\n n > 75 ? 'hsl(139, 100%, 27%)':\n n > 60 ? 'hsl(139, 100%, 32%)':\n n > 50 ? 'hsl(139, 100%, 37%)':\n n > 45 ? 'hsl(139, 100%, 42%)':\n n > 40 ? 'hsl(139, 100%, 47%)':\n n > 35 ? 'hsl(139, 100%, 52%)':\n n > 30 ? 'hsl(139, 100%, 57%)':\n n > 25 ? 'hsl(139, 100%, 62%)':\n n > 20 ? 'hsl(139, 100%, 67%)':\n n > 15 ? 'hsl(139, 100%, 72%)':\n n > 10 ? 'hsl(139, 100%, 77%)':\n n > 5 ? 'hsl(139, 100%, 87%)':\n n > 3 ? 'hsl(139, 100%, 92%)':\n n > 2 ? 'hsl(139, 100%, 95%)':\n n > 1 ? 'hsl(139, 100%, 97%)':\n 'hsl(139, 100%, 99%)';\n }", "function genlegendScaleLevels(start, end, num) {\n\tvar incr=(end[0]-start[0])/num;\n\tvar incg=(end[1]-start[1])/num;\n\tvar incb=(end[2]-start[2])/num;\n\tfor(k = 1; k <= num; k++) {\n\t\tcur=[Math.round(start[0]+k*incr),Math.round(start[1]+k*incg),Math.round(start[2]+k*incb)];\n\t\tcreateClass(\".heatLevel\"+k.toString(),\"fill: rgb(\"+cur.toString()+\");\");\n\t\tlegendScaleLevels[k]=cur;\n\t}\n}", "function update_color() {\n refresh_color_display();\n\n // Iterate over each channel on the page\n for (var cs in COLORSPACES) {\n var colorspace = COLORSPACES[cs];\n var cs_name = colorspace.identifier;\n for (var i in colorspace.channels) {\n var channel = colorspace.channels[i];\n var id = cs_name + '-' + channel.identifier;\n\n // Update value and marker position\n update_slider(colorspace, channel);\n\n // Iterate over stops and update their colors, using assume()\n // to see what they *would* be if the slider were there. Note\n // that hue and lightness are special cases; hue runs through\n // the rainbow and needs several stops, whereas lightness runs\n // from black to a full color and then back to white, needing\n // an extra stop in the middle.\n var stop_ct = channel.stops;\n\n var $canvas = $('#' + id + ' canvas');\n var ctx = $canvas[0].getContext('2d');\n\n var grad = ctx.createLinearGradient(0, 0, 100, 0);\n var assumption = {};\n for (var i = 0; i < stop_ct; i++) {\n var offset = i / (stop_ct - 1);\n assumption[channel.identifier] = offset;\n grad.addColorStop(offset, current_color.assume(assumption).to_hex());\n }\n ctx.fillStyle = grad;\n ctx.fillRect(0, 0, 100, 100);\n }\n }\n}", "function getColor(magnitude) {\n if (magnitude > 7) {\n return 'red'\n } else if (magnitude > 6) {\n return 'orange'\n } else if (magnitude > 5) {\n return 'yellow'\n } else if (magnitude > 4) {\n return 'lightgreen'\n } else if (magnitude > 2) {\n return 'green'\n } else {\n return 'blue'\n }\n}", "function u$2(e,o,l,i){const{rendererJSON:s,isRGBRenderer:f}=e;let u=null,c=null;if(o&&f)u=o;else if(o&&\"pointCloudUniqueValueRenderer\"===s.type){c=a$3.fromJSON(s);const e=c.colorUniqueValueInfos;u=new Uint8Array(3*i);const r=p$2(c.fieldTransformType);for(let t=0;t<i;t++){const n=(r?r(o[t]):o[t])+\"\";for(let o=0;o<e.length;o++)if(e[o].values.indexOf(n)>=0){u[3*t]=e[o].color.r,u[3*t+1]=e[o].color.g,u[3*t+2]=e[o].color.b;break}}}else if(o&&\"pointCloudStretchRenderer\"===s.type){c=c$4.fromJSON(s);const e=c.stops;u=new Uint8Array(3*i);const r=p$2(c.fieldTransformType);for(let t=0;t<i;t++){const n=r?r(o[t]):o[t],l=e.length-1;if(n<e[0].value)u[3*t]=e[0].color.r,u[3*t+1]=e[0].color.g,u[3*t+2]=e[0].color.b;else if(n>=e[l].value)u[3*t]=e[l].color.r,u[3*t+1]=e[l].color.g,u[3*t+2]=e[l].color.b;else for(let o=1;o<e.length;o++)if(n<e[o].value){const r=(n-e[o-1].value)/(e[o].value-e[o-1].value);u[3*t]=e[o].color.r*r+e[o-1].color.r*(1-r),u[3*t+1]=e[o].color.g*r+e[o-1].color.g*(1-r),u[3*t+2]=e[o].color.b*r+e[o-1].color.b*(1-r);break}}}else if(o&&\"pointCloudClassBreaksRenderer\"===s.type){c=c$5.fromJSON(s);const e=c.colorClassBreakInfos;u=new Uint8Array(3*i);const t=p$2(c.fieldTransformType);for(let r=0;r<i;r++){const n=t?t(o[r]):o[r];for(let o=0;o<e.length;o++)if(n>=e[o].minValue&&n<=e[o].maxValue){u[3*r]=e[o].color.r,u[3*r+1]=e[o].color.g,u[3*r+2]=e[o].color.b;break}}}else {u=new Uint8Array(3*i);for(let e=0;e<u.length;e++)u[e]=255;}if(l&&c&&c.colorModulation){const e=c.colorModulation.minValue,o=c.colorModulation.maxValue,r=.3;for(let t=0;t<i;t++){const n=l[t],i=n>=o?1:n<=e?r:r+(1-r)*(n-e)/(o-e);u[3*t]=i*u[3*t],u[3*t+1]=i*u[3*t+1],u[3*t+2]=i*u[3*t+2];}}return u}", "function Qcolor(magnitude) {\n if (magnitude >= 5) {\n return \"#990000\";} \n else if (magnitude >= 4 && magnitude <5) {\n return \"#D60000\";} \n else if (magnitude >= 3 && magnitude <4) {\n return \"#FF4848\";} \n else if (magnitude >= 2 && magnitude <3){\n return \"#FFB0B0\";} \n else if (magnitude >= 1 && magnitude <2){\n return \"#FFCACA\"; } \n else if (magnitude < 1){\n return \"#FFE4E4\";} \n }", "function getColor(d) {\n\n\t\tswitch (valueType) {\n\t\tcase \"percent\":\n\t\t\treturn d > 500 ? colours[6] :\n\t\t\td > 200 ? colours[5] :\n\t\t\td > 100 ? colours[4] :\n\t\t\td > 50 ? colours[3] :\n\t\t\td > 25 ? colours[2] :\n\t\t\td > 0 ? colours[1] :\n\t\t\t colours[0];\n\t\t\tbreak;\n\t\tcase \"difference\":\n\t\t zoomDiff = 11 - zoomLevel;\n\t\t if (zoomDiff > 0) {\n d = d / Math.pow(4, zoomDiff)\n\t\t }\n\n\t\t\treturn d > 500 ? colours[6] :\n\t\t\td > 200 ? colours[5] :\n\t\t\td > 100 ? colours[4] :\n\t\t\td > 50 ? colours[3] :\n\t\t\td > 25 ? colours[2] :\n\t\t\td > 0 ? colours[1] :\n\t\t\t colours[0];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn d > 500 ? colours[6] :\n\t\t\td > 200 ? colours[5] :\n\t\t\td > 100 ? colours[4] :\n\t\t\td > 50 ? colours[3] :\n\t\t\td > 25 ? colours[2] :\n\t\t\td > 0 ? colours[1] :\n\t\t\t colours[0];\n\t\t}\n\t}", "function getMunsellColor(hue, value, chroma) {\n // hue (aka color) 0-100 -> 0-39\n // value (aka shade) 0-100 -> 0-10\n // chroma (aka grey) 0-100 -> 0-14\n // We linear-interpret value.\n var h = Math.round(hue / 2.5);\n h %= 40; // doesn't guarentee it will be positive.\n while (h < 0) {\n h += 40;\n }\n var v1 = Math.floor(value / 10);\n var v2 = v1 + 1;\n if (v1 < 0) {\n v1 = 0;\n v2 = 0;\n } else if (v1 > 10) {\n v1 = 10;\n v2 = 10;\n }\n var p = (v2 * 10 - value) / 10.;\n if (p > 1) {\n p = 1;\n } else if (p < 0) {\n p = 0;\n }\n var c = Math.round((chroma * 14) / 100);\n if (c < 0) {\n c = 0;\n } else if (c > 14) {\n c = 14;\n }\n return interpColor(MUNSELL[h * 165 + v1 * 15 + c], MUNSELL[h * 165 + v2 * 15 + c], p);\n}", "paintColors ( ) {\n this.colorScale = d3.scaleOrdinal( )\n .range( [\n \"#316395\",\"#dc3912\",\"#ff9900\",\"#109618\",\"#990099\",\"#0099c6\",\"#8b0707\",\n \"#3b3eac\",\"#b82e2e\",\"#994499\",\"#22aa99\",\"#aaaa11\",\"#6633cc\",\"#e67300\",\n ] )\n .domain( this.data.children.map( d => d.name ) );\n this.tile.attr( 'fill', d => this.colorScale( d.data.category ) );\n\n return this;\n }", "function u(e,o,l,i){const{rendererJSON:s,isRGBRenderer:f}=e;let u=null,c=null;if(o&&f)u=o;else if(o&&\"pointCloudUniqueValueRenderer\"===s.type){c=a$3.fromJSON(s);const e=c.colorUniqueValueInfos;u=new Uint8Array(3*i);const r=p$1(c.fieldTransformType);for(let t=0;t<i;t++){const n=(r?r(o[t]):o[t])+\"\";for(let o=0;o<e.length;o++)if(e[o].values.indexOf(n)>=0){u[3*t]=e[o].color.r,u[3*t+1]=e[o].color.g,u[3*t+2]=e[o].color.b;break}}}else if(o&&\"pointCloudStretchRenderer\"===s.type){c=a$4.fromJSON(s);const e=c.stops;u=new Uint8Array(3*i);const r=p$1(c.fieldTransformType);for(let t=0;t<i;t++){const n=r?r(o[t]):o[t],l=e.length-1;if(n<e[0].value)u[3*t]=e[0].color.r,u[3*t+1]=e[0].color.g,u[3*t+2]=e[0].color.b;else if(n>=e[l].value)u[3*t]=e[l].color.r,u[3*t+1]=e[l].color.g,u[3*t+2]=e[l].color.b;else for(let o=1;o<e.length;o++)if(n<e[o].value){const r=(n-e[o-1].value)/(e[o].value-e[o-1].value);u[3*t]=e[o].color.r*r+e[o-1].color.r*(1-r),u[3*t+1]=e[o].color.g*r+e[o-1].color.g*(1-r),u[3*t+2]=e[o].color.b*r+e[o-1].color.b*(1-r);break}}}else if(o&&\"pointCloudClassBreaksRenderer\"===s.type){c=d$2.fromJSON(s);const e=c.colorClassBreakInfos;u=new Uint8Array(3*i);const t=p$1(c.fieldTransformType);for(let r=0;r<i;r++){const n=t?t(o[r]):o[r];for(let o=0;o<e.length;o++)if(n>=e[o].minValue&&n<=e[o].maxValue){u[3*r]=e[o].color.r,u[3*r+1]=e[o].color.g,u[3*r+2]=e[o].color.b;break}}}else {u=new Uint8Array(3*i);for(let e=0;e<u.length;e++)u[e]=255;}if(l&&c&&c.colorModulation){const e=c.colorModulation.minValue,o=c.colorModulation.maxValue,r=.3;for(let t=0;t<i;t++){const n=l[t],i=n>=o?1:n<=e?r:r+(1-r)*(n-e)/(o-e);u[3*t]=i*u[3*t],u[3*t+1]=i*u[3*t+1],u[3*t+2]=i*u[3*t+2];}}return u}", "function numberToColorGradient(value, max, palette, neg_and_pos = false) {\n if (neg_and_pos) {\n value = value + max\n max = max*2\n }\n\n if (value > max)\n value = max\n if (value < 0)\n value = 0\n\n switch(palette){\n case \"rwb\": // red-white-blue\n return colorGradient(value/max, {red:255, green:0, blue: 0}, {red:255, green:255, blue: 255}, {red:0, green:0, blue: 255})\n break;\n case \"bwr\": // blue-white-red\n return colorGradient(value/max, {red:0, green:0, blue: 255}, {red:255, green:255, blue: 255}, {red:255, green:0, blue: 0})\n break;\n case \"ryg\": // red-yellow-green\n return colorGradient(value/max, {red:255, green:0, blue: 0}, {red:0, green:255, blue: 0}, {red:0, green:255, blue: 0})\n break;\n case \"gyr\": // green-yellow-red\n return colorGradient(value/max, {red:255, green:0, blue: 0}, {red:255, green:255, blue: 0}, {red:0, green:255, blue: 0})\n break;\n case \"rgb\":\n return colorGradient(value/max, {red:255, green:0, blue: 0}, {red:255, green:255, blue: 255}, {red:0, green:0, blue: 255})\n break;\n case \"wr\": // white-red\n return colorGradient(value/max, {red:255, green:255, blue: 255}, {red:255, green:0, blue: 0})\n break;\n case \"wg\": // white-green\n return colorGradient(value/max, {red:255, green:255, blue: 255}, {red:0, green:255, blue: 0})\n break;\n case \"wb\": // white-blue\n return colorGradient(value/max, {red:255, green:255, blue: 255}, {red:0, green:0, blue: 255})\n break;\n case \"rb\": // red-blue\n return colorGradient(value/max, {red:255, green:0, blue: 0}, {red:0, green:0, blue: 255})\n break;\n // ADDON if you're missing gradient values\n case \"br\": // blue-red\n default:\n return colorGradient(value/max, {red:0, green:0, blue: 255}, {red:255, green:0, blue: 0})\n break;\n }\n}", "function paintColor(d, i){\n if (i < n){\n tog(color, i / ( n + 2) );\n } else {\n var k = Math.floor(i/n);\n var num = ( 2 * k + 1);\n var dem = Math.pow(2, Math.ceil( Math.log(k + 1) / Math.LN2 ));\n var added = ( num / dem ) % 1;\n tog(color, (i % n + added) / ( n + 2) );\n }\n vec3.scale( color, color, 100);\n \n return [\n \"color:rgb( \", \n Math.round(color[0]), \"%,\", \n Math.round(color[1]), \"%,\",\n Math.round(color[2]), \"% )\"\n ].join(\"\");\n }", "function getColor(magnitude) {\n switch (true) {\n case magnitude > 5:\n return \"#ea2c2c\";\n case magnitude > 4:\n return \"#ea822c\";\n case magnitude > 3:\n return \"#ee9c00\";\n case magnitude > 2:\n return \"#eecc00\";\n case magnitude > 1:\n return \"#d4ee00\";\n default:\n return \"#98ee00\";\n } \n }", "function GaugeBarColor (s) {\r\n\t\t\tvar\tcolorScale = d3.scaleLinear()\r\n\t\t\t\t.domain([0,9])\r\n\t\t\t\t.range([0,255]);\r\n\t\t\t//red is (255,0,0), yellow is (255,255,0), green is (0,255,0)\r\n\t\t\t//between red and yellow we need to add to the green channel\r\n\t\t\t//between yellow and green we need to subtract from the red channel\r\n\t\t\t//had to mix some blue at 10% to make the dark green stand out from a (0,255,0)\r\n\t\t\tif(s < 4.5) {\r\n\t\t\t\treturn \"rgb(255,\" + 2 * Math.round(colorScale(s)) + \",0)\"\r\n\t\t\t} else {\r\n\t\t\t\treturn \"rgb(\" + Math.round((255-(colorScale(s)+1))) + \",255,\"+ Math.round(colorScale(s)*0.2)+\")\"\r\n\t\t\t};\r\n\t\t}", "function greyScaledMap(noiseval) {\n let greyval = Math.round(noiseval * 255);\n return 'rgb(' + greyval + ',' + greyval + ',' + greyval + ')';\n }", "colour(d) {\n const vis = this;\n\n const colourScale = d3\n .scaleOrdinal()\n .domain(vis.listOfHabits)\n .range(['#3EBA9D', '#FF815D', '#7B97C1', '#F080B8', '#96D05B']);\n\n return colourScale(d);\n }", "function colormaker()\r\n{\r\n var colorObject = {};\r\n var color = d3.scaleOrdinal(d3.schemeCategory10);\r\n return function(x)\r\n {\r\n if (!(Object.keys(colorObject).includes(x)))\r\n {\r\n colorObject[x] = Object.keys(colorObject).length;\r\n }\r\n return color(colorObject[x])\r\n }\r\n}", "function color(n) {\r\n // rgb\r\n return `hsl(${n * quickcol * 360},100%,50%)`;\r\n // default\r\n return `hsl(${n * quickcol * 360},${20+n*quickcol*50}%,${n * quickcol * 100}%)`;\r\n // gray-scaled\r\n return `hsl(0, 0%, ${100 - n * quickcol * 100}%)`;\r\n}", "getColor(value) {\n let normalizeValue = 0;\n if (value >= 50) {\n normalizeValue = 100 - (value / 100);\n } else {\n normalizeValue = ((value / 100) - 100) * -1;\n }\n\n const hue = ((1 - normalizeValue) * 120).toString(10);\n\n return [\"hsl(\", hue, \", 100%, 50%)\"].join(\"\");\n }", "function setColor(magnitude) {\n \tif (magnitude > 5) {\n \treturn '#FF0000'\n \t} else if (magnitude > 4) {\n \treturn '#FF7C00'\n \t} else if (magnitude > 3) {\n \treturn '#FFBE00'\n \t} else if (magnitude > 2) {\n \treturn '#FFF500'\n \t} else if (magnitude > 1) {\n \treturn '#AEFF00'\n \t} else {\n \treturn '#39FF00'\n \t}\n}", "function setQuantileColorScale (domainArr, rangeArr) {\n return d3.scale.quantile()\n .domain(domainArr)\n .range(rangeArr);\n }", "function create_color(root_node) {\n\t// black color for root\n\troot_node.color = d3.rgb(0,0,0);\n\tvar hue_scale = d3.scaleLinear().domain([0,root_node.children.length-1]).range([10,250])\n\tfor(var c = 0; c < root_node.children.length; c++) {\n\t\tvar child_node = root_node.children[c];\n\t\tvar interpolator = d3.interpolateLab(d3.hsl(hue_scale(c),0.8,0.3), d3.hsl(hue_scale(c),0.8,0.8))\n\t\tchild_node.color = interpolator(0.5);\n\t\tfor(var d = 0; d < child_node.children.length; d++)\n\t\t\tchild_node.children[d].color = interpolator(d / (child_node.children.length-1));\n\t}\n}", "function getColor(d) {\n\tvar value = d ;\n\tvar s = value * 100 / 4 + 75;\n\tvar v = (1.0 - value * 1.5) * 50 + 50;\n\treturn currentCategory == \"footfall\" ? \"hsl(0, \" + s + \"%, \" + v + \"%)\"\t: \n\t\t\tcurrentCategory == \"rainfall\" ? \"hsl(300, \" + s + \"%, \" + v + \"%)\" :\n\t\t\t\tcurrentCategory == \"stayduration\" ? \"hsl(285, \" + s + \"%, \" + v\t+ \"%)\" :\n\t\t\t\t\tcurrentCategory == \"freetaxi\" ? \"hsl(265, \" + s + \"%, \" + v + \"%)\" :\n\t\t\t\t\t\tcurrentCategory == \"subzoneingress\" ? \"hsl(195, \" + s + \"%, \" + v\t+ \"%)\" : \n\t\t\t\t\t\t\tcurrentCategory == \"subzoneegress\" ? \"hsl(165, \" + s + \"%, \" + v\t+ \"%)\":\n\t\t\t\t\t\t\t\tcurrentCategory == \"planningareaegress\" ? \"hsl(75, \" + s + \"%, \" + v\t+ \"%)\":\n\t\t\t\t\t\t\t\t\tcurrentCategory == \"odplanningarea\" ? \"hsl(60, \" + s + \"%, \" + v\t+ \"%)\":\n\t\t\t\t\t\t\t\t\t\tcurrentCategory == \"model1\" ? \"hsl(30, \" + s + \"%, \" + v\t+ \"%)\"://45\n\t\t\t\t\t\t\t\t\t\t\tcurrentCategory == \"model2\" ? \"hsl(30, \" + s + \"%, \" + v\t+ \"%)\":\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentCategory == \"model3\" ? \"hsl(30, \" + s + \"%, \" + v\t+ \"%)\"://330\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"hsl(30, \" + s + \"%, \" + v + \"%)\";//175\n}", "function fill2color(fill, scale, geoJson) {\n // extract values for fill color\n const values = geoJson.features.map(x => +x.properties[fill]);\n // min and max value of the array\n const maxValue = Math.max(...values)\n const minValue = Math.min(...values.filter(utils.isNotZero))\n // calculate the sorted orders\n const orders = utils.argsort(values);\n let value2range;\n let colorBarMax, colorBarMin;\n // get value2range function for color map\n switch (scale) {\n case \"linear\":\n colorBarMax = maxValue;\n colorBarMin = minValue;\n if (fill === \"confirmed\") {\n value2range = d3.scaleLinear()\n .domain([colorBarMin, colorBarMax])\n .range([1, -4]);\n } else if (fill === \"confirmed_per_capita\") {\n value2range = d3.scaleLinear()\n .domain([colorBarMin, colorBarMax])\n .range([1, -8]);\n }\n break;\n case \"log\":\n colorBarMax = maxValue;\n colorBarMin = minValue;\n value2range = d3.scaleLog()\n .domain([colorBarMin, colorBarMax])\n .range([1.2, -0.1]);\n break;\n case \"percentile\":\n colorBarMax = 100;\n colorBarMin = 0;\n value2range = d3.scaleLinear()\n .domain([colorBarMin, colorBarMax])\n .range([1.4, 0]);\n break;\n }\n\n updateColorBar(colorBar, x => d3.interpolateRdYlGn(value2range(x)),\n colorBarMin, colorBarMax);\n\n // if the value is 0, use \"gray\" color, else use the color generated\n return (i, value) => {\n if (value === 0) {\n return \"gray\";\n } else if (scale === \"percentile\") {\n return d3.interpolateRdYlGn(value2range(orders[i] / orders.length * 100));\n } else {\n return d3.interpolateRdYlGn(value2range(value));\n }\n };\n }", "function to_jet() {\n\t\tvar feed = mesh_feed[this];\n\t\tvar ctx = feed.context2d,\n\t\t\tmetadata = feed.canvas.metadata,\n\t\t\trange = 255.0;\n\n\t\tif(metadata.c==='raw'){\n\t\t\tmetadata.data = new window.Float32Array(metadata.data);\n\t\t\tfeed.canvas.width = metadata.dim[1];\n\t\t\tfeed.canvas.height = metadata.dim[0];\n\t\t\trange = 5.0;\n\t\t}\n\n\t\tvar data = metadata.data,\n\t\t\tdlen = data.length,\n\t\t\timgdata = ctx.getImageData(0, 0, feed.canvas.width, feed.canvas.height),\n\t\t\tidata = imgdata.data,\n\t\t\tlen = idata.length,\n\t\t\tfourValue,\n\t\t\ti = 0,\n\t\t\tdatum;\n\n\t\t//console.log(metadata.data);\n\t\tvar w = feed.canvas.width,\n\t\t\th = feed.canvas.height;\n\t\tfor(var u = 0; u<w; u+=1){\n\t\t\tfor(var v = 0; v<h; v+=1){\n\t\t\t\tdatum = data[u*h + v];\n\t\t\t\t//datum = data[v*w + u];\n\t\t\t\tfourValue = 4 - 4 * max(0, min(datum / range, 1));\n\t\t\t\tidata[i] = 255 * min(fourValue - 1.5, 4.5 - fourValue);\n\t\t\t\tidata[i + 1] = 255 * min(fourValue - 0.5, 3.5 - fourValue);\n\t\t\t\tidata[i + 2] = 255 * min(fourValue + 0.5, 2.5 - fourValue);\n\t\t\t\tidata[i + 3] = 255;\n\t\t\t\ti += 4;\n\t\t\t}\n\t\t}\n\n\t\tctx.putImageData(imgdata, 0, 0);\n\n\t}" ]
[ "0.73159134", "0.7102787", "0.70865196", "0.6956765", "0.6922303", "0.69118196", "0.69102824", "0.69102377", "0.69013095", "0.6890672", "0.6846617", "0.6777873", "0.6760269", "0.6717097", "0.6701262", "0.66768765", "0.6581931", "0.6575383", "0.6536377", "0.651751", "0.648503", "0.6433621", "0.6421742", "0.640551", "0.63957757", "0.63864845", "0.63591707", "0.6354862", "0.63331604", "0.63227415", "0.62484485", "0.62423867", "0.62275296", "0.6193697", "0.6164039", "0.6108392", "0.6108024", "0.61061263", "0.609598", "0.607525", "0.60731447", "0.60559446", "0.60346115", "0.6028944", "0.6016079", "0.59973747", "0.5985139", "0.5981675", "0.59298277", "0.59231305", "0.5904856", "0.5903622", "0.5898319", "0.58913976", "0.588312", "0.58648413", "0.5850834", "0.5827289", "0.58241373", "0.5812185", "0.57945234", "0.5791918", "0.57908297", "0.5781199", "0.5773278", "0.5770144", "0.5763228", "0.57582617", "0.5752659", "0.5741959", "0.5741808", "0.5733537", "0.5718981", "0.5716316", "0.5716218", "0.57139766", "0.57122755", "0.5694823", "0.56719476", "0.5665552", "0.5652789", "0.56410617", "0.5638592", "0.56379884", "0.5637838", "0.5629407", "0.56232476", "0.5618889", "0.56157196", "0.5614374", "0.56131005", "0.5605629", "0.55980515", "0.55965215", "0.5586122", "0.5584098", "0.55811644", "0.5577187", "0.55735356", "0.557233" ]
0.6724549
13
Iterate all the elements from json file
function storeData( p_obj ) { var i; this.elements = p_obj.elements; for( i in this.elements ) { addElem.call( this, this.elements[ i ] ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collectFromElements(json, files) {\n for (let i = 0; i < json.length; i++) {\n let element = json[i];\n traverse(element.content, contentElement => {\n getFilesFromElement(contentElement, files);\n });\n\n getFilesFromElementPreview(element, files);\n }\n}", "function injectFilesIntoElements(json, files) {\n for (let i = 0; i < json.length; i++) {\n let element = json[i];\n traverse(element.content, contentElement => {\n injectFilesIntoElement(contentElement, files);\n });\n injectFilesIntoElementPreview(element, files);\n }\n}", "function readJSON() {\r\n\r\n $.getJSON(\"resources/damageTypes.json\", function (json) {\r\n var i = 1;\r\n for (const key of Object.keys(json)) {\r\n damageCards(json[key], i++);\r\n }\r\n });\r\n\r\n}", "function processJSON ( file ) {\n 'use strict';\n var _json = JSON.parse(file.contents.toString());\n var _jsonOut = [];\n for (var i in _json) {\n _jsonOut[i] = {};\n _jsonOut[i].id = md5(i.toString());\n\n for (var j in _json[i]) {\n\n if (j in COL_NAME_MAP) {\n var v = COL_NAME_MAP[j];\n\n if (typeof v === 'object') {\n\n var content = _json[i][j];\n\n if (v.slugify) {\n content = slugify(content);\n }\n\n if ('parent' in v) {\n if (!(v.parent in _jsonOut[i])) {\n _jsonOut[i][v.parent] = v.many ? [] : {};\n }\n\n if (v.many) {\n var _split = content.split(v.delimiter);\n\n for (var s in _split) {\n if (_jsonOut[i][v.parent].length == 0) {\n let a = v.value;\n let b = {};\n b[a] = '';\n _jsonOut[i][v.parent][s] = b;\n }\n _jsonOut[i][v.parent][s][v.value] = _split[s].trim();\n }\n }\n }\n\n _jsonOut = populateChildren(_jsonOut, content, v, i);\n\n } else {\n _jsonOut[i][v] = _json[i][j];\n }\n }\n }\n }\n var out = JSON.stringify(_jsonOut);\n file.contents = new Buffer(out);\n}", "async function getNameFetch (){\n try{\n let request = await fetch(\"json.txt\");\n let result = await request.json();\n for(one in result){\n console.group(result[one].name + \" \" + result[one].lastname);\n console.log(\"Name: \" + result[one].name);\n console.log(\"Lastname: \" + result[one].lastname);\n console.log(\"Age: \" + result[one].age);\n console.log(\"Note: \" + result[one].note);\n console.groupEnd();\n };\n } catch(err){\n console.log(\"LA API FALLO\");\n };\n}", "static async read() {\n let json = (await IO.parseFileJSON(Paths.FILE_SONGS)).list;\n let l = json.length;\n this.list = new Array(l);\n let i, j, m, n, jsonHash, k, jsonList, jsonSong, id, list, song;\n for (i = 0; i < l; i++) {\n jsonHash = json[i];\n k = jsonHash.k;\n jsonList = jsonHash.v;\n // Get the max ID\n m = jsonList.length;\n n = 0;\n for (j = 0; j < m; j++) {\n jsonSong = jsonList[j];\n id = jsonSong.id;\n if (id > n) {\n n = id;\n }\n }\n // Fill the songs list\n list = new Array(n + 1);\n for (j = 0; j < n + 1; j++) {\n jsonSong = jsonList[j];\n if (jsonSong) {\n id = jsonSong.id;\n song = new System.Song(jsonSong, k);\n if (k !== SongKind.Sound) {\n song.load();\n }\n if (id === -1) {\n id = 0;\n }\n list[id] = song;\n }\n }\n this.list[k] = list;\n }\n }", "function collectFromPages(json, files) {\n for (let i = 0; i < json.length; i++) {\n let page = json[i];\n traverse(page.content, element => {\n getFilesFromElement(element, files);\n });\n\n getFilesFromPageSettings(page, files);\n }\n}", "getAllData() {\n return this.jsonFile;\n }", "function main() {\n for (x in filesToRead) {\n readTextFile(filesToRead[x]);\n }\n exportToJson(finalOutput, \"test\");\n}", "function getJSON(file){\n reader.onload = function (file) {\n var obj = JSON.parse(file.target.result);\n for(var i = 0; i < obj.Result.length; i++)\n appendToScreen(obj.Result[i].title, obj.Result[i].url, obj.Result[i].description);\n };\n reader.readAsText(file);\n}", "function readStudentsJSONFile(fileName) {\n let jsonString = fs.readFileSync(path.join(__dirname, fileName)).toString();\n let objs = JSON.parse(jsonString);\n console.log(objs)\n let students = objs.map(obj => new Student(obj.firstName, obj.lastName, obj.age, obj.grades));\n return students;\n}", "async function runfile() {\n for (let i = 0; i < fileName.length; i++) {\n const { inputPath, outputPath } = pathGenerator(fileName[i]);\n const jsonObj = await csv().fromFile(inputPath);\n const obj = jsonObj.map((obj) => {\n // Output result\n console.log(obj);\n return obj;\n });\n\n // Output to JSON file (uncomment on output command only..refer README)\n // fs.writeFileSync(outputPath, JSON.stringify(obj));\n }\n}", "function injectFilesIntoPages(json, files) {\n for (let i = 0; i < json.length; i++) {\n let page = json[i];\n traverse(page.content, element => {\n injectFilesIntoElement(element, files);\n });\n\n injectFilesIntoPageSettings(page, files);\n }\n}", "function auxiliar(json){\n if(json.length==0 || json == null){\n alert(\"No hay productos en ese rango de precios\");\n return;\n }\n for(let producto of json){\n items(producto);\n }\n }", "parseJSON(fileContent) {\n // Capabilities \n var browserName = fileContent.capabilities.browserName;\n\n // Save browser\n this.pushUsedBrowsers(browserName);\n\n var suites = fileContent.suites;\n if (suites.length !== 0) {\n // Increment number of test suites\n this.incTestSuites(browserName);\n }\n\n _.each(suites, (suite) => {\n const suiteName = suite.name;\n const suiteDuration = suite.duration;\n const testCases = suite.tests;\n\n _.each(testCases, (testCase) => {\n const testCaseName = testCase.name;\n const testCaseDuration = testCase.duration;\n const testCaseState = testCase.state;\n\n // Increment number of tests by browser and by test state\n this.incTestsByBrowserByState(testCaseState, browserName, suiteName);\n\n // Increment number of tests per browser per state \n this.incTestsByBrowserByState(testCaseState, browserName, suiteName);\n\n // Increment global execution duration\n this.incExecutionDuration(testCaseDuration);\n\n const testCaseDescription = {\n testSuite: suiteName,\n testCase: testCaseName,\n duration: testCaseDuration,\n state: this.standardTestState(testCaseState)\n };\n // Set test case description\n this.pushTestByBrowser(browserName, testCaseDescription);\n });\n });\n }", "function JSONReader()\r\n{\r\n var jsonDoc = null;\r\n var varNodes = null;\r\n var curVars = null;\r\n this.jsonFilepath = null;\r\n var varsElementIdx = 0;\r\n\r\n this.load = function(jsonpath) {\r\n\r\n fileReader = new FileReader();\r\n this.jsonFilepath = uriFor(jsonpath);\r\n\r\n var url = fileReader.prepareUrl(this.jsonFilepath);\r\n // the xml http requester to fetch the page to include\r\n\r\n var requester;\r\n\t\tif(window.XMLHttpRequest) {\r\n requester = new XMLHttpRequest();\r\n }\r\n if (!requester) {\r\n throw new Error(\"Http requester object not initialized\");\r\n }\r\n\r\n requester.open(\"GET\", url, false); // synchron mode ! (we don't want selenium to go ahead)\r\n try {\r\n requester.send(null);\r\n } catch(e) {\r\n throw new Error(\"Error while fetching url '\" + url + \"' details: \" + e);\r\n }\r\n\r\n if ( requester.status != 200 && requester.status !== 0 ) {\r\n throw new Error(\"Error while fetching \" + url + \" server response has status = \" + requester.status + \", \" + requester.statusText );\r\n }\r\n\r\n xmlDoc = requester.responseText; // XMLDocument\r\n\r\n varNodes = jsonBlob2JsonArray(xmlDoc); // HTMLCollection\r\n\r\n if (varNodes == null || varNodes.length == 0) {\r\n throw new Error(\"A JSON element could not be loaded, or the file was empty.\");\r\n }\r\n\r\n curVars = 0;\r\n return varNodes;\r\n }\r\n\r\n this.EOF = function() {\r\n return (curVars == null || curVars >= varNodes.length);\r\n }\r\n\r\n this.next = function() {\r\n\r\n if (this.EOF()) {\r\n LOG.error(\"No more JSON elements to read after element #\" + varsElementIdx);\r\n return;\r\n }\r\n varsElementIdx++;\r\n \tkey = Object.keys(varNodes[curVars]);\r\n storedVars[key] = varNodes[curVars][key];\r\n// storedVars = varNodes[curVars]; // Bad idea to overwrite storedVars\r\n curVars++;\r\n }\r\n\r\n\r\n\tfunction jsonBlob2JsonArray(aJsonBlob) {\r\n\r\n\t\tvar aryJson = new Array();\r\n\t\tvar start = aJsonBlob.indexOf('{');\r\n\t\tvar end = aJsonBlob.indexOf('}');\r\n\t\tvar idx = 0;\r\n\t\twhile (start > -1) {\r\n\r\n\t\t\taryJson[idx] = JSON.parse(aJsonBlob.substring(start, end+1));\r\n\r\n\t\t\tstart = aJsonBlob.indexOf('{', (start+1));\r\n\t\t\tend = aJsonBlob.indexOf('}', (end+1));\r\n\r\n\t\t\tidx++;\r\n\r\n\t\t}\r\n\r\n\t\treturn aryJson;\r\n\t}\r\n}", "readInFile() {\n //Goes through the json files and populate the pokemon list\n for (var i = 0; i < pokemon.length; ++i) {\n var currentPokemon = pokemon[i];\n\n var id = currentPokemon.id\n var name = currentPokemon.name;\n var type = currentPokemon.type;\n var species = currentPokemon.species;\n var height = currentPokemon.height;\n var weight = currentPokemon.weight;\n var abilities = currentPokemon.abilities;\n var stats = currentPokemon.stats;\n var desc = currentPokemon.desc;\n\n var newPokemon = new Pokemon(id, name, type, species, height, weight, abilities, stats);\n newPokemon.setDesc(desc);\n this.fullList.push(newPokemon);\n }\n }", "function readJSON ( filename, callback ) {\n\tfs.readFile ( filename , function ( err , filedata ) {\n\t\tif (err) {\n\t\t\tconsole.log( \"We have a problem broski :\" + err )\n\t\t}\n\t\tconsole.log(countryname)\n\t\tvar jsondata = JSON.parse( filedata )\n\n\t\tjsondata.forEach( function ( country ) {\n\t\t\tif ( country.name == countryname ) {\n// possibly client wants to output all the info from a country?\n\t\tconsole.log( \"Country: \" + country.name )\n\t\tconsole.log( \"Top Level Domain: \" + country.topLevelDomain ) // tld field is an array and may contain more tld's\n\t}\n})\n\t})\n}", "async function handleFiles() {\r\n try {\r\n let fileList = this.files;\r\n let fileArray = [];\r\n let result = {};\r\n for await (const file of fileList) {\r\n const fileContents = await readUploadedFileAsText(file) \r\n jsonContent = JSON.parse(fileContents);\r\n fileArray.push(jsonContent);\r\n }\r\n for (let i = 0; i < fileArray.length; i++) {\r\n result = deepMergeJson(result, fileArray[i]);\r\n }\r\n exportToJsonFile(result);\r\n } catch (error) {\r\n console.warn(error.message)\r\n }\r\n}", "function readJSON(file, response) {\n if (file.mimetype !== 'application/json') {\n response.render('error', { error: 'Wrong file format' })\n return;\n }\n\n let dataObj = JSON.parse(file.buffer.toString());\n\n // Check if dataObj contains operations\n if (!dataObj.operations || !dataObj.operations.length) {\n response.render('error', { error: 'Wrong data structure' })\n return;\n }\n\n let result = 0;\n\n for (operation of dataObj.operations) {\n // Check if operation contains all required field\n if (!operation.name || !operation.arg1 || !operation.arg2) {\n response.render('error', { error: 'Wrong data structure' })\n return;\n }\n\n // Check if agr1 is valid\n if (operation.arg1 !== 'result' && isNaN(operation.arg1)) {\n response.render('error', { error: 'Wrong data structure' })\n return;\n }\n\n // Check if agr2 is valid\n if (operation.arg2 !== 'result' && isNaN(operation.arg2)) {\n response.render('error', { error: 'Wrong data structure' })\n return;\n }\n\n let arg1 = operation.arg1 === 'result' ? result : operation.arg1;\n let arg2 = operation.arg2 === 'result' ? result : operation.arg2;\n\n switch (operation.name) {\n case 'add':\n result = arg1 + arg2;\n break;\n case 'subtract':\n result = arg1 - arg2;\n break;\n case 'multiply':\n result = arg1 * arg2;\n break;\n case 'divide':\n result = arg1 / arg2;\n break;\n default:\n response.render('error', { error: 'Wrong data structure' })\n return;\n }\n }\n\n response.render('result', { result: result })\n return;\n}", "function loadJSON(fileUrl) {\n // Declare our xhr object\n const xhr = new XMLHttpRequest();\n // Set up the callback for our successful request\n xhr.onload = function() {\n // Parse the JSON\n arry = JSON.parse(xhr.responseText);\n console.log(arry);\n renderAll(arry);\n };\n // Open the request\n xhr.open('GET', fileUrl, true);\n // Send the request\n xhr.send();\n}", "function readFile() {\n let data = file.readFileSync(\"accounts.json\");\n if (data.length === 0)\n return;\n let parsedData = JSON.parse(data.toString())[\"users\"];\n for (let i = 0; i < parsedData.length; i++) {\n accounts.push(parsedData[i]);\n }\n}", "static getAll(cb) {\n fs.readFile(p, (err, data) => {\n let activities = [];\n if (!err) {\n activities = JSON.parse(data);\n }\n // callback function when the data is ready\n cb(activities);\n });\n }", "function readFile() {\n const fs = require(\"fs\");\n fs.readFile(\"src/database.json\", \"utf8\", (err, jsonString) => {\n //error checkign to make sure that the database is read correctly\n if (err) {\n //This line will print if an error occurs\n console.log(\"Error reading file from disk:\", err);\n return;\n }\n // the try catch method is used as an error prevention method. The code\n // in the 'try' section is run and if errors occur then the 'catch'\n // code is run\n try {\n // create an array of objects which will be each country\n var countries = JSON.parse(jsonString);\n //loop through each country\n countries.forEach(function (country) {\n //------------------------------------------------------------------------\n // TASK 2 and 3\n // you may want to create a seperate function and simply call that function here\n //------------------------------------------------------------------------\n });\n } catch (err) {\n console.log(\"Error parsing JSON string:\", err);\n }\n });\n}", "function loadActivities(){\n var activitiesJSONified = JSON.parse(Activities); //read the JSON file\n for (var i=0; i<activitiesJSONified.length; i++){\n activityBucket.push(new Activity( //process contents through object constructor and push to array.\n activitiesJSONified[i].title,\n activitiesJSONified[i].image,\n activitiesJSONified[i].shortContent\n ));\n }\n}", "parseFile(file) {\n\n var content = this.lire(file);\n\n var lines = content.split(/\\r?\\n/);\n\n //string that contains keys\n var header = lines[0];\n\n //array containing data separate with \";\"\n var dataLines = lines.slice(1);\n\n // data = dataLines.map(this.parser);\n\n var data = this.jsonifydata(header,dataLines);\n\n console.log(data);\n\n }", "function ParseJSON() {\n // console.log(scheduleList[1]);\n for (var i = 0, length = scheduleList.length; i < length; i++) {\n //This loop will read through all of the elements of an array\n var scheduleFile = fs.readFileSync('./schedule/' + scheduleList[i] + '', 'utf-8');\n var json = checkJSON(scheduleFile);\n if (json != undefined) {\n playlist = json;\n }\n }\n}", "static getAllItems(path) {\r\n try {\r\n return JSON.parse(fs.readFileSync(`${path}`));\r\n } catch (err) {\r\n console.error(err);\r\n process.exit(1);\r\n }\r\n }", "function loadFromJSON(json, CMIElement) {\n if (!_self.isNotInitialized()) {\n console.error(\"loadFromJSON can only be called before the call to Initialize.\");\n return;\n }\n\n CMIElement = CMIElement || \"cmi\";\n\n for (var key in json) {\n if (json.hasOwnProperty(key) && json[key]) {\n var currentCMIElement = CMIElement + \".\" + key;\n var value = json[key];\n\n if (value[\"childArray\"]) {\n for (var i = 0; i < value[\"childArray\"].length; i++) {\n _self.loadFromJSON(value[\"childArray\"][i], currentCMIElement + \".\" + i);\n }\n } else if (value.constructor === Object) {\n _self.loadFromJSON(value, currentCMIElement);\n } else {\n setCMIValue(currentCMIElement, value);\n }\n }\n }\n }", "function readJSONfile() {\n let archivo = fs.readFileSync(\n path.join(__dirname, \"..\") + \"/data/users.json\"\n );\n let usuarios = JSON.parse(archivo);\n return usuarios;\n}", "function read_parse_json_files(json_files, zlib_comp){\n // reads a list of files that contain the json\n // data structure. The files can be compressed\n // using zlib compression. Very large files can\n // be split into chunks to be consolidated back into\n // a single structure.\n if ( json_files.length == 1 ){\n\tjson = read_parse_json_file(json_files[0], zlib_comp);\n } else {\n\tvar json_arr = new Array(json_files.length);\n\tfor (var i_js=0; i_js < json_files.length; i_js++){\n\t json_arr[i_js] = read_parse_json_file(json_files[i_js], zlib_comp);\n\t};\n\tvar json = json_arr[json_arr.length-1];\n\tconsolidate_json(json, json_arr);\n };\n return json;\n}", "function read_json(fname) {\n\t\t\tconsole.log(\"in read_json\");\n\t\t\t$.getJSON(fname, function(data) {\n\t\t\t\tconsole.log(\"returned from read_json to execute function\");\n\t\t\t\tsurface.renderSurface(data);\n\t\t\t});\t\t\t\n\t\t}", "function fillJson() {\n var onSuccess = function (data) {\n jsonElements = data.elements;\n };\n $.getJSON(\"assets/table.json\", onSuccess);\n}", "function AbrirArchivo(files){\nvar file = files[0];\nvar reader = new FileReader();\nreader.onload = function(event){\n contents = event.target.result;\n var json = JSON.parse(contents);\n var count = Object.keys(json.valores).length;\n for (let index = 0; index < count; index++) {\n lista.insert(json.valores[index]); \n }\n graficar();\n};\nreader.onerror = function(event) {\n console.error(\"File could not be read! Code \" + event.target.error.code);\n};\nreader.readAsText(file);\n}", "function getUsers(){\r\n fetch('data.json')\r\n .then((res) => res.json())\r\n .then((data)=>{\r\n data.forEach((color) => {\r\n \r\n items.push(color); \r\n });\r\n\r\n })\r\n }", "function forLoop(data){\n\tfor(var i = 0; i<data.length;++i){\nconsole.log(data[i].username);\n\t}\n}", "function populateMonsterList(json) {\n for (monster of json) {\n renderSingleMonster(monster);\n }\n}", "function load() {\n loadJSONfromServer()\n .then(function (result) {\n console.log('Laden erfolgreich!', result);\n myJSON = JSON.parse(result);\n for (let i = 0; i < myJSON.length; i++) {\n docsList[i] = myJSON[i];\n }\n displayDocsImages();\n Profiles();\n })\n .catch(function (error) {\n console.error('Fehler beim laden!', error);\n });\n}", "function processFilesJSON(data, basePath, depth = 20, relativePath = \"\", outList = []) {\n relativePath = FtpFile.appendSlash(relativePath);\n\n if (depth == 0) {\n console.log(\"Maximum file depth reached, exiting\", relativePath);\n return;\n }\n for (let file of data) {\n if (file.type == FTP_TYPE_FILE) {\n console.log(relativePath + file.name);\n let fileObj = new FtpFile(basePath, relativePath, file);\n outList.push(fileObj);\n } else if (file.type == FTP_TYPE_DIRECTORY) {\n if (typeof file.children == 'object') {\n const newPath = relativePath + file.name;\n processFilesJSON(file.children, basePath, depth - 1, newPath, outList);\n }\n }\n }\n\n return outList;\n}", "function iterate() {\n cursor.read(1000, (err, rows) => {\n if (err) return cb(err);\n\n if (!rows.length) {\n done();\n return cb();\n }\n\n for (let row of rows) {\n if (turf.lineDistance(row.geom) < 0.001) continue;\n\n row.name = row.name.filter(name => {\n if (!name.display) return false;\n return true;\n });\n\n if (!row.name.length) continue;\n\n let feat = {\n type: 'Feature',\n properties: {\n 'carmen:text': row.name,\n 'carmen:rangetype': 'tiger',\n 'carmen:parityl': [[]],\n 'carmen:parityr': [[]],\n 'carmen:lfromhn': [[]],\n 'carmen:rfromhn': [[]],\n 'carmen:ltohn': [[]],\n 'carmen:rtohn': [[]]\n },\n geometry: {\n type: 'GeometryCollection',\n geometries: [\n row.geom\n ]\n }\n };\n\n if (self.opts.country) feat.properties['carmen:geocoder_stack'] = self.opts.country;\n\n feat = self.post.feat(feat);\n if (feat) self.output.write(JSON.stringify(feat) + '\\n');\n }\n\n return iterate();\n });\n }", "function read() {\n for (var tableName in tables) {\n try {\n var json = fs.readFileSync('./old/' + tableName + '.json', 'utf8')\n tables[tableName] = JSON.parse(json)\n } catch (e) {\n console.error('Could not read or parse ./old/' + tableName + ', skipping')\n }\n }\n}", "function initData(){\n fetch('./FishEyeData.json')\n .then(res => res.json())\n .then( function (datas) {\n for( data of datas.photographers){\n allPhotographers.push(data);\n }\n }) \n .catch(error => alert (\"Erreur : \" + error));\n}", "function traerDatos(){\r\n\t\tconst xhttp = new XMLHttpRequest();\r\n\t\txhttp.open('GET','datos.json',true);\r\n\t\txhttp.send();\r\n\t\t xhttp.onreadystatechange = function(){ \t\r\n\t\t\tif(this.readyState == 4 && this.status ==200){\r\n\t\t\t\tdatos = JSON.parse(this.responseText);\r\n\t\t\t}\r\n\t\t }\r\n\t}", "function loadFromJSON(json, CMIElement) {\n if (!_self.isNotInitialized()) {\n console.error(\"loadFromJSON can only be called before the call to LMSInitialize.\");\n return;\n }\n\n CMIElement = CMIElement || \"cmi\";\n\n for (var key in json) {\n if (json.hasOwnProperty(key) && json[key]) {\n var currentCMIElement = CMIElement + \".\" + key;\n var value = json[key];\n\n if (value[\"childArray\"]) {\n for (var i = 0; i < value[\"childArray\"].length; i++) {\n _self.loadFromJSON(value[\"childArray\"][i], currentCMIElement + \".\" + i);\n }\n } else if (value.constructor === Object) {\n _self.loadFromJSON(value, currentCMIElement);\n } else {\n setCMIValue(currentCMIElement, value);\n }\n }\n }\n }", "async getAbi(_AbiFileName){\n let result = [];\n try {\n const response = await fetch(_AbiFileName);\n if (response.ok) {\n const jsonResponse = await response.json();\n console.log('JSON parsed successfully...');\n for(var i in jsonResponse){\n result.push(jsonResponse[i]);\n }\n return result;\n }\n\n } catch(error) {\n console.log(error);\n }\n }", "function getJSONfiles() {\n let urlStudents = \"https://petlatkea.dk/2021/hogwarts/students.json\";\n let urlFamilies = \"https://petlatkea.dk/2021/hogwarts/families.json\";\n\n function loadJSON() {\n fetch(urlStudents)\n .then((response) => response.json())\n .then((jsonData) => {\n prepareObjects(jsonData);\n });\n }\n fetch(urlFamilies)\n .then((response) => response.json())\n .then((jsonData) => {\n bloodInfo = jsonData;\n loadJSON();\n });\n}", "function loadFile (filePath) {\n\tconsole.log(\"start!\");\n\tfileOpen.jsonFileOpen (filePath, function(parsedJSON, fd) {\n\t\t\n\t\tvar fileArray = parsedJSON;\n\t\tfileFD = fd;\t\n\t\t\n\t\tfs.close(fileFD, function doneWriting (err){\n if (err) {console.log (err);}\n console.log(\"initial file closed\");\n\t\t\t\n\t\t\t\n\t\t\ttraverseArray (fileArray); //go over each document/object in the array\n\t\t});\n\t});\n}", "readData(){\n try{\n this.myData= JSON.parse(fs.readFileSync('all.json').toString())\n if(!Array.isArray(this.myData)) throw new Error ('') \n }\n catch(e){\n this.myData=[]\n }\n}", "function loadJSON() {\r\n $.getJSON(/nodeshift/, function (data) {\r\n glob_data = data;\r\n });\r\n }", "function importFile(keyWord){\n let URL= \"../acme/js/acme.json\";\n fetch (URL)\n .then(response => response.json())\n .then(function (data) {\n console.log('Json object from getCode function:');\n console.log(data);\n const acmeInfo ={}; //Create and empty object\n \n let x;\n for (x in data){\n acmeInfo[x+\"Name\"]= data[x].name;\n acmeInfo[x+\"Path\"]= data[x].path;\n acmeInfo[x+\"Description\"]= data[x].description;\n acmeInfo[x+\"Manufacturer\"]= data[x].manufacturer;\n acmeInfo[x+\"Price\"]= data[x].price;\n acmeInfo[x+\"Reviews\"]=data[x].reviews;\n }\n\n buildContent(acmeInfo, keyWord);\n console.log(acmeInfo);\n\n })\n .catch(error => console.log('There was a getCode error: ', error))\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}", "async function loadJSON(){\n try {\n let url = document.location.pathname.replace('index','items').replace('html','json')\n if(document.location.href.startsWith('file')){\n console.log('what');\n url = \"file://\"+url\n }\n \n itemsPortfolio = filterByQueryCategory(globalItems)\n console.log(itemsPortfolio);\n itemsPortfolio = filterByQuery(itemsPortfolio);\n currentPage = 0\n let itemsPaginated = paginatorItem(itemsPortfolio);\n buildItems(itemsPaginated)\n } catch (error) {\n console.error('errrr ',JSON.stringify(error), error.message)\n }\n}", "getItems() {\n this.axios.get(this.sourceUrl).then((response) => {\n\n // Load HTML\n if (response.status === 200) {\n const html = response.data,\n $ = this.cheerio.load(html);\n let items = [];\n let counter = 0;\n\n // Search HTML and collect values\n $('.headlines_content ul').first().find('li').each((i, element) => {\n\n // Create item object\n items[i] = {\n id: '',\n title: $(element).children('a').text().trim(),\n url: $(element).children('a').attr('href').trim(),\n date: '',\n author: '',\n image: {\n url: '',\n alt: ''\n },\n content: ''\n }\n\n // Get single item content\n this.getItemContent(items[i].url).then((response) => {\n items[i].id = Date.now();\n items[i].date = response.date;\n items[i].image = {\n url: response.image.url,\n alt: response.image.alt\n };\n items[i].content = response.content;\n\n // Increment counter\n counter++;\n console.log(this.chalk.yellow(`Scraping item ${counter}`));\n\n // Save to JSON file when counter is equal to items array\n if (counter == items.length) {\n console.log('\\n');\n // Save items to JSON file\n this.saveJson(items);\n }\n\n });\n\n });\n\n }\n\n }, (error) => this.errorHandler(error));\n }", "loadJsonData() {\n }", "function try2(){\n user= new XMLHttpRequest();\n user.open('GET','users.json',true)\n user.onload=function(){\n if (this.status=200) {\n var u=JSON.parse(this.responseText)\n console.log(u)\n outptut='<h1></h1>'\n u.forEach(function(q){\n outptut+=`\n <li>${q.id}</li>\n <li>${q.name}</li>\n <li>${q.email}</li>\n\n\n\n\n\n `;\n if (q.id==1) {\n\n console.log('hii',q.name)\n }\n }\n\n )\n\n document.getElementById('one').innerHTML=outptut;\n }\n\n }\n user.send()\n}", "function jsonlStreamForEach( ins, fn ) {\n return lineParser( ins, async ( line ) => {\n if( line.length > 0 ) {\n await fn( JSON.parse( line ) );\n }\n });\n}", "function addCustomers(){\n const xhr = new XMLHttpRequest();\n xhr.open(\"GET\",\"customers.json\",true);\n /*expecting JSON in the response,so setting the responseType will convert the json data into a native object and place it in the xhr.response property*/\n xhr.responseType = \"json\";\n xhr.send();\n xhr.onload = function(){\n if (xhr.status == 200) {\n const customers = this.response; //<--passing the array of objects\n customers.forEach(function(customer){ //<--customer is the current obj\n loadDOM(customer);\n });\n }\n }\n}", "function readJson(name, posX, posY, subName, color, money, op, amnt) {\n fs.readFile('asd/map.json', function(err, data){\n if (err) throw err;\n map = JSON.parse(data);\n console.log(map);\n modJson(name, posX, posY, subName, color, money, op, amnt);\n });\n}", "function loadEmployees() {\n const xhr = new XMLHttpRequest();\n\n // open connection\n xhr.open('GET', 'employees.json', true);\n\n xhr.onreadystatechange = function () {\n if (this.status === 200 && this.readyState === 4) {\n\n const employees = JSON.parse(this.responseText);\n\n let outPut = ``;\n employees.forEach(function (employee) {\n outPut += `\n <ul>\n <li>ID: ${employee.id}</li>\n <li>Name: ${employee.name}</li>\n <li>Company: ${employee.company}</li>\n <li>Job: ${employee.job}</li> \n </ul>\n `;\n\n });\n\n\n document.getElementById('employees').innerHTML = outPut;\n }\n }\n\n xhr.send();\n}", "async loopFunction(iterate) {\n \t\tlet results = [];\n \t\twhile (true) {\n let result = await iterate.next();\n if (result.value && result.value.value.toString()) {\n \t\t\t\tresults.push(JSON.parse(result.value.value.toString('utf8')));\n }\n if (result.done) {\n \t\t\t\tawait iterate.close();\n return results;\n }\n }\n \t}", "async load(obj) {\n console.log(\"loadGardenJSON\");\n var gtool = this.gtool;\n var inst = this;\n if (obj.flowers) {\n obj.flowers.forEach(flower => {\n console.log(\"flower:\", flower);\n gtool.addFlower(flower);\n });\n }\n if (obj.pictures) {\n obj.pictures.forEach(pic => {\n gtool.addPic(pic);\n });\n }\n if (obj.items) {\n obj.items.forEach(item => {\n gtool.addItem(item);\n });\n }\n }", "function load_objs() {\n\n const OBJFILES = Object.values(json_data[2].files);\n\n // fix paths\n for (var i in OBJFILES)\n OBJFILES[i] = 'scripts/data/' + OBJFILES[i];\n\n (function next(i=0) {\n if (i < OBJFILES.length) {\n var script = document.createElement('script');\n script.addEventListener('load', function tmp() {\n next(++i);\n script.removeEventListener('load', tmp);\n });\n script.setAttribute(\"type\",\"text/javascript\");\n script.setAttribute('src', OBJFILES[i]);\n document.head.appendChild(script);\n } else\n console.log(\"Objects loaded.\");\n DATA.LOADED = true;\n }) ();\n}", "function parseJSON () {\n var process = new Process (packagesfile);\n packages = process.parse ();\n packages = packages.packages;\n }", "function load_printer_json(filename, callback) {\n\tfs.readFile(filename, function (err, data) {\n\t if (err) {\n\t\tconsole.log('Error: ' + err);\n\t\treturn;\n\t }\n\t \n\t\tdata = JSON.parse(data);\n\t\tvar count = 0;\n\t\tfor (var i = 0; i < data.registry.length; i++) {\n\t\t\tvar reg = data.registry[i];\n\t\t\tvar Winreg = require('winreg')\n\t\t\t, registry = new Winreg({\n\t\t\t\t hive: reg.hive,\n\t\t\t\t key: reg.key\n\t\t\t\t})\n\t\t\tlog(\"HIVE : \" + reg.hive + \" KEY : \" + reg.key + \" NAME : \" + reg.name + \" TYPE \" + reg.type);\n\t\t\tregistry.set(reg.name, reg.type, reg.value, function (err) {\n\t\t\t\tif (err) {\n\t\t\t\t\tconsole.log('Error: ' + err);\n\t\t\t\t}\n\t\t\t\t//if all change has return success, call callback\n\t\t\t\t++count;\n\t\t\t\tif (count == data.registry.length) {\n\t\t\t\t\tlog(\"I print\");\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t\n\t});\n\n }", "function getKhJSONDetails() {\r\n var khGames = [];\r\n\r\n $.getJSON(\"kh-details.json\", function(json) {\r\n $.each(json, function(key, value) { // Foreach loop\r\n khGames.push(value); //Add to games array\r\n });\r\n });\r\n\r\n return khGames;\r\n}", "function cargarJSON() {\n // FetchAPI usando Promises\n fetch( 'empleados.json' ) // Se conecta a los datos\n .then( response => response .json() ) // Recibe la respuesta\n .then( data => { // Coloca los datos obtenidos en el DOM\n let html = '<ul>'; // Crea un \"Template\"\n\n console .log( data );\n\n // Recorre el 'Array' de objetos empleado\n data .forEach( empleado => {\n // Agrega los datos al Template\n html += `\n <li>${ empleado .nombre } - <b> ${ empleado .puesto } </b></li>\n `;\n });\n\n html += '</ul>';\n document .getElementById( 'resultado' ) .innerHTML = html; // Coloca los datos obtenidos en el DOM\n\n }) .catch( error => console .log( 'ERROR', error ) ); // Captura los ERRORES\n}", "function jsonData() {\n getJSONP(jsonLink, function(data) {\n fillList(data);\n });\n}", "function parseFile(file_data){\n let s = ''\n let read = false\n // find the index correspondding to the start of the json data\n for (i in file_data){\n if (file_data[i] == '{') {\n read = true\n }\n\n if (read) {\n s+=file_data[i]\n }\n }\n return s\n }", "async read_resources(file_path) {\n try {\n const file_json = await this.kubectl(`apply -f ${file_path} --dry-run='client' -o json`);\n const resources = JSON.parse(file_json);\n return resources.items;\n } catch (err) {\n console.error(`failed to load noobaa resources from ${file_path}. error:`, err);\n throw err;\n }\n }", "function getJson(){\n fetch('posts.json')\n .then(res => res.json())\n .then(data => {\n\n console.log(data);\n let output = '';\n data.forEach(function(post){\n\n output += `<li>${post.title}</li>`\n });\n document.getElementById('output').innerHTML = output;\n \n\n })\n .catch(err => console.log(err));\n\n}", "function jsonTransform() {\n\tconsole.log(\"in json function\");\n\t$.getJSON(\"ajax/WagPregeo.json\",function(data) {\n\t\t$.each(data,function(key, val) {\t\n\t\t\taddressArray.push({id: val.id, name: val.name,addresseng: val.addresseng, addresscn: val.addresscn});\n\t\t});\n\t\tinitializeGeo();\t\n\t});\n}", "function scrapeJson() {\n var scriptTags = document.body.querySelectorAll(FUNDME_JSON_SELECTOR);\n var pointers = [];\n\n if (scriptTags.length) {\n scriptTags.forEach(function (json) {\n pointers = parseScriptJson(json);\n });\n }\n\n return pointers;\n }", "function handleFileSelect(evt) {\n var json = ''; // variable para almacenar los datos del archivo cargao\n var files = evt.target.files; // FileList objeto para la lectura del archivo\n for (var i = 0, f; f = files[i]; i++) { // Número de iteraciones para nuestro objeto input file\n var reader = new FileReader();\n reader.onload = (function (theFile) {\n return function (e) {\n try {\n json = JSON.parse(e.target.result);\n fnOrderArray(json);\n } catch (ex) {\n alert('Ocurrio un problema: ' + ex);\n }\n }\n })(f);\n reader.readAsText(f);\n }\n}", "function readUsers()\n{\n return require(\"./users.json\").allUsers;\n}", "loadCards(){\n let cards = require(\"C:\\\\Users\\\\Tony\\\\Desktop\\\\Programming\\\\Yugiosu\\\\Yugiosu - Python (Discord)\\\\yugiosu discord bot\\\\cogs\\\\Yugiosu\\\\cards.json\");\n for(let card of cards){\n this.cards[card[\"id\"]] = new Card(card['id'], card[\"name\"], card[\"cardtype\"], card[\"copies\"], card[\"description\"], card[\"properties\"]);\n }\n }", "forEach(f) {\n this.content.forEach(f);\n }", "function getJson() {\n fetch(\"sources.json\")\n .then(response => response.json())\n .then(jsonDATA => {\n\n allTruths = jsonDATA;\n\n console.log(\"Non manipulation Json DATA: \",allTruths);\n \n createPrototype(allTruths);\n\n });\n}", "function loadAllJSON(list, func) {\n\tconst promises = [];\n\tlist.forEach(data => promises.push(loadJSON(data, func)));\n\treturn Promise.all(promises);\n}", "constructor() {\n this.templates = this.readJSONFile((err, data) => {\n if (err) {\n console.log(\"Data not loaded: \\n \" + err);\n } else {\n this.templates = data;\n }\n });\n }", "function setJsonData() {\n\tvar files = ['dayclub','nightclub','service'];\n\n\t$.each(files, function(index, value) {\n \t\tconsole.log( value );\n\n\t\t$.getJSON('data/'+ value +'.json', function(json) {\n\t\t\tlocalStorage.setItem(value+'-data', JSON.stringify(json));\n\t\t\tvar retrievedObject = localStorage.getItem(value+'-data');\n\t\t\tconsole.log('retrievedObject: '+ value, JSON.parse(retrievedObject));\n\t\t});\n\t});\n}", "function loadJson() {\n let file_loader = new THREE.FileLoader();\n file_loader.load(jsonPath,\n function (data) {\n font_json = JSON.parse(data);\n loadImg();\n })\n }", "static getAll(cb) {\n fs.readFile(p, (err, data) => {\n let todos = [];\n if (!err) {\n todos = JSON.parse(data);\n }\n // callback function when the data is ready\n cb(todos);\n });\n }", "function getJson() {\n fetch(\"posts.json\")\n .then(function (res) {\n return res.json();\n })\n .then(function (data) {\n console.log(data);\n let output = \"\";\n data.forEach(function (post) {\n output += `<li>${post.title} <br> &nbsp; &nbsp; ${post.body} </li>`;\n });\n document.getElementById(\"output\").innerHTML = output;\n })\n .catch(function (err) {\n console.log(err);\n });\n}", "function traverse(o) {\n for (var i in o) {\n console.log(o[i]);\n cardGenerate(o[i].name, o[i].id, o[i].rating, o[i].link);\n }\n}", "function iterate(obj, jsonArr) {\n for(var key in obj) {\n var elem = obj[key];\n\n if(typeof elem === \"object\") {\n iterate(elem, jsonArr); // call recursively\n }\n else{\n if(!patt.test(key.toString())){\n if(elem == undefined)\n jsonArr.push({\"key\":key.toString(),\"text\":null});\n else\n {\n if($.trim(elem) != \"\")\n jsonArr.push({\"key\":key.toString(),\"text\":elem});\n }\n }\n }\n }\n}", "loadJson() {\n return readFile(this.jsonPath, { encoding: 'utf8' }).then((jsonText) => {\n this.jsonText = jsonText;\n return (this.jsonData = JSON.parse(jsonText));\n });\n }", "function autoFillData() {\n\t\t// Retrieve JSON OBJECT from json.js //\n\t\t// Store the JSON OBJECT to local storage //\n\t\tfor(var n in json) {\n\t\tvar id = Math.floor(Math.random()*10001);\n\t\tlocalStorage.setItem(id, JSON.stringify(json[n]));\n\t\t}\n\t}", "function getJsonData() {\n //Store JSON Object into Local Storage.\n for (var n in json) {\n var id = Math.floor(Math.random()*10000001);\n localStorage.setItem(id, JSON.stringify(json[n]));\n }\n }", "function doit(files){\n// console.log(pattern);\n var element={};\n var img={};\n var obj=[];\n var images=[];\n var err='';\n var codice='';\n for (var i=0; i<files.length; i++) { \n if (i==0){\n codice=files[i];\n codice=codice.replace('./img/items/','');\n codice=codice.substring(0,14);\n // console.log(codice);\n }\n img={\"thumbnails\":files[i]};\n images[i]=img;\n }\n \n element.id = codice;\n element.images = images;\n obj=element;\n console.log(obj);\n \n \n// console.log(obj);\n // If the `nonull` option is set, and nothing\n // was found, then files is [\"**/*.js\"] \n // er is an error object or null.\n// console.log(files);\nvar jsonString = JSON.stringify(obj);\nfs.stat('test_dir.json', function(err, stat) {\nif(err == null) {\n fs.appendFile(\"./data/img.json\", \",\"+jsonString+\"\\n\", function(err) {\n if(err) {\n return console.log(err);\n }\n });\n\n } else if(err.code == 'ENOENT') {\n fs.writeFile(\"./data/img.json\", jsonString, function(err) {\n if(err) {\n return console.log(err);\n }\n });\n } else {\n console.log('Some other error: ', err.code);\n }\n});\n\n\n}", "read() {\n return JSON.parse(\n new File(this.path).read()\n );\n }", "function readJsonFile(data) {\n //console.log(this.result);\n var obj = JSON.parse(data);\n\n // dictionary of symbols containing the breakouts for each symbol\n patternJsonData = obj[1];\n\n // Breakouts list\n var breakoutsList = obj[0];\n breakoutsList.sort(function (a, b) {\n return parseInt(b[1]) - parseInt(a[1]);\n });\n\n var patternBreakouts = [];\n for (var i = 0; i < breakoutsList.length; i++) {\n var breakout = breakoutsList[i];\n var pb = new PatternBreakouts(breakout[0], breakout[1]); // symbol, date\n patternBreakouts.push(pb);\n }\n\n return patternBreakouts;\n}", "function loadJSON(file, callback) {\n var xobj = new XMLHttpRequest();\n xobj.overrideMimeType(\"application/json\");\n xobj.open('GET', 'https://www.mocky.io/v2/5da9b4023100000e004e0b21', true);\n xobj.onreadystatechange = function() {\n if (xobj.readyState == 4 && xobj.status == \"200\") {\n callback(xobj.responseText);\n }\n };\n xobj.send(null);\n }", "function gotData() {\n try {\n allDataGotten = JSON.parse(fs.readFileSync(\"out.json\"));\n if ((allDataGotten == undefined) || (JSON.stringify(allDataGotten).includes('\"message\":\"useragent mismatch\",\"status\":\"fail\"'))) {\n console.log(\"unsuccessful - incorrect keys\");\n process.exit(1);\n }\n console.log(\"-> Successful folloowers\");\n } catch (e) {\n console.error(\"UNSUCCESSFUL - got html\");\n process.exit(1);\n }\n\n users = allDataGotten.users;\n console.log(\"-> Example - \", users[5].username)\n writeToFile();\n}", "function autoFillData() {\n //the actual JSON obj data required for this to work is coming for our json.js file which is loaded from out HTML\n //Store the JSON obj into local storage\n for(var n in json){\n var id = Math.floor(Math.random()*1000001);\n localStorage.setItem(id, JSON.stringify(json[n]));\n }\n }", "function iterate() {\n cursor.read(1000, (err, rows) => {\n if (err) return cb(err);\n\n if (!rows.length) {\n done();\n return cb();\n }\n\n rows.forEach((row) => {\n if (!row.name.some(name => { return name.display.trim().length })) return;\n\n let feat = {\n type: 'Feature',\n properties: {\n 'carmen:text': row.name,\n 'carmen:addressnumber': []\n },\n geometry: {\n type: 'GeometryCollection',\n geometries: [{\n type: 'MultiPoint',\n coordinates: []\n }]\n }\n };\n\n const units = new Units();\n\n row.geom.coordinates.forEach((coord) => {\n let num = units.decode(coord.pop());\n\n if (!num || !num.output) return;\n\n feat.properties['carmen:addressnumber'].push(num.num);\n feat.geometry.geometries[0].coordinates.push(coord);\n });\n\n if (feat.geometry.geometries[0].coordinates.length) {\n feat.properties['carmen:addressnumber'] = [ feat.properties['carmen:addressnumber'] ];\n\n if (self.opts.country) feat.properties['carmen:geocoder_stack'] = self.opts.country;\n feat = self.post.feat(feat);\n\n if (feat) self.output.write(JSON.stringify(feat) + '\\n');\n }\n });\n\n return iterate();\n });\n }", "function defaultpage(){\r\n document.getElementById(\"defaultOpen\").click();\r\n/* fetch('sample.json')\r\n.then((res) => res.json())\r\n.then((data) => {\r\n // console.log(data.Station[0]._id);\r\n //});\r\n let output = `<h2>Users<h2>`\r\n Object.keys(data).forEach(function(key){\r\n output+= `<ul><li>\r\n Region: ${key._id}</li></ul>` ;\r\n console.log(data[key]);\r\n +\\ \r\n });*/\r\n}", "function readJSONFromFile(){\n console.log(\"--> OPEN file\");\n fs.readFile('output.geojson', 'utf8', function (err, data) {\n if (err) throw err;\n console.log(data);\n obj = JSON.parse(data);\n console.log(obj.features[0].properties[\"Latest measurement\"]);\n });\n}", "function parse() {\n\t\n\tvar req = new XMLHttpRequest();\n\treq.open(\"GET\", \"data.json\", true);\t\n\treq.send();\t\n\treq.onreadystatechange = function() {\n\t\t\n\t\tif (req.readyState == 4 && req.status == 200) { \n\t\t\tparsedData = JSON.parse(req.responseText);\n\t\t\t\n\t\t\telem = document.getElementById(\"messages\");\n\t\t\tfor (var i = 0; i < 2; i++ ) {\n\t\t\t\telem.innerHTML += \"<p>\" + parsedData[i][\"username\"] + \": \" + parsedData[i][\"content\"] + \"</p>\";\n\t\t\t}\n\t\t}\n\t}\n}", "function getJson() {\n fetch('post.json')\n .then(function (response) {\n return response.json();\n })\n .then(function (data) {\n console.log(data);\n let op = '';\n data.forEach(function (post) {\n op+= `<li>${post.title}</li>`\n });\n document.getElementById('output').innerHTML = op;\n })\n .catch(function (err) {\n console.log(err);\n });\n}", "function iterateFile( file, enc, callback ){\r\n outputFile = outputFile || file;\r\n var fileName = parseFileName(file),\r\n path = files; // path.relative(file.base, file.path);\r\n\r\n filePathArr = fileName.split('\\\\');\r\n\r\n filePathArr.forEach((v, i) => {\r\n // last part is the file name itself and not a path\r\n if( i == filePathArr.length - 1 )\r\n path[v] = parseFileContent(file);\r\n else if( v in path )\r\n path = path[v];\r\n else\r\n path = path[v] = {};\r\n })\r\n\r\n callback();\r\n}", "function getJson(){\n fetch('posts.json')\n .then(res => res.json())\n .then(data =>{\n console.log(data);\n let output = '';\n data.forEach(function(post){\n output += `<li>${post.title}</li>`;\n });\n document.getElementById('output').innerHTML = output;\n })\n .catch(err => console.log(err));\n}" ]
[ "0.64651614", "0.6391489", "0.606283", "0.5993646", "0.5979594", "0.5844648", "0.57586014", "0.5753392", "0.57514536", "0.5745576", "0.5735031", "0.5718338", "0.5716168", "0.57099473", "0.5670515", "0.56516135", "0.56331366", "0.5625763", "0.56168103", "0.5610128", "0.5606457", "0.55682945", "0.55638146", "0.55146635", "0.54938877", "0.54889774", "0.5473021", "0.5446471", "0.54260284", "0.5425186", "0.5418257", "0.54176503", "0.5415848", "0.5410057", "0.53620666", "0.5346493", "0.5339593", "0.5315593", "0.53078353", "0.5300441", "0.5295137", "0.52851176", "0.5282734", "0.5275806", "0.5255626", "0.52335346", "0.522423", "0.52128214", "0.5206411", "0.52020127", "0.51965", "0.5195518", "0.5195323", "0.518182", "0.51810443", "0.5169763", "0.51630706", "0.5150353", "0.5145625", "0.5141205", "0.51379085", "0.5127638", "0.5127572", "0.51256645", "0.51171863", "0.5107183", "0.5107063", "0.5102786", "0.5099526", "0.50932735", "0.5088086", "0.5085603", "0.5082261", "0.50819534", "0.5079304", "0.5077377", "0.5076534", "0.5065256", "0.50602615", "0.5058296", "0.50560266", "0.505481", "0.50531477", "0.50517344", "0.5049626", "0.5030261", "0.50295246", "0.50260955", "0.5025639", "0.5019908", "0.5014167", "0.5002334", "0.49929947", "0.4983505", "0.49753886", "0.49695328", "0.4966352", "0.49620602", "0.4958158", "0.4954022", "0.49512652" ]
0.0
-1
Adds All elements to the firebase DB
function addElem( p_obj ) { firebase.database().ref( '/elements/' + p_obj[ 'name' ] ).set({ "proton": filterString( p_obj[ 'proton' ] ), "Symbol": filterString( p_obj[ 'Symbol' ] ), "name": filterString( p_obj[ 'name' ] ), "type": filterString( p_obj[ 'type' ] ), "block": filterString( p_obj[ 'block' ] ), "boilingPoint": filterString( p_obj[ 'boilingPoint' ] ), "Electronegativity": filterString( p_obj[ 'Electronegativity' ] ), "Density": filterString( p_obj[ 'Density' ] ), "AtomicMass": filterString( p_obj[ 'AtomicMass' ] ), "IonizationEnergy": filterString( p_obj[ 'IonizationEnergy' ] ), "AtomicRadius": filterString( p_obj[ 'AtomicRadius' ] ), "AtomicRadius_InPicometers": filterString( p_obj[ 'AtomicRadius_InPicometers' ] ), "MeltingPoint": filterString( p_obj[ 'MeltingPoint' ] ), "ElementColor": filterString( p_obj[ 'ElementColor' ] ) }); console.log( 'data is added to firebase.' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 addToDatabase() {\n if (!hasError) {\n console.log(3, hasError);\n database = firebase.database();\n var setUserListRef = database.ref(`userList`);\n setUserListRef.push({\n \"userName\": userName,\n \"lastSpoken\": [\"null\"],\n \"favoritePlayer\": [\"null\"]\n })\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 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 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 syncData() {\n //clear table\n $('#trainData').empty();\n //call append function from database\n console.log(database.ref());\n database.ref().once('value').then(function(snapshot) {\n var val = snapshot.val();\n var keys = Object.keys(val);\n console.log(val);\n console.log(keys);\n keys.forEach(function(key) {\n database.ref(key).once('value').then(append);\n });\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}", "handleSubmit() {\n const itemsRef = firebase.database().ref('jungleClick');\n const item = {\n name: this.props.name,\n score: this.state.score,\n };\n itemsRef.push(item)\n }", "function addFoods(){\n foodS++;\n database.ref('/').update({Food : foodS})\n}", "function addFood(){\r\n foods++\r\n database.ref('/').update({\r\n Food: foods\r\n })\r\n}", "addItems() {\n let id = 0;\n let name = \"\";\n let amount = 0;\n let datecreated = \"\";\n let status = \"\";\n let type = \"\";\n\n db.transaction(async function(d) {\n\n console.log(data);\n data.forEach(e => {\n id = e.id;\n name = e.name;\n amount = e.amount;\n datecreated = e.date;\n status = e.status;\n type = e.type;\n\n d.executeSql('INSERT INTO activities (id,name, amount, datecreated, status, type) VALUES (?,?,?,?,?,?)', [id, name, amount, datecreated, status, type]);\n\n });\n });\n }", "function addFoods(){\r\n food++\r\n database.ref('/').update({\r\n Food: Foods\r\n \r\n })\r\n\r\n\r\n}", "savePlaylist(songs){\n const playlistDatabase = this.database.ref('/playlist');\n\n playlistDatabase.set({\n songs: songs\n });\n }", "function firebasePush() {\n\n\n //prevents from braking\n if (!firebase.apps.length) {\n firebase.initializeApp(config);\n }\n\n //push itself\n var mailsRef = firebase.database().ref('emails').push().set(\n {\n Name: Name.value,\n Email: Email.value,\n Message: Message.value\n\n }\n );\n}", "writeIncompleteOrderData(id,pid,pname,psize){\n // A post entry.\n var postData = {\n orderid: id,\n product_id: pid,\n product_name: pname,\n product_size: psize\n };\n\n // Get a key for a new Post.\n var newPostKey = firebase.database().ref().child('Incomplete_Order').push().key;\n var newPostKey2 = firebase.database().ref().child('Incomplete_Order_Total').push().key;\n // Write the new post's data simultaneously in the posts list and the user's post list.\n var updates = {};\n var updates2 ={};\n\n\n\n updates['incomplete_Order/' + '/IC/' + newPostKey] = postData;\n updates2[newPostKey2] = postData;\n\n firebase.database().ref().update(updates);\n\n var date = moment().format(\"MMM Do\");\n firebase.database().ref('/Total_Incomplete_Order/'+ date).update(updates2);\n}", "function addFoods(){\n foodS++;\n database.ref('/').update({\n Food:foods\n })\n}", "function addFoods(){\r\n\r\n foodS++;\r\n database.ref('/').update({\r\n Food:foodS\r\n })\r\n\r\n\r\n}", "function addFoods(){\r\n foods++;\r\n database.ref('dog').update({\r\n food:foods\r\n })\r\n}", "function addFoods() {\n foodS++;\n database. ref(' / ') . update({\n Food: foods\n\n\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 }", "function addToFavourites(Id, title, link, content) { \nFavorites.push(Id) \nconsole.log(Favorites)\n\n db.collection(\"users\").doc(globaluser.uid).set({ \n favourites: Favorites\n \n},{ merge: true }) \n.then(() => {\n console.log(\"Document successfully written!\");\n})\n.catch((error) => {\n console.error(\"Error writing document: \", error);\n}); \n\n}", "function addFoods(){\n foodS++;\n database.ref('/').update({\n Food:foodS\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}", "function addFoods(){\r\nfoodS++;\r\ndatabase.ref('/').update({\r\n Food: foodS\r\n})\r\n}", "function updateDatabase() {\n database.ref().set({ \n p1name: v_p1name,\n p1pick: v_p1pick,\n p1wins: v_p1wins,\n p1losses: v_p1losses,\n p1ties: v_p1ties,\n p2name: v_p2name,\n p2pick: v_p2pick,\n p2wins: v_p2wins,\n p2losses: v_p2losses,\n p2ties: v_p2ties,\n conversation: v_conversation,\n message: v_message\n });\n\n}", "function saveUsers(name,password){\n var newUserRef = userRef.push();\n newUserRef.set({\n name:name,\n password:password\n });\n}", "function addFoods(){\r\n foodS++;\r\n database.ref('/').update({\r\n Food:foodS\r\n })\r\n}", "function addFoods(){\n foodS++;\n database.ref('/').update({\n Food: foodS\n })\n}", "function addFoods(){\n foodS++;\n database.ref('/').update({\n Food: foodS\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}", "SETALLVALUES({ commit }) {\n try {\n const starCountRef = firebase.database().ref(\"Greenhouse\");\n starCountRef.on(\"value\", async (snapshot) => {\n const data = await snapshot.val();\n commit(\"setLoading\", false);\n commit(\"setAllSensor\", data.allSensors.split(\",\"));\n });\n } catch (error) {\n console.log(error);\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 addTramite(){\n var fullname = vm.name + \" \" + vm.surnames;\n var date = dateFormat(vm.date);\n firebase.database().ref('rh/tramitesProceso/').push({\n usuario: fullname,\n rfc: vm.rfc,\n tramite: vm.tramite.nombreTramite,\n fecha: date,\n estatus: vm.estatus,\n oficina: vm.usuarioOficina,\n usuarioOficina: vm.usuarioTramites \n }).then(function(){\n vm.modalAddTramite.dismiss();\n swal('Tramite agregado!','','success');\n vm.name = \"\";\n vm.surnames = \"\";\n vm.rfc = \"\";\n vm.tramite = \"\";\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 addFoods(){\r\n foodS++;\r\n database.ref('/').update({\r\n Food:foodS\r\n })\r\n}", "function addFoods(){\r\n foodS++;\r\n database.ref('/').update({\r\n Food:foodS\r\n })\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 addFoods(){\n foodS++;\n database.ref('/').update({\n Food:foodS\n })\n}", "function addFoods(){\n foodS++;\n database.ref('/').update({\n Food:foodS\n })\n}", "function firebasePush() {\n\n\n //prevents from braking\n if (!firebase.apps.length) {\n firebase.initializeApp(config);\n }\n\n //push itself\n var mailsRef = firebase.database().ref('emails').push().set(\n {\n Name: Name.value,\n Email: Email.value,\n Message: Message.value\n }\n );\n success();\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}", "onHandleSubmit(){\n const itemsRef = firebase.database().ref('restriction');\n const restriction = {\n num: this.state.index,\n restrictionName: this.state.restrictionName, \n date: this.state.date,\n timeStart: this.state.timeStart,\n timeEnd: this.state.timeEnd,\n }\n\n itemsRef.push(restriction);\n\n\n this.setState({\n restrictionName: '',\n index: this.state.index + 1,\n date: '',\n timeStart: '',\n timeEnd: '',\n })\n }", "function addNewFB(queryURL) {\n // Save the new data in Firebase\n database.ref().push({\n food: food,\n place: place,\n queryURL: queryURL,\n dateAdded: firebase.database.ServerValue.TIMESTAMP\n });//End push \n }", "function saveMessages(name,email,phone,message, fecha){\n var newMessagesRef=messageRef.push();\n newMessagesRef.set({\n name: name,\n email: email,\n phone: phone,\n message: message,\n fecha : fecha\n })\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 loadFormData() {\n //load validated data into the firebase database\n \n database.ref().push({\n trainname: trainData.trainName,\n destination: trainData.dest,\n starttime: trainData.startTime,\n frequency: trainData.freq,\n // currenttime: now\n });\n noEntry = 0; //needed to allow the update procedure to run\n}", "function addfoods() {\nfoods++;\ndatabase.ref('/').update({\n Food : foods,\n})\n}", "function newElement() {\n var newPostKey = firebase.database().ref().child('list' + userId + '/').push().key;\n\n var inputValue = document.getElementById(\"myInput\").value;\n \n // Get a key for a new Post.\n\n // Write the new post's data simultaneously in the posts list and the user's post list.\n var updates = {};\n updates['list/' + userId + '/' + newPostKey] = inputValue;\n console.log(updates);\n document.getElementById(\"myInput\").value = \"\";\n\n firebase.database().ref().update(updates);\n\n\n}", "function DB_Winner_Write(won) {\n firebase.database().ref(\"winner\").push({won:won});\n}", "add(collection, obj) {\n this.db.get(collection).push(obj).last().value();\n }", "function test() {\n firebase.database().ref(\"Payment\").push({Paid:true});\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 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}", "PushToUserDatabase() {\n console.log(\"Pushing to User Database\\n\");\n\n let database = firebase.database();\n let dbRef = database.ref();\n // Get Node with all users\n let usersRef = dbRef.child(\"users\");\n // Get Unique Key for New User\n let newUserkey = this.UserId;\n console.log(\"From PushToUserDatabase \\n\" + this.toJSON());\n let userObject = {};\n // Construct JSON Object for User\n userObject[\"/users/\" + newUserkey] = this.toJSON();\n // Call Update on Object\n dbRef.update(userObject, function() {\n console.log(\"User Successfully Updated\\n\"); // Optional callback for success\n });\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 addFoods()\n{\n foodS++;\n database.ref(\"/\").update({\n Food:foodS\n })\n}", "function pushFans(){\n\n\tvar firstName = document.getElementById(\"Fname\").value;\n\tvar surname = document.getElementById(\"Surname\").value;\n\tvar dob = document.getElementById(\"DOB\").value;\n\tvar addressLine1 = document.getElementById(\"address1\").value;\n\tvar addressLine2 = document.getElementById(\"address2\").value;\n\tvar addressLine3 = document.getElementById(\"address3\").value;\n\tvar creditCard = document.getElementById(\"credit-card\").value;\n\tvar expiryDate = document.getElementById(\"expiryDate\").value;\n\tvar cvn = document.getElementById(\"cvn\").value;\n\tvar photoId = document.getElementById(\"photo-id\").value;\n\tvar proofAddress = document.getElementById(\"proof-address\").value;\n\n\n\tvar mydata = database.ref('/Fans/'); // creates ref at Fans\n\tvar postRef = mydata.push({'firstName':firstName,'surname':surname,'dob':dob, 'addressLine1': addressLine1,'addressLine2':addressLine2,'addressLine3':addressLine3, 'creditCard': creditCard,'expiryDate':expiryDate,'cvn':cvn, 'photoId': photoId,'proofAddress':proofAddress, 'valid': \"false\"}); // adds unique key then the following child nodes\n\tvar postID = postRef.key; // saves unique key from above\n\n\tconsole.log(postID) // posts unique key to console so it can be checked\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 addStudent(){\n // event.preventDefault()\n let name = $(\"#studentName\").val();\n let course = $(\"#course\").val()\n let grade = $(\"#studentGrade\").val()\n\n let dataToSend = {\n student_name: name,\n course: course,\n grade: grade,\n }\n // var fbRef = firebase.database();\n fbRef.ref('students').push(dataToSend)\n clearAddStudentFormInputs();\n showAlert(); // success alert\n closeAlert(); // auto closes on setInterval\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 }", "createContract (title, description, price, index) { \n // create new contract ARRAY with parameters from playerInput\n let newContract = [{\n title: title,\n description: description,\n price: price\n }];\n\n // make new contractList that is the old contract list concatonated\n // with the single element new contract list\n let newContractList = this.state.contractList.concat(newContract);\n\n // update state with new contract list\n this.setState({\n ...this.state,\n contractList: newContractList\n });\n\n // add contract to database - new contract get named based on position in array\n firebase.database().ref('Contracts').set({\n Contracts: newContractList\n });\n }", "function updateDB(event){\n event.preventDefault();\n const firstname = firstnameElement.value;\n const lastname = lastnameElement.value;\n const date = dateElement.value;\n const message = messageElement.value;\n\n firstnameElement.value = \"\";\n lastnameElement.value = \"\";\n dateElement.value = \"\";\n messageElement.value = \"\";\n\n console.log(firstname + \" : \" + lastname + \" : \" + date + \" : \" + message);\n\n //Update database here\nconst value = {\n FIRSTNAME: firstname,\n LASTNAME: lastname,\n DATE: date,\n MESSAGE: message\n}\ndatabase.push(value);\n}", "async function initDatabase() {\n for (let collectionName of Object.keys(data.collections)) {\n let collectionData = data.collections[collectionName];\n // Insert entries\n let collection = db.collection(collectionName);\n await collection.insertMany(collectionData);\n }\n}", "function addItem() {\n var database = firebase.database(); // Ref to Firebase Database\n var itemRef = database.ref('items'); // Ref to 'Item' table\n var geoFire = new GeoFire(database.ref('items_locations')); // Ref to 'Item Locations' table\n\n // Add new item to Firebase Database\n var newItemRef = itemRef.push();\n var coords = getRandomCoords();\n var name = Math.random().toString(36).substring(10);\n newItemRef.set({\n location: coords,\n name: name\n }).then(() => {\n console.log(`Item added with name: ${name}`);\n\n // Set GeoFire location for the new item\n geoFire.set(newItemRef.key, coords).then(() => {\n console.log(`Set location for Item with name ${name}`);\n });\n });\n}", "function addNew(str) {\n starterCheer.push(str);\n happyRef.set(starterCheer);\n happyRef.get().then(function (snapshot) {\n if (snapshot.exists()) {\n starterCheer = snapshot.val();\n }\n else {\n console.log(\"No data available\");\n }\n }).catch(function (error) {\n console.error(error);\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 saveBulkPublicChat(){\n console.log('save bulk');\n db.collection('publicChat').insertMany(publicMessages)\n .then(function(result) {\n // process result\n //console.log(result);\n publicMessages = [];\n });\n}", "function addItem(event) {\n var newTodoText = $('#newTodo').val();\n \n //Need to add the id field in your firebase\n // you need this id field to identify your selected row\n \n \n //calling firebase\n database.ref().push({\n Todo: newTodoText,\n id: (new Date().getTime()).toString(36)\n });\n //When you finished adding, you need to clear out\n // the input textbox\n $('#newTodo').val(\"\");\n }", "function cargarData() {\n let tarjeta = document.getElementById('numerot').value;\n var db = firebase.firestore();\n db.collection('tarjetas').add({\n tarjeta: tarjeta\n\n })\n .then(function(docRef) {\n console.log('Document written with ID: ', docRef.id);\n document.getElementById('numerot').value = '' ;\n })\n .catch(function(error) {\n console.error('Error adding document: ', error);\n });\n\n}", "function uploadData(){\r\n getReadingSpeed();\r\n var r = localStorage.getItem('ReadingSpeed');\r\n var p = localStorage.getItem('Password');\r\n var e = localStorage.getItem('Email');\r\n var m = localStorage.getItem('Major');\r\n var u = localStorage.getItem('UserName');\r\n var l = localStorage.getItem('LastName');\r\n var f = localStorage.getItem('FirstName');\r\n database.ref(\"Users/\").push(\r\n {\r\n FirstName:f,\r\n LastName:l,\r\n FullName: u,\r\n Major:m,\r\n Email:e,\r\n Password:p,\r\n ReadingSpeed:r\r\n });\r\n}", "function addFoods(){\n foodS++;\n database.ref('/').update({\n Food:foodS\n });\n dog.addImage(dogImg);\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 addFoods(foodS){\r\n foodS++\r\n database.ref('/').update({\r\n food: foodS\r\n })\r\n \r\n}", "function addItem(event) {\n var newTodoText = $('#newTodo').val();\n \n //Need to add the id field in your firebase\n // you need this id field to identify your selected row\n //calling firebase \n database.ref().push({\n Todo: newTodoText,\n id: (new Date().getTime()).toString(36) \n });\n //When you finished adding, you need to clear out\n // the input textbox\n $('#newTodo').val(\"\");\n }", "async function addToCollection() {\n await EraseDatabase();\n var data = await getData();\n for (var i = 0; i < data.results.length; i++) {\n var datatostore = {\n \"user\": { \"username\": data.results[i].author.username, \"userIcon\": data.results[i].author.usericon },\n \"profile\": data.results[i].url,\n \"image\": data.results[i].thumbs[1].src\n }\n\n db.collection('search').save(datatostore, function (err, result) {\n if (err) throw err;\n console.log(\"Saved to database\");\n })\n };\n }", "function addFood(){\r\n foodS++;\r\n database.ref('/').update({\r\n food:foodS\r\n })\r\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 writeQuestionsToFirebase(questions) {\n questions.forEach(function (question) {\n writeQuestionData(question.id, question.question, question.options, question.question_type);\n });\n}", "function addFoods() {\n foodS++;\n database.ref('/').update({\n Food:foodS\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 pushData(e){\n e.preventDefault();\n //Values\n const link = document.querySelector('.movie-link').value;\n if(link != '' && id != ''){\n db.collection(\"movie\").add({\n link: link,\n id: id,\n timestamp:today\n })\n .then(function(docRef) {\n console.log(\"Document written with ID: \", docRef.id);\n })\n .catch(function(error) {\n console.error(\"Error adding document: \", error);\n });\n }\n else console.log('Missing')\n \n \n \n\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 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 writeOrderData() {\r\n \r\n var orderNotes = prompt(\"Eklemek istediğiniz notlar (Örnek : acısız) ?\");\r\n firebase.database().ref(\"Basket/\" + userId + \"/\").push().update({\r\n \r\n \r\n phone : userPhoneNo,\r\n //ARRANGE THIS TO WRITE EVERYTHING IN THE LIST\r\n //productTotalPrice : totalPrice,\r\n //productLocation : orderLocation,\r\n notes : orderNotes,\r\n name: fname,\r\n nameid: nameid,\r\n ucret: fprice,\r\n quantity: f_adet,\r\n restid: storeUID\r\n \r\n \r\n }, function(error) {\r\n if (error) {\r\n alert(\"Siparişiniz gönderilemedi, lütfen tekrar deneyin\");\r\n } else {\r\n \r\n var x = document.getElementById(\"snackbar\");\r\n x.className = \"show\";\r\n setTimeout(function(){ x.className = x.className.replace(\"show\", \"\"); }, 3000);\r\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}", "async function setData() {\n await db.collection('users').doc(uid).set(userFields);\n await db.collection('users').doc(uid).collection('txs').add({\n receipt: {},\n date: Date.now(),\n number: 0,\n });\n await db.collection('users').doc(uid).collection('items').add({\n icon: '🍔',\n name: 'My-First-Item',\n price: 14,\n options: {\n extra_sauce: true\n }\n });\n }", "function generar(){\r\n //con estos datos obtenemos los datos de los clientes, y los ids de los productos\r\n var cc=getId(\"cedulacliente\");\r\n \r\n var idp=getId(\"idp\");\r\n var idp2=getId(\"idp2\");\r\n var idp3=getId(\"idp3\");\r\n //un arreglo que agregas los ids\r\n ides.push(idp+idp2+idp3);\r\n\r\n for(var i=0;i<=ides.length;i++){\r\n //esta variable accede a los productos\r\n var producto= firebase.database().ref('producto/'+i);\r\n producto.on('value',function(data){\r\nvar datos=data.val();\r\ndesc=datos.description;\r\n });\r\nconsole.log(desc);\r\n }\r\n //esta variable accede la nodo que contiene los \"clientes\"\r\n // var cliente= firebase.database().ref('clientes/'+cc);\r\n \r\n //con este metodo obtengo el objetp del cliente debido a que necesito\r\n // cliente.on('value',function(parameters){\r\n //aqui estoy guardando el objeto del cliente\r\n //var data=parameters.val();\r\n //ced=data.cedula;\r\n //console.log(ides);\r\n //});\r\n\r\n\r\n //ahora voy a llamar al producto que estoy insertando\r\n\r\n\r\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}", "writeUserData(uid, id) {\n // A post entry.\n var postData = {\n orderCompleted: id\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['users/' + uid + '/OC/' + newPostKey] = postData;\n\n firebase.database().ref().update(updates);\n\n\n\n}", "function addFoods(){\n foodS =foodS+1;\n database.ref('/').update({\n Food:foodS\n })\n}", "addFeedback() {\n var feedbackData = {\n comment: 'Dummy feedback',\n username: 'chocho',\n timestamp: 5,\n left: 0.1,\n top: 0.7,\n width: 0.4,\n height: 0.1,\n };\n var newFeedbackKey = database.ref(`videos/${this.props.currentVideo.key}`).child('feedback').push().key;\n var updates = {};\n updates[`/videos/${this.props.currentVideo.key}/feedback/${newFeedbackKey}`] = feedbackData;\n database.ref().update(updates);\n }", "addLevelDBData(key, value) {\n let self = this;\n self.recordCount = self.recordCount + 1;\n return new Promise((resolve, reject) => {\n self.db.put(key, value, (error) => {\n if(error) { reject(error) } else { resolve(value) }\n });\n });\n }", "async uploadProduct(name, description, category, colors, stock, images, price){\n const id = camelcase(name)\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n\n const imagesLink = []\n\n for (let i = 0; i < images.length; i++) {\n\n imagesLink.push(await this.uploadImage(images[i], id, i))\n console.log(imagesLink)\n }\n\n const time = firebase.firestore.FieldValue.serverTimestamp()\n await db.collection(\"products\").doc(id).set({\n name: name,\n description: description,\n category: category,\n colors: colors,\n stock: stock,\n images: imagesLink,\n price: price,\n created: time,\n updated: time\n }).then(\n () => toast.success(\"Producto creado correctamente\")\n\n )\n .catch((e) => {\n toast.error(\"Error\" + e.message)\n })\n }", "function runPOST() {\n // Prevent the page from refreshing\n event.preventDefault();\n\n // Get inputs\n postTitle = $(\"#title-post\").val().trim();\n post = $(\"#post\").val().trim();\n imgProfile = $(\"#profile-img\").val().trim();\n username = $(\"#username\").val().trim();\n\n emptyAll();\n\n // Change what is saved in firebase\n database.ref(\"Chuck\").push({\n postTitle: postTitle,\n post: post,\n imgProfile: imgProfile,\n username: username\n });\n}", "function update() {\n var database = firebase.database();\n\n // gets which team is selected from the dropdown menu\n const teamSelect = document.getElementById(\"teamSelect\");\n const team = teamSelect.options[teamSelect.selectedIndex].value;\n console.log(team);\n\n const ref = firebase.database().ref(team);\n ref.once(\"value\").then(_team => {\n _team.forEach(_teamStats => {\n const teamStats = _teamStats.val();\n });\n });\n\n // gets value of input boxes and pushes it to an array\n valueArray = [];\n const gp = document.getElementById(\"gp\").value;\n const pts = document.getElementById(\"pts\").value;\n const ason = document.getElementById(\"ason\").value;\n const ah = document.getElementById(\"ah\").value;\n const pp = document.getElementById(\"pp\").value;\n const sp = document.getElementById(\"sp\").value;\n\n valueArray.push(gp, pts, ason, ah, pp, sp);\n console.log(valueArray);\n\n // this loops through the array and gets each individual number in the array\n count = 0;\n for (i = 0; i < valueArray.length; i++) {\n console.log(valueArray[i]);\n\n if (valueArray[i] === \"\") {\n alert(\"The database won't be updated if any of the text boxes are empty\");\n count += 1;\n }\n }\n\n if (count === 0) {\n const data = {\n GamesPlayed: gp,\n Points: pts,\n ASON: ason,\n AH: ah,\n PuckPossession: pp,\n SaveP: sp\n };\n ref.set(data);\n }\n\n // resets input fields\n document.getElementById(\"gp\").value = \"\";\n document.getElementById(\"pts\").value = \"\";\n document.getElementById(\"ason\").value = \"\";\n document.getElementById(\"ah\").value = \"\";\n document.getElementById(\"pp\").value = \"\";\n document.getElementById(\"sp\").value = \"\";\n\n console.log(\"Updated\");\n alert(\"Data Updated\");\n\n window.location.reload();\n}", "function writeData(Head, details) {\n firebase.database().ref(Head).set({ details });\n }", "function addfood(){\r\nfoodobj.addfoodcount()\r\ndatabase.ref('/').update({\r\n foodCount: foodobj.foodcount\r\n});\r\n\r\n}", "addData(way, name, obj) {\n this.database.ref(this.ref+'/'+way).child(name).set(obj);\n }", "add(data) {\n return this.ref.add(data);\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}" ]
[ "0.7114251", "0.7013014", "0.6804755", "0.6747807", "0.6706552", "0.6679208", "0.6547496", "0.64493847", "0.64470834", "0.6427676", "0.6422186", "0.64172506", "0.64064556", "0.6403986", "0.6401505", "0.6373045", "0.63543284", "0.6346126", "0.6345196", "0.6339694", "0.6335454", "0.633127", "0.6327316", "0.63271976", "0.63204867", "0.6318753", "0.63180786", "0.6299867", "0.6299867", "0.6299746", "0.62913615", "0.6284941", "0.6284519", "0.62834764", "0.6283252", "0.6283252", "0.62693846", "0.62679374", "0.62679374", "0.62655896", "0.6254906", "0.6243267", "0.62404597", "0.62315196", "0.622325", "0.62102216", "0.6201201", "0.6197313", "0.6197026", "0.6196748", "0.619323", "0.6172042", "0.6141578", "0.6139677", "0.6137774", "0.6135985", "0.6117631", "0.611052", "0.60887504", "0.6083587", "0.6078673", "0.60778767", "0.60764515", "0.60757864", "0.6071227", "0.60659313", "0.6051246", "0.6048763", "0.6031309", "0.6026124", "0.5998678", "0.5995146", "0.5972553", "0.594492", "0.59382004", "0.59362584", "0.5928759", "0.59285235", "0.59272003", "0.5920286", "0.5915966", "0.5913302", "0.58952546", "0.58946764", "0.58932257", "0.58848083", "0.5883576", "0.5880916", "0.5878048", "0.5867623", "0.5862292", "0.58614516", "0.5858563", "0.5856575", "0.5853929", "0.5853095", "0.58529276", "0.58504367", "0.5849355", "0.58489114" ]
0.66379184
6
Hides all elements excluding provided className
function hideAll() { let frames = document.getElementsByClassName("frame"); for (let i = 0; i < frames.length; i++) { frames[i].style.display = "none" } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideByClassName (className) {\n\tvar elements = document.getElementsByClassName(className)\n\tfor (var i = 0; i < elements.length; i++) {\n\t\telements[i].style.display = 'none'\n\t}\n// return document.getElementsByClassName(className).length.style.display = \"none\";\n}", "function hide_elements_with_class(class_name, exclude_id) {\n var exclude_flag = typeof exclude_id !== 'undefined';\n var nodelist = document.getElementsByClassName(class_name);\n for(var i = 0; i < nodelist.length; i++) {\n if(exclude_flag && nodelist[i].id != exclude_id) {\n nodelist[i].style.display = 'none';\n }\n }\n}", "function hideByClassName (className) {\n return $(\".\" + className).hide()\n}", "function hideElementByClass(elementArray){\n Array.prototype.map.call(elementArray, function(element){\n return element.style.display = 'none'\n })\n}", "function hideClassUnder(container, cl)\n{\n var elems = container.getElementsByClassName(cl);\n var i;\n for (i = 0; i < elems.length; i++) {\n $(elems[i]).hide();\n }\n}", "function removeHiddenClassForAll() {\n let hiddenElements = document.querySelectorAll('.hidden');\n hiddenElements.forEach((elem) => {\n elem.classList.remove('hidden');\n });\n}", "_make_hidden(...html_elements) {\n for (const element of html_elements) {\n if (element.className.search(\"is-hidden\") == -1) element.className += \" is-hidden\";\n }\n }", "function hideClass(elements) {\n // if there are no elements, we're done\n if (!elements) {\n return;\n }\n // if we have a selector, get the chosen elements\n if (typeof(elements) === 'string') {\n elements = document.querySelectorAll(elements);\n }\n // if we have a single DOM element, make it an array to simplify behavior\n else if (elements.tagName) {\n elements = [elements];\n }\n //loop the elements\n for (var i = 0; i < elements.length; i++) {\n elements[i].style.display = \"none\";\n }\n }", "function hideElements() {\n let elementsToHide = document.querySelectorAll(\".elementToHide\");\n \n elementsToHide.forEach((item) => {\n item.classList.toggle(\"hide-element\");\n })\n // console.log(elementsToHide);\n}", "function HideWithoutDisplayNone(elementClass, hide) {\n var hiddenMargin = GetNumber(document.getElementsByClassName(elementClass)[0].style.marginLeft, \"px\") + (hide ? -9999 : 9999);\n document.getElementsByClassName(elementClass)[0].style.marginLeft = hiddenMargin.toString() + \"px\";\n}", "function visuallyHide( el, className ) {\n\tel.classList.add( className );\n\n\tsetStylesOnElement( {\n\t\tclip: 'rect(1px, 1px, 1px, 1px)',\n\t\tclipPath: 'inset(50%)',\n\t\theight: '1px',\n\t\twidth: '1px',\n\t\toverflow: 'hidden',\n\t\tposition: 'absolute'\n\t}, el );\n}", "function hideItems(element, name) {\r\n var i, arr1, arr2;\r\n arr1 = element.className.split(\" \");\r\n arr2 = name.split(\" \");\r\n for (i = 0; i < arr2.length; i++) {\r\n while (arr1.indexOf(arr2[i]) > -1) {\r\n arr1.splice(arr1.indexOf(arr2[i]), 1); \r\n }\r\n }\r\n element.className = arr1.join(\" \");\r\n}", "function makeInvisible(elem) {\r\n\t\telem.classList.remove('visible');\r\n\t}", "function hide(elements) {\n elements.forEach(element => element.classList.add('hidden'));\n}", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $loadMore ,\n $favoriteStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $userProfile\n ];\n elementsArr.forEach(($elem) => $elem.addClass(\"hidden\"));\n }", "function hideAll(){\n $$('.contenido').each(function(item){\n item.hide();\n })\n}", "function hide() {\n $.forEach(this.elements, function(element) {\n element.style.display = 'none';\n });\n\n return this;\n }", "_make_visible(...html_elements) {\n for (const element of html_elements) {\n element.className = element.className.replace(\" is-hidden\", \"\");\n }\n }", "function filter(classes) {\n let products = document.getElementsByClassName('product');\n\n for (var i = 0; i < products.length; i++) {\n if (!products.item(i).classList.contains(classes)) {\n products.item(i).style.display = 'none';\n } else {\n products.item(i).style.display = 'inline-block';\n }\n }\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $favoritedArticles\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function hideAll () {\n\t\tvar all = document.querySelectorAll (\"div.thumbnail-item.gallery\");\n\t\tfor (var i = 0; i < all.length; i++)\n\t\t\tall [i].className = \"hidden\";\n\t}", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $sectionUserProfile\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach(val => val.hide());\n }", "function hide_it() {\r\n\targ=hide_it.arguments;\r\n\tfor(i=0;i<arg.length;i++) {\r\n\t\t_z = _ge(arg[i]);\r\n if (_z) _z.className='hideit';\r\n\t}\r\n}", "function HideEverything() {\n let x = document.getElementsByClassName(\"button-outcome\");\n // console.log(x);\n for(let i = 0; i<x.length; i++) {\n x[i].classList.remove('non-hidden');\n x[i].classList.add('hidden');\n }\n}", "function removeClass(element) {\n var elementClasses = element.className.split(\" \");\n while (elementClasses.indexOf(\"show\") > -1) {\n elementClasses.splice(elementClasses.indexOf(\"show\"), 1);\n }\n element.className = elementClasses.join(\" \");\n}", "function showElement(element) {\n element.classList.remove(\"hide\");\n}", "function hide(ele) {\n ele.classList.remove(showClass);\n ele.classList.add(hideClass);\n }", "function TUI_toggle_class(className)\n{\n var hidden = toggleRule('tui_css', '.'+className, 'display: none !important');\n TUI_store(className, hidden ? '' : '1');\n TUI_toggle_control_link(className);\n}", "hide() {\n this.container.classList.remove(\"enabled\");\n }", "hideAllComponents_() {\n const components = this.shadowRoot.querySelectorAll('.shimless-content');\n Array.from(components).map((c) => c.hidden = true);\n }", "function hideSignup(){\n document.getElementsByClassName('abc')[1].style.display = \"none\";\n}", "function hideElement(ids) {\n ids.forEach((id) => addClass(id, 'hidden'));\n}", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n // **** added favorite article, submit story, user profile hide\n $submitStoryForm,\n $favoriteArticles,\n $userProfile,\n // ****\n ];\n elementsArr.forEach(($elem) => $elem.hide());\n }", "function revealAllHidden() {\r\n\t\tdocument.querySelectorAll('.hidden').forEach(function(el) {\r\n\t\t\tel.classList.remove('hidden')\r\n\t\t})\r\n\t}", "function eHide(target) {\n if (target.constructor == Text) return;\n \n if (isArray(target) || isNodeList(target)) {\n for (var i = 0; i < target.length; i++) {\n eHide(target[i]);\n }\n } else if (!eHasClass(target, 'hidden')) {\n target.className += ' hidden';\n }\n}", "function hidePageElements()\n{\n quizCaption.setAttribute(\"class\", \"hide-elements\");\n quizStartBtn.setAttribute(\"class\", \"hide-elements\");\n}", "function showElement(ids) {\n ids.forEach((id) => removeClass(id, 'hidden'));\n}", "show() {\n this.element.classList.remove(\"hidden\");\n }", "function hide(element) {\n dom(element).addClass(invisibleClass);\n }", "function hideElement(element) {\n element.className += \" hide\";\n}", "function show(el) {\n el.className = el.className.replace(/ ?hidden/gi, '');\n}", "function hideEverythingBut(instance) {\n // ARIA: Hide all the things\n var children = document.body.children;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n\n // If it's not a parent of or not the instance itself, it needs to be hidden\n if (child !== instance && !child.contains(instance)) {\n var currentAriaHidden = child.getAttribute('aria-hidden');\n if (currentAriaHidden) {\n // Store the previous value of aria-hidden if present\n // Don't blow away the previously stored value\n child._previousAriaHidden = child._previousAriaHidden || currentAriaHidden;\n if (currentAriaHidden === 'true') {\n // It's already true, don't bother setting\n continue;\n }\n }\n else {\n // Nothing is hidden by default, store that\n child._previousAriaHidden = 'false';\n }\n\n // Hide it\n child.setAttribute('aria-hidden', 'true');\n }\n }\n\n // Always show ourselves\n instance.setAttribute('aria-hidden', 'false');\n }", "function hideElements(elements){\n for (var el of elements) {\n if (el !== undefined && el !== null && el.classList !== undefined){\n el.classList.add('hidden');\n }\n }\n}", "function show(e){\n e.classList.remove(\"Hide\");\n}", "function hide(element) {\n element.classList.add('hidden');\n }", "function hideAll(tagname, classname, viewValue) {\n\t var elements = document.getElementsByTagName(tagname);\n\t for (var i=0; i < elements.length; i++) {\n\t if (elements[i].className == classname) {\n\t elements[i].style.display=viewValue;\n\t }\n\t }\n\t}", "function toggleClassElements(className, state) {\n let elements = document.getElementsByClassName(className);\n for (let i = 0; i < elements.length; i++) elements[i].style.display = state;\n}", "function remove_hide_Cards() {\n\tlistOfOpenCards.map(x => x.className = 'card');\n\tlistOfOpenCards = [];\n}", "function showHideElementsInTable(tableId, className) {\n\ttry\n\t{\n \t\tvar tbl = document.getElementById(tableId);\n\t var body = tbl.getElementsByTagName(\"TBODY\")[0];\n\t // show or hide all elements with the given className\n\t \tvar htmlNodeIterator = new HTMLNodeIterator();\n\t\thtmlNodeIterator.iterate(showOrHideElement, body, className);\n\t}\n\tcatch (Err)\n\t{\n\t\talert(Err.description)\n\t\treturn false\n\t}\n}", "function show(element) {\n element.classList.remove('hidden');\n }", "function hideAllCards(){\n for(i=0; i<divItems.length;i++){\n if(divItems[i].className !='off') divItems[i].className='hidden';\n }\n}", "exibir(e) {\n e.classList.remove('d-none');\n }", "function hideLogin(){\n document.getElementsByClassName('abc')[0].style.display = \"none\";\n}", "hideAll () {\n // Hide every section.\n document.querySelectorAll('section').forEach(section => {\n section.classList.remove('visible')\n })\n }", "hide() {\n this.element.classList.add(\"hidden\");\n }", "function hide_ranks_except(classid) {\n $(\"#ranks_container ul\").addClass(\"hidden\");\n $(\"#ranks_container ul[data-classid=\" + classid + \"]\").removeClass(\"hidden\");\n}", "function hideElements(selector) {\n document.querySelectorAll(selector).forEach((e) => { e.style.display = \"none\"; });\n}", "function hide_selectors() {\n var classes = new Array( '.phone_selector', '.address_selector', '.emergency_selector' )\n for(i in classes) {\n if ( $( classes[i] ).size() == 1 ) {\n $( classes[i] ).each( function(){\n $( this ).hide()\n })\n }\n }\n}", "function hideElement () {\n if(this instanceof HTMLCollection || this instanceof NodeList) {\n for(var i = 0; i < this.length; i++) {\n this[i].style.display = 'none';\n }\n }\n else if(this instanceof HTMLElement) {\n this.style.display = 'none';\n }\n\n return this;\n }", "function killTagsByClass(tagType, tagClass){\r\n\tvar element = document.getElementsByTagName(tagType);\r\n\r\n\tfor (i=0; i<element.length; i++) {\r\n\t\tif (element[i].className==tagClass) {\r\n\t\t\telement[i].style.display=\"none\";\r\n\t\t}\r\n\t}\r\n}", "function killTagsByClass(tagType, tagClass){\r\n\tvar element = document.getElementsByTagName(tagType);\r\n\r\n\tfor (i=0; i<element.length; i++) {\r\n\t\tif (element[i].className==tagClass) {\r\n\t\t\telement[i].style.display=\"none\";\r\n\t\t}\r\n\t}\r\n}", "unhide() {\n document.getElementById(\"guiArea\").classList.remove(\"hideMe\");\n document.getElementById(\"guiAreaToggle\").classList.remove(\"hideMe\");\n }", "function hideElement(element) {\n element.classList.remove(\"show\");\n element.classList.add(\"hide\");\n}", "function unhideControls() {\n\tdocument.querySelector('.hidden').style.visibility = 'visible';\n}", "hide() {\n super.hide();\n this.overlay.classList.add(\"hidden\");\n unblurBaseElements(this);\n }", "function removeShow() {\n tabContentItems.forEach( item => {\n item.classList.remove( 'show' );\n } );\n}", "_hideAll() {\n this.views.directorySelection.hide();\n this.views.training.hide();\n this.views.messages.hide();\n this.views.directorySelection.css('visibility', 'hidden');\n this.views.training.css('visibility', 'hidden');\n this.views.messages.css('visibility', 'hidden');\n }", "function showElemnt(){\n articleElem.classList.remove(\"elementIsNotVisible\")\n articleElem2.classList.remove(\"elementIsNotVisible\")\n console.log(\"visible\");\n}", "function hideAllCells(classname) {\r\n $(\".\" + classname).css(\"display\", 'none');\r\n $(\".\" + classname).css(\"visibility\", 'collapse');\r\n}", "hide() {\n this.elem.classList.add(\"hiding\");\n setTimeout(() => this.elem.classList.add(\"noDisplay\"), 184);\n this.isHidden = true;\n }", "function toggleHide(el){\n\tel.classList.toggle(\"hide\");\n}", "function hideAll() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n excludedReferenceOrInstance = _ref.exclude,\n duration = _ref.duration;\n\n arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {\n var instance = popper._tippy;\n\n if (instance) {\n var isExcluded = false;\n\n if (excludedReferenceOrInstance) {\n isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : popper === excludedReferenceOrInstance.popper;\n }\n\n if (!isExcluded) {\n instance.hide(duration);\n }\n }\n });\n }", "toggleIcon_() {\n this.toggleIconEls_.forEach((el) => {\n if (el.classList.contains(cssClass.HIDE)) {\n el.classList.remove(cssClass.HIDE);\n } else {\n el.classList.add(cssClass.HIDE);\n }\n });\n }", "function removeShow() {\n //loop thru, for each of the item in the classList, remove border\n tabContentItems.forEach(item => item.classList.remove('show'));\n\n}", "function hideDisplay(element) {\r\n element.classList.remove(\"visible\");\r\n element.classList.add(\"hidden\");\r\n}", "hideCards() {\n this.cardsArray.forEach(card => {\n card.classList.remove('visible');\n });\n }", "function myFunction() {\r\n var x = document.getElementsByClassName(\"city\");\r\n for (var i = 0; i < x.length; i++) {\r\n x[i].style.display = \"none\";\r\n }\r\n}", "function showElements(elements){\n for (var el of elements) {\n if (el !== undefined && el !== null && el.classList !== undefined){\n el.classList.remove('hidden');\n }\n }\n}", "function showOrHide() {\n bild.classList.toggle('hide')\n}", "function removeElementsByClass(className){\n var elements = document.getElementsByClassName(className);\n while(elements.length > 0){\n elements[0].parentNode.removeChild(elements[0]);\n }\n }", "hide() {\n\t\tthis.isVisible = false;\n this.element.classList.remove('hide')\n\t\tthis.element.classList.remove('showCarousel')\n\t\tthis.element.classList.add('hideCarousel')\n\t\tthis.buttons.style.paddingTop = \"72px\"\n\t\t\n\t}", "function hideAll() {\n for (var i=0; i<lessonsClass.length; i++){\n document.getElementById(lessonsClass[i].id).style.display = \"none\";\n }\n}", "function hideElement(){\n articleElem.classList.add(\"elementIsNotVisible\")\n articleElem2.classList.add(\"elementIsNotVisible\")\n console.log(\"hidden\");\n}", "function hideAll() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n excludedReferenceOrInstance = _ref.exclude,\n duration = _ref.duration;\n\n arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {\n var instance = popper._tippy;\n\n if (instance) {\n var isExcluded = false;\n\n if (excludedReferenceOrInstance) {\n isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : popper === excludedReferenceOrInstance.popper;\n }\n\n if (!isExcluded) {\n instance.hide(duration);\n }\n }\n });\n}", "function hideSearchBar()\r\n{\r\n document.getElementsByClassName(name_searchBar)[0].style.display = 'none';\r\n}", "function DisableElement(elementName) {\n var el = document.getElementsByClassName(elementName)[0];\n el.style.display = \"none\";\n}", "function removeElementsByClass(className){\n var elements = document.getElementsByClassName(className);\n while(elements.length > 0){\n elements[0].parentNode.removeChild(elements[0]);\n }\n }", "opacityOff() {\n [].forEach.call(this.elements, (el) => {\n if (el.classList.contains('out')) {\n el.classList.remove('out');\n }\n });\n }", "function hideRatingSelector()\r\n{\r\n document.getElementsByClassName(name_ratingSelector)[0].style.display = 'none';\r\n}", "function toggleHideElement(elementClass) {\n const element = document.querySelector(elementClass);\n element.classList.contains('hide')\n ? element.classList.remove('hide')\n : element.classList.add('hide');\n}", "function hide(element){\n element.classList.add('to-hide');\n if(element.classList.contains('to-show')){\n element.classList.remove('to-show');\n }\n}", "hideAll() {\n\n\t\tthis._gridIterator( col => {\n\t\t\tcol.$elem.hide();\n\t\t});\n\t}", "function hideDOMElement(element) {\n element.classList.add('hideElement');\n}", "function removeElementsByClass(className) {\n var elements = document.getElementsByClassName(className);\n while (elements.length > 0) {\n elements[0].parentNode.removeChild(elements[0]);\n }\n}", "hide() {\n var event = this.fireBeforeEvent_();\n if (!event.defaultPrevented) {\n this.element_.classList.remove(this.cssClasses_.VISIBLE);\n this.fireAfterEvent_();\n }\n }", "function disappear() {\n\tfor (let i = 0; i < iconIdsArr.length; i++) {\n\t\tfor (let j = 0; j < slotClassArr.length; j++) {\n\t\t\t$(`${slotClassArr[j]}`).find(`${iconIdsArr[i]}`)\n\t\t\t\t\t\t\t\t .css(\"display\", \"none\");\n\t\t}\n\t}\n}", "function hide(e){\n e.classList.add(\"Hide\");\n}", "function showClass(elements) {\n // if there are no elements, we're done\n if (!elements) {\n return;\n }\n // if we have a selector, get the chosen elements\n if (typeof(elements) === 'string') {\n elements = document.querySelectorAll(elements);\n }\n // if we have a single DOM element, make it an array to simplify behavior\n else if (elements.tagName) {\n elements = [elements];\n }\n //loop the elements\n for (var i = 0; i < elements.length; i++) {\n elements[i].style.display = \"\";\n }\n }" ]
[ "0.7701808", "0.7678816", "0.7587907", "0.7335602", "0.71089745", "0.68852794", "0.67839706", "0.67716134", "0.6757388", "0.67388594", "0.6737931", "0.67102844", "0.6690607", "0.66851383", "0.66607356", "0.66527903", "0.6636133", "0.6628762", "0.662547", "0.6616178", "0.6616178", "0.6610159", "0.65899205", "0.65793055", "0.65708584", "0.65507144", "0.65415615", "0.65355706", "0.65172243", "0.65154344", "0.65053177", "0.6498543", "0.64814276", "0.6478481", "0.64686143", "0.64653337", "0.6461019", "0.64235085", "0.64140594", "0.64035285", "0.6399478", "0.6397848", "0.63938427", "0.63915014", "0.63895875", "0.63866335", "0.63863605", "0.633533", "0.63298833", "0.63189137", "0.63189054", "0.6307297", "0.63007414", "0.63001084", "0.62982166", "0.62965524", "0.6290661", "0.62801194", "0.6277127", "0.6270245", "0.62691605", "0.6268315", "0.62528974", "0.62528974", "0.6248294", "0.6237739", "0.6224607", "0.6206724", "0.6196918", "0.61868453", "0.6176073", "0.6170135", "0.61695296", "0.6165819", "0.6159422", "0.6157532", "0.61553276", "0.61505646", "0.6148879", "0.61411107", "0.6133126", "0.6126901", "0.6118939", "0.6103912", "0.6100229", "0.60897875", "0.60888076", "0.608826", "0.6085355", "0.60773265", "0.60718346", "0.60704184", "0.60676", "0.6061726", "0.60546595", "0.6047973", "0.6047057", "0.6044478", "0.6040582", "0.6033907", "0.6029495" ]
0.0
-1
Handler for new Kafka messages. Writes all new messages to app.lo
function dataHandler(messageSet) { messageSet.forEach( (m) => { console.log(m.message.value.toString('utf8')) co(fs.appendFile('app.log', m.message.value.toString('utf8') + '\r\n')) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onReceivedMessage(messages) {\n this._storeMessages(messages);\n }", "function onMessageArrived(message) {\n console.log(message);\n console.log(\"database\");\n //this condtion is accept greater than 100\n //if true it will call sendXml function\n //this condition check data to handle xml request\n if(parseInt(message.payloadString)>100)\n {\n sendXml();\n }\n console.log(\"onMessageArrived:\" + message.payloadString);\n var today = new Date(),\n h = checkTime(today.getHours()),\n m = checkTime(today.getMinutes()),\n s = checkTime(today.getSeconds());\n \n var data = {\n \"ind\":ind++,\n msg: message.payloadString,\n time: h + \":\" + m + \":\" + s\n\n }\n // db.push(\"/mqtt\", data);\n db.push(\"/mqtt/datas[]\", data, true);\n //db.push(\"/arraytest/myarray[]\",data , true);\n //db.save();\n $scope.temp = parseInt(message.payloadString)\n $scope.logs.push(data)\n $scope.$apply();\n\n\n \n }", "async handleChatMessages(docs) {\n //TODO: List of chat messages, save into local db\n }", "onMessage(messageSet) {\n // console.debug(`Consumer.onMessage messageSet`, messageSet)\n\n // Parses Kafka message strings to JSON\n const msgs = messageSet.map((m) =>\n JSON.parse(m.message.value.toString('utf8'))\n )\n // console.debug(`Consumer.onMessage ${msgs.length} original msgs`, msgs)\n // TODO: data validation? E.g. whitelist\n\n this._broadcast(msgs)\n }", "_ackConnectHandler(messages){\n\t // Add stored messages\n\t if ((messages !== \"\") && (this.messages.length === 0)){\n\t\t for (var x in messages){\n\t\t\t var message = messages[x];\n\t\t\t this.push('messages', {\"user\": message.user, \"message\": message.textMessage, \"time\": message.time});\n\t\t }\n\t } \n }", "function onNewNotifications(data) {\n\t_.map(Object.keys(data), function(ch) {\n\t\t_.map(data[ch], emitData(ch).bind(this));\n\t}.bind(this));\n}", "function _listenForMessages(insertContext) {\n console.log('_listenForMessages');\n // References an existing subscription\n const subscription = pubSubClient.subscription(subscriptionName);\n\n // Create an event handler to handle messages\n let messageCount = 0;\n const messageHandler = message => {\n console.log(`Received message ${message.id}:`);\n console.log(`\\tData: ${message.data}`);\n console.log(`\\tAttributes: ${message.attributes}`);\n messageCount += 1;\n\n var inferenceNotification = JSON.parse(message.data);\n var lockKeyData = inferenceNotification.basePath.split('/');\n var lockKey = path.join(lockKeyData[10], lockKeyData[12], lockKeyData[14]);\n var ws = requestsLock.get(lockKey);\n if (ws){\n\n _sendLogMessage(ws, 'Inference complete!');\n\n var params = (inferenceNotification.reportPath).split('/');\n var inferenceInstance = {};\n inferenceInstance.studyId = params[10];\n inferenceInstance.seriesId = params[12];\n inferenceInstance.instanceId = params[14];\n insertContext.inferenceInstance = inferenceInstance;\n\n _sendAppMessage(ws, 'INFERENCE_COMPLETE', insertContext);\n\n } else {\n console.log('ignoring msg');\n }\n message.ack();\n };\n // Listen for new messages until timeout is hit\n subscription.on('message', messageHandler);\n\n setTimeout(() => {\n subscription.removeListener('message', messageHandler);\n console.log(`${messageCount} message(s) received.`);\n }, timeout * 1000);\n}", "function handle_msg(msg, clock_time)\r\n{\r\n // add to recorded_data if recording is on\r\n\r\n if (recording_on)\r\n {\r\n recorded_records.push(JSON.stringify(msg));\r\n }\r\n\r\n var sensor_id = msg[RECORD_INDEX];\r\n\r\n console.log(\"Got message: \"+JSON.stringify(msg));\r\n\r\n // If an existing entry in 'sensors' has this key, then update\r\n // otherwise create new entry.\r\n if (sensors.hasOwnProperty(sensor_id))\r\n {\r\n update_sensor(msg, clock_time);\r\n }\r\n else\r\n {\r\n init_sensor(msg, clock_time);\r\n }\r\n\r\n}", "function onNewMessage(data) {\n //TODO: update dialogs\n\n if ($state.current.name == 'chatRoom' && $state.params.user_id == data.user.id) { //if user in chat\n pushToToday(data.message);\n } else {\n NewMessageService.show(data);\n }\n\n $rootScope.currentUser.new_messages++;\n $rootScope.$apply();\n }", "handleIncomingMessage(data) {\n\t\tconsole.log(data);\n\t\tlet { messages } = this.state;\n\t\tmessages.push(data);\n\t\tthis.setState({ messages });\n\t\tthis.messagesContainer.current.scrollTop = this.messagesContainer.current.scrollHeight;\n\t}", "loadServerMessages(callback){\n this.initializeFirebaseDb();\n\n //On receive\n const onReceive = (data) => {\n try {\n let message = data.val();\n let formated = {\n _id: data.key,\n text: message.text,\n response: message.response,\n createdAt: new Date(message.createdAt),\n user: {\n _id: message.user._id,\n name: message.user.name\n }\n }\n //Local Save Messages\n if(this.saveMessage(formated)) callback(formated); \n } catch (error) {\n console.log(\"Erro na mensagem\")\n console.log(error)\n }\n \n };\n\n //Ser \"trigger\" on firebase db\n this.messagesPointer.limitToLast(20).on('child_added', onReceive); \n }", "handleMessages(messages) {\n\n }", "_onWrite (entry) {\n this._updateEntries([entry])\n this._decrementSendingMessageCounter()\n }", "function onNewData(channel, msg) {\n\temitData.call(this, channel, msg);\n\tnotifyChannel.call(this, channel, msg);\n}", "function handleKResponse (err, data){\n if (err) {\n console.log('ERROR -> '+ err)\n }\n//If no error counter the responses and close when weve received them all\n if (respCounter === sndMessages.length ){\n producer.close(function (){\n console.log(respCounter + ' Responses received ... Closing')\n })\n }else {respCounter++}\n}", "function onMessageArrived(message) {\n console.log(\"onMessageArrived:\" + message.payloadString);\n write(message.payloadString);\n}", "function onMessageArrived(message) {\n try{\n let topic = message.destinationName;\n const data = JSON.parse(message.payloadString);\n addData(charts[topic], lists[topic], data.Id, { x: Date.now(), y: data.Value });\n }catch(e){\n // nothing\n }\n console.log(\"onMessageArrived:\"+message.payloadString);\n}", "__handleResponse() {\n this.push('messages', {\n author: 'server',\n text: this.response\n });\n }", "async checkNewMessages() {\n\n try {\n await this.messagesDb.connect();\n let messages = await this.messagesDb.getMessagesSince()\n\n if (!messages.length) return false;\n\n // If we have new messages push them out\n // @TODO will need to abstract this out so we can notify locally, globally, and mesh\n let data = await this.getSupportingMessageData(messages, {alert: true});\n this.dataflow.socket.emit('receivedMessages', data);\n this.dataflow.onReceivedMessages(data);\n } catch (e) {\n console.error(e);\n }\n\n }", "function cb_onMessageArrived(message) {\n console.log(\"Message arrived: topic=\" + message.destinationName + \", message=\" + message.payloadString);\n\tvar topic = message.destinationName.split(\"/\");\n\tvar colored_lbg = \"<span style='background-color: LightGray'>\" + topic[0] + \"</span>\"\n\tvar colored_topic = \"<span style='background-color: LightSteelBlue'>\" + topic[1] + \"</span>\"\n\tvar colored_hashid = \"<span style='background-color: Linen'>\" + topic[2] + \"</span>\"\n\tvar payload = message.payloadString.split(\";\");\n\tvar colored_dp = \"<span style='background-color: Linen'>\" + payload[0] + \"</span>\"\n\tvar dt = payload[1].split(\"T\")\n\tdt = dt[0] + ' ' + dt[1].split(\"Z\")[0].split(\".\")[0]\n\t\n\t$('#messages').prepend('<li><span style=\"font-size: 0.8rem\">' + dt + \" - \" + colored_lbg + '/' + colored_topic + '/' + colored_hashid + \": \" + colored_dp + ' ' + payload[2] + '</span></li>');\n}", "function appendNewMessage(msg) {\n // take the incoming message and push it into the Vue instance\n // into the messages array\n console.log(msg)\n vm.list.push(msg);\n }", "function processMessagesCreatedEventWithHandler(handler, originalResponse, event, data) {\n\t\t// Check the event is well formed\n\t\tif (!data.id) {\n\t\t\tconsole.log(\"no message id, aborting...\");\n\t\t\toriginalResponse.status(500).json({'message': 'could not retreive the message contents, no message id there !'});\n\t\t\treturn;\n\t\t}\n\t\tvar messageId = data.id;\n\n\t\t// Retreive text for message id\n\t\tconsole.log(\"requesting message contents\");\n\t\tvar options = {\n\t\t\t\t\t\t'method': 'GET',\n\t\t\t\t\t\t'hostname': 'api.ciscospark.com',\n\t\t\t\t\t\t'path': '/v1/messages/' + messageId,\n\t\t\t\t\t\t'headers': {'authorization': 'Bearer ' + self.config.token}\n\t\t\t\t\t};\n\t\tvar req = https.request(options, function (response) {\n\t\t\tconsole.log('assembling message');\n\t\t\tvar chunks = [];\n\t\t\tresponse.on('data', function (chunk) {\n\t\t\t\tchunks.push(chunk);\n\t\t\t});\n\t\t\tresponse.on(\"end\", function () {\n\t\t\t\tif (response.statusCode != 200) {\n\t\t\t\t\tconsole.log(\"status code: \" + response.statusCode + \" when retreiving message with id: \" + messageId);\n\t\t\t\t\toriginalResponse.status(500).json({'message': 'status code: ' + response.statusCode + ' when retreiving message with id:' + messageId});\n\t\t\t\t\t\n\t\t\t\t\t// August 2016: 404 happens when the webhook has been created with a different token from the bot\n\t\t\t\t\tif (response.statusCode == 404) {\n\t\t\t\t\t\tconsole.log(\"WARNING: Did you create the Webhook: \" + event.id + \" with the same token you configured this bot with ? Not sure !\");\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t// Robustify\n\t\t\t\tif (!chunks) {\n\t\t\t\t\tconsole.log(\"unexpected payload: empty\");\n\t\t\t\t\t// let's consider this as a satisfying situation, it is simply a message structure we do not support\n\t\t\t\t\t// we do not want the webhook to resend us the message again and again \n\t\t\t\t\t// => 200 OK: got it and we do not process further \n\t\t\t\t\toriginalResponse.status(200).json({'message': 'unexpected payload for new message with id:' + messageId});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar payload = JSON.parse(Buffer.concat(chunks));\n\t\t\t\tvar message = validateMessage(payload);\n\t\t\t\tif (!message) {\n\t\t\t\t\tconsole.log(\"unexpected message format, aborting...\");\n\t\t\t\t\t// let's consider this as a satisfying situation, it is simply a message structure we do not support\n\t\t\t\t\t// we do not want the webhook to resend us the message again and again \n\t\t\t\t\t// => 200 OK: got it and we do not process further \n\t\t\t\t\toriginalResponse.status(200).json({'message': 'no content to process for new message with id:' + messageId});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// event is ready to be processed, let's respond to Spark without waiting whatever the processing outcome will be\n\t\t\t\toriginalResponse.status(200).json({'message': 'message is being processed by webhook'});\n\n\t\t\t\t// processing happens now\n\t\t\t\tconsole.log(\"calling handler to process 'Message/Created' event\");\n\t\t\t\t//console.log(\"now processing 'Messages/Created' event with contents: \" + JSON.stringify(message)); // for debugging purpose only\n\n\t\t\t\t// if we're a bot account and the message is emitted in a \"group\" room, the message contains the bot display name (or a fraction of it)\n\t\t\t\t// removing the bot name (or fraction) can help provide homogeneous behavior in direct & group rooms, as well as Outgoing integrations\n\t\t\t\tif (self.config.trimBotMention && (message.roomType == \"group\") && (self.accountType == \"BOT\")) {\n\t\t\t\t\tconsole.log(\"trying to homogenize message\");\n\t\t\t\t\tvar trimmed = trimBotName(message.text, self.account.displayName);\n\t\t\t\t\tmessage.originalText = message.text;\n\t\t\t\t\tmessage.text = trimmed;\n\t\t\t\t}\n\n\t\t\t\thandler(message);\n\t\t\t});\n\n\t\t});\n\t\treq.on('error', function(err) {\n \t\t\tconsole.log(\"cannot retreive message with id: \" + messageId + \", error: \" + err);\n\t\t\toriginalResponse.status(500).json({'message': 'could not retreive the text of the message with id:' + messageId});\n\t\t\treturn;\n\t\t});\n\t\treq.end();\n\t}", "function processLastMessagesResponse(data){\n let { pkfp, topic, messages, before } = data;\n let topicUXData = uxTopics[pkfp]\n console.log(\"PROCESSING LAST MESSAGES LOADED RESPONSE\");\n\n let container = getTopicMessagesContainer(pkfp);\n let messagesWindow = domUtil.$(\".messages-window\", container)\n\n if(!messages || messages.length === 0) return;\n\n\n //Here excluding all messages that have been already appended\n messages = messages.filter(message=> !topicUXData.messagesLoadedIds.has(message.header.id))\n\n if(messages.length ===0) {\n //nothing to append.\n return\n }\n\n let willScroll = isScrollingRequired(messagesWindow)\n\n for(let message of messages){\n\n\n let authorAlias = topic.getParticipantAlias(message.header.author)\n appendMessageToChat({\n nickname: message.header.nickname,\n alias: Common.formatParticipantAlias(topic.pkfp, message.header.author, authorAlias),\n body: message.body,\n timestamp: message.header.timestamp,\n pkfp: message.header.author,\n messageID: message.header.id,\n service: message.header.service,\n private: message.header.private,\n recipient: message.header.recipient,\n attachments: message.attachments\n }, pkfp, messagesWindow, true);\n }\n\n uxTopics[pkfp].earliesLoadedMessage = messages[messages.length - 1].header.id;\n\n if(willScroll){\n Scroll.scrollDown(messagesWindow)\n }\n\n}", "handleMessage(message) {\r\n console.log('Received message', message.payloadString);\r\n this.callbacks.forEach((callback) => callback(message));\r\n }", "onMessage(event) {\n const message = JSON.parse(event.data);\n const topicId = message[TOPIC_KEY];\n const topicCallback = this.topics[topicId];\n\n if (topicId && topicCallback) {\n topicCallback(message.payload);\n } else if (topicId) {\n // eslint-disable-next-line no-console\n console.error(`Could not find topic ${topicId}. Dropping message.`, event);\n } else {\n // consider this some sort of broadcast from the server\n // eslint-disable-next-line no-console\n console.log('Unknown message from server', message, event);\n }\n }", "function messageChangeHandler(/*msgs*/) {\n this.views.messages.render(this.model.messages);\n var count = document.querySelector('footer .messages-count');\n //console.log(this.model.messages.length + ' message' + (this.model.messages.length > 1 ? 's' : ''));\n count.textContent = 'Showing ' \n + this.model.messages.length.toLocaleString(this.model.locale)\n + ' message' \n + (this.model.messages.length > 1 ? 's' : '')\n + ' of ' + this.model.total.toLocaleString(this.model.locale);\n }", "function storeMessages(){\n if (stagedMessages && stagedMessages.length > 0){\n var q1 = 'INSERT INTO messages (date, username, message) VALUES';\n\n //TODO: update this to deal with SQL injection .e.g. setting a username to '; DROP TABLE ...'\n\n var msgCount = stagedMessages.length;\n var i = 0;\n stagedMessages.map(function(msg){\n q1 += \"('\"+stripDate(msg.date)+\"', '\"+msg.author+\"', '\"+msg.message+ \"')\";\n if (i++ != (msgCount-1)){\n q1+=\",\";\n }\n });\n q1 += ';';\n\n db.query(q1, function(done){ if(!done){\n debug.log('serverDB: storeMessages: error');} });\n stagedMessages = [];\n }\n}", "function handler(event, context, callback) {\n // Decode and format the incoming records,\n const records = event.Records\n .map(decode)\n // and discard the ones we can't parse.\n .filter(Boolean);\n\n if (records.length === 0) {\n console.log(\"No valid records!\");\n callback(null, \"Early exit: No valid records\");\n return;\n }\n\n // If we're under test, the test will pass in stub clients in context.stubs\n const stubs = context.stubs;\n\n console.log('records: ' + records);\n console.log(records);\n console.log('stubs: ' + stubs);\n\n let firehose = null;\n let publisherPromise = null;\n\n if (stubs) {\n firehose = stubs.firehose;\n publisherPromise = stubs.redisPublisher;\n }\n\n else {\n firehose = new aws.Firehose();\n publisherPromise = getConnectedRedisClient(callback);\n }\n\n console.log(firehose);\n\n // Kick off the publication steps.\n Promise.all([\n pushToFirehose(records, firehose),\n pushToSocketServer(records, publisherPromise)\n ])\n // Claim victory...\n .then(results => {\n // pushToSocketServer resolves with number of observations published\n const msg = `Published ${records.length} records`;\n callback(null, msg);\n })\n // or propagate the error.\n .catch(callback);\n}", "function handle_request(msg, callback) {\n\n console.log(\"\\n\\nInside kafka backend for booking \")\n\n\n\n\nconsole.log(msg.cid)\nconsole.log(msg.traveler)\n userinfos.updateOne(\n {\n $and: [{ email: msg.traveler },\n { 'conversation.cid': msg.cid }]\n },\n {\n $push: {\n 'conversation.$.msg': msg.msg\n }\n },\n { upsert: true },\n function (err1, result1) {\n if (err1) {\n console.log(\"error in updating, at kafka\");\n console.log(err1);\n callback(err1, \"Error in updating from database at kafka11111111111111.\");\n } else {\n userinfos.updateOne(\n {\n $and: [{ _id: msg.ownerId },\n { 'conversation.cid': msg.cid }]\n },\n {\n $push: {\n 'conversation.$.msg': msg.msg\n }\n },\n { upsert: true },\n function (err1, result1) {\n if (err1) {\n console.log(\"error in updating, at kafka\");\n console.log(err);\n callback(err, \"Error in updating from database at kafka.\");\n } else {\n console.log(result1)\n let data = {\n status: 1,\n msg: \"Successfully booked\",\n // info: information\n }\n console.log(\"successfully booked the property\")\n callback(null, data)\n }\n });\n }\n });\n\n\n\n\n\n\n // userinfos.updateOne(\n // { email: msg.email },\n // {\n // $push: {\n // pastPropertyList: msg.property\n\n // }\n // },\n // { upsert: true },\n // function (err, result) {\n // if (err) {\n // console.log(\"error in updating, at kafka\");\n // console.log(err);\n // callback(err, \"Error in updating from database at kafka.\");\n // } else {\n // // console.log(result)\n // if (msg.property && msg.property.ownderId) {\n\n // userinfos.updateOne(\n // {\n // $and: [{ _id: msg.property.ownderId },\n // { 'propertyList.street': msg.property.street }]\n // },\n // {\n // $push: {\n // 'propertyList.$.booked': msg.property.booked\n // }\n // },\n // { upsert: true },\n // function (err1, result1) {\n // if (err1) {\n // console.log(\"error in updating, at kafka\");\n // console.log(err);\n // callback(err, \"Error in updating from database at kafka.\");\n // } else {\n // // console.log(result1)\n // let data = {\n // status: 1,\n // msg: \"Successfully booked\",\n // // info: information\n // }\n // console.log(\"successfully booked the property\")\n // callback(null, data)\n // }\n // });\n // }\n // else {\n // console.log(\"error in updating, at kafka\");\n // console.log(err);\n // callback(err, \"Error in updating from database at kafka.\");\n // }\n // }\n // });\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}", "function processPostRequest(req, res) {\n const msg = JSON.parse(req.body);\n console.log(\"incoming message: \" + msg.message);\n storage.messages.push(msg);\n\n res.writeHead(200, headers);\n res.end();\n }", "function handleCommentGetterMessage(msg) {\n switch (msg.event) {\n case 'finishOnCreate':\n console.log(msg.data);\n break;\n \n case 'finishOnDelete':\n console.log('finish on delete', msg.data);\n break;\n\n case 'finishOnDestroy':\n console.log('finish on destroy', msg.data);\n break;\n\n case 'sendReplyEvent':\n // send onReply to Kafka\n console.log('prepare to send event reply');\n\t\t\tconsole.log(msg.data.comments);\n\t\t\tconsole.log(msg.data.comments.length);\n\t\t\tmsg.data.comments.forEach(function(comment) {\n\t\t\t\tsendMessageToKafka({\n\t\t\t\t\tdata: comment\n\t\t\t\t});\n\t\t\t});\n break;\n \n default:\n console.log('invalid getter messsage');\n break;\n }\n}", "_handle(data) {\n // TODO: json-schema validation of received message- should be pretty straight-forward\n // and will allow better documentation of the API\n let msg;\n try {\n msg = deserialise(data);\n } catch (err) {\n this._logger.push({ data }).log('Couldn\\'t parse received message');\n this.send(build.ERROR.NOTIFY.JSON_PARSE_ERROR());\n }\n this._logger.push({ msg }).log('Handling received message');\n switch (msg.msg) {\n case MESSAGE.CONFIGURATION:\n switch (msg.verb) {\n case VERB.NOTIFY:\n case VERB.PATCH: {\n const dup = JSON.parse(JSON.stringify(this._appConfig)); // fast-json-patch explicitly mutates\n jsonPatch.applyPatch(dup, msg.data);\n this._logger.push({ oldConf: this._appConfig, newConf: dup }).log('Emitting new configuration');\n this.emit(EVENT.RECONFIGURE, dup);\n break;\n }\n default:\n this.send(build.ERROR.NOTIFY.UNSUPPORTED_VERB(msg.id));\n break;\n }\n break;\n default:\n this.send(build.ERROR.NOTIFY.UNSUPPORTED_MESSAGE(msg.id));\n break;\n }\n\n }", "sendNewMessages () {\n if (this.socket) {\n const serializeJobs = this.messages.map(message => message.toTransferObject())\n Promise.all(serializeJobs)\n .then(serializedMessages => {\n this.socket.emit('messages', {\n hasMessages: this.hasMessages(),\n messages: serializedMessages\n })\n })\n .catch(e => console.error('Failed to send new messages: ', e))\n }\n }", "addCallbacks(messagesCallback, newMessageCallback){\n this.callbacks['messages'] = messagesCallback;\n this.callbacks['new_message'] = newMessageCallback;\n }", "run(){\n //Determining right strategy for getting messages from topic\n let getter = this.lastId ? new MessageGetterBeforeLastIDStrategy(this.topic, this.lastId, this.howMany):\n new MessageGetterLastStrategy(this.topic, this.howMany)\n\n //Getting messages\n let messages = getter.get()\n\n //updating remaining messages count\n this.howMany -= messages.length;\n\n //if there are any messages at all\n if(messages.length > 0){\n //Giving them to writer\n let writer = this.outWriterFactory.make()\n\n let response = {\n pkfp: this.topic.pkfp,\n messages: messages,\n before: this.lastId,\n topic: this.topic\n }\n\n writer.output(response)\n\n //Updating last written message id\n this.lastId = messages[messages.length-1].header.id;\n }\n\n //Checking whether request is fulfilled\n if(new FulfilledCondition(this.topic, this.howMany).isFulfilled()){\n //If request fulfilled - unsubscribing from bus and terminating\n console.log(\"Request fulfilled!\");\n this.uxBus.off(this);\n }\n }", "setMessageHandler(handler) {\n let query = this.collection\n .orderBy('timestamp', 'desc')\n .limit(MessageHandler.MESSAGE_LIMIT);\n\n query.onSnapshot(snapshot => {\n snapshot.docChanges().forEach(change => {\n let message = change.doc.data();\n if(message.timestamp === null) return;\n handler(change.doc.id, message.timestamp, message.name, message.text);\n });\n });\n }", "function scribeAppender(category, layout, client) {\n var isReady = false;\n var STORED_MESSAGES_LIMIT = 1000; // number of messages we store until scribe is fully connected\n var storedMessages = [];\n\n client.open(function(err){\n\n if(err) {\n return console.log(err);\n }\n while (storedMessages.length) {\n var msg = storedMessages.shift();\n client.send(category, msg);\n }\n isReady = true;\n });\n\n client.on('error', function(err){\n console.log(\"Couldn't connect to scribe: \", err.code);\n });\n\n if(!layout) {\n layout = passThrough;\n }\n\n return function(loggingEvent) {\n var msg = layout(loggingEvent);\n if (isReady) {\n client.send(category, msg);\n } else if (storedMessages.length < STORED_MESSAGES_LIMIT) {\n storedMessages.push(msg);\n }\n };\n }", "function onMessageHandler(target, context, msg, self) {\n console.log({ target, context, msg, self });\n app.service('messages').create({\n user: context['display-name'],\n color: context.color,\n text: msg,\n });\n}", "function processReceivedMessages(messages) {\n let message_list = chat_messages.get(initiated_chat_id);\n let message_type = chat_messages_type.get(initiated_chat_id);\n\n if (!is_page_in_view && messages.length > 0) {\n // play message notification sound\n sound.play();\n }\n\n // add messages to list\n for (let i = 0; i < messages.length; i++) {\n message_list.push(messages[i]);\n message_type.push(CLIENT_MSG);\n }\n\n // check to add message to chat window\n if (current_chat_id == initiated_chat_id) {\n let prev_sent_msg_time = 0;\n let curr_sent_msg_time;\n\n for (let i = 0; i < messages.length; i++) {\n curr_sent_msg_time = messages[i].time;\n\n // check to create header or tail message\n if ((curr_sent_msg_time - prev_sent_msg_time) > 60) { // create header message\n chat_window_msg_list_elem.appendChild(createClientHeaderMessageBox(messages[i]));\n\n } else { // create tail message\n chat_window_msg_list_elem.appendChild(createClientTailMessageBox(messages[i]));\n }\n\n prev_sent_msg_time = curr_sent_msg_time;\n }\n }\n }", "onMessageArrived(topic,message) {\n\t\tlet that = this;\n\t\tlet parts = topic ? topic.split(\"/\") : [];\n if (topic === \"hermod/default/tts/say\") {\n\t\t\tconsole.log('DUMPME')\n\t\t\tconsole.log(this.eventCallbackFunctions);\n\t\t} \n\t\tlet payload = null\n\t\tif (parts.length > 0 && parts[0] === \"hermod\") {\n // Audio Messages pass through message body direct\n if (parts.length > 3 && (parts[2]===\"speaker\"&& parts[3]===\"play\" )) {\n\t\t\t\tpayload = message;\n\t\t\t\tconsole.log('speaker play')\n } else if (parts.length > 3 && (parts[2]===\"microphone\" && parts[3]===\"audio\")) {\n\t\t\t\tpayload = message;\n\t\t\t} else {\n\t\t\t\t// only log non audio\n\t\t\t\t//console.log(['message '+topic,message.toString()]);\n\t\t\t\ttry {\n payload = JSON.parse(message.toString()); \n } catch (e) {\n\t\t\t\t console.log(['JSON PARSE ERROR',message.toString()]);\n\t\t\t\t payload = {}\n }\n console.log(['message payload '+topic,payload]);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tlet siteId = parts[1];\n\t\t\tlet callbacks = this.subscriptions[topic];\n\t\t\tif (callbacks) {\n\t\t\t\tfor (var subscriptionId in callbacks) {\n\t\t\t\t\tlet value = callbacks[subscriptionId]\n\t\t\t\t\tvalue.callBack.bind(that)(topic,siteId,payload);\n\t\t\t\t\tif (value.oneOff) {\n\t\t\t\t\t\tthis.removeCallbackById(subscriptionId)\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\t\n\t\n }\n }", "function onNewMessage(myId, msg, msgtype)\n{\n\tm.startComputation();\n\tthis.textHistory().push([myId, msg, msgtype]);\n\tm.endComputation();\n}", "onReceivedMessage(messages) {\n if (this._isMounted) {\n this.setState((previousState) => {\n return {\n messages: GiftedChat.append(previousState.messages, messages),\n };\n });\n this.updateTimeOfLastReadMessage();\n }\n }", "handleMessages(token, lastMessageId, messageFn) {\n let lastReadId = lastMessageId\n\n const msgFetch = async () => {\n const messages = await this.messages.getMessages(token, lastReadId)\n for (const {msg, msgId} of messages) {\n if (msgId > lastReadId)\n {\n messageFn(msg, msgId)\n lastReadId = msgId\n }\n }\n }\n // initial fetch for messages\n msgFetch()\n return this.messages.subscribeMessage(token, msgFetch)\n }", "_onMessage (msg) {\n const { data, from, topicIDs } = msg\n let key\n try {\n key = topicToKey(topicIDs[0])\n } catch (err) {\n log.error(err)\n return\n }\n\n log(`message received for ${key} topic`)\n\n // Stop if the message is from the peer (it already stored it while publishing to pubsub)\n if (from === this._peerId.toB58String()) {\n log(`message discarded as it is from the same peer`)\n return\n }\n\n if (this._handleSubscriptionKeyFn) {\n this._handleSubscriptionKeyFn(key, (err, res) => {\n if (err) {\n log.error('message discarded by the subscriptionKeyFn')\n return\n }\n\n this._storeIfSubscriptionIsBetter(res, data)\n })\n } else {\n this._storeIfSubscriptionIsBetter(key, data)\n }\n }", "received(message) {\n // Called when there's incoming data on the websocket for this channel\n return store.dispatch(addMessage(message));\n\n }", "function publish(msg, cb) {\n msg.seq = ++state.seq\n feed.add('eco', msgpack.encode(msg), function(err, msg) {\n if (err) return cb(err)\n applyMessage(msg, cb)\n })\n }", "function on_message(m) {\n console.log('message received'); \n // console.log(m);\n msg_from_stomp = JSON.parse(m.body);\n console.log(msg_from_stomp);\n\n if ($scope.inOutStatus.length) {\n var already_exist = 0;\n for (var i = 0; i < $scope.inOutStatus.length; i++) {\n \n if ($scope.inOutStatus[i].kid_name==msg_from_stomp.kid_name) {\n $scope.inOutStatus[i].datetime = msg_from_stomp.datetime;\n $scope.inOutStatus[i].status = msg_from_stomp.status;\n already_exist = 1;\n }\n }\n if (!already_exist) {\n $scope.inOutStatus.push(msg_from_stomp);\n } \n\n }else{\n $scope.inOutStatus.push(msg_from_stomp);\n }\n console.log($scope.inOutStatus);\n $scope.$apply();\n\n \n \n }", "startListening() {\n // If this object doesn't have a uid it could potentially create problematic queries, so return.\n if (this.uid === undefined) return;\n // Get a reference to where the messages are stored.\n const ref = Fetch.getMessagesReference(this.uid).child(\"messages\");\n // Add a handler for when a message is added.\n ref.on(\"child_added\", snapshot => {\n const message = snapshot.val();\n if (!message || !message.content) return;\n this.messages = this.messages || {};\n if (!this.messages[message.uid]) {\n this.emit(\"new_message\", message);\n }\n this.messages[message.uid] = message;\n this.emit(\"message\", message);\n this.emit(\"change\", this.messages);\n });\n // Add a handler for when a message is changed, e.g. edited.\n ref.on(\"child_changed\", snapshot => {\n const message = snapshot.val();\n if (!message || !message.content) return;\n this.messages = this.messages || {};\n this.messages[message.uid] = message;\n this.emit(\"edit\", message);\n this.emit(\"change\", this.messages);\n });\n // Add a handler for when a message is deleted.\n ref.on(\"child_removed\", snapshot => {\n const message = snapshot.val();\n if (!message || !message.content) return;\n this.messages[message.uid] = null;\n delete this.messages[message.uid];\n this.emit(\"delete\", message);\n this.emit(\"change\", this.messages);\n });\n }", "function onMessageIn(call, callback) {\n var request = call.request;\n\n // Process the business logic\n console.log(\"OnMessageIn printout: \",request)\n var emptyRes = {}\n insertMsg = {\n \"_id\": ObjectID(request.messageId),\n \"timestamp\": request.timestamp,\n \"roomId\": ObjectID(request.roomId),\n \"userId\": ObjectID(request.userId),\n \"clientUID\": request.clientUid,\n \"data\": request.data,\n \"type\": request.type,\n }\n \n MongoClient.connect(url, function(err, db) {\n if (err) throw err;\n var dbo = db.db(\"backup\");\n \n dbo.collection(\"message\").insertOne(insertMsg, function(err, res) {\n if (err) throw err;\n console.log(\"1 document inserted\");\n });\n\n });\n\n\n\n\n callback(null, emptyRes);\n}", "static listenSocketEvents() {\n Socket.shared.on(\"wallet:updated\", (data) => {\n let logger = Logger.create(\"wallet:updated\");\n logger.info(\"enter\", data);\n\n Redux.dispatch(Wallet.actions.walletUpdatedEvent(data));\n });\n }", "function handleChatMessages(data) {\n // Check whether the message is private.\n if(data.private) {\n $scope.privateChat = {\n state: true,\n contact: data.user\n };\n $scope.privateMessages[data.user.id] = $scope.privateMessages[data.user.id] ? $scope.privateMessages[data.user.id] : [];\n\n // If there is no chat window for private chat with the client, creates a new window.\n if ($scope.privateChats.filter(chat => chat.id === data.user.id).length == 0) {\n $scope.privateChats.push(data.user);\n }\n\n // Update the view with new message.\n $scope.$apply(() => {addPrivateChatMessage({room: data.user.id, username: data.user.username, message: data.message});});\n chatNotify(data.user.username, 'New message received!');\n } else {\n $scope.$apply(() => {addChatMessage(data);});\n chatNotify(data.username, 'New message received!');\n }\n }", "function onMessage(message) {\t\n\tvar topic = message.destinationName;\n\n\t// find any matching subscriptions in our map\n\tvar matchingSubs = findMatchingSubs(topic);\n\n\t// did we find any?\n\tif (matchingSubs.length === 0) {\n\t\tconsole.log(\"don't seem to have matching sub...\");\n\t\treturn;\n\t}\t\t\n\n\t// for each matching sub we have, add the message to the\n\t// appropriate text area.\n\tfor (var i=0; i<matchingSubs.length; i++) {\n\t\t// grab the entry from the map\n\t\tvar entry = subscriptions[matchingSubs[i]];\n\t\tvar textArea = entry.text;\n\t\t// grab the current text (i.e all the messages displayed so far)\n\t\tvar current = textArea.value;\t\t\n\n\t\t// if we are already displaying 500 messages, reset...\n\t\tif (entry.msgCount === 500) {\n\t\t\tcurrent = \"\";\n\t\t\tentry.msgCount = 0;\n\t\t}\n\n\t\t// stick the most recent message at the top.\n\t\t// append a newline, so that each message is on\n\t\t// its own line.\n\t\tvar newText = message.payloadString + \"\\n\";\n\t\t// then append the existing messages\n\t\tnewText += current;\n\t\ttextArea.value = newText;\n\t\t// note how many messages we are now displaying\n\t\tentry.msgCount++;\n\t}\t\n}", "function payloadHandler(payload) {\n \n switch(payload.jaxl) {\n case 'authFailed':\n {\n jaxl.setConnected(false);\n break;\n }\n case 'connected':\n {\n jaxl.setConnected(true);\n jaxl.setJid(payload.jid);\n jaxl.ping();\n \n break;\n }\n case 'disconnected':\n {\n jaxl.setConnected(false);\n jaxl.setDisconnecting(false);\n console.log('disconnect :<');\n break;\n }\n case 'message':\n {\n appendMessage(jaxl.urlDecode(payload.message));\n jaxl.ping();\n break;\n }\n case 'presence':\n {\n appendMessage(jaxl.urlDecode(payload.presence));\n \n onlineUsers[payload.statusChange.user] = payload.statusChange.status;\n $('#onlineUsers').replaceWith(createUserList(onlineUsers));\n \n console.log(onlineUsers);\n \n \n jaxl.ping();\n break;\n }\n case 'pinged':\n {\n jaxl.ping();\n break;\n }\n }\n }", "function socket_handler(socket, mqtt) {\n\t// Called when a client connects\n\tmqtt.on('clientConnected', client => {\n\tconsole.log(\"inside client connected\");\n\t\tsocket.emit('debug', {\n\t\t\ttype: 'CLIENT', msg: 'New client connected: ' + client.id\n\t\t});\n\t});\n\n\t// Called when a client disconnects\n\tmqtt.on('clientDisconnected', client => {\n\t\tconsole.log(\"inside client disconnected\");\n\t\tsocket.emit('debug', {\n\t\t\ttype: 'CLIENT', msg: 'Client \"' + client.id + '\" has disconnected'\n\t\t});\n\t});\n\n\t\n\n\t\n\t// Called when a client publishes data\n\tmqtt.on('published', (data, client) => {\n\t\t\t\n\t\t\t//var x = topic;\n\t\tif (!client) return;\n\t\t//console.log(\"data is\" +data.topic);\n\n\t\tconsole.log(\"inside client published\"+data+\" --client:\"+ \"\"+client);\n\t\t\tvar local_topic = \"\"+data.topic;\n\t\t\tconsole.log(\"incoming topic is: \"+local_topic);\n\n\t\tconsole.log(\"inside locl storage:\"+localStorage.get(local_topic));\t\t\t\n\n\t\t\n\t\tif(localStorage.get(local_topic) == null)\n\t\t{\n\t\t\tconsole.log(\"local storage is null\");\n\t\t\t\t\tlocalStorage.set(local_topic, 2);\n\t\t}\n\t\t\n\telse\n\t{\n\t\n\t\tconsole.log(\"count is \" + localStorage.get(local_topic));\n\t\t\n\t\tlocalStorage.set(local_topic , localStorage.get(local_topic)+1);\n\t\t\t\n\t\t\tif(localStorage.get(local_topic) >threshold){\n\t\t\t\t\n\t\t\t\t//Message for above the threshold value\n\t\t\t\tvar newTopic = \"ifAboveThreshold_\"+local_topic;\n\t\t\t\tconsole.log(\"new topic:\"+newTopic);\n\t\t\t\tvar message = {\n\t\t\t\ttopic : newTopic,\n\t\t\t\tpayload : 'red',\n\t\t\t\tqos :0,\n\t\t\t\tretain: false\n\t\t\t};\t\t\t\n\n\t\t\t\tconsole.log(\"message to be publshed \"+message);\n\n\t\t\t\tmqtt.publish(message, function(){\n\t\t\t\tconsole.log(\"local storage published\");\n\t\t\t});\n\t\t\t}\n\t}\t\n\n\t\tconsole.log(\"current count for buttom:\"+localStorage.get(local_topic));\n\t\t\t\t\t\t\n\t\t socket.emit('debug', {\n \t\t\ttype: 'PUBLISH', \n \t\t\tmsg: 'Client \"' + client.id + '\" published \"' + JSON.stringify(data) + '\"',\n \t\t\tkey: local_topic,\n \t\t\tpayload: localStorage.get(local_topic)\n \t\t});\n\tconsole.log(\"done!\");\n\n});\n\n\t// Called when a client subscribes\n\tmqtt.on('subscribed', (topic, client) => {\n\t\tconsole.log(\"inside client subscribed\");\n\t\tconsole.log(\"subscribed to topic\"+topic+\"\");\n\t\tif (!client) return;\n\n\t\tsocket.emit('debug', {\n\t\t\ttype: 'SUBSCRIBE',\n\t\t\tmsg: 'Client \"' + client.id + '\" subscribed to \"' + topic + '\"'\n\t\t});\n\t});\n\n\t// Called when a client unsubscribes\n\tmqtt.on('unsubscribed', (topic, client) => {\n\t\tconsole.log(\"inside client unsub\");\n\t\tif (!client) return;\n\n\t\tsocket.emit('debug', {\n\t\t\ttype: 'SUBSCRIBE',\n\t\t\tmsg: 'Client \"' + client.id + '\" unsubscribed from \"' + topic + '\"'\n\t\t});\n\t});\n}", "startEventListener() {\n Utils.contract.MessagePosted().watch((err, { result }) => {\n if(err)\n return console.error('Failed to bind event listener:', err);\n\n console.log('Detected new message:', result.id);\n this.fetchMessage(+result.id);\n });\n }", "generateMessage (callback) {\n\t\tthis.updatedAt = Date.now();\n\t\tthis.updateStream(error => {\n\t\t\tif (error) { return callback(error); }\n\t\t\tthis.message = {\n\t\t\t\tuser: {\n\t\t\t\t\t_id: this.currentUser.user.id,\t// DEPRECATE ME\n\t\t\t\t\tid: this.currentUser.user.id,\n\t\t\t\t\t$unset: {\n\t\t\t\t\t\t[`lastReads.${this.stream.id}`]: true\n\t\t\t\t\t},\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tversion: 7\n\t\t\t\t\t},\n\t\t\t\t\t$version: {\n\t\t\t\t\t\tbefore: 6,\n\t\t\t\t\t\tafter: 7\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tcallback();\n\t\t});\n\t}", "_newMessage(message) {\n this.messages.push(message);\n this.emitChange();\n }", "function onMessage(evt) {\n\t\t// Update the marks on the map\n\t\tvar data = JSON.parse(evt);\n\t\tswitch(data.type) {\n\t\t\tcase 'location':\n\t\t\t\t//noty({text: 'Incoming: New coordinates for geolocations.'});\n\t\t\t\tif (controller == \"Geolocations\") {\n\t\t\t\t\tupdateMarkers(data);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\n\t\t\tcase 'update':\n\t\t\t\tif (data.section == \"events\") {\n\t\t\t\t\tnoty({text: 'Your event '+data.title+\" has been updated!\", type: 'information'});\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'history':\n\t\t\t\tincomingChatMessage(data);\n\t\t\t\tbreak;\n\n\t\t\tcase 'message':\n\t\t\t\tincomingChatMessage(data);\n\t\t\t\tbreak;\n\t\t}\n\t}", "function processMessages(topic, message) {\n switch(topic) {\n // Input device has sent keep-alive message\n case inputDeviceStatusTopic:\n if(!inputDeviceOnline) {\n inputDeviceOnline = true;\n displayDeviceStatus();\n }\n\n break;\n\n // Sensor device has sent sensor data\n case inputDeviceDistanceSensorTopic:\n case inputDeviceTemperatureSensorTopic:\n case inputDeviceLightSensorTopic:\n let nextValue = message;\n\n // Real MQTT messages are UTF-8 encoded, so we need to decode them\n if(!mockDataEnabled) {\n let nextValue = new TextDecoder('utf-8').decode(nextValue);\n }\n\n // Push next value to appropriate sensor data object\n currentSensorData.labels.push(Date.now());\n currentSensorData.data.push(parseInt(message));\n\n // Remove first data point when we have too many\n if(currentSensorData.labels.length >= maxReadings) {\n currentSensorData.labels.shift();\n currentSensorData.data.shift();\n }\n\n // Inject current sensor data into chart data object\n dataObject.labels = currentSensorData.labels;\n dataObject.datasets[0].data = currentSensorData.data;\n\n // Only refresh the UI at the interval requested by the user\n if(Date.now() > lastDisplayUpdate + displayInterval && !isPaused) {\n\n // Re-initialize chart to display new data\n liveChart = new Chart(chartCanvasEl, {\n type: 'line',\n data: dataObject,\n options: optionsObject\n });\n\n // Create new row in visually-hidden data table\n let row = document.createElement('tr');\n row.innerHTML = `\n <td>${nextValue}</td>\n <td>${new Date()}</td>\n `;\n\n let tbody = document.querySelector('#sensor-data tbody');\n let firstRow = tbody.querySelector('tr');\n\n // Insert new row into the data table\n if(firstRow == undefined) {\n tbody.append(row);\n } else {\n tbody.insertBefore(row, firstRow);\n }\n\n // Remove oldest sensor reading when maximum threshold reached\n if(tbody.children.length >= maxReadings) {\n tbody.children[tbody.children.length - 1].remove();\n }\n\n // Display this new sensor value on the \"last reading\" highlight block\n displaySensorReading();\n\n // Update last display refresh timestamp\n lastDisplayUpdate = Date.now();\n }\n\n // Add to total reading count for this sensor\n switch(currentSensor) {\n case 'distance':\n totalReadings.distance++;\n break;\n\n case 'temperature':\n totalReadings.temperature++;\n break;\n\n case 'light':\n totalReadings.light++;\n break;\n }\n\n displayTotalReadings();\n\n break;\n\n // Output device has sent keep-alive message\n case outputDeviceStatusTopic:\n if(!outputDeviceOnline) {\n outputDeviceOnline = true;\n displayDeviceStatus();\n }\n\n break;\n }\n}", "function onNodeInserted(event) {\r\n\t// If we have a new incoming message cluster\r\n\t// (i.e., one that would have the 'Alan:' prefix)\r\n\tif (event.target.getAttribute('role') == 'chatMessage' &&\r\n\t\tevent.target.getAttribute('chat-dir') == 't') {\r\n\r\n\t\t// Growl using text in the last child node (it's really the only node)\r\n\t\tgrowlChatMessage(event.target.lastChild);\r\n\t\t\r\n\t// If we have a new incoming message within an existing cluster\r\n\t// (i.e., just the message, 'Alan:' already showed up previously)\r\n\t} else if (event.target.parentNode.getAttribute('role') == 'chatMessage' &&\r\n\t\t\t event.target.parentNode.getAttribute('chat-dir') == 't') {\r\n\t\t\r\n\t\t// Growl using text in the current node (message node)\r\n\t\tgrowlChatMessage(event.target);\r\n\r\n\t// If a new chat window is created by this incoming message\r\n\t} else if (event.target.getAttribute('role') == 'log' &&\r\n\t\t\t event.target.firstChild.lastChild.getAttribute('chat-dir') == 't') {\r\n\r\n\t\t// Growl using text in the latest message node\r\n\t\tgrowlChatMessage(event.target.firstChild.lastChild.lastChild);\r\n\t}\r\n}", "function publish() {\n if (!arguments || arguments.Length < 1) {\n throw \"Publishing events requires at least one argument for topic id\";\n }\n\n var topic = arguments[0];\n var restArgs = Array.prototype.slice.call(arguments, 1);\n\n cache[topic] && angular.forEach(cache[topic], function(callback) {\n try {\n callback.apply(null, restArgs);\n } catch (exc) {\n console.log(\"Error in messaging handler for topic \", topic);\n }\n });\n }", "function handler(event, context, callback) {\n\n console.log(JSON.stringify(event, null, 2));\n\n console.log(event.Records);\n\n handleEventWrapper(event.Records)\n .then((res) => {\n\n // If any record failed to be treated, returns an error and the event will be sent again by the stream\n if (res.failedRecords && res.failedRecords.length > 0) {\n console.log(\"Finished handling records with some errors: \", res.failedRecords);\n console.log(\"Succeded messages: \", res.successfulRecords);\n\n callback(res);\n }\n else {// If all events were treated succsesfully, returns a success and the event will not sent again\n console.log(\"Handled messages with no errors: \", res);\n\n callback(null, res)\n }\n })\n .catch((err) => { // If another error occurs, also returns an error\n console.log(\"Error handling some messages: \", err);\n\n callback(err)\n })\n}", "onSend(messages=[]) {\n console.log(messages)\n let data = this.formatMessage(messages)\n this.socket.emit('msgadmin', data);\n this._storeMessages(messages);\n }", "function onMessageArrived(message) {\n console.log(\"onMessageArrived: \" + message.payloadString);\n document.getElementById(\"messages\").innerHTML += '<span>Topic: ' + message.destinationName + ' | ' + message.payloadString + '</span><br/>';\n}", "function addMessageToDb(newPost) {\n const { newMessage, nameNotify } = newPost;\n if (nameNotify) {\n messages.push(nameNotify);\n wss.broadcast({\n nameNotify\n });\n } else {\n messages.push(newMessage);\n wss.broadcast({\n newMessage\n });\n }\n}", "[NEW_MESSAGE] (state, msg) {\n state.items.push(msg)\n }", "function onMessageArrived(message) {\n\n if (message.destinationName == temp_topic) {\n\tg_t.refresh(message.payloadString);\n } \n if (message.destinationName == humidity_topic) {\n\tg_h.refresh(message.payloadString);\n } \n\n if (message.destinationName == light_topic) {\n\tif (message.payloadString == \"on\") {\n\t $scope.light = true;\n\t} else {\n\t $scope.light = false;\n\t} \n\tconsole.log(message.payloadString);\n }\n\n $scope.$apply();\n}", "function onMessageArrived(message) {\r\n console.log(\"onMessageArrived: \" + message.payloadString);\r\n document.getElementById(\"messages\").innerHTML += '<span>Topic: ' + message.destinationName + ' | ' +\r\n message.payloadString + '</span><br/>';\r\n}", "function onMessageReceived(payload) {\n let response = JSON.parse(payload.body);\n if (Array.isArray(response)) {\n for (let message of response) {\n printMessage(message);\n }\n } else {\n printMessage(response);\n }\n messageArea.scrollTop = messageArea.scrollHeight;\n}", "function onMessage(evt) {\n console.log(\"onMessage: \" + evt.data);\n var chatEvent = JSON.parse(evt.data);\n if (chatEvent.type === \"usersChanged\") {\n $scope.$apply(function() {\n $scope.usersOnline = chatEvent.msg;\n });\n } else {\n enqueueMessage(chatEvent);\n }\n }", "function addNewMessage(data){\n\t\t$chat.append(createMessage(data));\n\t\t$chat.scrollTop($chat[0].scrollHeight);\n\t}", "SOCKET_ONMESSAGE(state, message) {\n switch (message.type) {\n case \"message\":\n state.messages.push(message.payload);\n break;\n default:\n state.socket.message = message;\n }\n }", "function handleMsg(msg) {\n const msgData = new TextDecoder('utf-8').decode(msg.data);\n const msgDataObj = JSON.parse(msgData);\n\n const msgFrom = document.createElement('LI');\n const fromNode = document.createTextNode(`Sender: ${msg.from}`);\n msgFrom.appendChild(fromNode);\n\n const msgCid = document.createElement('LI');\n const cidNode = document.createTextNode(`CID: ${msgDataObj.cid}`);\n msgCid.appendChild(cidNode);\n\n const msgHash = document.createElement('LI');\n const hashNode = document.createTextNode(`File hash: ${msgDataObj.hash}`)\n msgHash.appendChild(hashNode);\n\n document.getElementById('messages').appendChild(msgFrom);\n document.getElementById('messages').appendChild(msgCid);\n document.getElementById('messages').appendChild(msgHash);\n}", "function handleNewFiles() {\n var fileName;\n do {\n // If there is a file, move it from staging into the application folder\n fileName = inbox.nextFile();\n if (fileName) {\n console.log(\"/private/data/\" + fileName + \" is now available\");\n // refresh weather now\n weatherFromFile();\n }\n } while (fileName);\n}", "get gettingNewMessages() {\n\t\treturn true;\n\t}", "_onWrite(entry) {\n this._markEntryAsRead(entry)\n this._updateEntries([entry])\n this._decrementSendingMessageCounter()\n }", "on(params) {\n let self = this\n\n this.find(params.topic)\n .on(params.event, payload => self.send(params.topic, \"Message\", {event: params.event, payload: payload}))\n }", "function messagesUpdated() {\n\n updateMessageLayers();\n\n if (scope.detailsMap) {\n updateLabelLayer();\n }\n\n if (scope.fitExtent) {\n var extent = ol.extent.createEmpty();\n ol.extent.extend(extent, nwLayer.getSource().getExtent());\n ol.extent.extend(extent, nmLayer.getSource().getExtent());\n if (!ol.extent.isEmpty(extent)) {\n map.getView().fit(extent, {\n padding: [5, 5, 5, 5],\n size: map.getSize(),\n maxZoom: maxZoom\n });\n } else if (scope.rootArea && scope.rootArea.latitude\n && scope.rootArea.longitude && scope.rootArea.zoomLevel) {\n // Update the map center and zoom\n var center = MapService.fromLonLat([ scope.rootArea.longitude, scope.rootArea.latitude ]);\n map.getView().setCenter(center);\n map.getView().setZoom(scope.rootArea.zoomLevel);\n }\n }\n }", "function node_server_starter()\n{\n /*\n Lets create a server to wait for request.\n */\n var server_start = http.createServer(function(request, response)\n {\n /*\n Making sure we are waiting for a JSON.\n */\n response.writeHeader(200, {\"Content-Type\": \"application/json\"});\n\n /*\n request.on waiting for data to arrive.\n */\n\n if(request.method === \"POST\")\n {\n /*\n Using kafka-node - really nice library\n create a producer and connect to a Zookeeper to send the payloads.\n */\n var kafka = require('kafka-node'),\n Producer = kafka.Producer,\n client = new kafka.Client('kafka:2181'),\n producer = new Producer(client);\n\n if (request.url === \"/upload/topic/A\")\n {\n request.on('data', function (chunk)\n {\n\n /*\n CHUNK which we recive from the clients\n For our request we are assuming its going to be a JSON data.\n We print it here on the console.\n */\n console.log(\"For Topic A\")\n console.log(chunk.toString('utf8'))\n\n\n\n /*\n Creating a payload, which takes below information\n 'topic' \t-->\tthis is the topic we have created in kafka.\n 'messages' \t-->\tdata which needs to be sent to kafka. (JSON in our case)\n 'partition' -->\twhich partition should we send the request to.\n If there are multiple partition, then we optimize the code here,\n so that we send request to different partitions.\n\n */\n payloads = [\n { topic: 'topic_a', messages: chunk.toString('utf8'), partition: 0 },\n ];\n\n /*\n producer 'on' ready to send payload to kafka.\n */\n producer.on('ready', function(){\n producer.send(payloads, function(err, data){\n console.log(data)\n });\n });\n\n /*\n if we have some error.\n */\n producer.on('error', function(err){})\n\n });\n }\n else if (request.url === \"/upload/topic/B\")\n {\n request.on('data', function (chunk)\n {\n\n /*\n CHUNK which we recive from the clients\n For our request we are assuming its going to be a JSON data.\n We print it here on the console.\n */\n console.log(\"For Topic B\")\n console.log(chunk.toString('utf8'))\n\n\n /*\n Creating a payload, which takes below information\n 'topic' \t-->\tthis is the topic we have created in kafka.\n 'messages' \t-->\tdata which needs to be sent to kafka. (JSON in our case)\n 'partition' -->\twhich partition should we send the request to.\n If there are multiple partition, then we optimize the code here,\n so that we send request to different partitions.\n\n */\n payloads = [\n { topic: 'topic_b', messages: chunk.toString('utf8'), partition: 0 },\n ];\n\n /*\n producer 'on' ready to send payload to kafka.\n */\n producer.on('ready', function(){\n producer.send(payloads, function(err, data){\n console.log(data)\n });\n });\n\n /*\n if we have some error.\n */\n producer.on('error', function(err){})\n });\n }\n else if (request.url === \"/upload/topic/C\")\n {\n request.on('data', function (chunk)\n {\n\n /*\n CHUNK which we recive from the clients\n For our request we are assuming its going to be a JSON data.\n We print it here on the console.\n */\n console.log(\"For Topic C\")\n console.log(chunk.toString('utf8'))\n\n /*\n Creating a payload, which takes below information\n 'topic' \t-->\tthis is the topic we have created in kafka.\n 'messages' \t-->\tdata which needs to be sent to kafka. (JSON in our case)\n 'partition' -->\twhich partition should we send the request to.\n If there are multiple partition, then we optimize the code here,\n so that we send request to different partitions.\n\n */\n payloads = [\n { topic: 'topic_c', messages: chunk.toString('utf8'), partition: 0 },\n ];\n\n /*\n producer 'on' ready to send payload to kafka.\n */\n producer.on('ready', function(){\n producer.send(payloads, function(err, data){\n console.log(data)\n });\n });\n\n /*\n if we have some error.\n */\n producer.on('error', function(err){})\n });\n }\n\n else\n {\n request.on('data', function (chunk)\n {\n\n /*\n CHUNK which we recive from the clients\n For our request we are assuming its going to be a JSON data.\n We print it here on the console.\n */\n console.log(\"ERROR: Could not Process this URL :\" + request.url)\n console.log(chunk.toString('utf8'))\n\n });\n }\n }\n\n\n /*\n end of request\n */\n response.end();\n\n /*\n Listen on port 8125\n */\n })\n\n server_start.listen(8125);\n}", "function onMessage(event) {\n var str = event.data.split(\"\\r\");\n var pos\n for (pos = 0; pos < str.length - 1; pos++) {\n if (logMessages.length >= maxLogs) {\n logMessages.shift();\n }\n logMessages.push(str[pos]);\n }\n}", "onMessagesRemoved() {}", "function onMessageArrived(message) {\n console.log(\"onMessageArrived: \" + message.payloadString);\n document.getElementById(\"messages\").innerHTML += '<span>' + message.payloadString + '</span><br/>';\n updateScroll();\n}", "function mqtt_messsageReceived(topic, message, packet) {\n\tconsole.log(\"\\n topic: \"+topic);\n\tconsole.log(\"\\n message: \"+message);\n\t\n\t//console.log(\"packet: \"+packet);\n\tvar message_str = message.toString(); //convert byte array to string\n\tmessage_str = message_str.replace(/\\n$/, ''); //remove new line\n\t//payload syntax: clientID,message //Old Syntax\n\tif (countInstances(message_str) != 1) {\n\t\tconsole.log(\"Invalid payload\"); //Incase payload must contain ClientID else use else Part directly\n\t\tparseString2JsonArray(topic,message_str,packet); // Message must in JSON Array Format\n\t\t//[{'client':'clientId'},message_str,{'value':'value'}]\n\t\t//my_packet i.e. Message: {'d':'dht','c':'','h':'\"+hmdtChar+\"','t':'\"+tmprChar+\"'}\n\t} \n\telse {\t\t\n\t\tinsert_message(topic, message_str, packet);\n\t\tconsole.log(\"insert_message\");\n\t\t//console.log(message_arr);\n\t}\n}", "OnMessage(Topic, Payload){\n switch (Topic) {\n case this._TopicConfigRes:\n // Save Config\n this._DeviceConfig = Payload\n break;\n \n case this._TopicConfigUpdateRes:\n // Save Config\n this._DeviceConfig = Payload\n break;\n\n case this._TopicDebugRes:\n // Save Debug\n this._IsOnDebugMode = Payload.Debug\n let divtitre = document.getElementById(this._DeviceTitreId)\n if (this._IsOnDebugMode){\n divtitre.innerText = \"Debug: \" + this._Device.DeviceName\n divtitre.style.color = \"red\"\n } else {\n divtitre.innerText = this._Device.DeviceName\n divtitre.style.color = null\n }\n break;\n \n case this._TopicConnectionStatus:\n if (Payload.connection == \"on\"){\n // Set DeviceConnected to true\n this._DeviceConnected = true\n // change color of status\n if (document.getElementById(this._DeviceIconStatusId)){\n document.getElementById(this._DeviceIconStatusId).style.backgroundColor = \"green\"\n }\n // Send message in queue\n this._DeviceMqttQueue.forEach(Message => {\n this.SendMqttMessage(Message.Topic, Message.Payload, Message.Option)\n });\n // Clear queue\n this._DeviceMqttQueue = []\n } else {\n // Set DeviceConnected to false\n this._DeviceConnected = false\n // change color of status\n if (document.getElementById(this._DeviceIconStatusId)){\n document.getElementById(this._DeviceIconStatusId).style.backgroundColor = \"red\"\n }\n }\n break;\n \n case this._TopicActionRes:\n if (Payload != \"\"){\n if (this._DeviceConfig != null){\n this._Player.Show(Payload, this._DeviceConfig.Electrovannes)\n }\n }\n break;\n \n default:\n this._DisplayError(`Topic not found: ${Topic}, Message: ${Payload}`)\n break;\n }\n }", "function onMessageArrived(message) {\n console.log('Message Recieved: Topic: ', message.destinationName, '. Payload: ', message.payloadString, '. QoS: ', message.qos);\n console.log(message);\n var messageTime = new Date().toISOString(); //timestamp primitka pristigle poruke\n var poruka = document.createElement('span'); //kreiranje html elementa sa sadržajem poruke\n poruka.innerHTML = 'Tema: ' + message.destinationName + ' | ' + message.payloadString + '</span><br/>'; \n var messages = document.getElementById(\"messages\"); //dohvaćanje html elementa za prikazivanje poruka\n messages.appendChild(poruka); //dodavanje nove poruke html elementu predviđenom za prikaz pristiglih poruka\n}", "function handleMessage(message_event) {\n appendToEventLog('nexe sez: ' + message_event.data);\n}", "function add_new_messages(new_messages) {\n for(var i=0; i < new_messages.length; i++) {\n var list_element = document.createElement(\"li\");\n $(list_element).text(new_messages[i]);\n $(\"#chat_messages\").append(list_element);\n\n // Reload the scroller and point it at the bottom\n var chat_list = $(\"#scroller\");\n chat_list.jScrollPane();\n if(chat_list[0].scrollTo != undefined) {\n chat_list[0].scrollTo(chat_list.attr(\"scrollHeight\"));\n };\n };\n}", "handler(request, reply) {\n try {\n const entry = new LogEntry({\n message: request.body.message,\n timestamp: getUTCDate(),\n });\n logInstance.write(entry);\n reply.status(200).send(entry.toString());\n } catch (e) {\n console.log(e);\n reply.status(500).send();\n }\n }", "function onMessageArrived(message) {\n // Split the message into an array:\n let readings = float(split(message.payloadString, ','));\n // if you have all the readings, put them in the chart:\n if (readings.length >= numBands) {\n chart.data.datasets[0].data = readings;\n // update the timestamp:\n timestampDiv.html('last reading at: ' + new Date().toLocaleString());\n }\n}", "function mqtt_messsageReceived(topic, message) {\n\n if (topic.toString() == dbTopic.toString()) {\n console.log(\"Message is \" + message + \" and going to store in database!\");\n var msg = message.toString();\n const strarray = msg.split(';');\n var inDate = strarray[0];\n var inStartTime = strarray[1];\n var inStopTime = strarray[2];\n var inMoist = strarray[3];\n console.log(\"StopTime\" + inStopTime.toString());\n insertIrrigationData(inDate, inStartTime, inStopTime, inMoist);\n return;\n }\n\n if (topic.toString() == plantNameTopic.toString()) {\n currentPlant = message.toString();\n irrigationsPath += currentPlant;\n console.log('currentplant:' + currentPlant);\n return;\n }\n\n if (topic.toString() == brokerUrlTopic.toString()) {\n currentBrokerUrl = message.toString();\n irrigationsPath += currentBrokerUrl + \"/irrigations/\";\n console.log('currentbrokerUrl:' + currentBrokerUrl);\n return;\n }\n}", "function handleSensorDataUpdate(message) {\n var record_data = {\n water_level: message.water_level,\n moisture_level: message.moisture_level,\n temperature: message.temperature\n };\n\n var record = new SensorRecord(record_data);\n record.save(function() {\n console.log(\"Record saved\");\n last_record = record;\n });\n}", "function onMessageArrived(message) {\n var msg = message.payloadString;\n var topic = message.destinationName;\n console.log(\"onMessageArrived(\" + topic + \"):\"+msg);\n\n // response according to topic\n var topicHie = topic.split(\"/\");\n var topicType = topicHie[topicHie.length-1];\n if ( topicType == \"newChat\" ) {\n // chat message\n // append message to chat textarea\n if ( $(\"#findFriendsBtn\").hasClass(\"active\")) {\n var chatwith = topicHie[topicHie.length-2];\n // only update chat text area if the current chat user is the sender\n if ( $(\"#chat_\" + chatwith).hasClass(\"double\") ) {\n $('#chatarea').append('<p class=\"mensagem2 toggle\">'+msg+'</p>');\n scrollTextareaToEnd();\n }\n }\n\n $(\"#findFriendsBtn\").addClass('notify');\n } else if ( topicType == \"addItinerary\" ) {\n // new itinerary\n $(\"#myTripsBtn\").addClass('notify');\n } else if ( topicType == \"updateItinerary\" ) {\n // new itinerary feed/comment\n $(\"#myTripsBtn\").addClass('notify');\n } else if ( topicType == \"addFriend\" ) {\n // is added friend\n $(\"#findFriendsBtn\").addClass('notify');\n }\n\n\n }", "function handle_request(message, callback) {\n\n console.log('=========================Inside Kafka Backend - Register =========================');\n console.log('Message', message);\n\n var now = new Date().now;\n\n Model.Users.findOne(\n { 'UserID': message.UserID },\n (err, user) => {\n if (err) {\n console.error(\"Error in user registration : \" + err.message)\n callback(err, null)\n } else if (user) {\n console.error(\"UserID already exists!\", err);\n callback(null, null);\n } else {\n const avatar = gravatar.url(message.UserID,\n {\n s: '200',\n r: 'pg',\n d: 'mm'\n }\n );\n\n var user = new Model.Users({\n \"Role\": message.role,\n \"FirstName\": message.first_name,\n \"LastName\": message.last_name,\n \"Avatar\": avatar,\n \"Email\": message.email,\n \"Password\": message.password,\n \"ProfilePicID\": message.profilePicID,\n \"PhoneNo\": message.phoneNo,\n \"AboutMe\": message.aboutMe,\n \"City\": message.city,\n \"Country\": message.country,\n \"Company\": message.company,\n \"School\": message.school,\n \"HomeTown\": message.homeTown,\n \"Languages\": message.languages,\n \"Gender\": message.gender,\n \"UserID\": message.userID,\n \"created\": now,\n \"Links\": message.links\n });\n\n bcrypt.genSalt(10, (err, salt) => {\n if (err) {\n console.error('Error in salt generation', err)\n callback(err, null)\n\n }\n else {\n bcrypt.hash(user.Password, salt, (err, hash) => {\n if (err) {\n console.error('Error in password encryption', err)\n callback(err, null)\n } else {\n user.Password = hash\n user\n .save()\n .then((user) => {\n console.log(\"Successfully Registered User\", user)\n // res.send(user)\n callback(null, user)\n });\n }\n\n })\n }\n })\n }\n })\n}", "onMessage(callback) {\n exports.default.sub.on('message', (channel, message) => callback(channel, JSON.parse(message)));\n }", "function postEvents(req, res, next) {\n jackalopeApp.jackrabbitConnection.publish('queue.simple', req.body);\n res.status(200).end();\n }", "bindTopicToAction(topic, action) {\n\n const client = new PubkeeperClient({\n server: config.PK_SERVER,\n jwt: config.PK_JWT,\n brews: [\n new WebSocketBrew({\n brewerConfig: {\n hostname: config.PKWEBSOCKET_HOST,\n port: config.PKWEBSOCKET_PORT,\n secure: true,\n },\n }),\n ],\n });\n\n client.connect().then(() => {\n\n client.addPatron(topic, (patron) => {\n\n const handler = (rawData) => {\n const data = JSON.parse(new TextDecoder().decode(rawData))[0];\n this.dispatcher(action(data));\n };\n\n patron.on('message', handler);\n\n return () => {\n // deactivation/tear-down\n patron.off('message', handler);\n };\n });\n\n\n });\n }", "onMessageCreated (data) {\n\t\t// console.log('CLEARED SENDING');\n\t\tif (data.hasOwnProperty(\"delivered\")) {\n\t\t\tthis.$timeout(() => {\n\t\t\t\tlet lastMsg = null;\n\t\t\t\t_remove(this.messagesList, (item) => {\n\t\t\t\t\tif (item.hasOwnProperty(\"loading\") && item.hasOwnProperty(\"sender\")) {\n\t\t\t\t\t\tif (item.text == data.text && item.chat == data.chat) {\n\t\t\t\t\t\t\tlastMsg = item;\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t\tdata.sender = this.AuthorizationService.user.id;\n\t\t\t});\n\t\t}\n\t\tthis.setScrollbar();\n\t}", "function emitMessages(payloads) {\n\t\tfor (var i = 0; i < payloads.length; i++) {\n\t\t\tvar data = payloads[i]\n\t\t\tif (this.encoding) {\n\t\t\t\tdata = data.toString(this.encoding)\n\t\t\t}\n\t\t\tif (this.paused) {\n\t\t\t\tlogger.info(\n\t\t\t\t\t'buffering', this.name,\n\t\t\t\t\t'length', this.bufferedMessages.length\n\t\t\t\t)\n\t\t\t\tthis.bufferedMessages.push(data)\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.emit('data', data)\n\t\t\t}\n\t\t}\n\t}", "onMqttMessage(topic, payload) {\r\n const o = JSON.parse(payload.toString());\r\n console.log(`Received message on topic:${topic}`);\r\n // console.log(`Received message on topic:${topic}, payload:`, o);\r\n }", "function loadPersistedMessages() {\n getPersistedMessages((response) => {\n // console.log(response);\n \n if(response.receivedMessages) {\n receivedMessages = JSON.parse(response.receivedMessages);\n }\n if(response.removedMessages) {\n removedMessages = JSON.parse(response.removedMessages);\n\n }\n // purge receivedMessages if the time conditions are met\n purgeReceivedMessages(response.lastPurgeTime);\n });\n}" ]
[ "0.58614504", "0.579827", "0.5792275", "0.5753699", "0.57123816", "0.5588394", "0.55401254", "0.5508094", "0.5482992", "0.5453257", "0.54329616", "0.5431964", "0.54116774", "0.54076606", "0.5376311", "0.5330562", "0.52975893", "0.5276933", "0.52520925", "0.52004814", "0.5185461", "0.5179147", "0.5177091", "0.5169196", "0.5167631", "0.5159935", "0.5155262", "0.51234704", "0.5109908", "0.510035", "0.5088944", "0.5079517", "0.50763726", "0.5076299", "0.5072672", "0.50683135", "0.50596786", "0.5046669", "0.5044506", "0.50442433", "0.5044035", "0.5038788", "0.50386506", "0.503626", "0.50152034", "0.5012789", "0.5005706", "0.5002696", "0.49958074", "0.49913028", "0.49857694", "0.49823782", "0.49782705", "0.49775183", "0.49728072", "0.49718118", "0.49692276", "0.4960059", "0.49435312", "0.49432546", "0.49418718", "0.4933794", "0.49309903", "0.49250636", "0.4913513", "0.49032378", "0.49007046", "0.48984048", "0.48905528", "0.48851135", "0.48760152", "0.48679504", "0.48511064", "0.48462793", "0.48410994", "0.4840126", "0.48392144", "0.48378325", "0.48328382", "0.48318523", "0.4822748", "0.48217997", "0.48086694", "0.48056737", "0.48040724", "0.4802824", "0.47979966", "0.47976083", "0.47963116", "0.4794514", "0.47924256", "0.4792415", "0.4789624", "0.47820944", "0.4776722", "0.47748566", "0.4768623", "0.4765237", "0.4761212", "0.47602022" ]
0.5258157
18
Async wrapper for co_log
function log(msg) { co(co_log(msg)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logCars(cars){\n console.log(cars);\n\n var car = cars.pop();\n\n //the async function logCar() is called\n logCar(car, function(){\n //the logCars() function is used as the callback when logCar() completes\n logCars(cars);\n }); \n}", "async function logRequest($){\n\tlogging.winston.info(new Date().toISOString() + \": \" + $.method + \": \" + $.url.path)\n\t$.return()\n}", "getClientLog() {\n\n }", "async function writeLog() {\r\n const remId = getOrCreateRem(PUBLISH_LOG_NAME);\r\n // TODO: Implement\r\n}", "log() {}", "function callLogs() {\n console.log('HAI SAYA ADALAH CALLBACK');\n}", "async function getLog(callback) {\n var command;\n\n function puts(err, stdout) {\n if (err) {\n throw err;\n }\n callback(stdout);\n }\n\n if (params.pr) {\n var log = await prLog().catch(e => console.error(e));\n\n callback(log);\n return;\n\n }\n\n command = 'git log --format=\"%s<br>\" ';\n if (params.since) {\n command += ' ' + params.since + '..HEAD ';\n } else {\n if (params.after) {\n command += '--after={' + params.after + '} ';\n }\n if (params.before) {\n command += '--before={' + params.before + '} ';\n }\n }\n\n cmd.exec(command, null, puts);\n }", "async function getCloudantLog(cloudantUrl, dbName, start, end, greeting, filename) {\n var db = null;\n try {\n console.log(\"Trying to connect to cloudant with URL: %s, DB: %s\", cloudantUrl,dbName);\n db = await connectCloudant(cloudantUrl, dbName);\n extractCloudantLog(db, start, end, greeting, filename);\n } catch(e) {\n console.error('Encounter error: ',e);\n console.error('Please try again later...');\n }\n}", "log(...args) {\n return this.getInstance().log(...args);\n }", "function logSomething(log) { log.info('something'); }", "log(_args) {\n\n }", "async function parent() {\n logger();\n console.log(\"parent called\");\n}", "function log() {\n //log here\n }", "async componentDidMount() {\n try {\n const log = await this.props.model.detailedLog(this.props.commit.commit);\n this.setState({\n info: log.modified_file_note,\n numFiles: log.modified_files_count,\n insertions: log.number_of_insertions,\n deletions: log.number_of_deletions,\n modifiedFiles: log.modified_files,\n loadingState: 'success'\n });\n }\n catch (err) {\n console.error(`Error while getting detailed log for commit ${this.props.commit.commit} and path ${this.props.model.pathRepository}`, err);\n this.setState({ loadingState: 'error' });\n return;\n }\n }", "function Log() {}", "function logCurentCallToLocaLStorage() {\n\n}", "function internal_logger(task) { return task && this[0].run(task, this[1]) }", "_subscribeForLogging() {\n const oThis = this;\n\n oThis.client.on('log', function(level, className, message, furtherInfo) {\n const msg = `cassandra log event: ${level} -- ${message}`;\n\n switch (level) {\n case 'info': {\n break;\n }\n case 'warning': {\n logger.warn('l_cw_2', msg);\n break;\n }\n case 'error': {\n logger.error('l_cw_3', msg);\n const errorObject = responseHelper.error({\n internal_error_identifier: 'l_cw_3',\n api_error_identifier: 'something_went_wrong',\n debug_options: {\n message: message,\n className: className,\n furtherInfo: furtherInfo\n }\n });\n\n createErrorLogsEntry.perform(errorObject, errorLogsConstants.highSeverity);\n break;\n }\n case 'verbose': {\n break;\n }\n default: {\n logger.log(`Current level: ${level}.--${msg}`);\n break;\n }\n }\n });\n }", "function done () {\n resolve(logs)\n }", "logBlock() {\n return __awaiter(this, void 0, void 0, function* () {\n // Hash the message then call Logger to log it into csv file\n return this.hashMessage().then((_) => (this.logger.writeNewBlock = this.mostRecentBlock));\n });\n }", "handleLogACall() {\n this.message = 'Logging call...';\n // Imperative invocation of Apex\n logCall({\n accountId: this.recordId,\n subject: this.form.subject,\n comments: this.form.comments,\n // W-4320896 - coerce to string to workaround integer conversion issues\n duration: '' + parseInt(this.form.duration, 10) * 60,\n })\n .then(() => {\n this.message = 'Call logged. Refreshing data.';\n // Data changed so re-fetch @wire(Apex) to display new summary. gallery_apex_detail\n // is notified of new data because it @wire'd to the same Apex method.\n return refreshApex(this.wiredActivities);\n })\n .then(() => {\n this.message = 'Call logged. Data refreshed.';\n })\n .catch(e => {\n this.message = 'Error logging call or refreshing data: ' + e.toString();\n });\n }", "log(kind, msg, data){ this.logger(kind, msg, data) }", "function LogOperator(){}", "log_network (_url) {\n\n return this.log('network', `Fetching ${_url}`);\n }", "function logger() {}", "async function bar(){\r\n\tconsole.log(\"bar\")\r\n}", "scheduleLogRequest() {\n if (!this.state.looping) {\n return;\n }\n this.requestLoop = window.setTimeout(() => {\n this.requestLatestJobLog();\n }, this.logPollInterval);\n }", "logHealthcheck() {\n (async () => {\n await module.exports.checkPg();\n module.exports.calcUptime();\n lumServer.logger.info('healthcheck', lumServer.healthcheck);\n })();\n }", "requestLatestJobLog() {\n this.state.scrollToEndOnNext = true;\n this.ui.showElement('spinner');\n this.state.awaitingLog = true;\n this.bus.emit(jcm.MESSAGE_TYPE.LOGS, {\n [jcm.PARAM.JOB_ID]: this.jobId,\n latest: true,\n });\n }", "async function consoleLog() {\n await sleep(10);\n console.log(treeArr);\n }", "execute(client, data) {\n events.log.push(data);\n }", "async handleCommandLog (msg) {\n try {\n // console.log(\"msg: \", msg);\n\n _this.props.handleLog(msg)\n // Add a slight delay, to give the browser time to render the DOM.\n await this.sleep(250)\n\n // _this.keepScrolled();\n _this.keepCommandScrolled()\n } catch (error) {\n console.warn(error)\n }\n }", "log() {\n\n const task = chalk.white('[project]');\n\n Array.prototype.unshift.call(arguments, task);\n gutil.log.apply(this, arguments);\n }", "_log (str) {\n if (this.context.runnerOptions.stream) console.log(str)\n else this._logs.push(str)\n }", "async function initialize() {\n enableLogging = await isLoggingEnabled();\n}", "function logFetchNonAsync(theUrl){\n // return some data\n console.log(\"Requested to fetch\", theUrl, \"WITHOUT async\")\n return fetch(theUrl)\n // \"fetches\" the url & consumes its JSON\n .then(console.log(\"Just fetched the URL, now setting the response\"))\n .then(response => response.text())\n .then(console.log(\"Just set the response\"))\n // Then it will console log the response\n .then(text => {\n console.log(\"Logging response:\", text)\n })\n .catch(err => {\n console.log(\"The fetch failed: \", err)\n });\n }", "log(data) {\n return __awaiter(this, void 0, void 0, function* () {\n let aggregate = new data_1.DataAggregate();\n //creating a unique key for the aggregate\n let key = CQRS.Utils.Key.createKey(['Data', '1']);\n //setting the id to the aggregate\n aggregate.id = key;\n //retreiving the version from the store\n aggregate.version = yield this.store.load(key);\n //performing the aggregate's method\n yield aggregate.log(data);\n //aggregate : the aggregate to be stored\n //function (domainEvent) : the method invoqued after the event has been stored. this will work for send the event to the event handler.\n yield this.store.saveEvents(aggregate, function (domainEvent) {\n //send the result to the Event handler\n // Send an Event Object\n //Command.name : The name of the command Handler (CalculatorEvent)\n //Command.method : The name of the method to be invoked (domainEvent.eventName)\n //Command.command : The command or object to be sent (domainEvent)\n CQRS.ServiceLocator.Process.Instance.publishEvent(new CQRS.Models.Entities.Command('DataEvent', domainEvent.eventName, domainEvent));\n });\n });\n }", "log() {\n\n this.respond(undefined, \"log\", undefined, undefined, arguments);\n\n }", "function _log() {\n // logger.trace.apply(logger, arguments)\n}", "function genaLog(func) {\n return function() {\n let abc = func.apply(this, arguments);\n console.log(\"called\");\n return abc;\n }\n}", "async function log3lines() {\n try {\n await ensureDir();\n\n await logger(\"Ligne 1\");\n await logger(\"Ligne 2\");\n await logger(\"Ligne 3\");\n } catch (err) {\n console.log(err);\n }\n}", "function doLog(s) {\n console.log(\"Ret>> \" + s);\n}", "function log(){\n console.log('logging');\n}", "async function readEventLogsFast() {\n var successList = [];\n console.log(\"Reading event logs ...\");\n await newContract.getContractInstanceObject().getPastEvents('Transfer', {\n filter: {\n _from: web3.utils.toChecksumAddress(document.getElementById(\"read_event_logs_input_fast\").value)\n },\n fromBlock: 0,\n toBlock: 'latest'\n }, function(error, events) {\n if (!error) {\n for(var i = 0; i < events.length; i++){\n var temp = [events[i].returnValues._to, events[i].returnValues._amount];\n successList.push(temp);\n temp = [];\n }\n } else {\n console.log(\"Error: \" + error);\n }\n });\n\n console.log(\"Writing output, the following transfers are 100% confirmed via event logs\");\n document.getElementById(\"read_event_logs_output_fast\").innerHTML = JSON.stringify(successList);\n}", "compute(correlationId, message, logLevel) {\n\n let ts = moment().tz('Europe/Rome').format('YYYY-MM-DD HH:mm:ss.SSS');\n\n if (logLevel == 'info') console.info('[' + ts + '] - [' + correlationId + '] - [' + this.apiName + '] - ' + message);\n else if (logLevel == 'error') console.error('[' + ts + '] - [' + correlationId + '] - [' + this.apiName + '] - ' + message);\n else if (logLevel == 'warn') console.warn('[' + ts + '] - [' + correlationId + '] - [' + this.apiName + '] - ' + message);\n\n }", "function logTest(delay, stringToLog){ \n setTimeout(() => {\n console.log(stringToLog);\n }, delay*1000); \n}", "_final(callback) {\n this._logger\n .close()\n .then(() => callback())\n .catch((err) => callback(err));\n }", "function log() {\n setTimeout(console.log.bind(console, arguments[0], arguments[1] || ''));\n }", "function log() {\n setTimeout(console.log.bind(console, arguments[0], arguments[1] || ''));\n }", "async logDispatch(instance, level, data) {\n //保存到数据库中\n const time = new Date();\n this.send({\n type: \"add_log\",\n name: instance.fileName,\n level,\n data: { time: time.toUTCString(), level, data },\n })\n await instance.logModel.create({ level, data, time });\n }", "async sendLog(logEvents) {\n\n\n const streamParams = {\n logEvents,\n sequenceToken: this.sequenceToken,\n logStreamName: this.logStreamName,\n logGroupName: this.logGroupName\n };\n\n const responseHandler = (resolve, reject) => (err, data) => {\n if (err) {\n reject(err);\n } else {\n this.sequenceToken = data.nextSequenceToken;\n resolve(data);\n }\n };\n\n return new Promise((resolve, reject) => {\n this.CloudWatchLogs.putLogEvents(streamParams, responseHandler(resolve, reject));\n });\n }", "get log() {\n // combineLatest will emit the latest of each\n // whenever either of them updates\n return rxjs_1.combineLatest(this.rxDocs, this.rxSync).pipe(operators_1.mergeMap(x => {\n // human readable text to explain sync number\n let syncText = \"remote couchDB \";\n switch (true) {\n case x[1] < 0:\n syncText += \"offline\";\n break;\n case x[1] === 1:\n syncText += \"online and in sync\";\n break;\n case x[1] > 1:\n syncText += \"uploading\";\n break;\n default:\n syncText += \"downloading\";\n break;\n }\n // assemble a nice JSON object that\n // has the docs and then the sync stuff\n return rxjs_1.of({\n \"PouchDB docs array\": x[0],\n \"sync code\": x[1].toString(),\n \"sync description\": syncText\n });\n }));\n }", "function finish (err, result) {\n if (!calledDone) {\n calledDone = true;\n var intervalId = setInterval(function () {\n if (logFinished) {\n clearInterval(intervalId);\n cb(err, result);\n }\n }, 1000);\n }\n }", "async log(message, level = LogLevel.Info, context = {}) {\n // Check that we have a sync function\n if (typeof this._sync !== \"function\") {\n throw new Error(\"No Timber logger sync function provided\");\n }\n // Increment log count\n this._countLogged++;\n // Start building the log message\n let log = Object.assign({ \n // Implicit date timestamp\n dt: new Date(), \n // Explicit level\n level }, context);\n // Determine the type of message...\n // Is this an error?\n if (message instanceof Error) {\n log = Object.assign({}, log, this.getContextFromError(message), { \n // Add error message\n message: message.message });\n }\n else {\n log = Object.assign({}, log, { \n // Add string message\n message });\n }\n // Pass the log through the middleware pipeline\n const transformedLog = await this._middleware.reduceRight((fn, pipedLog) => fn.then(pipedLog), Promise.resolve(log));\n try {\n // Push the log through the batcher, and sync\n await this._batch(transformedLog);\n // Increment sync count\n this._countSynced++;\n }\n catch (e) {\n // Catch any errors - re-throw if `ignoreExceptions` == false\n if (!this._options.ignoreExceptions) {\n throw e;\n }\n }\n // Return the resulting log\n return transformedLog;\n }", "await(eventName, options = {\n checkLog: true,\n resetLog: true\n }) {\n const me = this;\n\n if (options === false) {\n options = {\n checkLog: false\n };\n }\n\n return new Promise(resolve => {\n // check if previously triggered?\n if (options.checkLog && me._triggered && me._triggered[eventName]) {\n // resolve immediately, no params though...\n resolve(); // reset log to be able to await again\n\n if (options.resetLog) {\n me.clearLog(eventName);\n }\n }\n\n me.on({\n [eventName]: (...params) => {\n // resolve when event is caught\n resolve(...params); // reset log to be able to await again\n\n if (options.resetLog) {\n me.clearLog(eventName);\n }\n },\n prio: -10000,\n // Let others do their stuff first\n once: true // promises can only be resolved once anyway\n\n });\n });\n }", "promiseResolve (asyncId) {\n fs.writeSync(1, \"\\n\\tHook promiseResolve \"+asyncId+\"\\n\")\n }", "function run () {\n logger.success('hello world!')\n}", "async function asyncCall() {\n result = await resolveAfter2Seconds();\n result.forEach((indItem) =>\n printItem(\n indItem.title,\n indItem.tkt,\n indItem.desc,\n indItem.urg,\n indItem.store,\n indItem.owner,\n indItem.date\n )\n );\n }", "async connect() {\n\n const streamParams = {\n\n logStreamName: this.logStreamName,\n logGroupName: this.logGroupName\n };\n\n const responseHandler = (resolve, reject) => (err, data) => {\n if (err) {\n resolve(err);\n }\n else {\n resolve(this);\n }\n };\n\n return new Promise((resolve) => {\n this.CloudWatchLogs.createLogStream(streamParams, responseHandler(() => {\n this.isConnected = true;\n resolve();\n }, resolve));\n });\n }", "sendLogs() {\n this.log.info('logging from tests');\n }", "function log(str) { Logger.log(str); }", "async function showLogs(logType = 'browser') {\n for (const line of await exports.driver.fetchLogs(logType)) {\n console.log(line);\n }\n}", "function log() {\n\t\t//var args = [].slice.call(arguments);\n\t\t//send('LOG', args);\n\t}", "function custom_log(string)\n{\n log(\"SKETCH2CODE | \" + string)\n}", "async 'after sunbath' () {\n console.log( 'see? I appear here because of the first custom above' )\n }", "registerLogFeed() {\n const {flags: {domain, utc}} = this.parse(LogsCommand)\n const feed = new LogFeed()\n\n feed.onLog(log => {\n const entry = new LogEntry(log, domain)\n\n // Check if we're waiting\n if (this.canLog) {\n // Stop the spinner\n this.spinner(null)\n\n // Print the line\n this.log(entry.formattedSummary(utc))\n entry.setPrinted()\n\n // Restart the spinner\n this.spinner('Listening for logs from Chec. Press \"up\" to navigate through the existing logs')\n\n // Keep logs pruned\n this.pruneLogs()\n }\n\n // Append the log\n this.logs.push(entry)\n })\n\n this.logFeed = feed\n }", "function promiseLog(message) {\n return value => {\n console.log(message);\n return value;\n }\n}", "async function updateCredentialsAndLog() {\n\ttry {\n\t\tawait updateCredentials();\n\t\tconsole.log(new Date(), \"Update successful\");\n\t}\n\tcatch(error) {\n\t\tconsole.error(new Date(), \"Update error\", error);\n\t}\n}", "function postLog() {\n api(\"POST\", \"/log\", JSON.stringify(logData), (res)=>{/*donothing*/});\n}", "async method(){}", "function queueLog(log) {\n\n logCache.add(log);\n while (logCache.length() > 1000) {\n const oldestLog = logCache.remove();\n logger.log(oldestLog.severity, oldestLog);\n }\n\n}", "async function logEvent$1(gtagFunction, initializationPromise, eventName, eventParams, options) {\r\n if (options && options.global) {\r\n gtagFunction(\"event\" /* EVENT */, eventName, eventParams);\r\n return;\r\n }\r\n else {\r\n const measurementId = await initializationPromise;\r\n const params = Object.assign(Object.assign({}, eventParams), { 'send_to': measurementId });\r\n gtagFunction(\"event\" /* EVENT */, eventName, params);\r\n }\r\n}", "async prepareLogger() {\n this.logger = await this.addService('logger', new this.LoggerTransport(this.options.logger));\n }", "async prepareLogger() {\n this.logger = await this.addService('logger', new this.LoggerTransport(this.options.logger));\n }", "async function handler(message) {\n console.log(message);\n}", "function log() {\n if (logging) {\n for (let i = 0; i < logBody.length; i++)\n console.log(logBody[i])\n }\n }", "function doLog() {\n console.log(\"This is a log message.\");\n}", "function log(log) {\n var dateTime = moment().format('YYYY/MM/DD @ hh:mm:ss a');\n console.log('PraxBot: ' + dateTime + ': ' + log);\n }", "function future(msg) {\n\tif ( logger.getLevel() >= logger.LEVELS.WARN ) {\n\t\tconst args = [...arguments];\n\t\targs[0] = \"FUTURE: \" + args[0] + \" (future error, ignored for now)\";\n\t\t/* eslint-disable no-console */\n\t\tconsole.warn(...args);\n\t\t/* eslint-disable no-console */\n\t}\n}", "function start_log(node_name, element_id, options)\n{\n options = options || {};\n var position = -100;\n var element = $(element_id);\n var log_func = (() => {\n Hivemind.fetch_json(\n /* endpoint */\n '/nodes/' + node_name + '/log',\n\n /* options */\n {\n 'params' : {\n 'position' : position\n }\n },\n\n /* on_success */\n (data) => {\n\n // Auto scroll if we're at the bottom\n var autoScroll = false;\n var e = element[0];\n var offset = (e.scrollHeight - e.offsetHeight);\n if (e.scrollTop <= (offset + 1) && e.scrollTop >= (offset - 1))\n {\n autoScroll = true;\n }\n else\n {\n console.log(e.scrollTop, e.scrollHeight, e.offsetHeight, e.scrollHeight - e.offsetHeight);\n }\n\n data.content.forEach((line) => element.append(line + '<br/>'))\n position = data.position;\n\n if (autoScroll)\n {\n setTimeout(() => {\n console.log('running...');\n console.log(e.scrollTop, e.scrollHeight, e.offsetHeight, e.scrollHeight - e.offsetHeight);\n e.scrollTop = (e.scrollHeight - e.offsetHeight);\n }, 10);\n }\n });\n });\n setTimeout(log_func, 10);\n var interval = setInterval(log_func, 3000);\n}", "function Test_EnumLogFile() {\n return __awaiter(this, void 0, void 0, function () {\n var out_rpc_enum_log_file;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.log(\"Begin: Test_EnumLogFile\");\n return [4 /*yield*/, api.EnumLogFile()];\n case 1:\n out_rpc_enum_log_file = _a.sent();\n console.log(out_rpc_enum_log_file);\n console.log(\"End: Test_EnumLogFile\");\n console.log(\"-----\");\n console.log();\n return [2 /*return*/, out_rpc_enum_log_file];\n }\n });\n });\n}", "log() {\n return; // no output for initial application build\n }", "function Test_SetHubLog(in_rpc_hub_log) {\n return __awaiter(this, void 0, void 0, function () {\n var out_rpc_hub_log;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.log(\"Begin: Test_SetHubLog\");\n return [4 /*yield*/, api.SetHubLog(in_rpc_hub_log)];\n case 1:\n out_rpc_hub_log = _a.sent();\n console.log(out_rpc_hub_log);\n console.log(\"End: Test_SetHubLog\");\n console.log(\"-----\");\n console.log();\n return [2 /*return*/];\n }\n });\n });\n}", "doLog(level, parentArgs) {\r\n if (!this.initialized) {\r\n return; // no instance to log\r\n }\r\n\r\n let args = Array.prototype.slice.call(parentArgs);\r\n if (Buffer.isBuffer(args[0])) { // the first argument is \"reqId\"\r\n let reqId = args.shift().toString('base64');\r\n args[0] = reqId + ': ' + args[0];\r\n }\r\n this.instance[level].apply(this.instance, args);\r\n }", "static async method(){}", "dispatchAsync() {\r\n this._dispatch(true, this, arguments);\r\n }", "function Test_GetHubLog() {\n return __awaiter(this, void 0, void 0, function () {\n var in_rpc_hub_log, out_rpc_hub_log;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.log(\"Begin: Test_GetHubLog\");\n in_rpc_hub_log = new VPN.VpnRpcHubLog({\n HubName_str: hub_name\n });\n return [4 /*yield*/, api.GetHubLog(in_rpc_hub_log)];\n case 1:\n out_rpc_hub_log = _a.sent();\n console.log(out_rpc_hub_log);\n console.log(\"End: Test_GetHubLog\");\n console.log(\"-----\");\n console.log();\n return [2 /*return*/, out_rpc_hub_log];\n }\n });\n });\n}", "log(message) {\n // Send http request\n console.log(message);\n\n //Raised an event\n // commented out of app.js after adding into logger.js\n\n this.emit('messageLogged', {id: 1, url: 'http:' }); \n }", "function uiLog_log(event, target, id) {\n // creates an entry\n var entry = new Array();\n entry[\"event\"] = event;\n entry[\"target\"] = target;\n entry[\"id\"] = id;\n entry[\"time\"] = (new Date()).getTime();\n\n // adds all extra parameters to the entry\n var paramNumber = arguments.length-3;\n entry[\"paramNumber\"] = paramNumber;\n for(var i = 0; i < paramNumber; i++)\n entry[\"param\"+i] = arguments[i+3];\n\n // add the entry to the log variable\n _uiLog_entries[_uiLog_entries.length] = entry;\n\n // flush log 15 seconds later if no flush has been set\n if(_uiLog_flushSet == null)\n _uiLog_flushSet = setTimeout(\"uiLog_flush()\", 15000);\n}", "function NodeLogger() {}", "function NodeLogger() {}", "function NodeLogger() {}", "await(eventName, options = { checkLog: true, resetLog: true }) {\n const me = this;\n\n return new Promise((resolve) => {\n // check if previously triggered?\n if (options.checkLog && me._triggered && me._triggered[eventName]) {\n // resolve immediately, no params though...\n resolve();\n // reset log to be able to await again\n if (options.resetLog) {\n me.clearLog(eventName);\n }\n }\n\n me.on({\n [eventName]: (...params) => {\n // resolve when event is caught\n resolve(...params);\n // reset log to be able to await again\n if (options.resetLog) {\n me.clearLog(eventName);\n }\n },\n prio: -10000, // Let others do their stuff first\n once: true // promises can only be resolved once anyway\n });\n });\n }", "function wrapLog(name, proxy, plugin) {\n return (function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (plugin.context.config.logging === \"verbose\") {\n /**/\n var startTime = Date.now();\n logger_1.logger.verbose(\"[\" + name + \"] Called\");\n var result = proxy.apply(void 0, __spread(args));\n var time = Math.round(Date.now() - startTime);\n logger_1.logger.verbose(\"[\" + name + \"] Finished (\" + time + \"ms): Result: \", result == null ? \"undefined\" : Array.isArray(result) ? \"Array: \" + result.length + \" length\" : \"defined\");\n if (time > 100) {\n logger_1.logger.warn(\"[\" + name + \"] took long time to complete! (\" + time + \"ms)\");\n }\n return result;\n }\n else {\n return proxy.apply(void 0, __spread(args));\n }\n });\n}", "doPlayLogs() {\n this.fsm.updateState({\n auto: true,\n });\n this.state.stopped = false;\n this.startLogAutoFetch();\n }", "function log(apiMethod, apiUri, msg) {\n console.log(\"[\" + apiMethod + \"], [\" + apiUri + \"], [\" + msg + \"], [UTC:\" +\n new Date().toISOString().replace(/\\..+/, '') + \"]\");\n }", "function log(apiMethod, apiUri, msg) {\n console.log(\"[\" + apiMethod + \"], [\" + apiUri + \"], [\" + msg + \"], [UTC:\" +\n new Date().toISOString().replace(/\\..+/, '') + \"]\");\n }", "toLog(){return{total:this.total,progress:this.progress,url:this.url==null?\"\":this.url.url}}", "function log(apiMethod, apiUri, msg) {\r\n console.log(\"[\" + apiMethod + \"], [\" + apiUri + \"], [\" + msg + \"], [UTC:\" +\r\n new Date().toISOString().replace(/\\..+/, '') + \"]\");\r\n }", "async loop() {\n // Always reset the \"canLog\" tracker\n this.canLog = true\n\n const navigationPrompt = 'Press \"up\" to navigate through the existing logs'\n this.spinner(`Listening for logs from Chec. ${this.logs.length > 0 ? navigationPrompt : ''}`)\n\n // Wait for the user to navigation logs\n if (!await this.handleNavigation()) {\n return\n }\n\n // Trim the log count\n this.pruneLogs()\n\n // Print the rest of the logs\n this.printLogs()\n\n // Recurse\n await this.loop()\n }" ]
[ "0.6192786", "0.6092507", "0.60654056", "0.598227", "0.59743094", "0.59237766", "0.5912073", "0.5880962", "0.58527684", "0.5819817", "0.5817359", "0.573304", "0.5706651", "0.5705274", "0.567159", "0.5623884", "0.5577558", "0.555967", "0.5557964", "0.55289286", "0.55261874", "0.5519932", "0.5492129", "0.5473919", "0.54531217", "0.5437509", "0.54210484", "0.54175484", "0.5407644", "0.5406279", "0.54006064", "0.53880894", "0.538394", "0.5383706", "0.53483987", "0.53471476", "0.53394973", "0.5330974", "0.53272265", "0.531325", "0.530989", "0.5294718", "0.5282678", "0.5281618", "0.52808493", "0.5280843", "0.5260421", "0.5257082", "0.5257082", "0.5251108", "0.5242098", "0.52305424", "0.5230025", "0.5219059", "0.52153903", "0.5213708", "0.5197989", "0.5179283", "0.5178907", "0.51781964", "0.5168756", "0.51660776", "0.51590097", "0.5156584", "0.5149336", "0.51461965", "0.5140975", "0.51394075", "0.51382786", "0.51352346", "0.51251376", "0.5119152", "0.5117348", "0.5117348", "0.51124704", "0.51099426", "0.5099895", "0.50922817", "0.50874794", "0.5087122", "0.5082532", "0.50806874", "0.50750494", "0.5071875", "0.5070533", "0.5065239", "0.5062327", "0.5051858", "0.50514764", "0.5046957", "0.5046957", "0.5046957", "0.50443345", "0.5043686", "0.5038667", "0.50364786", "0.50364786", "0.5034466", "0.5033969", "0.50289375" ]
0.59027123
7
Hide the modal dialog
function hideModal(modal) { $("#flex-overlay").css({ 'display': 'none', opacity: 0 }); if (typeof modal == 'string') modal = $(modal); modal.css({ "display": "none" }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hide(){\n\t\tthis.modalShadow.hide();\n\t\tthis.modalBody.hide();\n\t}", "function hideModal() {\n vm.modalVisible = false;\n }", "function hideModal() {\n vm.modalVisible = false;\n }", "function hideThisModalDialog(hideDialog) {\n\thideDialog();\n}", "hide(){\n\t\tif(atom && this.panel)\n\t\t\tthis.panel.hide();\n\t\telse (\"dialog\" === this.elementTagName)\n\t\t\t? this.element.close()\n\t\t\t: this.element.hidden = true;\n\t\tthis.autoFocus && this.restoreFocus();\n\t}", "function modalHidden(){\n\t\trestoreTabindex();\n\t\ttdc.Grd.Modal.isVisible=false;\n\t}", "function hide() {\n $$invalidate('modalIsVisible', modalIsVisible = false); // Ensure we cleanup all event listeners when we hide the modal\n\n _cleanupStepEventListeners();\n }", "function div_hide(){ \n\t\t//$('#myModal').modal('hide');\n\t\t$('#dialog-overlay6, #dialog-box6').hide();\n\t}", "function hideDialog() {\n\t\tstopSlideshow();\n\n\t\t// unregister events\n\t\tdoc.unbind('keydown', _onKeyDown).unbind('contextmenu', _onContextMenuOpen);\n\t\tdialog.stop(true, true);\n\n\t\tcurrent = -1; // no image is displayed\n\n\t\tdialog.addClass(CLASS_DISABLED).add(panels).add(viewer).add(background).addClass(CLASS_HIDDEN);\n\t}", "function hideDialog() {\n document.getElementById('dialog').style.display = \"none\";\n document.getElementById('dialog-mask').style.display = \"none\";\n}", "hide(e){\n e.preventDefault();\n hideModalDialog(this._dialog, this._hideBound);\n this._updatePreviewField();\n }", "function hideModal() {\n modal.style.display = \"none\";\n}", "function hideModal() {\r\n //The modal is currently closed\r\n modal.open = false;\r\n //Add class to hide modal\r\n modal.container.classList.add(\"hide-modal\");\r\n }", "function hideLoginDialog() {\n $(\"#loginDialog\").hide();\n $(\"#modal-backdrop\").hide();\n}", "function hideDialog(dialog){\r\n\tdocument.getElementById(dialog).style.visibility = \"hidden\";\r\n}", "function dialogOff() {\n\n if (dialog !== null) {\n if (typeof uiVersion !== 'undefined' && uiVersion === 'Minuet') {\n hideSection('percDialogTarget', 'fadeOut', true);\n }\n else {\n dialog.remove();\n }\n dialog = null;\n }\n isDialogOn = false;\n\n }", "function hidePleaseWait() {\r\n $(\"#pleaseWaitDialog\").modal(\"hide\");\r\n}", "function hidePleaseWait() {\r\n $(\"#pleaseWaitDialog\").modal(\"hide\");\r\n}", "function hidePleaseWait() {\n $(\"#pleaseWaitDialog\").modal(\"hide\");\n}", "function closeDialog() {\n $mdDialog.hide();\n }", "function hideDialogue(){\n\tget(\"dialogue\").style.display = 'none';\n}", "function hideDialog() {\n let dialog = document.querySelector('.dialog-overview')\n dialog.hide()\n}", "function esconderModal() {\n\tmodal.style.display = 'none';\n}", "function cerrar() {\n\n modal.style.display = \"none\";\n}", "function hideModal(){\n \n $('.close').click(function(){\n \n $('#myModal').css('display', 'none');\n } ); \n}", "function HideproptypDialog()\n {\n $(\"#proptypoverlay\").hide();\n $(\"#proptypdialog\").fadeOut(300);\n }", "function hide() {\n // Remove background\n bg.remove();\n // Remove modal\n modal.style.display = \"none\";\n}", "hideModal() {\n this.clearModal();\n $('.modal').modal('hide');\n }", "function hideModal() {\n this.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 handleClose() {\n setDialog(false);\n }", "function handleClose() {\n setDialog(false);\n }", "function closeModal () {\n modal.style.display = 'none';\n }", "function onClose() {\n\t\t\t$mdDialog.hide()\n\t\t}", "hideModal(){\n if(document.getElementById('modal')){\n document.getElementById('modal').style.display = 'none';\n document.getElementById('caption').style.display = 'none';\n document.getElementById('modal').style.zIndex = 0;\n }\n \n }", "function closeDialog(sDialogId)\r\n{\r\n var div = document.getElementById(sDialogId);\r\n div.style.display = \"none\";\r\n var div = document.getElementById(\"modal\");\r\n div.style.display = \"none\";\r\n}", "function closeModal () {\n //chnge the display value to none\n modal.style.display = 'none';\n}", "modalHide(myModal) {\n myModal.style.display = \"none\";\n player.choosePlayer();\n }", "deactivateModal() {\n\t\tdocument.querySelector('#login-modal').style.display = 'none';\n\t}", "function close() {\n $mdDialog.hide();\n }", "function HidelolDialog()\n {\n $(\"#loloverlay\").hide();\n $(\"#loldialog\").fadeOut(300);\n }", "function hideModal() {\n\tdocument.querySelector('.backdrop').style.display = 'none';\n\tdocument.querySelector('.modal').style.display = 'none';\n}", "function closeModal(){\r\n modal.style.display = 'none';\r\n }", "function hideDialog(){\n\tdocument.getElementById('addNewTaskDiv').style.display='none';\n\tdocument.getElementById('fade').style.display='none';\n}", "function hide_nag()\n {\n $( \"#nag_dialog\" ).dialog('close');\n\n }", "modify () {\n\n // Hide modal\n this.modal.hide();\n }", "checkhide(e) {\n if (e.target == this.modal) {\n this.hide();\n }\n }", "function hideModalBox() {\n deleteIncidentModal.style.display = \"none\";\n}", "function HideageDialog()\n {\n $(\"#ageoverlay\").hide();\n $(\"#agedialog\").fadeOut(300);\n }", "function hide() {\n if (isLogOpen === false) {\n return;\n }\n\n $modalContainer.html('');\n $modalContainer.scrollTop();\n $modalContainer.hide();\n scrollBar.load();\n\n isLogOpen = false;\n}", "function hideShareModal() {\n // modal animation\n $( '.celebration-cards-share-modal' ).animate( {\n opacity: 0\n }, 500, function() {\n $( '.celebration-cards-share-modal' ).css( \"display\", \"none\" );\n $('.celebration-cards-share-modal__content__cancel').css('display', 'block');\n $('.celebration-cards-share-modal__content__input').css('display', 'none');\n $('.celebration-cards-share-modal__content__input').css('opacity', '0');\n });\n }", "function hideModal() {\n $(\"#modal-container\").hide(\"fold\", 1000);\n}", "function closeModal(){\n modal.style.display = 'none';\n }", "function hideModal() {\n document.querySelector(\"#signinup-modal\").style.display = \"none\";\n document.querySelector(\".main-login-form\").classList.add(\"hidden\");\n }", "function closeDialog() {\n jQuery('#oexchange-dialog').hide();\n jQuery('#oexchange-remember-dialog').hide();\n refreshShareLinks();\n }", "function hideCreatePostModal(){\r\n var modal = document.getElementById(\"create-post-modal\");\r\n modal.style.display = \"none\";\r\n }", "hide()\n {\n this._window.hide();\n }", "function HidecontactDialog()\n {\n $(\"#contactoverlay\").hide();\n $(\"#contactdialog\").fadeOut(300);\n }", "function hideModal() {\n instructions.style.display = 'none';\n showButton.style.display = 'inline';\n}", "function hideTutorials() {\r\n tutModal.style.visibility = \"hidden\";\r\n tutModal.style.opacity = \"0\";\r\n console.log(\"The modal was closed\");\r\n}", "function closeDialog() {\n setDialogOpen(false)\n }", "function inmueble_cerrarPopUp2(){\n\t$(\"#mascaraPrincipalNivel2\").hide();\n\t$(\"#inmueble_obtenerCoordenadas\").hide();\n\t$(\"#inmueble_subirImagen\").hide();\n\t$(\"#inmueble_subirVideo\").hide();\n}", "function inmueble_cerrarPopUp2(){\n\t$(\"#mascaraPrincipalNivel2\").hide();\n\t$(\"#inmueble_obtenerCoordenadas\").hide();\n\t$(\"#inmueble_subirImagen\").hide();\n\t$(\"#inmueble_subirVideo\").hide();\n}", "hidePane() {\n this.modalPanel.hide()\n }", "function closeInformationDialogBox() {\n document.getElementById(\"checkDoc\").style.display = \"none\";\n document.getElementById(\"dialogBox\").style.display = \"none\";\n}", "function hide_upload_modal(){\n\t\tsetTimeout(\n\t\t\tfunction(){\n\t\t\t\t$('#uploading_file_popup').modal('hide')\n\t\t\t},500\n\t\t);\n\t}", "function closeModal () {\n modal.style.display = 'none'\n}", "function hide() {\n document.getElementById(\"myModal\").style.display = \"none\";\n}", "function hideModalFun() {\n loginModal.style.display = \"none\";\n}", "function hideModalScreen() {\n\t\tcurrent_x = this;\n\t\tcurrent_x.style.display = \"none\";\n\t\tcurrent_x.nextElementSibling.style.display = \"none\";\n\t}", "function closeModelDialog() {\n document.getElementById('myModal').style.display = \"none\";\n document.getElementById(\"detailContent\").innerHTML = \"\";\n}", "function onHiddenBsModal() {\n isModalInTransitionToHide = false;\n isModalVisible = false;\n }", "hideCurrentDialog_() {\n if (this.currentDialog_) {\n this.currentDialog_.removeAttribute('active');\n removeAfterTimeout(this, this.currentDialog_, 200);\n this.currentDialog_ = null;\n }\n }", "function cancel() {\n $('#confirmExportModal').css('display', 'none');\n $('#confirmImportModal').css('display', 'none');\n $('#confirmDownloadLogModal').css('display', 'none');\n $('#confirmCustomSchedExportModal').css('display', 'none');\n }", "function hideLoadingDialog(ev) {\n $mdDialog.hide();\n }", "cancel() {\n $('#snmpDialog').jqxWindow('hide');\n }", "function closeModal() {\r\n modal.style.display = \"none\";\r\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function closeModal() {\n modal.style.display = \"none\";\n}", "function hide_bs_modal() {\n currentModal = this.previousModal;\n\n //Close elements\n this._bsModalCloseElements();\n\n //Never close pinned modals\n if (this.bsModal.isPinned)\n return false;\n\n //Remove all noty added on the modal and move down global backdrop\n $._bsNotyRemoveLayer();\n\n //Remove the modal from DOM\n if (this.removeOnClose)\n this.get(0).remove();\n }", "function closeModal(){\r\n modal.style.display = 'none';\r\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 hid() {\n // Hides the modal when user click on the 'No' button\n var btn = document.getElementsByClassName('modal')[2];\n btn.style.display = \"none\";\n\n}", "function hideModal() {\n var backdrop = document.getElementById(\"backdrop\");\n backdrop.style.display = \"none\";\n var modal = document.getElementById(\"modal\");\n modal.style.display = \"none\";\n}", "function onCloseButtonClick(){\n\t\tt.hide();\n\t}", "function closeModal() {\r\n modal.style.display = 'none';\r\n}", "function hideView() {\n $rootScope.helpModal.hide();\n }", "function clickclose(){\n modal.style.display=\"none\";\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function closeModal() {\n modal.style.display = 'none';\n}", "function hideActivateSpecReviewModal() {\n $('#TB_overlay').hide();\n $('#TB_window_custom').hide();\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}", "hideWindow() {\n\t\tfinsembleWindow.hide();\n\t}", "function closeModal(){\n modal.style.display = \"none\";\n}" ]
[ "0.80906236", "0.7920762", "0.7920762", "0.78558594", "0.7843421", "0.78368676", "0.7753049", "0.7741022", "0.76053923", "0.7509544", "0.74288785", "0.73939824", "0.7371251", "0.7366744", "0.7360812", "0.7333456", "0.73315054", "0.73315054", "0.7290878", "0.7258829", "0.7225481", "0.7209602", "0.720233", "0.7191047", "0.71600837", "0.7159019", "0.71458703", "0.71446526", "0.7129972", "0.7111811", "0.7111811", "0.7111811", "0.70865965", "0.70865965", "0.70842296", "0.7070376", "0.7059747", "0.7052476", "0.7049865", "0.70451164", "0.7043955", "0.7043386", "0.7036567", "0.7030936", "0.70234215", "0.7022883", "0.702232", "0.7016305", "0.70155", "0.7014885", "0.70141244", "0.6985584", "0.6977148", "0.6973995", "0.6962887", "0.69608486", "0.69535804", "0.69508076", "0.694509", "0.6944256", "0.6939719", "0.6932468", "0.6926212", "0.6925378", "0.6925378", "0.6901083", "0.6899525", "0.6884933", "0.6876664", "0.68728447", "0.687095", "0.6870381", "0.6859239", "0.6856192", "0.685302", "0.6851438", "0.6851392", "0.68466496", "0.684081", "0.68387616", "0.68387616", "0.68337643", "0.68314093", "0.68297803", "0.68297803", "0.68297803", "0.68287605", "0.68275243", "0.6826804", "0.6825574", "0.68224317", "0.6814671", "0.6811588", "0.6811588", "0.6810978", "0.6808822", "0.6808822", "0.6808822", "0.6808822", "0.68084913", "0.680799" ]
0.0
-1
Create function that stores Points to dashboard
function displayPointsDashBoard(data){ const html = ` <ul class="statistics"> <li class="statistics__entry"> <p class="statistics__entry-description" >Current Points</p> <span class="statistics__entry-quantity">${data}</span> </li> </ul>`; const renderPoints = document.getElementById('points') renderPoints.innerHTML = html return html }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addPoint(){\n trackingFB.push({\n latitud:localStorage.getItem(\"latitud\"),\n longitud:localStorage.getItem(\"longitud\")\n })\n }", "function displayPoints(){\n console.log(pointMap);\n console.log(payerPointLog);\n}", "function save_points() {\r\n var update = {\r\n endpoint : 'actualizarPuntos',\r\n method:'POST',\r\n body :{\r\n ID_Facebook : JSON.parse(localStorage.getItem('user_information')).id,\r\n Partidas_Ganadas : $scope.player.totalWins,\r\n Partidas_Empatadas : $scope.player.totalTies,\r\n Partidas_Perdidas : $scope.player.totalLoses\r\n }\r\n };\r\n HttpRequest.player_vs_system(update,function (response) {\r\n //no va hacer nada\r\n });\r\n }", "function set_pointsToAdd(num){\n localStorage[\"pointsToAdd\"] = num;\n}", "function getPoints() {}", "function savePoints(points){\n meanData.countPoints(points)\n .success(function () {\n console.log(point_badge[p] - vm.user.points)\n console.log(punkteGesamt)\n if(punkteGesamt >= (point_badge[p] - vm.user.points)){\n document.getElementById(\"new_badge\").src = badge[p];\n document.getElementById(\"new_points\").innerHTML = \"Sehr gut, Du hast mehr als \" + point_badge[p] + \" Punkte erreicht!!!\";\n p=p+1\n $(\"#myModal3\").modal();\n }\n //$location.path('/account');\n })\n .catch(function (e) {\n console.log(e);\n });\n }", "function giveUserPoint(ID){\n\n}", "function update_points(points) {\n localStorage.setItem('POINTS', points); // update points\n document.getElementById(\"playerpoints\").innerHTML = \"POINTS: \" + localStorage.getItem('POINTS'); //display updated points\n}", "function point() {\n var pointer = document.querySelector('#point').value;\n document.querySelector('#empty').innerHTML = pointer;\n temperature();\n area();\n length();\n volume();\n mass();\n data();\n\n}", "function getPointsForMap() {\n\n let holder = location.pathname.split('/');\n let map_id = holder[holder.length - 2];\n var pointsHolder = {};\n $.ajax({\n url: `/maps/${map_id}/points`,\n method: \"GET\",\n dataType: 'JSON',\n success: function (data){\n pointsHolder = data;\n console.log(\"This data being passed into create maps\",data);\n createMapWithPoints(data);\n },\n error: function(){\n console.log(\"Something has gone wrong with getting the data!\");\n }\n });\n\n\n}", "function pointCreation() {\n var point = new Point(10, 10);\n pointsCollection.add(point);\n point.create();\n }", "terzo(){\n localStorage.setItem('points_' + this.props.type + '_3', this.props.points);\n localStorage.setItem('time_' + this.props.type + '_3', this.props.time);\n }", "function addPoints() {\n\t//for every station in the dataset, create a marker\n for(var i=0; i<dataTrento.length; i++) {\n var station=dataTrento[i];\n createMarker(station);\n }\n for(var i=0; i<dataPergine.length; i++) {\n var station=dataPergine[i];\n createMarker(station);\n }\n for(var i=0; i<dataRovereto.length; i++) {\n var station=dataRovereto[i];\n createMarker(station);\n }\n}", "function add_points() {\n var sum = parseInt(localStorage[\"pointSum\"]);\n sum += parseInt(localStorage[\"pointsToAdd\"]);\n localStorage[\"pointSum\"] = sum;\n}", "addPoint(point) {\n this.dataset.push(point);\n this.draw();\n }", "function load_point() {\n\n}", "function importPoints(points) {\n initializeBoard();\n\n // split data into separate functions\n var segments = [];\n var last_x = Number.POSITIVE_INFINITY;\n $.each(points, function(i,o) {\n if (o.length !== 2) return;\n if (o[0] < last_x) {\n var s = [];\n s.index = i;\n segments.push(s);\n }\n last_x = o[0];\n segments[segments.length-1].push(o);\n });\n \n // add functions\n $.each(segments, function(i,o) {\n if (o.length < 2) return;\n addFunction(o);\n });\n \n // switch to functions tab\n $('#datatable').empty();\n $('.nav-tabs a[href=\"#functions\"]').tab('show');\n $('#graph-overlay').hide();\n $('.jxgbox').css('opacity', 1.0);\n}", "function saveFSPoint(){\n\t// reset point \n\tcurrent_fs_bd = [];\n\tcurrent_fs_bd.push(point_fs.lon);\n\tcurrent_fs_bd.push(point_fs.lat);\n\t\n\toutputSaveProgress();\n}", "function payerPoints(payer){\n console.log(pointMap.get(payer));\n return (\n <div>\n <h2>Points of Payer: {payer}</h2>\n </div>\n );\n \n}", "function renderPoints(points_array){\n for(var i = 0; i < points_array.length; i++) {\n let pointObject = points_array[i]\n let latLng = {lat: Number(pointObject.lat), lng: Number(pointObject.long)};\n let marker = new google.maps.Marker({ //change this to ID later\n position: latLng,\n map: map,\n icon: image\n });\n markers.push(marker)\n newPointDescription(pointObject.title, pointObject.address, pointObject.description, pointObject.id, pointObject.img_url)\n }\n let map_id = $('#map').data('map_id')\n isUserOwnerOfMap(map_id)\n}", "addPoint(point) {\n this._points.push(point);\n }", "function TakeAPoint(data)\n {\n \n TakePointSound();\n var x = {\"X\": data.X, \"Y\":data.Y, \"Z\": data.Z, \"I\": data.I, \"J\": data.J, \"K\": data.K, \"ANGLES\": data.ANGLES, \"RawPositions\" : data.RawPositions}; \n elem = document.getElementById(\"pointsTakenId2\");\n\n switch(MeasureStep)\n \n {\n case 0:\n pts1.push(x);\n \n $(\"#pointsTakenId\").val(pts1.length)\n elem.value = pts1.length;\n if(pts1.length<=pointsNeededVal){\n $(\"#probPointsId\").html(pts1.length+\"/\"+pointsNeededVal);\n $(\"#CalculateResultId\").click(function(){\n finalStep();\n })\n }else{\n \n $(\"#CalculateResultId\").unbind(\"click\");\n\n\n }\n // special case for calibration and checkout.\n\n if(MaxPointsToTake != 0 && MaxPointsToTake == pts1.length){\n $(\".pointsContainer .btn-green\").css('background','#1db79b'); \n }\n\n break;\n case 1:\n pts2.push(x);\n elem.value = pts2.length;\n break;\n case 2:\n pts3.push(x);\n elem.value = pts3.length;\n break;\n case 3:\n pts4.push(x);\n elem.value = pts4.length;\n break;\n }\n \n \n \n }", "secondo(){\n localStorage.setItem('points_' + this.props.type + '_3', localStorage.getItem('points_' + this.props.type + '_2'));\n localStorage.setItem('time_' + this.props.type + '_3', localStorage.getItem('time_' + this.props.type + '_2'));\n localStorage.setItem('points_' + this.props.type + '_2', this.props.points);\n localStorage.setItem('time_' + this.props.type + '_2', this.props.time);\n }", "function addPoint(latitude, longitude, date, batterryStatus, pointType) {\n\tvar isPreviousPointInSamePoint = false;\n\tfor(var i = 0; i < sizeListPoint; ++i){\n\t\tif(listPoint[i].latitude == latitude && listPoint[i].longitude){\n\t\t\tlistPoint[i].title += '\\n\\nPoint type : ' + pointType + ';\\nDate: ' + date + ';\\nBattery status : '+ batterryStatus + '%';\n\t\t\tlistPoint[i].pointType = pointType;\n\t\t\tisPreviousPointInSamePoint = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif(!isPreviousPointInSamePoint){\n\t\tlistPoint[sizeListPoint++] = {\n\t\t\tlatitude : latitude,\n\t\t\tlongitude : longitude,\n\t\t\tpointType : pointType,\n\t\t\ttitle : 'Point type : ' + pointType + ';\\nDate: ' + date + ';\\nBattery status : '+ batterryStatus + '%',\n\t\t};\n\t\tlastPoint = listPoint[sizeListPoint - 1];\n\t}\n\tpolyline.getPath().push(new google.maps.LatLng(latitude, longitude));\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 getLocationSuccess(success,point) {\n var point2 = Wsg2Mars(point);\n console.log(\"new location find\");\n success(point2);\n $('#loading-more').empty();\n $('.page').show();\n //save to cache\n amplify.request(\"updateCachedLocation\",\n {\n Longitude: point2.coords.longitude,\n Latitude: point2.coords.latitude\n }\n );\n}", "function getPoints() {\n send(json_get_points_message());\n}", "constructor(newPointHandler) \n {\n this.provider = newPointHandler;\n this.points = new Map();\n this.domain = [0, 0];\n this.range = [0, 0];\n }", "function buriedPoint(eventnumberData,channelnameData,sourcepageData,houseidData,machinetypeData,sourceData,customeridData) {\n // 埋点开始\n var buriedPoint= {\n \"eventnumber\": eventnumberData,\n \"channelname\": channelnameData ,\n \"sourcepage\": sourcepageData,\n \"houseid\": houseidData,\n \"machinetype\":machinetypeData,\n \"source\": sourceData,\n \"customerid\": customeridData\n };\n console.log(\"传参\",buriedPoint)\n $.ajax({\n url:testHttp+\"/visitor/record\",\n type:\"POST\",\n headers:{\"Content-Type\":\"application/json;charset=UTF-8\"},\n data:JSON.stringify(buriedPoint),\n success:function(data){\n if(data.code===\"000000\"){\n localStorage.setItem(\"customeridLos\",data.data.customerid);\n console.log(\"获取表示1\",localStorage.getItem(\"customeridLos\"))\n }\n }\n });\n // 埋点结束\n}", "static addPoints(){\n Point.clearPoints();\n \n for(var i = 0; i < points.length; i++){\n pointMarkers[i] = two.makeCircle(points[i].x, points[i].y, 6);\n pointMarkers[i].noStroke();\n\n //Colors of points\n switch(points[i].name){\n case 'A':\n pointMarkers[i].fill = 'red'; //Red\n break;\n case 'B':\n pointMarkers[i].fill = '#0058ff'; //Blue\n break;\n case 'C':\n pointMarkers[i].fill = '#03ff0d'; //Green\n break;\n case 'D':\n pointMarkers[i].fill = '#ffab2f'; //Orange\n break;\n case 'E':\n pointMarkers[i].fill = '#f1c40f'; //Yellow\n break;\n case 'F':\n pointMarkers[i].fill = '#8e44ad'; //Purple\n break;\n case 'G':\n pointMarkers[i].fill = '#bdc3c7'; //Silver\n break;\n case 'H':\n pointMarkers[i].fill = '#000000'; //Black\n break;\n default:\n pointMarkers[i].fill = 'black';\n }\n }\n }", "function updatePoints()\n\t{\n\t\ttfPoints.text = \"POINTS: \" + String(points);\n\t}", "static initialize(obj, points) { \n obj['points'] = points;\n }", "function pushPoint(X, Y) {\n points.push({ x: X, y: Y });\n}", "function updateCityConsumePoints(city_id,points){\n \t$.ajax({\n\t method: \"POST\",\n\t url: SITE_URL + '/welcome/updateCityConsumePoints',\n\t data: { city_id: city_id,points:points }\n\t})\n \n}", "function pointsGen(dataset, pointStyle, points) {\r\n return L.geoJson(dataset, {\r\n style: pointStyle,\r\n pointToLayer: points\r\n }).addTo(map);\r\n}", "addPoints(state, delta){\n console.log(\"store commit add points delta is \", delta)\n state.points += +delta\n user.setPoints(state.points)\n }", "function utilityPointCompleted(grandTotal) {\n var total_number_utilPoint = {\n onStatisticField: \"LAYER\",\n outStatisticFieldName: \"total_number_utilPoint\",\n statisticType: \"count\"\n };\n\nvar total_completed_utilPoint = {\nonStatisticField: \"CASE WHEN Status = 1 THEN 1 ELSE 0 END\",\noutStatisticFieldName: \"total_completed_utilPoint\",\nstatisticType: \"sum\"\n};\n\nvar query = utilPointLayer.createQuery();\nquery.outStatistics = [total_number_utilPoint, total_completed_utilPoint];\nquery.groupByFieldsForStatistics = [\"CP\"];\n\nvar point_cpN01 = [];\nvar point_cpN01_a = [];\n\nvar point_cpN02 = [];\nvar point_cpN02_a = [];\n\nvar point_cpN03 = [];\nvar point_cpN03_a = [];\n\nvar point_cpN04 = [];\nvar point_cpN04_a = [];\n\nvar point_cpN05 = [];\nvar point_cpN05_a = [];\n\nreturn utilPointLayer.queryFeatures(query).then(function(response) {\nstats = response.features;\n\nstats.forEach((result, index) => {\nconst attributes = result.attributes;\nconst cpPackage = result.attributes.CP;\nconst completed = attributes.total_completed_utilPoint;\nconst totalUtilPoint = attributes.total_number_utilPoint;\n\nif (cpPackage === 'N-01') {\n point_cpN01.push(completed);\n point_cpN01_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-02') {\n point_cpN02.push(completed);\n point_cpN02_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-03') {\n point_cpN03.push(completed);\n point_cpN03_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-04') {\n point_cpN04.push(completed);\n point_cpN04_a.push(totalUtilPoint);\n\n} else if (cpPackage === 'N-05') {\n point_cpN05.push(completed);\n point_cpN05_a.push(totalUtilPoint);\n}\n});\nreturn [point_cpN01, point_cpN02, point_cpN03, point_cpN04, point_cpN05, point_cpN01_a, point_cpN02_a, point_cpN03_a, point_cpN04_a, point_cpN05_a, grandTotal];\n});\n}", "get points() { return this._points; }", "function addFunction(point_data) { \n optimalApp.board.suspendUpdate();\n \n var func = {\n data: point_data,\n dataTable: null,\n drawnSidebar: null,\n drawnGraph: null,\n drawnPoints: null\n }; \n \n // create datatable\n func.drawnSidebar =\n $('<div class=\"datatable\"></div>')\n .appendTo('#datatables');\n \n // create delete button\n $('<a class=\"remove-function\" href=\"#\"><i class=\"icon-trash\"></i></a>')\n .click(function() { removeFunction(func); })\n .appendTo(func.drawnSidebar);\n \n func.drawnSidebar.handsontable({\n startRows: 3,\n startCols: 2,\n rowHeaders: false,\n colHeaders: getColHeaders(),\n minSpareRows: 1,\n fillHandle: true,\n onChange: function(data) { _redrawFunction(func); },\n onBeforeChange: function (data) { /* TODO reject invalid values as in Handsontable demo */ }\n });\n \n // draw the graphs\n // careful: data is duplicated between .data and .dataTable\n func.dataTable = func.drawnSidebar.data().handsontable;\n func.drawnPoints = drawFunctionPoints(func);\n func.drawnGraph = drawFunctionGraph(func);\n updateDataTable(func);\n \n optimalApp.functions.push(func);\n optimalApp.board.unsuspendUpdate();\n return func;\n}", "function onePoint() {\n var branch_id = $('#branch_id').val();\n var postData = 'branch=' + branch_id + '&_csrf=' + $('.toPost').val();\n $.post('/companies/getonepoint', postData, function(data) {\n var answer = jQuery.parseJSON(data);\n\n onePoint = prepareOnePlacemark(answer);\n myMap.geoObjects.add(onePoint);\n myMap.setCenter([answer.ay, answer.ax], 16);\n\n });\n }", "addSpawnPoint(from_, x_, y_) {\n this.spawnPoints.push({\n from: from_,\n x: x_,\n y: y_\n });\n }", "function displayPoints(data) {\n\treturn new Promise(function(resolve) {\n\n\t\tif (data.hasOwnProperty('LastEvaluatedKey')) lastEvaluatedKey = data.LastEvaluatedKey.Id;\n\t\telse lastEvaluatedKey = 'finished';\n\n\t\tfor (var i = 0; i < data.Items.length; i++) {\n\t\t\tvar LatLng = new google.maps.LatLng({\n\t\t\t\tlat: data.Items[i].Coordinates[0],\n\t\t\t\tlng: data.Items[i].Coordinates[1]\n\t\t\t});\n\n\t\t\tvar circle = new google.maps.Circle({\n\t\t\t\tfillColor: pointsStyle[data.Items[i].Action].fillColor,\n\t\t\t\tfillOpacity: pointsStyle[data.Items[i].Action].fillOpacity,\n\t\t\t\tmap: map,\n\t\t\t\tcenter: LatLng,\n\t\t\t\tradius: pointsStyle[data.Items[i].Action].radius,\n\t\t\t\tstrokeWeight: 0\n\t\t\t});\n\n\t\t\tif (data.Items[i].Action === 'view') pageviews++;\n\n\t\t\tif (data.Items[i].Action === 'commitment') commitments++;\n\n\t\t}\n\n\t\tdocument.getElementById('pageviews').innerText = pageviews;\n\t\tdocument.getElementById('commitments').innerText = commitments;\n\n\t\tresolve('All points processed');\n\n\t});\n}", "function createPoint(temp) {\n //var t = random(0, height-20);\n // Creates a new point with x -> live width of the canvas & y -> the temperature value from arduino\n var P = new Points(width, temp);\n chartpoints.push(P);\n}", "function createfoundpoints(latitude, longitude, fromArray) {\n //Extracts the search distance from the input box\n distance = document.getElementById(\"dist\").value\n console.log(table, longitude, latitude, distance)\n //Ajax call to server\n $.ajax({\n url: 'http://localhost:3000/findpointfrompoint',\n type: \"POST\",\n cache: false,\n contentType: \"application/json\",\n //Passes table, search from position and distance as req.body parameters\n data: JSON.stringify({\n table: table,\n longitude: longitude,\n latitude: latitude,\n distance: distance\n }),\n success: function (res) {\n console.log(findFromPos, findFromPoint, findFromTrail, target);\n console.log(res);\n //Clear previous search position markers and adds a new in the correct feature (fromArray)\n clickedArray.clear();\n positionArray.clear();\n addPositionMarker(longitude, latitude, fromArray);\n //Loops the rows of the query result and adds positions markers\n for (var i in res) {\n console.log(latitude, longitude, res[i].latitude, res[i].longitude);\n console.log('Point within distance Yeey!');\n addPositionMarker(res[i].longitude, res[i].latitude, \"searchResult\");\n }\n //Sets the view to the search from position\n map.setView(new View({\n center: fromLonLat([longitude, latitude]),\n zoom: 13\n }))\n }\n })\n }", "async record({ metric, value }) {\n return fetchJSON(`/api/datasets/${metric._id}/points`, {\n method: 'POST',\n body: { metric, value },\n });\n }", "function drawPointList(points) {\n var points = imageSet.images[currentImageIndex].points;\n var dataString = '';\n var dataStringArray = [];\n \n $('#pointlistDiv ul').html('');\n \n points.forEach(function(p) {\n \n // dataString for each point is \"<imageName>, x, y\"\n dataString = imageSet.images[currentImageIndex].name + ', '+p.x+', '+p.y;\n dataStringArray.push(dataString);\n \n var newPointLi = '<li>' + dataString + '</li>';\n $('#pointlistDiv ul').append(newPointLi);\n });\n \n //writePointData(dataStringArray);\n}", "addPoints(newPoints) {\n for (let p of newPoints) {\n this.points.push(p);\n }\n return this;\n }", "function updatePoints() {\n\t\t$('.points span.points').html(points + '$Dolares');\n\t}", "async UsePoints(ctx, usePoints) {\n usePoints = JSON.parse(usePoints);\n usePoints.timestamp = new Date(\n ctx.stub.txTimestamp.seconds.low * 1000\n ).toGMTString();\n usePoints.transactionId = ctx.stub.txId;\n\n let member = await ctx.stub.getState(usePoints.member);\n member = JSON.parse(member);\n if (member.points < usePoints.points) {\n throw new Error(\"Member does not have sufficient points\");\n }\n member.points -= usePoints.points;\n await ctx.stub.putState(\n usePoints.member,\n Buffer.from(JSON.stringify(member))\n );\n\n let usePointsTransactions = await ctx.stub.getState(\n usePointsTransactionsKey\n );\n usePointsTransactions = JSON.parse(usePointsTransactions);\n usePointsTransactions.push(usePoints);\n await ctx.stub.putState(\n usePointsTransactionsKey,\n Buffer.from(JSON.stringify(usePointsTransactions))\n );\n\n return JSON.stringify(usePoints);\n }", "function updatePoints(){\npoints = salary_score + education_score + experience_score + timeSpent_score + extraCredit_score + chineseLevel_score + location_score + province_score + age_score;\n$('td#points').html(points);\n}", "function getPoints() {\n return tableData;\n }", "async addPointsToHFEvent(eventId, fields, points) {\n const res = await this.post('events/' + eventId + '/series',\n {\n format: 'flatJSON',\n fields: fields,\n points: points\n });\n if (!res.status === 'ok') {\n throw new Error('Failed loading serie: ' + JSON.stringify(res.status));\n }\n return res;\n }", "function setPoints() {\n let shadowDOM = document.getElementById('gdx-bubble-host').shadowRoot;\n let points = shadowDOM.querySelector('#gdx-bubble-points');\n points.innerText = data[currentIndex].points;\n}", "get point() {}", "function getPoints() {\n return [\n new google.maps.LatLng(37.782551, -122.445368),\n new google.maps.LatLng(37.782745, -122.444586),\n new google.maps.LatLng(37.782842, -122.443688),\n new google.maps.LatLng(37.782919, -122.442815),\n new google.maps.LatLng(37.782992, -122.442112),\n new google.maps.LatLng(37.7831, -122.441461),\n new google.maps.LatLng(37.783206, -122.440829),\n new google.maps.LatLng(37.783273, -122.440324),\n new google.maps.LatLng(37.783316, -122.440023),\n new google.maps.LatLng(37.783357, -122.439794),\n new google.maps.LatLng(37.783371, -122.439687),\n new google.maps.LatLng(37.783368, -122.439666),\n new google.maps.LatLng(37.783383, -122.439594),\n new google.maps.LatLng(37.783508, -122.439525),\n new google.maps.LatLng(37.783842, -122.439591),\n new google.maps.LatLng(37.784147, -122.439668),\n new google.maps.LatLng(37.784206, -122.439686),\n new google.maps.LatLng(37.784386, -122.43979),\n new google.maps.LatLng(37.784701, -122.439902),\n new google.maps.LatLng(37.784965, -122.439938),\n new google.maps.LatLng(37.78501, -122.439947),\n new google.maps.LatLng(37.78536, -122.439952),\n new google.maps.LatLng(37.785715, -122.44003),\n new google.maps.LatLng(37.786117, -122.440119),\n new google.maps.LatLng(37.786564, -122.440209),\n new google.maps.LatLng(37.786905, -122.44027),\n new google.maps.LatLng(37.786956, -122.440279),\n new google.maps.LatLng(37.800224, -122.43352),\n new google.maps.LatLng(37.800155, -122.434101),\n new google.maps.LatLng(37.80016, -122.43443),\n new google.maps.LatLng(37.800378, -122.434527),\n new google.maps.LatLng(37.800738, -122.434598),\n new google.maps.LatLng(37.800938, -122.43465),\n new google.maps.LatLng(37.801024, -122.434889),\n new google.maps.LatLng(37.800955, -122.435392),\n new google.maps.LatLng(37.800886, -122.435959),\n new google.maps.LatLng(37.800811, -122.436275),\n new google.maps.LatLng(37.800788, -122.436299),\n new google.maps.LatLng(37.800719, -122.436302),\n new google.maps.LatLng(37.800702, -122.436298),\n new google.maps.LatLng(37.800661, -122.436273),\n new google.maps.LatLng(37.800395, -122.436172),\n new google.maps.LatLng(37.800228, -122.436116),\n new google.maps.LatLng(37.800169, -122.43613),\n new google.maps.LatLng(37.800066, -122.436167),\n new google.maps.LatLng(37.784345, -122.422922),\n new google.maps.LatLng(37.784389, -122.422926),\n new google.maps.LatLng(37.784437, -122.422924),\n new google.maps.LatLng(37.784746, -122.422818),\n\n ];\n}", "function draw(event) {\n var idDibujo = $('#dibujo').val();\n if(idDibujo==null || idDibujo==\"\"){\n alert(\"El Identificador del Dibujo es obligatorio\")\n }else{\n var canvas = document.getElementById(\"canvas\");\n var offset = getOffset(canvas);\n var pt=new Point(event.pageX-offset.left, event.pageY-offset.top);\n console.info(\"publishing point at (\"+pt.x+\",\"+pt.y+\")\");\n //publicar el evento\n stompClient.send(\"/app/newpoint.\"+idDibujo, {}, JSON.stringify(pt));\n }\n }", "createPoint(id, title, completed, isEdit) {\n return (\n <Point\n id={id}\n title={title}\n completed={completed}\n isEdit={isEdit}\n />\n );\n }", "function viewPoints() {\n const data = processTransactions();\n const listItems = data.map(\n (d) =>\n <tr><td>{d.customer}</td><td>{d.point}</td>\n <td>{d.date.getMonth() + 1}</td>\n <td>{d.total}</td>\n </tr>\n );\n\n return (\n <div class=\"report\">\n <p>POINTS REWARDED SUMMARY:</p>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">Customer</th>\n <th scope=\"col\">Reward Point</th>\n <th scope=\"col\">Month</th>\n <th scope=\"col\">Total</th>\n </tr>\n </thead>\n <tbody>\n {listItems}\n </tbody>\n </table>\n </div>\n );\n}", "function updatePoints() {\n const playerPoints = cookie.get('points');\n document.getElementById(\"pointDisplay\").innerHTML = \"points: \" + playerPoints;\n}", "function load_points() {\n var gv = this;\n // last_update = last_update.toString();\n \n if (last_update != \"\") {\n // epochs\n last_update = Math.round(last_update.getTime() / 1000.0)\n }\n \n $.get(this.dback + \"/points\", { last_update: last_update }, function(data) {\n var items = eval(data);\n $.each(items, function(i,item) {\n // TODO: add opacity in, with item.opacity\n gv.update(item.x * gv.xwidth, item.y * gv.xwidth, item.opacity / 100);\n });\n // for vanity's sake\n load_signature();\n });\n last_update = new Date;\n}", "function storePositionforDrinkups() {\n var place = autocomplete.getPlace();\n var position= {\n coords: {latitude:place.geometry.location.lat(),longitude:place.geometry.location.lng()}\n };\n changeMapLocationforDrinkups(position.coords.latitude,position.coords.longitude,15);\n\n initializeMarkers(position);\n}", "function getPoints() {\n return [\n new google.maps.LatLng(45.391982833,-93.367101333),new google.maps.LatLng(45.391982833,-93.367101333),new google.maps.LatLng(45.391982833,-93.367101333),new google.maps.LatLng(45.391982833,-93.367101333),\n \n ];\n }", "function AddPoints(colIndex,value,allowNegative)\n{\n var addedPoints = parseInt(value); \n if (isNaN(addedPoints))\n {\n addedPoints = 0;\n }\n if (addedPoints == 0) return;\n\n AddPointsRefreshUI(colIndex, addedPoints, allowNegative);\n}", "function addLatLng(event) {\n var path = poly.getPath();\n\n\n\n var point = [(event.latLng.lat()), (event.latLng.lng())]\n console.log(point);\n\n coordinates_array.push(point);\n\n // Because path is an MVCArray, we can simply append a new coordinate\n // and it will automatically appear.\n path.push(event.latLng);\n\n\n // and it will automatically appear.\n\n var inputs = $(\".points\");\n\n $(\".points\").each(function() {\n\n for (var i=0; i<inputs.length; i++) {\n if (inputs[i].value === \"\") {\n console.log(inputs[i]);\n console.log(point);\n inputs[i].value = point;\n break;\n }\n }\n });\n\n\n\n // Add a new marker at the new plotted point on the polyline.\n var marker = new google.maps.Marker({\n position: event.latLng,\n title: '#' + path.getLength(),\n map: map\n });\n }", "function addPoint( mouseEvent ) {\n $.ajax( {\n\ttype: \"POST\",\n\turl: \"/point/add/\",\n\tdata: { 'lat': mouseEvent.latLng.lat(),\n\t\t'lng': mouseEvent.latLng.lng() },\n\tsuccess: function() {\n\t displayPoint( mouseEvent.latLng );\n\t}\n } );\n}", "getPoints() {\n let valueArray = this.getPointsRaw()\n let returningArray = []\n valueArray.forEach((coordinate) => {\n returningArray.push(new google.maps.LatLng(coordinate[0],coordinate[1]))\n })\n return returningArray\n }", "async function requestAddPoints(setAddPoints) {\n try {\n const response = await fetch(`${API_URL}/user/points`, {\n method:\"POST\",\n body:JSON.stringify({ amount:\"1000\" }),\n headers: {\n \"content-type\": \"application/json\",\n Accept: \"application/json\",\n Authorization: \"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MTFkMzIwYmMxZDFhNzAwMjE5ZjNjM2YiLCJpYXQiOjE2MjkzMDMzMDd9.hQvbprVSC3iqDFNO9_xGgb-95zLRg3KFwGUstJmCew4\",\n }\n });\n const data = await response.json();\n setAddPoints(data);\n }\n catch (e) {\n console.error(\"error\",e);\n }\n}", "initPoints() {\n this._points = [\n { id: 1, x: 4845573.7636, y: 8538444.1986 },\n { id: 40991, x: 4833272.2905, y: 8851879.3016 },\n { id: 3, x: 4841121.9158, y: 8533011.0179 },\n { id: 49192, x: 4885807.9349, y: 8735902.9555 },\n { id: 40994, x: 4831497.6883, y: 8844107.6121 },\n { id: 6, x: 4838140.2016, y: 8522348.6552 },\n { id: 7, x: 4837455.3198, y: 8539117.3266 },\n { id: 49196, x: 4882214.6475, y: 8724167.5077 },\n { id: 40999, x: 4829374.7513, y: 8859821.2174 },\n { id: 49198, x: 4881983.8495, y: 8731365.8486 },\n { id: 45108, x: 4784887.2271, y: 8736542.1748 },\n { id: 45111, x: 4783068.1658, y: 8741691.5428 },\n { id: 45112, x: 4781138.3706, y: 8724108.5082 },\n { id: 45115, x: 4778080.4764, y: 8730855.1873 },\n { id: 45121, x: 4773662.6047, y: 8737584.4445 },\n { id: 45123, x: 4771470.2781, y: 8730974.57 },\n { id: 45124, x: 4770033.5888, y: 8724357.968 },\n { id: 45126, x: 4770132.5006, y: 8742756.1221 },\n { id: 57430, x: 4651133.5325, y: 8564166.3124 },\n { id: 57431, x: 4649947.7363, y: 8574527.3911 },\n { id: 57432, x: 4648420.2475, y: 8581932.6169 },\n { id: 57433, x: 4646699.7672, y: 8566887.7299 },\n { id: 24642, x: 4671025.1343, y: 8648694.5889 },\n { id: 8247, x: 4852754.2341, y: 8441379.725 },\n { id: 24645, x: 4669448.5337, y: 8656404.5069 },\n { id: 8249, x: 4850769.8648, y: 8449468.0238 },\n { id: 57437, x: 4643864.6942, y: 8582553.0918 },\n { id: 57438, x: 4643047.4543, y: 8575052.6667 },\n { id: 57440, x: 4641484.2172, y: 8568899.615 },\n { id: 24651, x: 4664950.584, y: 8662439.1097 },\n { id: 8255, x: 4847103.6831, y: 8444416.9443 },\n { id: 24652, x: 4664011.3503, y: 8645504.779 },\n { id: 57444, x: 4637559.8974, y: 8580985.9182 },\n { id: 57445, x: 4636968.7959, y: 8571856.8208 },\n { id: 57447, x: 4635351.4645, y: 8565257.5349 },\n { id: 24656, x: 4661999.8118, y: 8651952.99 },\n { id: 8260, x: 4843341.3559, y: 8449078.7471 },\n { id: 24657, x: 4661598.9319, y: 8658541.6593 },\n { id: 24658, x: 4661620.9814, y: 8663252.7681 },\n { id: 8262, x: 4841522.4591, y: 8458715.6703 },\n { id: 8264, x: 4840271.9566, y: 8442728.8288 },\n { id: 24662, x: 4658418.9411, y: 8646120.2916 },\n { id: 8266, x: 4837711.0123, y: 8456724.9609 },\n { id: 24663, x: 4657525.3749, y: 8664178.9824 },\n { id: 8267, x: 4838003.1065, y: 8447700.828 },\n { id: 24664, x: 4657106.6719, y: 8654360.5278 },\n { id: 24667, x: 4654891.0932, y: 8659312.8827 },\n { id: 36978, x: 4815074.4873, y: 8629229.2459 },\n { id: 36980, x: 4813696.8075, y: 8639624.7224 },\n { id: 36986, x: 4808480.8037, y: 8629844.7891 },\n { id: 36987, x: 4807043.3983, y: 8622435.769 },\n { id: 36993, x: 4801868.2368, y: 8640892.6804 },\n { id: 36994, x: 4801363.2704, y: 8630342.2764 },\n { id: 61596, x: 4759856.792, y: 8428948.9905 },\n { id: 61597, x: 4759011.6692, y: 8438695.7709 },\n { id: 61599, x: 4758736.9359, y: 8424751.9062 },\n { id: 49302, x: 4883581.1233, y: 8716317.5643 },\n { id: 61601, x: 4758694.0585, y: 8419607.4773 },\n { id: 49304, x: 4882034.4233, y: 8708797.7416 },\n { id: 61602, x: 4757337.3297, y: 8434322.502 },\n { id: 20612, x: 4726884.4955, y: 8712834.2867 },\n { id: 20615, x: 4725984.3492, y: 8719460.95 },\n { id: 61608, x: 4754675.6519, y: 8428262.1365 },\n { id: 20618, x: 4721404.0859, y: 8719139.9542 },\n { id: 20619, x: 4721040.5256, y: 8711334.0662 },\n { id: 61612, x: 4753329.5224, y: 8422697.5282 },\n { id: 20624, x: 4716421.0654, y: 8721271.9634 },\n { id: 61615, x: 4751356.1493, y: 8434543.7994 },\n { id: 20625, x: 4715701.8335, y: 8709916.1772 },\n { id: 20628, x: 4712112.0631, y: 8717882.5207 },\n { id: 53421, x: 4687802.2242, y: 8532749.2921 },\n { id: 53422, x: 4686872.3477, y: 8521287.4844 },\n { id: 61621, x: 4748435.1229, y: 8418567.6572 },\n { id: 12434, x: 4779307.5841, y: 8450994.2065 },\n { id: 61623, x: 4747384.4654, y: 8423471.1476 },\n { id: 12435, x: 4777707.744, y: 8457252.5984 },\n { id: 61624, x: 4746227.6925, y: 8428802.5423 },\n { id: 53426, x: 4682126.2479, y: 8539466.3525 },\n { id: 12436, x: 4776715.1407, y: 8442878.7654 },\n { id: 61625, x: 4745049.71, y: 8435295.4147 },\n { id: 53427, x: 4679879.1011, y: 8527043.1572 },\n { id: 53428, x: 4679098.3825, y: 8532905.8255 },\n { id: 53432, x: 4673168.6113, y: 8522999.9055 },\n { id: 53433, x: 4672103.619, y: 8537693.5858 },\n { id: 12443, x: 4773343.0344, y: 8439304.745 },\n { id: 12444, x: 4771649.7924, y: 8454893.4028 },\n { id: 12447, x: 4770003.7549, y: 8447089.0213 },\n { id: 154, x: 4837923.3803, y: 8503688.173 },\n { id: 155, x: 4837459.7464, y: 8512006.0036 },\n { id: 12453, x: 4767073.8049, y: 8439662.2146 },\n { id: 69859, x: 4684373.4519, y: 8436107.2015 },\n { id: 69861, x: 4683201.117, y: 8425380.1458 },\n { id: 32973, x: 4856746.8842, y: 8696120.4124 },\n { id: 32976, x: 4853166.2667, y: 8687210.5286 },\n { id: 69869, x: 4675373.8011, y: 8435613.6206 },\n { id: 32978, x: 4849360.9302, y: 8693102.9097 },\n { id: 32979, x: 4848733.1769, y: 8685492.8914 },\n { id: 32981, x: 4846393.7924, y: 8700516.4742 },\n { id: 32984, x: 4842461.1527, y: 8687244.0655 },\n { id: 4296, x: 4799212.8973, y: 8564577.3201 },\n { id: 4297, x: 4798660.1907, y: 8573808.0204 },\n { id: 28893, x: 4651264.7262, y: 8635401.1655 },\n { id: 16596, x: 4748189.0844, y: 8775685.7499 },\n { id: 16597, x: 4746912.8779, y: 8782533.6861 },\n { id: 41192, x: 4825039.7972, y: 8850556.6709 },\n { id: 28895, x: 4649515.493, y: 8625305.8466 },\n { id: 41194, x: 4824394.0857, y: 8843896.1854 },\n { id: 28898, x: 4646878.2358, y: 8632936.1838 },\n { id: 16601, x: 4742564.8655, y: 8767350.981 },\n { id: 4304, x: 4793527.5292, y: 8565287.349 },\n { id: 28899, x: 4646605.6093, y: 8637651.0868 },\n { id: 28901, x: 4646709.8724, y: 8643228.5321 },\n { id: 16604, x: 4739877.7771, y: 8771735.1234 },\n { id: 41200, x: 4821384.0162, y: 8857427.9319 },\n { id: 16606, x: 4739731.9736, y: 8777271.5431 },\n { id: 28904, x: 4642704.9837, y: 8629445.7797 },\n { id: 16607, x: 4738967.9193, y: 8786137.9626 },\n { id: 211, x: 4841759.5197, y: 8574307.4225 },\n { id: 41202, x: 4818629.4998, y: 8849404.8323 },\n { id: 28906, x: 4642804.24, y: 8643421.3789 },\n { id: 4312, x: 4788189.9008, y: 8574847.6252 },\n { id: 28907, x: 4642414.8407, y: 8639101.0871 },\n { id: 28908, x: 4642019.755, y: 8635278.1995 },\n { id: 4314, x: 4787209.7644, y: 8563419.4359 },\n { id: 215, x: 4838325.3555, y: 8562713.1577 },\n { id: 41206, x: 4816023.2152, y: 8857745.0303 },\n { id: 28909, x: 4640208.1374, y: 8631212.2859 },\n { id: 216, x: 4838519.043, y: 8569905.424 },\n { id: 28913, x: 4639171.8324, y: 8644771.7166 },\n { id: 16616, x: 4731621.9822, y: 8781675.9347 },\n { id: 4319, x: 4783442.4572, y: 8571126.5227 },\n { id: 28916, x: 4636176.9791, y: 8639856.99 },\n { id: 28917, x: 4635955.429, y: 8635546.6397 },\n { id: 49413, x: 4890444.9347, y: 8760933.6966 },\n { id: 45314, x: 4782933.5767, y: 8715699.7561 },\n { id: 28918, x: 4635355.4158, y: 8628948.1374 },\n { id: 49418, x: 4882302.7025, y: 8778246.7343 },\n { id: 49419, x: 4881732.3174, y: 8765561.7243 },\n { id: 49421, x: 4880932.7349, y: 8772715.071 },\n { id: 45322, x: 4776952.1376, y: 8710823.2698 },\n { id: 45323, x: 4775200.4861, y: 8706639.8519 },\n { id: 45324, x: 4775502.0418, y: 8718761.2267 },\n { id: 12536, x: 4778064.1641, y: 8434727.2576 },\n { id: 45330, x: 4768188.5791, y: 8713830.4009 },\n { id: 12539, x: 4777031.8817, y: 8428291.2434 },\n { id: 45332, x: 4767201.2093, y: 8708756.684 },\n { id: 12540, x: 4775828.3423, y: 8423743.722 },\n { id: 12544, x: 4772850.4599, y: 8432158.5751 },\n { id: 12547, x: 4770841.497, y: 8436225.9983 },\n { id: 12548, x: 4769305.6383, y: 8419644.1396 },\n { id: 12549, x: 4769010.5054, y: 8427091.9958 },\n { id: 255, x: 4845487.4308, y: 8546652.9657 },\n { id: 259, x: 4841981.8098, y: 8553565.0144 },\n { id: 260, x: 4841230.272, y: 8541403.4438 },\n { id: 65846, x: 4704299.5496, y: 8401799.5793 },\n { id: 262, x: 4838748.1995, y: 8544827.9545 },\n { id: 65848, x: 4703786.7711, y: 8409685.2683 },\n { id: 65853, x: 4695588.2636, y: 8411959.6229 },\n { id: 65859, x: 4690625.8234, y: 8404492.2092 },\n { id: 20785, x: 4728852.9613, y: 8728153.8668 },\n { id: 20786, x: 4727029.1609, y: 8733826.0844 },\n { id: 20788, x: 4725448.0154, y: 8743119.9013 },\n { id: 20790, x: 4723800.2526, y: 8725769.9581 },\n { id: 20793, x: 4721540.6203, y: 8732639.5273 },\n { id: 20797, x: 4718912.4631, y: 8740472.1961 },\n { id: 20798, x: 4718374.1326, y: 8736158.346 },\n { id: 20801, x: 4715757.3548, y: 8745915.3159 },\n { id: 57693, x: 4632671.0929, y: 8571040.8634 },\n { id: 20802, x: 4714086.1862, y: 8729937.4116 },\n { id: 57695, x: 4630615.8402, y: 8580241.1424 },\n { id: 20805, x: 4712710.4933, y: 8737482.0239 },\n { id: 57697, x: 4630034.1448, y: 8574584.7136 },\n { id: 8509, x: 4850958.2733, y: 8430273.9243 },\n { id: 57702, x: 4625252.5066, y: 8569184.5257 },\n { id: 8514, x: 4847489.0979, y: 8420195.45 },\n { id: 57703, x: 4624311.8412, y: 8563527.9704 },\n { id: 8515, x: 4846697.4386, y: 8437758.9601 },\n { id: 57704, x: 4623966.3299, y: 8575275.9031 },\n { id: 57705, x: 4623886.1487, y: 8581305.3845 },\n { id: 37210, x: 4834772.0532, y: 8681073.1557 },\n { id: 37211, x: 4834591.6988, y: 8676361.2304 },\n { id: 37212, x: 4833853.8751, y: 8671167.4577 },\n { id: 57708, x: 4621904.0184, y: 8567727.9756 },\n { id: 37213, x: 4833325.1626, y: 8665917.2718 },\n { id: 57710, x: 4620200.356, y: 8575587.3931 },\n { id: 37216, x: 4829319.7587, y: 8661868.2033 },\n { id: 8524, x: 4840644.0345, y: 8429557.7753 },\n { id: 37219, x: 4827181.7696, y: 8680280.0359 },\n { id: 57715, x: 4616941.812, y: 8570222.4124 },\n { id: 37220, x: 4826495.0222, y: 8674680.3151 },\n { id: 57717, x: 4615981.0701, y: 8577810.3746 },\n { id: 70026, x: 4685896.4685, y: 8451020.9586 },\n { id: 70029, x: 4683210.1232, y: 8444606.4711 },\n { id: 33141, x: 4852192.1893, y: 8676415.7819 },\n { id: 33143, x: 4851697.6494, y: 8669899.2317 },\n { id: 33147, x: 4847543.8031, y: 8664123.8349 },\n { id: 70041, x: 4672501.0106, y: 8453345.8705 },\n { id: 70042, x: 4671676.8035, y: 8439387.3757 },\n { id: 33151, x: 4845340.8229, y: 8676529.2977 },\n { id: 33157, x: 4840562.6033, y: 8669173.4703 },\n { id: 24985, x: 4668450.3059, y: 8643343.1004 },\n { id: 24987, x: 4667414.8645, y: 8636853.9789 },\n { id: 24988, x: 4665649.3451, y: 8631651.8676 },\n { id: 24994, x: 4661331.2057, y: 8640366.9656 },\n { id: 24996, x: 4658000.0783, y: 8632080.8051 },\n { id: 24999, x: 4655752.7365, y: 8637911.8777 },\n { id: 25000, x: 4654398.8291, y: 8627611.0601 },\n { id: 25001, x: 4653184.5856, y: 8630850.8664 },\n { id: 16806, x: 4748135.3253, y: 8753065.0303 },\n { id: 16811, x: 4743832.9144, y: 8749753.2647 },\n { id: 16815, x: 4740974.3958, y: 8758841.5958 },\n { id: 70103, x: 4665324.6779, y: 8450959.2204 },\n { id: 16817, x: 4739601.5187, y: 8748443.7704 },\n { id: 70106, x: 4661321.1185, y: 8439694.2902 },\n { id: 16821, x: 4736571.4028, y: 8765478.3799 },\n { id: 70109, x: 4658782.2673, y: 8453634.8732 },\n { id: 16826, x: 4733701.8755, y: 8755463.7448 },\n { id: 70114, x: 4652110.166, y: 8448663.8978 },\n { id: 16827, x: 4732470.5371, y: 8748952.6654 },\n { id: 66018, x: 4707663.4045, y: 8381280.8154 },\n { id: 66026, x: 4699707.0193, y: 8386029.4252 },\n { id: 66028, x: 4698686.505, y: 8396886.9402 },\n { id: 4543, x: 4779103.5704, y: 8577014.4798 },\n { id: 41435, x: 4824042.894, y: 8828022.5049 },\n { id: 41437, x: 4822135.6702, y: 8836693.7491 },\n { id: 4546, x: 4777892.7168, y: 8564796.1432 },\n { id: 66033, x: 4695200.6442, y: 8382644.2414 },\n { id: 41445, x: 4816508.6286, y: 8838555.3643 },\n { id: 41447, x: 4814858.8176, y: 8830295.5968 },\n { id: 4556, x: 4771399.0499, y: 8572808.2151 },\n { id: 4560, x: 4768880.995, y: 8580767.2344 },\n { id: 4562, x: 4766894.0235, y: 8564760.1003 },\n { id: 57852, x: 4633065.2455, y: 8546317.3575 },\n { id: 16862, x: 4754081.0227, y: 8792303.8049 },\n { id: 57853, x: 4633235.7329, y: 8561419.8615 },\n { id: 16863, x: 4753113.5515, y: 8799568.0452 },\n { id: 4566, x: 4765097.3501, y: 8575700.7486 },\n { id: 61954, x: 4757329.1544, y: 8452201.9318 },\n { id: 49657, x: 4892752.0686, y: 8741825.078 },\n { id: 61955, x: 4756878.6424, y: 8457004.3705 },\n { id: 61956, x: 4756384.0616, y: 8443380.7266 },\n { id: 57857, x: 4628480.3065, y: 8552587.858 },\n { id: 49661, x: 4890158.5352, y: 8749320.9575 },\n { id: 57860, x: 4625192.8143, y: 8546475.8303 },\n { id: 61960, x: 4752179.6646, y: 8448763.6623 },\n { id: 475, x: 4832932.4492, y: 8516090.5459 },\n { id: 61962, x: 4751460.5337, y: 8457341.7881 },\n { id: 477, x: 4830898.8949, y: 8509683.1646 },\n { id: 61963, x: 4749977.111, y: 8439944.5235 },\n { id: 57864, x: 4622258.2678, y: 8549928.8672 },\n { id: 49666, x: 4888226.0899, y: 8756786.8212 },\n { id: 61964, x: 4749008.1604, y: 8453025.9491 },\n { id: 49667, x: 4887398.7396, y: 8741589.8577 },\n { id: 20974, x: 4710151.053, y: 8726738.3507 },\n { id: 479, x: 4829826.6921, y: 8500928.9349 },\n { id: 20976, x: 4709491.6408, y: 8741082.4244 },\n { id: 61967, x: 4746497.4568, y: 8451923.0316 },\n { id: 20977, x: 4709033.7083, y: 8745529.9358 },\n { id: 61968, x: 4745811.2115, y: 8457299.7624 },\n { id: 57869, x: 4617797.7163, y: 8555439.6558 },\n { id: 20978, x: 4707652.3725, y: 8730886.6651 },\n { id: 61969, x: 4745602.1042, y: 8440688.2615 },\n { id: 49672, x: 4884799.9848, y: 8751010.8363 },\n { id: 484, x: 4825707.4486, y: 8501362.8539 },\n { id: 485, x: 4826110.6954, y: 8514553.0748 },\n { id: 20981, x: 4703903.0853, y: 8738108.2496 },\n { id: 20982, x: 4703461.7165, y: 8728926.8553 },\n { id: 487, x: 4824363.0249, y: 8508429.7451 },\n { id: 20983, x: 4701999.0922, y: 8733790.8183 },\n { id: 20984, x: 4701659.7581, y: 8726488.9794 },\n { id: 20986, x: 4700501.3347, y: 8743003.2829 },\n { id: 493, x: 4819399.1101, y: 8501291.3331 },\n { id: 20992, x: 4695922.2785, y: 8733303.1609 },\n { id: 29192, x: 4652390.2464, y: 8650650.2735 },\n { id: 20994, x: 4694319.6305, y: 8741932.0169 },\n { id: 29193, x: 4650870.033, y: 8645196.9733 },\n { id: 29194, x: 4651107.9519, y: 8661687.1655 },\n { id: 29195, x: 4650589.1591, y: 8655570.518 },\n { id: 29198, x: 4647110.5557, y: 8655554.0677 },\n { id: 49695, x: 4765142.233, y: 8501168.7649 },\n { id: 29202, x: 4645623.6717, y: 8659460.2079 },\n { id: 45599, x: 4798936.0403, y: 8753940.4663 },\n { id: 45601, x: 4796173.0098, y: 8761399.1455 },\n { id: 29207, x: 4641215.1215, y: 8655354.1553 },\n { id: 45604, x: 4792911.6299, y: 8747153.1479 },\n { id: 29209, x: 4640434.3726, y: 8660834.9694 },\n { id: 8714, x: 4843577.7612, y: 8497359.1505 },\n { id: 8715, x: 4843882.324, y: 8484076.2569 },\n { id: 45607, x: 4790088.898, y: 8754735.8747 },\n { id: 8717, x: 4841004.5631, y: 8490436.7053 },\n { id: 45610, x: 4787711.8156, y: 8762918.2661 },\n { id: 29216, x: 4636229.0199, y: 8652570.9592 },\n { id: 8721, x: 4838296.5575, y: 8482119.2363 },\n { id: 29217, x: 4636175.551, y: 8657250.7836 },\n { id: 37420, x: 4838818.0092, y: 8698614.6527 },\n { id: 37424, x: 4832787.62, y: 8685624.1392 },\n { id: 37425, x: 4832720.2976, y: 8693608.8909 },\n { id: 16933, x: 4757578.3525, y: 8815984.2197 },\n { id: 37429, x: 4829307.1674, y: 8699407.9067 },\n { id: 37430, x: 4827343.9414, y: 8688945.2107 },\n { id: 33332, x: 4876820.5155, y: 8717832.916 },\n { id: 16936, x: 4754605.4235, y: 8811505.9074 },\n { id: 33335, x: 4874837.4917, y: 8706285.1288 },\n { id: 37435, x: 4821967.6898, y: 8686828.4479 },\n { id: 37437, x: 4821596.9258, y: 8696923.0636 },\n { id: 33341, x: 4870427.1187, y: 8713800.5907 },\n { id: 33345, x: 4866208.44, y: 8703835.085 },\n { id: 33350, x: 4862902.0352, y: 8719683.9321 },\n { id: 33351, x: 4861560.394, y: 8711921.6397 },\n { id: 49784, x: 4746920.965, y: 8511529.5164 },\n { id: 53895, x: 4667358.6799, y: 8527605.4645 },\n { id: 53897, x: 4665935.2674, y: 8533388.4431 },\n { id: 53901, x: 4661915.1225, y: 8538700.9303 },\n { id: 41606, x: 4843080.2435, y: 8865043.6437 },\n { id: 53908, x: 4653365.1949, y: 8537060.1295 },\n { id: 41612, x: 4833534.8544, y: 8871190.3103 },\n { id: 41615, x: 4829192.2024, y: 8867441.9185 },\n { id: 49828, x: 4749745.355, y: 8539071.4265 },\n { id: 49830, x: 4747439.5889, y: 8521122.3051 },\n { id: 49831, x: 4747192.1095, y: 8531593.94 },\n { id: 12941, x: 4795820.3538, y: 8470300.4134 },\n { id: 12943, x: 4794967.8882, y: 8475173.0704 },\n { id: 12944, x: 4795054.7997, y: 8459879.9008 },\n { id: 12945, x: 4793009.3719, y: 8465020.6464 },\n { id: 12949, x: 4790161.5741, y: 8469487.6003 },\n { id: 12952, x: 4788735.5329, y: 8475291.7382 },\n { id: 12953, x: 4788888.1985, y: 8462235.1169 },\n { id: 12957, x: 4785040.3205, y: 8459987.4248 },\n { id: 12958, x: 4784500.7174, y: 8470600.8113 },\n { id: 8861, x: 4851286.6435, y: 8462633.6993 },\n { id: 58050, x: 4651643.5161, y: 8594800.2894 },\n { id: 12961, x: 4782269.1895, y: 8464692.023 },\n { id: 8862, x: 4850788.3933, y: 8472095.6318 },\n { id: 58051, x: 4648947.1068, y: 8587813.7531 },\n { id: 58053, x: 4647721.8067, y: 8601718.4762 },\n { id: 58054, x: 4647040.9942, y: 8592910.6638 },\n { id: 8868, x: 4846124.3237, y: 8475801.9873 },\n { id: 58057, x: 4642612.9921, y: 8589042.6212 },\n { id: 8870, x: 4846107.1799, y: 8460039.5291 },\n { id: 58059, x: 4641470.2144, y: 8599189.5284 },\n { id: 8871, x: 4844307.8159, y: 8469327.072 },\n { id: 29370, x: 4631790.6614, y: 8651879.5284 },\n { id: 58064, x: 4635938.374, y: 8594467.448 },\n { id: 29371, x: 4630964.5359, y: 8646324.2134 },\n { id: 58065, x: 4635148.1716, y: 8585084.2569 },\n { id: 29372, x: 4631448.5776, y: 8665289.2165 },\n { id: 29373, x: 4630371.3743, y: 8654994.2124 },\n { id: 8879, x: 4838511.2897, y: 8471854.1106 },\n { id: 41672, x: 4821634.493, y: 8864941.8313 },\n { id: 8881, x: 4828823.1075, y: 8378671.56 },\n { id: 17080, x: 4748059.1523, y: 8814452.054 },\n { id: 17081, x: 4745327.1478, y: 8818231.7296 },\n { id: 29380, x: 4624747.526, y: 8646622.3722 },\n { id: 29381, x: 4623922.7832, y: 8656864.2475 },\n { id: 17084, x: 4742232.3311, y: 8807903.8611 },\n { id: 29382, x: 4623513.5598, y: 8662069.7747 },\n { id: 17085, x: 4739166.2941, y: 8817323.8719 },\n { id: 29383, x: 4622662.2942, y: 8650661.5622 },\n { id: 691, x: 4836664.8619, y: 8532858.2441 },\n { id: 693, x: 4835535.2975, y: 8538686.5217 },\n { id: 29390, x: 4616792.3318, y: 8656766.3887 },\n { id: 25292, x: 4689767.4887, y: 8674163.8685 },\n { id: 25293, x: 4689630.9673, y: 8681543.2985 },\n { id: 699, x: 4829823.5503, y: 8523515.3381 },\n { id: 700, x: 4829936.6747, y: 8532838.267 },\n { id: 4801, x: 4781235.7103, y: 8557169.8029 },\n { id: 702, x: 4828286.4981, y: 8538003.9958 },\n { id: 25297, x: 4686579.9531, y: 8681683.4947 },\n { id: 70387, x: 4668037.0224, y: 8429536.5785 },\n { id: 25298, x: 4684134.1586, y: 8671316.7374 },\n { id: 25299, x: 4684069.9147, y: 8678775.5018 },\n { id: 4804, x: 4778422.4747, y: 8550161.9244 },\n { id: 70389, x: 4667570.1796, y: 8422348.8826 },\n { id: 709, x: 4822214.6633, y: 8527416.1552 },\n { id: 25304, x: 4678295.8464, y: 8672324.1585 },\n { id: 25305, x: 4678138.1978, y: 8680938.3322 },\n { id: 711, x: 4820045.2039, y: 8533383.3388 },\n { id: 70395, x: 4658755.2297, y: 8424727.8983 },\n { id: 4811, x: 4773780.0444, y: 8543917.7169 },\n { id: 25307, x: 4676447.316, y: 8667073.6134 },\n { id: 4812, x: 4773617.0526, y: 8556326.8675 },\n { id: 25310, x: 4673538.5456, y: 8685045.0029 },\n { id: 70400, x: 4654913.9718, y: 8427970.0009 },\n { id: 25311, x: 4672490.2488, y: 8677337.3692 },\n { id: 70401, x: 4653945.8964, y: 8418044.6121 },\n { id: 4824, x: 4765437.9008, y: 8552832.9145 },\n { id: 4825, x: 4763786.5179, y: 8541836.0183 },\n { id: 33532, x: 4876071.3617, y: 8739845.3791 },\n { id: 45830, x: 4803407.5452, y: 8781720.9265 },\n { id: 45831, x: 4800896.0664, y: 8768608.8154 },\n { id: 33534, x: 4873551.1804, y: 8730720.3455 },\n { id: 45832, x: 4800112.288, y: 8778389.4674 },\n { id: 33535, x: 4872386.8184, y: 8722623.7893 },\n { id: 33537, x: 4870955.977, y: 8734070.8889 },\n { id: 45837, x: 4796072.4751, y: 8773055.3597 },\n { id: 33542, x: 4866095.9064, y: 8740689.4928 },\n { id: 45840, x: 4793611.3417, y: 8782442.4214 },\n { id: 45841, x: 4792216.6221, y: 8769516.0982 },\n { id: 45842, x: 4791506.3244, y: 8775268.6098 },\n { id: 33546, x: 4862734.3772, y: 8727302.8913 },\n { id: 54050, x: 4665556.4654, y: 8505301.4347 },\n { id: 54052, x: 4663217.3859, y: 8512702.8295 },\n { id: 54057, x: 4658141.2389, y: 8508117.3515 },\n { id: 54059, x: 4656521.7045, y: 8501371.2857 },\n { id: 54061, x: 4655001.2539, y: 8518584.1039 },\n { id: 54064, x: 4652177.1244, y: 8512302.9977 },\n { id: 49969, x: 4740075.6523, y: 8540543.4086 },\n { id: 58171, x: 4632983.9539, y: 8596254.809 },\n { id: 49973, x: 4736233.043, y: 8526546.31 },\n { id: 49975, x: 4735381.7916, y: 8533440.4682 },\n { id: 58175, x: 4631514.2431, y: 8601164.5982 },\n { id: 37684, x: 4812559.7815, y: 8698598.7683 },\n { id: 13090, x: 4796804.1552, y: 8493696.135 },\n { id: 37685, x: 4811829.2955, y: 8688661.0705 },\n { id: 13092, x: 4795817.3007, y: 8499379.2927 },\n { id: 58182, x: 4625571.9858, y: 8589561.9569 },\n { id: 49984, x: 4726764.9985, y: 8522079.6086 },\n { id: 13094, x: 4795002.7248, y: 8488360.6068 },\n { id: 58184, x: 4621551.2107, y: 8586193.0389 },\n { id: 58185, x: 4621369.4833, y: 8598254.9684 },\n { id: 13096, x: 4794005.7136, y: 8480104.9593 },\n { id: 58186, x: 4621071.2859, y: 8592361.7582 },\n { id: 37691, x: 4804332.4823, y: 8690002.8619 },\n { id: 13099, x: 4792253.5527, y: 8497106.506 },\n { id: 58189, x: 4617891.104, y: 8588428.9598 },\n { id: 58190, x: 4617040.8087, y: 8583579.9137 },\n { id: 13101, x: 4791437.3682, y: 8491023.8447 },\n { id: 13103, x: 4790154.9727, y: 8485112.2868 },\n { id: 13110, x: 4786028.4623, y: 8480699.8868 },\n { id: 13113, x: 4784195.5579, y: 8492962.3667 },\n { id: 13115, x: 4783336.877, y: 8488273.3193 },\n { id: 70547, x: 4683828.8775, y: 8460910.2343 },\n { id: 70548, x: 4683183.1828, y: 8469666.5805 },\n { id: 70555, x: 4676527.7292, y: 8472248.4299 },\n { id: 70556, x: 4672189.5119, y: 8478986.8549 },\n { id: 70557, x: 4671759.2089, y: 8465852.2056 },\n { id: 21378, x: 4709282.3397, y: 8707840.6059 },\n { id: 21382, x: 4705944.821, y: 8716040.6897 },\n { id: 21383, x: 4705250.2378, y: 8709769.5401 },\n { id: 29582, x: 4631803.1457, y: 8632859.7462 },\n { id: 21384, x: 4705217.8313, y: 8720576.3633 },\n { id: 41880, x: 4799285.0658, y: 8611222.5707 },\n { id: 29583, x: 4630871.843, y: 8637558.4673 },\n { id: 29585, x: 4629095.7592, y: 8640803.8136 },\n { id: 41883, x: 4796681.9229, y: 8618465.5332 },\n { id: 29586, x: 4627758.1547, y: 8629637.4889 },\n { id: 29587, x: 4627224.1302, y: 8624979.4043 },\n { id: 29588, x: 4626122.844, y: 8636983.4488 },\n { id: 21390, x: 4700405.0089, y: 8714441.0366 },\n { id: 17292, x: 4750802.6728, y: 8806278.8981 },\n { id: 29590, x: 4624978.6433, y: 8640203.9206 },\n { id: 29591, x: 4624340.8116, y: 8633696.4799 },\n { id: 21395, x: 4697031.9137, y: 8722970.4721 },\n { id: 29594, x: 4622680.3621, y: 8638238.7476 },\n { id: 21396, x: 4695634.6082, y: 8715356.1811 },\n { id: 17297, x: 4747451.3054, y: 8790781.7616 },\n { id: 29595, x: 4620765.5018, y: 8625038.6605 },\n { id: 17298, x: 4746951.4664, y: 8799181.1864 },\n { id: 29597, x: 4620695.5229, y: 8629739.4811 },\n { id: 21399, x: 4692154.9281, y: 8708860.1783 },\n { id: 41895, x: 4789521.7043, y: 8619193.7927 },\n { id: 29598, x: 4619773.6181, y: 8641413.3264 },\n { id: 41897, x: 4788742.6216, y: 8606374.3159 },\n { id: 29600, x: 4618677.7678, y: 8635389.8286 },\n { id: 29603, x: 4616384.4086, y: 8642535.0796 },\n { id: 17306, x: 4737118.4156, y: 8800267.6626 },\n { id: 58308, x: 4612343.8384, y: 8510320.2592 },\n { id: 25523, x: 4691195.4489, y: 8698528.8143 },\n { id: 929, x: 4816039.8238, y: 8520998.5207 },\n { id: 58317, x: 4599894.3231, y: 8502437.8136 },\n { id: 58318, x: 4600058.3074, y: 8516416.379 },\n { id: 932, x: 4813258.3293, y: 8535803.7911 },\n { id: 934, x: 4811637.8425, y: 8526305.4619 },\n { id: 25530, x: 4686022.4459, y: 8701757.5616 },\n { id: 9135, x: 4837665.647, y: 8389785.2943 },\n { id: 5036, x: 4798551.7264, y: 8582727.8275 },\n { id: 25532, x: 4683915.4487, y: 8694618.8685 },\n { id: 938, x: 4807969.8062, y: 8534187.751 },\n { id: 25533, x: 4683477.2494, y: 8685837.6081 },\n { id: 9138, x: 4836600.7475, y: 8379589.256 },\n { id: 9139, x: 4833432.345, y: 8395786.841 },\n { id: 5040, x: 4795419.5438, y: 8589862.3866 },\n { id: 13239, x: 4779493.608, y: 8499300.047 },\n { id: 25537, x: 4679460.3511, y: 8699705.2465 },\n { id: 13240, x: 4779873.4293, y: 8481349.0041 },\n { id: 5042, x: 4794565.1782, y: 8598605.9282 },\n { id: 943, x: 4803575.5462, y: 8527522.497 },\n { id: 25538, x: 4678918.5017, y: 8693532.0888 },\n { id: 9143, x: 4832203.5728, y: 8385404.8461 },\n { id: 13243, x: 4776580.6381, y: 8490573.7664 },\n { id: 5047, x: 4788314.5346, y: 8583504.5059 },\n { id: 25543, x: 4674671.5975, y: 8701531.1735 },\n { id: 13248, x: 4773440.6478, y: 8496674.3993 },\n { id: 5050, x: 4785675.0937, y: 8594274.3701 },\n { id: 13249, x: 4773762.5218, y: 8482190.0009 },\n { id: 9151, x: 4826228.9083, y: 8391048.8914 },\n { id: 13256, x: 4768339.68, y: 8497114.1549 },\n { id: 13257, x: 4768384.666, y: 8488467.8437 },\n { id: 13258, x: 4766464.3284, y: 8482988.2353 },\n { id: 9160, x: 4821221.8279, y: 8382717.6014 },\n { id: 66550, x: 4725943.3676, y: 8424564.5615 },\n { id: 66552, x: 4724567.2361, y: 8432179.2652 },\n { id: 46062, x: 4783843.3765, y: 8768269.0709 },\n { id: 46063, x: 4784128.2491, y: 8781208.835 },\n { id: 66561, x: 4717904.9116, y: 8429223.8592 },\n { id: 66565, x: 4715502.8811, y: 8418710.3972 },\n { id: 46070, x: 4778802.1486, y: 8775119.4135 },\n { id: 46071, x: 4777817.3287, y: 8783753.39 },\n { id: 46072, x: 4776445.0006, y: 8770005.8703 },\n { id: 66571, x: 4708655.7819, y: 8426751.6567 },\n { id: 46079, x: 4770086.5532, y: 8769151.7641 },\n { id: 46081, x: 4769048.8498, y: 8775606.5141 },\n { id: 33792, x: 4859344.6974, y: 8735700.7566 },\n { id: 33794, x: 4857161.3294, y: 8726301.4593 },\n { id: 33800, x: 4852204.6086, y: 8731411.6116 },\n { id: 33807, x: 4847966.2171, y: 8723614.0686 },\n { id: 33810, x: 4846322.7919, y: 8728656.6276 },\n { id: 33815, x: 4843413.3096, y: 8740931.9212 },\n { id: 58429, x: 4608389.0032, y: 8523531.091 },\n { id: 58430, x: 4608378.3665, y: 8530589.3964 },\n { id: 58435, x: 4602205.576, y: 8529995.2852 },\n { id: 58436, x: 4602285.4677, y: 8541326.778 },\n { id: 50242, x: 4741634.1224, y: 8504355.2635 },\n { id: 50246, x: 4736795.7667, y: 8509337.1051 },\n { id: 50247, x: 4736544.4947, y: 8517157.8012 },\n { id: 50251, x: 4733268.2907, y: 8503976.0232 },\n { id: 50260, x: 4726271.0326, y: 8509907.8628 },\n { id: 29767, x: 4653026.2764, y: 8666961.5452 },\n { id: 42066, x: 4779994.0114, y: 8603567.4191 },\n { id: 42067, x: 4780205.1687, y: 8613866.9111 },\n { id: 29772, x: 4650994.2542, y: 8679633.1774 },\n { id: 50268, x: 4734563.8127, y: 8602649.0497 },\n { id: 54374, x: 4687161.7707, y: 8556906.1308 },\n { id: 29780, x: 4645581.2073, y: 8671797.3154 },\n { id: 29781, x: 4643794.6812, y: 8677464.1331 },\n { id: 54376, x: 4685190.6006, y: 8548181.3828 },\n { id: 29783, x: 4643671.4296, y: 8682377.6313 },\n { id: 42081, x: 4769982.5627, y: 8611430.0649 },\n { id: 54379, x: 4683486.8966, y: 8560584.8355 },\n { id: 29787, x: 4639326.0623, y: 8673555.0013 },\n { id: 54382, x: 4678721.8186, y: 8545913.5257 },\n { id: 29788, x: 4639213.139, y: 8680903.2269 },\n { id: 42086, x: 4767190.5029, y: 8618793.9172 },\n { id: 29789, x: 4637447.6936, y: 8667620.327 },\n { id: 54384, x: 4677533.455, y: 8556446.0429 },\n { id: 42087, x: 4766083.9541, y: 8604489.5981 },\n { id: 29791, x: 4636141.3314, y: 8680159.9429 },\n { id: 29792, x: 4635768.5147, y: 8685874.0592 },\n { id: 21596, x: 4729075.4503, y: 8760129.1366 },\n { id: 54389, x: 4673395.9638, y: 8561588.083 },\n { id: 21597, x: 4728125.4638, y: 8754417.1882 },\n { id: 54390, x: 4672083.4823, y: 8552327.0085 },\n { id: 21599, x: 4725919.4952, y: 8749370.6272 },\n { id: 21601, x: 4725307.7992, y: 8763595.4839 },\n { id: 21602, x: 4723636.7318, y: 8755918.9637 },\n { id: 21606, x: 4720667.3218, y: 8764890.1431 },\n { id: 21607, x: 4719459.6524, y: 8751776.6543 },\n { id: 38006, x: 4819175.1788, y: 8677330.7762 },\n { id: 21610, x: 4717103.2843, y: 8759468.4826 },\n { id: 38008, x: 4818540.5179, y: 8664637.6299 },\n { id: 21612, x: 4714399.477, y: 8764191.8828 },\n { id: 38009, x: 4818106.5868, y: 8670835.8784 },\n { id: 21613, x: 4714048.7763, y: 8756191.8066 },\n { id: 21615, x: 4712429.874, y: 8750037.423 },\n { id: 38012, x: 4814057.9288, y: 8681262.2081 },\n { id: 38015, x: 4807815.6301, y: 8670886.2065 },\n { id: 38017, x: 4807577.9256, y: 8677575.5611 },\n { id: 38018, x: 4806981.6383, y: 8662899.0143 },\n { id: 25722, x: 4670458.2265, y: 8705157.7947 },\n { id: 70812, x: 4680685.2328, y: 8497863.7988 },\n { id: 25723, x: 4669919.4583, y: 8698859.814 },\n { id: 70814, x: 4679276.6132, y: 8486580.8447 },\n { id: 25725, x: 4668534.2373, y: 8692160.1207 },\n { id: 25730, x: 4664856.7655, y: 8700586.0635 },\n { id: 25732, x: 4663514.2831, y: 8690179.4172 },\n { id: 25736, x: 4660191.7973, y: 8694509.2428 },\n { id: 25739, x: 4658957.4512, y: 8700589.0805 },\n { id: 25741, x: 4656746.0584, y: 8688417.3545 },\n { id: 17543, x: 4725349.6274, y: 8610759.6656 },\n { id: 25742, x: 4656510.267, y: 8700658.6616 },\n { id: 17546, x: 4723443.3268, y: 8616104.9545 },\n { id: 17548, x: 4721845.4314, y: 8622312.5984 },\n { id: 17550, x: 4720159.8019, y: 8603248.9739 },\n { id: 17554, x: 4718040.4986, y: 8608875.0722 },\n { id: 9357, x: 4837314.0417, y: 8406553.1538 },\n { id: 17556, x: 4716553.1795, y: 8620405.9697 },\n { id: 17557, x: 4715086.5135, y: 8604464.634 },\n { id: 17558, x: 4713952.6214, y: 8614812.7357 },\n { id: 9360, x: 4835187.0857, y: 8413997.8257 },\n { id: 46253, x: 4781364.9575, y: 8756506.9612 },\n { id: 46254, x: 4779862.6748, y: 8749575.5049 },\n { id: 17562, x: 4710560.8162, y: 8615183.5771 },\n { id: 46256, x: 4779689.0124, y: 8761408.8134 },\n { id: 13465, x: 4779999.0897, y: 8475134.894 },\n { id: 9367, x: 4829759.7756, y: 8413739.8672 },\n { id: 17566, x: 4708298.5999, y: 8605230.8171 },\n { id: 13467, x: 4778373.1039, y: 8465362.8347 },\n { id: 46260, x: 4775396.5029, y: 8746254.3931 },\n { id: 13468, x: 4778242.7895, y: 8460638.6227 },\n { id: 46261, x: 4774433.5168, y: 8762333.0998 },\n { id: 13470, x: 4776673.6641, y: 8470429.8067 },\n { id: 9371, x: 4827504.6635, y: 8407260.7308 },\n { id: 13472, x: 4775482.4383, y: 8477098.3615 },\n { id: 46265, x: 4771260.6596, y: 8753542.0828 },\n { id: 13474, x: 4774988.8297, y: 8460771.9903 },\n { id: 9377, x: 4823578.8943, y: 8418706.1509 },\n { id: 13477, x: 4772440.0298, y: 8466528.3102 },\n { id: 13479, x: 4770308.3775, y: 8477584.7566 },\n { id: 9381, x: 4821659.5077, y: 8399409.4492 },\n { id: 13481, x: 4769183.0302, y: 8471027.692 },\n { id: 9383, x: 4820104.9313, y: 8408642.8415 },\n { id: 5284, x: 4779481.928, y: 8589805.5931 },\n { id: 13485, x: 4767561.2209, y: 8460798.7166 },\n { id: 5293, x: 4769540.7313, y: 8589708.0126 },\n { id: 5294, x: 4769197.108, y: 8596968.3329 },\n { id: 1226, x: 4817434.0326, y: 8507871.5236 },\n { id: 1232, x: 4811895.9458, y: 8517271.9736 },\n { id: 50421, x: 4721804.0706, y: 8501740.8335 },\n { id: 1236, x: 4809797.5008, y: 8509537.4155 },\n { id: 50425, x: 4717827.8098, y: 8513194.9935 },\n { id: 1238, x: 4807241.912, y: 8502171.005 },\n { id: 42231, x: 4797375.7856, y: 8626355.4232 },\n { id: 34035, x: 4858115.4581, y: 8705361.9254 },\n { id: 1243, x: 4802253.3348, y: 8501826.4588 },\n { id: 1244, x: 4802120.9863, y: 8510239.29 },\n { id: 50434, x: 4710973.4204, y: 8503256.7544 },\n { id: 34038, x: 4855371.8837, y: 8712255.7795 },\n { id: 1246, x: 4801316.4352, y: 8516610.5261 },\n { id: 42241, x: 4790452.0461, y: 8630956.7745 },\n { id: 50440, x: 4708128.7199, y: 8518632.0999 },\n { id: 34044, x: 4850394.18, y: 8717097.7678 },\n { id: 29945, x: 4653422.527, y: 8686733.0212 },\n { id: 29946, x: 4653531.7369, y: 8692973.272 },\n { id: 34047, x: 4847780.0646, y: 8707645.2678 },\n { id: 29948, x: 4652117.9175, y: 8703829.5677 },\n { id: 29949, x: 4651430.3143, y: 8694161.4895 },\n { id: 34051, x: 4844021.7482, y: 8719037.4751 },\n { id: 42250, x: 4783929.3998, y: 8636657.4329 },\n { id: 34054, x: 4840322.5795, y: 8712190.1027 },\n { id: 29956, x: 4644903.7983, y: 8700269.4881 },\n { id: 29958, x: 4643125.2835, y: 8688316.8174 },\n { id: 29959, x: 4643631.7089, y: 8705738.1728 },\n { id: 29960, x: 4641972.3977, y: 8696842.339 },\n { id: 29966, x: 4638532.8542, y: 8700061.9842 },\n { id: 29969, x: 4637915.3079, y: 8706129.5639 },\n { id: 70968, x: 4670116.563, y: 8493548.4502 },\n { id: 70972, x: 4667101.002, y: 8484917.4584 },\n { id: 70975, x: 4664186.5672, y: 8496886.7813 },\n { id: 70977, x: 4660670.9034, y: 8482932.3207 },\n { id: 70980, x: 4658451.2348, y: 8492222.5753 },\n { id: 70982, x: 4657071.791, y: 8483591.4663 },\n { id: 9504, x: 4815303.1105, y: 8417551.5674 },\n { id: 9512, x: 4811252.3603, y: 8401507.7038 },\n { id: 9514, x: 4809831.3699, y: 8408098.5278 },\n { id: 25913, x: 4671071.5161, y: 8670785.5547 },\n { id: 9517, x: 4807989.4726, y: 8415381.3373 },\n { id: 9519, x: 4806304.18, y: 8405024.1446 },\n { id: 25917, x: 4667256.0826, y: 8684107.7927 },\n { id: 25918, x: 4666609.6782, y: 8672293.3124 },\n { id: 9523, x: 4803024.6417, y: 8417579.8354 },\n { id: 25920, x: 4666480.5553, y: 8677396.1285 },\n { id: 9524, x: 4802930.3466, y: 8412090.3847 },\n { id: 25923, x: 4664036.6952, y: 8680512.8526 },\n { id: 9527, x: 4801734.1874, y: 8402336.7606 },\n { id: 25924, x: 4662940.6451, y: 8670957.2116 },\n { id: 25926, x: 4661983.7156, y: 8685468.0492 },\n { id: 25927, x: 4659998.1307, y: 8674795.7278 },\n { id: 25928, x: 4659427.1122, y: 8667209.0157 },\n { id: 25933, x: 4657393.0231, y: 8677850.2863 },\n { id: 25934, x: 4656709.0396, y: 8670976.481 },\n { id: 58727, x: 4613995.1856, y: 8560929.9803 },\n { id: 58730, x: 4611534.9024, y: 8556668.4496 },\n { id: 30038, x: 4635024.8566, y: 8703973.6254 },\n { id: 58732, x: 4610490.4632, y: 8545307.6689 },\n { id: 30039, x: 4634415.8316, y: 8694731.2778 },\n { id: 30040, x: 4631838.9298, y: 8689368.5433 },\n { id: 58734, x: 4608367.8368, y: 8550725.4641 },\n { id: 5447, x: 4758112.8727, y: 8507720.8397 },\n { id: 58735, x: 4607689.6043, y: 8548003.7145 },\n { id: 30042, x: 4627309.2917, y: 8692147.1457 },\n { id: 58736, x: 4607052.6578, y: 8555026.2567 },\n { id: 58739, x: 4603259.3815, y: 8557114.0463 },\n { id: 58740, x: 4602742.0321, y: 8552814.8752 },\n { id: 58742, x: 4600820.0343, y: 8549968.552 },\n { id: 17758, x: 4707034.5331, y: 8622778.9109 },\n { id: 17759, x: 4706439.9393, y: 8611942.4856 },\n { id: 17762, x: 4703974.8356, y: 8604205.6769 },\n { id: 17763, x: 4703147.7144, y: 8620311.7401 },\n { id: 38261, x: 4834909.6084, y: 8705229.7066 },\n { id: 17766, x: 4701045.8003, y: 8607685.8976 },\n { id: 17769, x: 4699704.5644, y: 8613909.0229 },\n { id: 9572, x: 4819186.2366, y: 8390019.2816 },\n { id: 50564, x: 4723751.1798, y: 8533557.0444 },\n { id: 17772, x: 4699143.1932, y: 8621946.1472 },\n { id: 38268, x: 4828042.7528, y: 8705067.4921 },\n { id: 9575, x: 4817263.3675, y: 8395517.8131 },\n { id: 38269, x: 4827868.9498, y: 8711639.3689 },\n { id: 17774, x: 4695767.5626, y: 8605101.6857 },\n { id: 17775, x: 4695981.9325, y: 8611702.5743 },\n { id: 50568, x: 4719313.6909, y: 8537988.5777 },\n { id: 17776, x: 4695351.8777, y: 8619281.4927 },\n { id: 9578, x: 4815388.0489, y: 8384853.7008 },\n { id: 50569, x: 4717587.1758, y: 8526627.1686 },\n { id: 50572, x: 4712909.2084, y: 8534247.2529 },\n { id: 9582, x: 4811963.641, y: 8389883.699 },\n { id: 17782, x: 4691502.818, y: 8621440.026 },\n { id: 9585, x: 4807596.4579, y: 8392977.8131 },\n { id: 54687, x: 4687692.1052, y: 8576664.1478 },\n { id: 54688, x: 4686425.9339, y: 8568136.3268 },\n { id: 54689, x: 4684146.547, y: 8581252.4795 },\n { id: 54693, x: 4681011.2878, y: 8574603.213 },\n { id: 54695, x: 4676719.6657, y: 8567303.0681 },\n { id: 54696, x: 4676633.1149, y: 8577673.8646 },\n { id: 42400, x: 4795394.7657, y: 8660970.0572 },\n { id: 54699, x: 4671370.4379, y: 8565335.8361 },\n { id: 42402, x: 4791756.1813, y: 8643434.2868 },\n { id: 54700, x: 4671575.679, y: 8577678.3867 },\n { id: 42404, x: 4791429.4244, y: 8649857.2926 },\n { id: 42410, x: 4787521.8542, y: 8655348.1525 },\n { id: 42414, x: 4783785.2703, y: 8645778.0792 },\n { id: 71117, x: 4669039.5452, y: 8458965.037 },\n { id: 71123, x: 4663188.4669, y: 8464740.1001 },\n { id: 71127, x: 4659156.8542, y: 8475401.4068 },\n { id: 71132, x: 4652420.9587, y: 8465890.3429 },\n { id: 34242, x: 4877803.3392, y: 8749260.1247 },\n { id: 34243, x: 4877475.0697, y: 8759683.7657 },\n { id: 71136, x: 4628451.5958, y: 8468604.6282 },\n { id: 71137, x: 4623404.7061, y: 8468290.6367 },\n { id: 34248, x: 4872344.5591, y: 8745446.4977 },\n { id: 34249, x: 4872102.5488, y: 8756396.5855 },\n { id: 71142, x: 4617058.5596, y: 8468142.2447 },\n { id: 71143, x: 4614986.3118, y: 8460528.7577 },\n { id: 34252, x: 4867320.5561, y: 8752431.4257 },\n { id: 34255, x: 4864432.3617, y: 8759777.6952 },\n { id: 1463, x: 4836404.0183, y: 8551830.9882 },\n { id: 1465, x: 4833424.1267, y: 8546591.3527 },\n { id: 1469, x: 4831454.7011, y: 8559476.6082 },\n { id: 1473, x: 4827393.2525, y: 8548717.3542 },\n { id: 1482, x: 4822118.9654, y: 8553891.872 },\n { id: 5597, x: 4761041.5137, y: 8526876.2458 },\n { id: 30194, x: 4633313.9067, y: 8670497.2555 },\n { id: 5600, x: 4757651.9297, y: 8537319.211 },\n { id: 5602, x: 4756831.1453, y: 8520513.8218 },\n { id: 13802, x: 4892972.8401, y: 8400074.0216 },\n { id: 5604, x: 4754981.982, y: 8528852.3164 },\n { id: 30199, x: 4631762.6811, y: 8676320.2261 },\n { id: 30200, x: 4631819.6528, y: 8682359.5831 },\n { id: 13805, x: 4887070.7015, y: 8406930.876 },\n { id: 30204, x: 4628428.1908, y: 8675297.3646 },\n { id: 30205, x: 4628654.3245, y: 8686409.4088 },\n { id: 13809, x: 4884863.1288, y: 8416349.4208 },\n { id: 30207, x: 4627049.3055, y: 8679602.8155 },\n { id: 13811, x: 4884384.7904, y: 8400893.5455 },\n { id: 30211, x: 4622219.0965, y: 8668939.1249 },\n { id: 13818, x: 4879003.4584, y: 8410929.623 },\n { id: 13820, x: 4877808.0966, y: 8405098.3638 },\n { id: 13821, x: 4876455.6195, y: 8415971.5999 },\n { id: 22021, x: 4730389, y: 8773990.7055 },\n { id: 22023, x: 4728860.7848, y: 8778601.6256 },\n { id: 22025, x: 4726969.6287, y: 8767324.5495 },\n { id: 22029, x: 4724332.3533, y: 8784093.7674 },\n { id: 22032, x: 4721480.9193, y: 8774273.3197 },\n { id: 22033, x: 4719455.2064, y: 8780682.7274 },\n { id: 22034, x: 4718638.9275, y: 8769552.7967 },\n { id: 22039, x: 4714598.5353, y: 8773188.987 },\n { id: 22040, x: 4714795.6947, y: 8784407.2686 },\n { id: 38438, x: 4839726.4344, y: 8728245.3894 },\n { id: 38442, x: 4836038.5572, y: 8722127.4069 },\n { id: 38443, x: 4835390.1112, y: 8737770.4874 },\n { id: 38448, x: 4829797.9801, y: 8722549.778 },\n { id: 38450, x: 4829212.1061, y: 8733246.4195 },\n { id: 38456, x: 4822314.8342, y: 8728454.5652 },\n { id: 26167, x: 4689377.9287, y: 8722180.331 },\n { id: 26168, x: 4688793.5958, y: 8706441.526 },\n { id: 26171, x: 4686418.8376, y: 8717005.2709 },\n { id: 26177, x: 4681574.286, y: 8707806.7579 },\n { id: 26178, x: 4680515.8682, y: 8716190.9647 },\n { id: 26181, x: 4677925.8387, y: 8722087.896 },\n { id: 71272, x: 4633097.4825, y: 8499696.6453 },\n { id: 71273, x: 4632978.0813, y: 8481581.7125 },\n { id: 46679, x: 4803338.2231, y: 8785356.8769 },\n { id: 26184, x: 4675099.791, y: 8717439.5836 },\n { id: 26185, x: 4674483.0349, y: 8708397.5536 },\n { id: 71275, x: 4628236.698, y: 8489011.5452 },\n { id: 46682, x: 4800267.4483, y: 8797748.9499 },\n { id: 30286, x: 4654842.5826, y: 8711022.6534 },\n { id: 46683, x: 4799891.2827, y: 8789006.435 },\n { id: 71278, x: 4622734.702, y: 8482071.0581 },\n { id: 46684, x: 4799203.4537, y: 8801481.9657 },\n { id: 30288, x: 4653195.1871, y: 8724710.8391 },\n { id: 30290, x: 4652679.9639, y: 8717373.6842 },\n { id: 71281, x: 4619047.7951, y: 8492965.9067 },\n { id: 46688, x: 4793911.1115, y: 8795628.0792 },\n { id: 42589, x: 4778219.8033, y: 8658606.3823 },\n { id: 30292, x: 4650516.6141, y: 8708227.0802 },\n { id: 46690, x: 4792712.381, y: 8788214.1303 },\n { id: 42591, x: 4775503.1383, y: 8653183.0566 },\n { id: 30294, x: 4646645.5975, y: 8709685.328 },\n { id: 46691, x: 4792732.7777, y: 8804333.7136 },\n { id: 30297, x: 4638065.3536, y: 8712107.6689 },\n { id: 18000, x: 4724628.7665, y: 8631596.4707 },\n { id: 46694, x: 4788788.8037, y: 8791491.2787 },\n { id: 18001, x: 4724538.8658, y: 8629857.48 },\n { id: 18003, x: 4724378.1717, y: 8641414.5109 },\n { id: 42600, x: 4769255.8946, y: 8643475.6566 },\n { id: 42602, x: 4768830.347, y: 8655952.7629 },\n { id: 30305, x: 4655685.5239, y: 8745865.7288 },\n { id: 30308, x: 4654371.2446, y: 8731085.21 },\n { id: 18011, x: 4718673.8302, y: 8632162.3083 },\n { id: 63101, x: 4743434.8835, y: 8445877.1675 },\n { id: 18013, x: 4717815.1231, y: 8643008.0168 },\n { id: 18014, x: 4716373.8163, y: 8628631.9157 },\n { id: 63105, x: 4741244.1711, y: 8458183.275 },\n { id: 63108, x: 4739111.3387, y: 8439455.0106 },\n { id: 9821, x: 4835783.8845, y: 8437145.8631 },\n { id: 63110, x: 4738048.3811, y: 8443872.4275 },\n { id: 18021, x: 4710662.5517, y: 8625641.7325 },\n { id: 63111, x: 4737609.245, y: 8444098.2603 },\n { id: 63112, x: 4737416.598, y: 8447623.264 },\n { id: 18023, x: 4709863.305, y: 8634034.5271 },\n { id: 9825, x: 4833012.1965, y: 8424888.3241 },\n { id: 9826, x: 4831432.9365, y: 8431512.8585 },\n { id: 67213, x: 4725097.0114, y: 8452212.9685 },\n { id: 67216, x: 4723646.9031, y: 8441705.6624 },\n { id: 67220, x: 4720332.8088, y: 8454633.4978 },\n { id: 30329, x: 4653814.1316, y: 8789415.0129 },\n { id: 63122, x: 4730765.7135, y: 8441832.4105 },\n { id: 67223, x: 4718738.4691, y: 8447765.7914 },\n { id: 9838, x: 4825115.7807, y: 8425729.1213 },\n { id: 63126, x: 4728354.7518, y: 8447437.3391 },\n { id: 9841, x: 4823125.8257, y: 8435166.4185 },\n { id: 67228, x: 4714747.3987, y: 8441822.2201 },\n { id: 67229, x: 4714642.1966, y: 8440883.1939 },\n { id: 67230, x: 4713611.1746, y: 8450358.329 },\n { id: 34440, x: 4876896.2126, y: 8778471.766 },\n { id: 67236, x: 4708853.8035, y: 8451497.0287 },\n { id: 34447, x: 4871677.996, y: 8770298.1753 },\n { id: 34448, x: 4871833.8205, y: 8777952.7106 },\n { id: 34449, x: 4871059.9838, y: 8763890.6016 },\n { id: 1657, x: 4833676.5694, y: 8573843.3714 },\n { id: 50848, x: 4707120.524, y: 8537258.7196 },\n { id: 50852, x: 4704791.6711, y: 8525294.9923 },\n { id: 1664, x: 4828216.5839, y: 8566984.7336 },\n { id: 1666, x: 4827661.1853, y: 8576833.7091 },\n { id: 13965, x: 4891600.0308, y: 8392970.4011 },\n { id: 34461, x: 4863109.1336, y: 8775210.8211 },\n { id: 1669, x: 4824461.6957, y: 8561032.3742 },\n { id: 34464, x: 4861139.1141, y: 8768688.5871 },\n { id: 1673, x: 4822497.8322, y: 8569756.2146 },\n { id: 50862, x: 4697599.5649, y: 8525359.4498 },\n { id: 13972, x: 4883194.7571, y: 8389614.1765 },\n { id: 50864, x: 4696716.7947, y: 8534075.8818 },\n { id: 13973, x: 4881330.4108, y: 8395790.4572 },\n { id: 50869, x: 4691379.967, y: 8527424.4386 },\n { id: 13979, x: 4877731.1699, y: 8382464.023 },\n { id: 71382, x: 4651289.4753, y: 8484123.2067 },\n { id: 71388, x: 4645370.5119, y: 8493062.4727 },\n { id: 71391, x: 4643122.0319, y: 8484626.1194 },\n { id: 71397, x: 4637449.7119, y: 8485789.8503 },\n { id: 71400, x: 4635007.4363, y: 8493478.1373 },\n { id: 30410, x: 4656021.54, y: 8798796.3532 },\n { id: 30415, x: 4649475.0013, y: 8794896.0643 },\n { id: 30419, x: 4658556.8905, y: 8825758.4324 },\n { id: 30422, x: 4656259.0815, y: 8812282.912 },\n { id: 30433, x: 4658828.4979, y: 8833324.2987 },\n { id: 26340, x: 4692420.7202, y: 8727280.3753 },\n { id: 59134, x: 4608119.6505, y: 8573614.0756 },\n { id: 26342, x: 4692001.901, y: 8744559.4919 },\n { id: 59135, x: 4607853.9727, y: 8566032.4871 },\n { id: 26343, x: 4689972.1135, y: 8732891.0255 },\n { id: 59136, x: 4607662.3072, y: 8579948.5831 },\n { id: 26346, x: 4686542.5189, y: 8737905.1193 },\n { id: 26347, x: 4685686.0373, y: 8728412.5175 },\n { id: 26348, x: 4685106.1357, y: 8733200.8836 },\n { id: 26349, x: 4684508.2148, y: 8745425.5245 },\n { id: 59143, x: 4602382.2803, y: 8565253.3405 },\n { id: 59144, x: 4600501.2591, y: 8571506.0739 },\n { id: 26352, x: 4681357.1129, y: 8727510.1577 },\n { id: 59146, x: 4598931.7699, y: 8580371.034 },\n { id: 26354, x: 4680574.4094, y: 8739304.692 },\n { id: 59148, x: 4597349.2632, y: 8566840.7578 },\n { id: 26359, x: 4677050.6218, y: 8733528.2532 },\n { id: 26365, x: 4673919.2311, y: 8727429.2337 },\n { id: 38675, x: 4822196.9396, y: 8734020.4816 },\n { id: 38677, x: 4817860.8958, y: 8738918.7012 },\n { id: 5886, x: 4757444.6018, y: 8555081.7644 },\n { id: 38679, x: 4816981.0152, y: 8725865.2283 },\n { id: 38682, x: 4811669.2952, y: 8732462.746 },\n { id: 38683, x: 4811149.2148, y: 8726431.991 },\n { id: 5891, x: 4752927.6366, y: 8548298.4572 },\n { id: 38688, x: 4806576.2852, y: 8741042.9187 },\n { id: 5896, x: 4748366.9316, y: 8556002.1433 },\n { id: 5899, x: 4746727.7656, y: 8546928.7557 },\n { id: 67411, x: 4706008.5299, y: 8456284.6525 },\n { id: 67414, x: 4704338.3791, y: 8448873.265 },\n { id: 67422, x: 4697492.4126, y: 8454933.1735 },\n { id: 67423, x: 4695956.3071, y: 8448271.3433 },\n { id: 34631, x: 4854828.9257, y: 8769222.9954 },\n { id: 67425, x: 4695406.797, y: 8439371.7717 },\n { id: 34635, x: 4853540.5339, y: 8776870.7715 },\n { id: 34641, x: 4849588.6814, y: 8762839.3487 },\n { id: 71537, x: 4648722.0318, y: 8477685.3217 },\n { id: 34648, x: 4844958.8857, y: 8776186.1013 },\n { id: 71541, x: 4645192.7337, y: 8468408.4935 },\n { id: 34651, x: 4842869.4052, y: 8764009.0641 },\n { id: 71544, x: 4640760.8446, y: 8474920.4935 },\n { id: 71546, x: 4637989.3044, y: 8463437.4544 },\n { id: 18277, x: 4724041.8175, y: 8650414.2713 },\n { id: 18278, x: 4722645.3657, y: 8659143.7538 },\n { id: 18283, x: 4717997.9603, y: 8647870.0351 },\n { id: 18284, x: 4717297.7556, y: 8661914.2071 },\n { id: 18286, x: 4715657.8563, y: 8653746.9178 },\n { id: 10089, x: 4829411.2792, y: 8454105.7657 },\n { id: 18288, x: 4713480.0056, y: 8644402.0804 },\n { id: 10090, x: 4829500.2484, y: 8444926.1953 },\n { id: 18290, x: 4713175.2936, y: 8644535.5873 },\n { id: 10093, x: 4826712.7644, y: 8439698.7204 },\n { id: 18293, x: 4710946.3234, y: 8654655.2455 },\n { id: 51087, x: 4706199.3488, y: 8512542.6471 },\n { id: 10101, x: 4820829.5066, y: 8451924.7531 },\n { id: 10104, x: 4819588.8323, y: 8443882.6332 },\n { id: 51095, x: 4700419.2031, y: 8507035.3391 },\n { id: 22402, x: 4710732.5588, y: 8769722.4661 },\n { id: 22406, x: 4708100.6652, y: 8778210.8521 },\n { id: 22408, x: 4707092.4739, y: 8785779.8951 },\n { id: 51102, x: 4696049.6351, y: 8514153.3038 },\n { id: 22410, x: 4705524.0313, y: 8772153.4533 },\n { id: 1916, x: 4815556.2346, y: 8561916.6426 },\n { id: 22413, x: 4702715.4081, y: 8781154.4885 },\n { id: 1919, x: 4814187.5403, y: 8567810.0971 },\n { id: 22416, x: 4698227.7834, y: 8778353.2777 },\n { id: 22419, x: 4697132.3765, y: 8771675.1623 },\n { id: 22420, x: 4696622.7543, y: 8783290.4365 },\n { id: 1925, x: 4810672.0772, y: 8574708.8603 },\n { id: 1930, x: 4806394.6074, y: 8561435.6711 },\n { id: 1934, x: 4804163.969, y: 8578412.7725 },\n { id: 1935, x: 4803470.0497, y: 8568438.2409 },\n { id: 26548, x: 4673064.1069, y: 8743071.5694 },\n { id: 26549, x: 4672177.4634, y: 8735686.5466 },\n { id: 26555, x: 4667428.215, y: 8728804.552 },\n { id: 26556, x: 4667231.3032, y: 8736555.3443 },\n { id: 26558, x: 4666545.2466, y: 8744620.3309 },\n { id: 26560, x: 4663811.4684, y: 8731321.245 },\n { id: 26561, x: 4663524.7221, y: 8736402.649 },\n { id: 26567, x: 4658680.7404, y: 8737634.5277 },\n { id: 26568, x: 4658082.6604, y: 8730317.685 },\n { id: 71679, x: 4632545.8844, y: 8421388.878 },\n { id: 71680, x: 4630740.0137, y: 8426629.2771 },\n { id: 71683, x: 4627789.3051, y: 8431448.7494 },\n { id: 71685, x: 4626862.059, y: 8422335.9447 },\n { id: 71689, x: 4621158.8466, y: 8419782.6677 },\n { id: 71690, x: 4619532.4399, y: 8427494.4721 },\n { id: 71693, x: 4617296.5008, y: 8423636.5945 },\n { id: 30717, x: 4611594.7702, y: 8606322.194 },\n { id: 30718, x: 4610901.1534, y: 8622004.9621 },\n { id: 55313, x: 4670180.105, y: 8570278.5919 },\n { id: 55314, x: 4666472.5741, y: 8581906.221 },\n { id: 30720, x: 4608526.6205, y: 8617013.1054 },\n { id: 55318, x: 4662124.5334, y: 8566702.0191 },\n { id: 55320, x: 4658325.0144, y: 8575364.6374 },\n { id: 30728, x: 4603942.6648, y: 8611621.8439 },\n { id: 30729, x: 4603374.0292, y: 8621804.6574 },\n { id: 30731, x: 4599504.903, y: 8622281.8681 },\n { id: 30732, x: 4598886.5053, y: 8613657.7232 },\n { id: 38957, x: 4820378.9041, y: 8717156.0389 },\n { id: 38958, x: 4818817.9806, y: 8703729.4265 },\n { id: 34859, x: 4859235.8107, y: 8747936.1709 },\n { id: 34860, x: 4858125.4681, y: 8757072.8847 },\n { id: 38960, x: 4817232.5173, y: 8709956.3279 },\n { id: 38966, x: 4811177.3887, y: 8704487.4101 },\n { id: 6176, x: 4757178.1818, y: 8579549.1853 },\n { id: 34869, x: 4852357.0713, y: 8741721.3402 },\n { id: 38969, x: 4809360.9414, y: 8714489.7118 },\n { id: 34870, x: 4852072.3981, y: 8751686.3485 },\n { id: 6178, x: 4756297.8943, y: 8572221.8588 },\n { id: 6180, x: 4753774.5361, y: 8561893.5153 },\n { id: 6184, x: 4751320.2102, y: 8569230.7454 },\n { id: 6186, x: 4749699.6918, y: 8575818.492 },\n { id: 34880, x: 4845245.9364, y: 8753277.0543 },\n { id: 34884, x: 4843659.8631, y: 8747970.9562 },\n { id: 14412, x: 4759967.3378, y: 8613741.9474 },\n { id: 14414, x: 4756135.0483, y: 8603738.5311 },\n { id: 14417, x: 4754325.2605, y: 8609977.779 },\n { id: 14419, x: 4751688.2177, y: 8617662.2095 },\n { id: 67710, x: 4705246.8946, y: 8436850.3308 },\n { id: 22622, x: 4710802.0058, y: 8759654.9587 },\n { id: 10325, x: 4813928.3971, y: 8457369.839 },\n { id: 51315, x: 4721657.0719, y: 8556534.4941 },\n { id: 14425, x: 4746994.861, y: 8621675.5918 },\n { id: 51316, x: 4721291.6563, y: 8550132.6127 },\n { id: 14426, x: 4746480.9196, y: 8608375.6727 },\n { id: 51317, x: 4719432.6307, y: 8542217.2385 },\n { id: 67714, x: 4701445.3537, y: 8425409.9119 },\n { id: 59517, x: 4595531.5579, y: 8583354.2582 },\n { id: 10331, x: 4810515.0778, y: 8443768.1964 },\n { id: 59519, x: 4595028.9192, y: 8574638.8153 },\n { id: 22629, x: 4706965.4348, y: 8755364.0468 },\n { id: 51322, x: 4715586.1088, y: 8544001.4528 },\n { id: 22631, x: 4705613.0062, y: 8750651.1416 },\n { id: 59522, x: 4592054.6106, y: 8569872.1506 },\n { id: 51324, x: 4714611.5413, y: 8551019.2827 },\n { id: 26731, x: 4671403.6565, y: 8722186.0249 },\n { id: 67721, x: 4695496.4097, y: 8419994.9862 },\n { id: 51326, x: 4714014.9812, y: 8557098.2016 },\n { id: 10336, x: 4806273.6699, y: 8458443.9529 },\n { id: 22634, x: 4705063.2956, y: 8759561.9697 },\n { id: 51328, x: 4710737.5049, y: 8550044.3237 },\n { id: 22636, x: 4702086.8789, y: 8762852.0095 },\n { id: 10339, x: 4803175.2044, y: 8449713.2376 },\n { id: 59527, x: 4589692.7362, y: 8575241.9185 },\n { id: 26736, x: 4668152.3799, y: 8715359.1975 },\n { id: 59528, x: 4589786.3083, y: 8580109.2765 },\n { id: 51331, x: 4708015.5259, y: 8541908.8313 },\n { id: 22638, x: 4701587.4963, y: 8757274.8922 },\n { id: 71826, x: 4628083.3541, y: 8442551.5568 },\n { id: 67727, x: 4690197.9194, y: 8427906.8265 },\n { id: 26738, x: 4667405.2418, y: 8710708.4383 },\n { id: 71827, x: 4626839.2909, y: 8457967.3741 },\n { id: 71828, x: 4626090.9895, y: 8450134.9134 },\n { id: 22641, x: 4697520.9844, y: 8754203.7875 },\n { id: 59533, x: 4585485.9578, y: 8574411.7883 },\n { id: 26742, x: 4664438.9075, y: 8725233.7794 },\n { id: 22643, x: 4696549.4828, y: 8766031.0907 },\n { id: 71831, x: 4621353.6529, y: 8458201.0357 },\n { id: 59534, x: 4584886.3824, y: 8563305.5526 },\n { id: 71832, x: 4621521.3713, y: 8437888.9463 },\n { id: 59535, x: 4580978.5341, y: 8565788.3403 },\n { id: 26744, x: 4662018.8765, y: 8713054.1805 },\n { id: 22645, x: 4695832.0372, y: 8748423.1043 },\n { id: 71833, x: 4620355.8537, y: 8445217.1941 },\n { id: 26746, x: 4661275.7024, y: 8719355.4121 },\n { id: 26748, x: 4659068.9962, y: 8708325.5973 },\n { id: 26750, x: 4657924.5067, y: 8726224.3792 },\n { id: 18552, x: 4708572.3187, y: 8647178.5878 },\n { id: 26752, x: 4655983.5683, y: 8720538.6476 },\n { id: 18554, x: 4707409.7619, y: 8653452.7031 },\n { id: 18556, x: 4706400.5033, y: 8659012.078 },\n { id: 18557, x: 4705182.1672, y: 8650309.1542 },\n { id: 18562, x: 4701105.3185, y: 8663423.1867 },\n { id: 18563, x: 4700378.8932, y: 8653711.0181 },\n { id: 18567, x: 4697784.1764, y: 8663725.323 },\n { id: 43165, x: 4780235.8783, y: 8622236.7201 },\n { id: 18571, x: 4696002.3531, y: 8659878.0683 },\n { id: 18572, x: 4694331.3124, y: 8647440.6379 },\n { id: 18573, x: 4693929.3428, y: 8653964.2192 },\n { id: 43170, x: 4776242.2601, y: 8630080.7132 },\n { id: 18577, x: 4690981.5421, y: 8657500.0136 },\n { id: 43172, x: 4775122.4289, y: 8638274.0494 },\n { id: 43183, x: 4767852.6698, y: 8635505.3492 },\n { id: 59581, x: 4595587.0861, y: 8547476.9619 },\n { id: 43185, x: 4766313.2817, y: 8627639.5168 },\n { id: 59582, x: 4595735.6693, y: 8556598.3008 },\n { id: 59583, x: 4593989.1909, y: 8562596.9921 },\n { id: 59584, x: 4593307.0845, y: 8551290.8938 },\n { id: 59586, x: 4587953.5366, y: 8551478.4505 },\n { id: 59587, x: 4587403.1381, y: 8558077.7166 },\n { id: 35019, x: 4879212.723, y: 8787669.9007 },\n { id: 63715, x: 4739865.9684, y: 8431507.4866 },\n { id: 63716, x: 4739849.2948, y: 8426511.9785 },\n { id: 35023, x: 4877007.5008, y: 8797362.382 },\n { id: 63717, x: 4739512.5333, y: 8419757.2879 },\n { id: 35028, x: 4873193.5211, y: 8794301.9281 },\n { id: 71920, x: 4646995.0701, y: 8457164.8458 },\n { id: 71921, x: 4645842.2879, y: 8446874.329 },\n { id: 71922, x: 4645178.6297, y: 8440806.8596 },\n { id: 63724, x: 4734129.2758, y: 8432362.3989 },\n { id: 35031, x: 4871761.9338, y: 8787407.8446 },\n { id: 6339, x: 4742975.9137, y: 8567280.8477 },\n { id: 6340, x: 4743265.6047, y: 8580102.96 },\n { id: 71925, x: 4635842.5025, y: 8454325.4339 },\n { id: 63727, x: 4733154.4999, y: 8424294.9012 },\n { id: 35034, x: 4869045.7546, y: 8783779.6925 },\n { id: 71927, x: 4635015.3993, y: 8441382.7357 },\n { id: 6343, x: 4740911.1765, y: 8561700.0604 },\n { id: 35037, x: 4867241.3209, y: 8797258.2538 },\n { id: 6344, x: 4738327.4778, y: 8571161.1721 },\n { id: 35038, x: 4865984.8745, y: 8790216.5552 },\n { id: 71930, x: 4650853.5676, y: 8434645.8699 },\n { id: 35039, x: 4864154.138, y: 8784063.9111 },\n { id: 63733, x: 4726603.8008, y: 8436162.2984 },\n { id: 71932, x: 4647166.3022, y: 8426987.0416 },\n { id: 6352, x: 4732040.6552, y: 8564086.4672 },\n { id: 6353, x: 4731876.7793, y: 8575265.2697 },\n { id: 6354, x: 4731643.6968, y: 8575112.6423 },\n { id: 71939, x: 4641155.2526, y: 8421902.254 },\n { id: 71940, x: 4640669.9817, y: 8432103.3993 },\n { id: 71946, x: 4635192.6583, y: 8430973.3395 },\n { id: 39163, x: 4837497.3421, y: 8760366.161 },\n { id: 39164, x: 4836967.1064, y: 8753149.1954 },\n { id: 39166, x: 4835197.6263, y: 8748300.2076 },\n { id: 39175, x: 4827176.9044, y: 8757022.9771 },\n { id: 39176, x: 4826056.6073, y: 8749117.3519 },\n { id: 39178, x: 4823983.3587, y: 8744523.9511 },\n { id: 30985, x: 4595701.5117, y: 8605580.7663 },\n { id: 30988, x: 4594340.5281, y: 8618000.0166 },\n { id: 30992, x: 4591798.1989, y: 8610499.8959 },\n { id: 26893, x: 4693001.536, y: 8756675.808 },\n { id: 30993, x: 4591009.6026, y: 8623971.9801 },\n { id: 26897, x: 4689682.1886, y: 8754681.796 },\n { id: 30998, x: 4588809.8803, y: 8604608.9945 },\n { id: 26899, x: 4689417.9625, y: 8761365.7204 },\n { id: 30999, x: 4586976.0356, y: 8613378.2395 },\n { id: 26900, x: 4688068.4008, y: 8749452.8292 },\n { id: 31000, x: 4586623.8305, y: 8617793.2726 },\n { id: 31001, x: 4585961.9396, y: 8607960.9114 },\n { id: 31002, x: 4586365.1948, y: 8621660.0424 },\n { id: 31005, x: 4583090.5827, y: 8610802.7977 },\n { id: 26907, x: 4682582.9351, y: 8756943.293 },\n { id: 31007, x: 4581677.0663, y: 8615559.0453 },\n { id: 31008, x: 4581314.6485, y: 8606975.0676 },\n { id: 31009, x: 4581329.1999, y: 8621005.2291 },\n { id: 31011, x: 4579308.2236, y: 8608254.738 },\n { id: 31012, x: 4578890.2727, y: 8615361.0772 },\n { id: 26913, x: 4678561.9113, y: 8750158.6033 },\n { id: 31013, x: 4578613.6457, y: 8611729.4817 },\n { id: 26915, x: 4677806.2067, y: 8761659.962 },\n { id: 26917, x: 4676241.3309, y: 8758404.0113 },\n { id: 14655, x: 4741551.5913, y: 8615165.9176 },\n { id: 47456, x: 4806773.1388, y: 8819811.6651 },\n { id: 14664, x: 4734308.1353, y: 8616623.4236 },\n { id: 35162, x: 4879821.421, y: 8816555.0701 },\n { id: 47462, x: 4802312.6425, y: 8810552.402 },\n { id: 2373, x: 4817335.3331, y: 8547285.0913 },\n { id: 47463, x: 4801503.7111, y: 8821002.0054 },\n { id: 47465, x: 4800003.8921, y: 8813583.2285 },\n { id: 47467, x: 4798299.446, y: 8816665.2404 },\n { id: 35170, x: 4873349.8608, y: 8812792.5958 },\n { id: 35171, x: 4871768.0207, y: 8806551.4856 },\n { id: 47469, x: 4797770.9808, y: 8820014.7937 },\n { id: 35175, x: 4870631.6535, y: 8819580.7836 },\n { id: 2384, x: 4810381.6241, y: 8555654.1962 },\n { id: 47474, x: 4795105.836, y: 8809014.7135 },\n { id: 2385, x: 4808300.7637, y: 8545433.0614 },\n { id: 35181, x: 4865775.9304, y: 8805651.3718 },\n { id: 47479, x: 4790047.4814, y: 8814250.7737 },\n { id: 35184, x: 4863387.6612, y: 8813690.8719 },\n { id: 2392, x: 4802329.8173, y: 8541681.9336 },\n { id: 2394, x: 4801881.8716, y: 8550435.1716 },\n { id: 43395, x: 4800686.7787, y: 8665405.1762 },\n { id: 43396, x: 4799401.0606, y: 8672986.9703 },\n { id: 43400, x: 4795633.7521, y: 8681784.0691 },\n { id: 22909, x: 4731884.1136, y: 8793536.7642 },\n { id: 43406, x: 4790528.5297, y: 8671284.2149 },\n { id: 22911, x: 4731993.5592, y: 8805075.3284 },\n { id: 63903, x: 4761236.9764, y: 8463063.0012 },\n { id: 43408, x: 4788594.184, y: 8663040.3446 },\n { id: 63905, x: 4758706.5487, y: 8474423.598 },\n { id: 63907, x: 4758205.7861, y: 8469314.1555 },\n { id: 22918, x: 4721477.8137, y: 8791195.7029 },\n { id: 63909, x: 4756998.7574, y: 8460687.0951 },\n { id: 43414, x: 4785550.1452, y: 8669514.7968 },\n { id: 43415, x: 4784055.1658, y: 8677333.75 },\n { id: 22920, x: 4719707.5246, y: 8799580.6934 },\n { id: 63914, x: 4752312.1632, y: 8474841.659 },\n { id: 63915, x: 4751894.5229, y: 8466944.3121 },\n { id: 6529, x: 4736943.3559, y: 8552606.4242 },\n { id: 63918, x: 4749333.6176, y: 8464362.8074 },\n { id: 63919, x: 4748831.2394, y: 8477121.2519 },\n { id: 68019, x: 4725077.9423, y: 8474842.8164 },\n { id: 14733, x: 4749395.0666, y: 8641212.2487 },\n { id: 63922, x: 4746705.0737, y: 8467131.8614 },\n { id: 39329, x: 4839272.3569, y: 8774223.2429 },\n { id: 63924, x: 4744345.8868, y: 8473013.4973 },\n { id: 68026, x: 4721868.9323, y: 8467367.6128 },\n { id: 6541, x: 4726184.9739, y: 8544969.0408 },\n { id: 39338, x: 4832806.002, y: 8767723.1096 },\n { id: 68032, x: 4718517.7331, y: 8474330.4471 },\n { id: 68035, x: 4716539.827, y: 8460925.2617 },\n { id: 39346, x: 4829272.5085, y: 8776641.5153 },\n { id: 39347, x: 4827458.3226, y: 8764276.9034 },\n { id: 68042, x: 4710821.9528, y: 8472544.3246 },\n { id: 10665, x: 4818435.5861, y: 8437877.1612 },\n { id: 59854, x: 4614793.5368, y: 8596803.3278 },\n { id: 10666, x: 4817061.7693, y: 8430991.4867 },\n { id: 59855, x: 4614574.685, y: 8591477.2786 },\n { id: 59856, x: 4614836.3706, y: 8602636.3011 },\n { id: 10671, x: 4813606.7944, y: 8425281.3201 },\n { id: 59860, x: 4611261.1019, y: 8586838.2628 },\n { id: 59861, x: 4611135.7102, y: 8595771.9825 },\n { id: 59862, x: 4609144.3144, y: 8603861.7822 },\n { id: 14774, x: 4751533.405, y: 8654713.0376 },\n { id: 51666, x: 4720749.8057, y: 8569348.0414 },\n { id: 10676, x: 4810118.5132, y: 8430901.1778 },\n { id: 59865, x: 4607039.8216, y: 8590055.6404 },\n { id: 51667, x: 4718969.2207, y: 8564061.0322 },\n { id: 27073, x: 4691649.6754, y: 8775728.5417 },\n { id: 51668, x: 4718925.8246, y: 8579268.4075 },\n { id: 27074, x: 4689544.1505, y: 8769905.9186 },\n { id: 27075, x: 4690045.6636, y: 8787804.7184 },\n { id: 14778, x: 4747416.8728, y: 8646783.5705 },\n { id: 59868, x: 4605808.5559, y: 8598991.2867 },\n { id: 27076, x: 4689820.239, y: 8782807.0644 },\n { id: 59869, x: 4604311.3629, y: 8603491.7697 },\n { id: 10682, x: 4806896.2966, y: 8420121.126 },\n { id: 51674, x: 4713114.4715, y: 8571651.1196 },\n { id: 51675, x: 4712171.6641, y: 8563661.7228 },\n { id: 27081, x: 4685046.4937, y: 8774378.3225 },\n { id: 59874, x: 4600276.6473, y: 8585578.0206 },\n { id: 27083, x: 4684271.6838, y: 8770139.1829 },\n { id: 10687, x: 4803049.6182, y: 8430455.8945 },\n { id: 59876, x: 4598401.3991, y: 8595626.2939 },\n { id: 51678, x: 4710019.0454, y: 8580426.3786 },\n { id: 10688, x: 4802315.0362, y: 8438671.892 },\n { id: 51680, x: 4707568.2878, y: 8564567.2951 },\n { id: 31185, x: 4615541.0872, y: 8631282.4883 },\n { id: 72175, x: 4628880.708, y: 8414071.1363 },\n { id: 31186, x: 4614798.8661, y: 8624949.0979 },\n { id: 27088, x: 4679686.572, y: 8768793.7382 },\n { id: 10692, x: 4800711.4918, y: 8422377.1609 },\n { id: 27090, x: 4678249.6433, y: 8785162.6702 },\n { id: 31190, x: 4612008.9966, y: 8637885.037 },\n { id: 27091, x: 4677828.6568, y: 8775718.8963 },\n { id: 31193, x: 4609257.4499, y: 8645013.574 },\n { id: 31194, x: 4609046.5895, y: 8639962.438 },\n { id: 31195, x: 4608442.1643, y: 8631613.7924 },\n { id: 72186, x: 4648057.1282, y: 8416265.4079 },\n { id: 31197, x: 4605435.0224, y: 8642563.548 },\n { id: 72187, x: 4644400.3652, y: 8409754.6863 },\n { id: 31200, x: 4602302.5793, y: 8634278.6152 },\n { id: 72190, x: 4638873.7122, y: 8415881.6799 },\n { id: 72193, x: 4635791.5414, y: 8411359.8178 },\n { id: 31204, x: 4599358.1737, y: 8628397.466 },\n { id: 31207, x: 4597788.6379, y: 8636974.871 },\n { id: 55820, x: 4670068.2705, y: 8544615.7005 },\n { id: 55823, x: 4667227.4898, y: 8560632.4147 },\n { id: 55825, x: 4665026.2526, y: 8547811.3431 },\n { id: 55827, x: 4661961.7892, y: 8557316.2019 },\n { id: 55829, x: 4660295.0145, y: 8544377.7 },\n { id: 55830, x: 4659066.5285, y: 8549418.3317 },\n { id: 55832, x: 4656800.9338, y: 8561749.2555 },\n { id: 55836, x: 4652405.6561, y: 8556639.1223 },\n { id: 72249, x: 4608965.4002, y: 8412708.2453 },\n { id: 2570, x: 4835706.0778, y: 8580732.24 },\n { id: 2571, x: 4835614.2389, y: 8591058.9473 },\n { id: 47662, x: 4787801.955, y: 8817589.3724 },\n { id: 47665, x: 4785868.2097, y: 8811383.2574 },\n { id: 72259, x: 4590986.3092, y: 8416168.2804 },\n { id: 72261, x: 4579053.0406, y: 8411008.4203 },\n { id: 27173, x: 4674255.579, y: 8771167.8709 },\n { id: 2581, x: 4827702.752, y: 8589462.053 },\n { id: 2582, x: 4827035.0918, y: 8596034.8176 },\n { id: 47672, x: 4781371.6221, y: 8812844.0285 },\n { id: 27177, x: 4671746.9359, y: 8788771.4695 },\n { id: 35376, x: 4862088.8507, y: 8821371.7812 },\n { id: 27178, x: 4670031.3061, y: 8781367.205 },\n { id: 2584, x: 4825943.5973, y: 8582342.4067 },\n { id: 35377, x: 4861026.1607, y: 8803689.8809 },\n { id: 27179, x: 4668958.2542, y: 8773912.9275 },\n { id: 47675, x: 4778982.737, y: 8817587.2237 },\n { id: 27180, x: 4668555.0893, y: 8770419.3953 },\n { id: 47676, x: 4777307.3475, y: 8808685.8589 },\n { id: 35381, x: 4857468.475, y: 8807367.1449 },\n { id: 27186, x: 4665282.5743, y: 8778383.0094 },\n { id: 27187, x: 4663623.7599, y: 8787742.2743 },\n { id: 35387, x: 4853219.1143, y: 8815181.793 },\n { id: 2595, x: 4819373.413, y: 8595384.2011 },\n { id: 35389, x: 4851882.7006, y: 8821138.5973 },\n { id: 27192, x: 4657777.2249, y: 8782325.762 },\n { id: 35392, x: 4850838.3214, y: 8802682.1797 },\n { id: 35393, x: 4849241.3984, y: 8809163.1347 },\n { id: 39495, x: 4822217.8408, y: 8765141.106 },\n { id: 39498, x: 4820496.0962, y: 8773038.2766 },\n { id: 39506, x: 4813868.3067, y: 8771768.801 },\n { id: 39509, x: 4812382.6563, y: 8781018.2088 },\n { id: 39513, x: 4809559.5665, y: 8766110.317 },\n { id: 39515, x: 4807203.6199, y: 8774675.0915 },\n { id: 68210, x: 4722400.2516, y: 8494034.7756 },\n { id: 68214, x: 4718875.908, y: 8482599.0039 },\n { id: 43625, x: 4798635.6862, y: 8699245.7202 },\n { id: 43626, x: 4796457.5293, y: 8689704.7795 },\n { id: 68222, x: 4713041.3014, y: 8490328.298 },\n { id: 68223, x: 4713216.0002, y: 8479799.0819 },\n { id: 43632, x: 4792825.2092, y: 8698177.9857 },\n { id: 43634, x: 4790242.0148, y: 8684846.7896 },\n { id: 43635, x: 4790273.7646, y: 8692125.5384 },\n { id: 43639, x: 4786174.4233, y: 8694730.4956 },\n { id: 43641, x: 4785759.758, y: 8686277.0245 },\n { id: 27259, x: 4673441.1964, y: 8751827.3878 },\n { id: 27261, x: 4671221.1821, y: 8764798.0038 },\n { id: 27268, x: 4666368.3878, y: 8754183.4729 },\n { id: 27269, x: 4666320.4654, y: 8760713.4919 },\n { id: 27271, x: 4664846.7998, y: 8748345.4322 },\n { id: 23178, x: 4708499.7711, y: 8795097.0931 },\n { id: 23180, x: 4707064.4711, y: 8803804.8628 },\n { id: 23185, x: 4702312.2272, y: 8791030.0401 },\n { id: 23186, x: 4702204.5835, y: 8797157.395 },\n { id: 23188, x: 4700235.4611, y: 8804426.7544 },\n { id: 14992, x: 4740513.4711, y: 8661555.6661 },\n { id: 14995, x: 4737431.9778, y: 8650842.6949 },\n { id: 14996, x: 4737166.9429, y: 8644007.1564 },\n { id: 19099, x: 4708525.6651, y: 8639696.4409 },\n { id: 15002, x: 4733955.0103, y: 8662959.0059 },\n { id: 19103, x: 4707336.9464, y: 8626770.6569 },\n { id: 51897, x: 4707429.4496, y: 8572314.2894 },\n { id: 19106, x: 4705759.7974, y: 8634707.5888 },\n { id: 51899, x: 4706568.6075, y: 8576572.7277 },\n { id: 51900, x: 4705239.9254, y: 8580105.7737 },\n { id: 15009, x: 4728122.4392, y: 8654950.5844 },\n { id: 31406, x: 4613243.0894, y: 8648376.6567 },\n { id: 31407, x: 4612343.6927, y: 8658980.0622 },\n { id: 51904, x: 4702629.1244, y: 8567642.6068 },\n { id: 72399, x: 4608901.387, y: 8419586.3106 },\n { id: 19113, x: 4703626.5899, y: 8642586.8441 },\n { id: 72400, x: 4608574.6662, y: 8425546.3083 },\n { id: 31411, x: 4607954.1946, y: 8650798.7004 },\n { id: 51907, x: 4700776.6733, y: 8574427.3691 },\n { id: 31412, x: 4607551.9321, y: 8654776.8983 },\n { id: 19116, x: 4701342.437, y: 8629643.8666 },\n { id: 72403, x: 4602932.8454, y: 8432341.2121 },\n { id: 19117, x: 4700975.1384, y: 8637628.1757 },\n { id: 51910, x: 4699543.9794, y: 8578055.1143 },\n { id: 31415, x: 4606326.4558, y: 8665184.6353 },\n { id: 72405, x: 4601535.5588, y: 8425975.3331 },\n { id: 72406, x: 4601359.1106, y: 8418821.0459 },\n { id: 31417, x: 4603444.6002, y: 8647685.1804 },\n { id: 19120, x: 4697558.1507, y: 8642270.9476 },\n { id: 31418, x: 4603182.9962, y: 8654995.9209 },\n { id: 19121, x: 4695790.3377, y: 8625606.25 },\n { id: 10923, x: 4835656.3617, y: 8463421.5505 },\n { id: 51914, x: 4695168.309, y: 8571983.591 },\n { id: 19122, x: 4696022.8113, y: 8633862.4371 },\n { id: 72409, x: 4597227.1671, y: 8432370.8309 },\n { id: 51915, x: 4693670.6501, y: 8577344.6725 },\n { id: 31420, x: 4602884.6745, y: 8659135.9729 },\n { id: 19124, x: 4693541.72, y: 8629515.2552 },\n { id: 10927, x: 4832417.601, y: 8467031.5507 },\n { id: 31423, x: 4599012.9388, y: 8664496.7798 },\n { id: 19126, x: 4692391.5954, y: 8641102.2007 },\n { id: 64218, x: 4761727.5752, y: 8487483.6102 },\n { id: 10932, x: 4828991.4326, y: 8475767.4888 },\n { id: 64221, x: 4759533.1011, y: 8495053.5308 },\n { id: 64223, x: 4756605.0948, y: 8483998.2928 },\n { id: 10939, x: 4826260.5025, y: 8460618.4229 },\n { id: 10940, x: 4825086.6567, y: 8471522.1933 },\n { id: 64228, x: 4751079.3309, y: 8499319.5716 },\n { id: 35535, x: 4858837.003, y: 8798071.9723 },\n { id: 35538, x: 4857069.4639, y: 8787374.8384 },\n { id: 64235, x: 4746796.7817, y: 8489423.412 },\n { id: 10948, x: 4818835.2402, y: 8468657.8629 },\n { id: 35548, x: 4850344.0444, y: 8785494.4863 },\n { id: 6856, x: 4761139.7466, y: 8590985.8702 },\n { id: 6857, x: 4759752.3485, y: 8598636.1705 },\n { id: 6858, x: 4758852.0719, y: 8584975.7751 },\n { id: 35552, x: 4847393.6557, y: 8792939.2503 },\n { id: 6870, x: 4747714.5078, y: 8595338.4477 },\n { id: 6871, x: 4746039.2078, y: 8587730.2744 },\n { id: 60162, x: 4595740.7057, y: 8589610.0233 },\n { id: 60166, x: 4593559.6854, y: 8601922.1805 },\n { id: 60168, x: 4591311.7003, y: 8585462.8725 },\n { id: 60170, x: 4588626.0194, y: 8589949.6782 },\n { id: 60172, x: 4586073.1763, y: 8594473.6887 },\n { id: 60176, x: 4582102.3003, y: 8588571.9608 },\n { id: 47882, x: 4785262.0317, y: 8787751.0468 },\n { id: 47883, x: 4785400.7663, y: 8803732.4589 },\n { id: 47884, x: 4783567.6371, y: 8798427.538 },\n { id: 47886, x: 4781356.2178, y: 8791652.7738 },\n { id: 47892, x: 4776445.8534, y: 8795727.9066 },\n { id: 2804, x: 4818412.18, y: 8589214.5203 },\n { id: 47894, x: 4774126.8905, y: 8804544.2741 },\n { id: 2805, x: 4816952.0393, y: 8581814.9397 },\n { id: 60192, x: 4575574.564, y: 8599097.8826 },\n { id: 47896, x: 4770078.1182, y: 8790876.6649 },\n { id: 39703, x: 4820420.5115, y: 8759175.4338 },\n { id: 2812, x: 4813534.4014, y: 8599498.1614 },\n { id: 2813, x: 4811801.8901, y: 8587137.0872 },\n { id: 2814, x: 4811985.0478, y: 8593630.4406 },\n { id: 39707, x: 4817251.4098, y: 8750013.5303 },\n { id: 39709, x: 4815423.6392, y: 8758421.6822 },\n { id: 56107, x: 4686504.0564, y: 8589862.5587 },\n { id: 56108, x: 4683233.4111, y: 8587145.5436 },\n { id: 56109, x: 4683420.7502, y: 8596395.5158 },\n { id: 2822, x: 4806267.7872, y: 8583081.1082 },\n { id: 56111, x: 4679830.9596, y: 8599048.0454 },\n { id: 56112, x: 4677675.8049, y: 8583479.3615 },\n { id: 39717, x: 4808906.0549, y: 8747061.1563 },\n { id: 56114, x: 4677712.2721, y: 8594590.6844 },\n { id: 2828, x: 4801975.6031, y: 8590784.9479 },\n { id: 39720, x: 4806714.3142, y: 8754497.9134 },\n { id: 27423, x: 4694765.6575, y: 8799769.7578 },\n { id: 39721, x: 4805397.8588, y: 8747260.2165 },\n { id: 56118, x: 4672861.267, y: 8593205.7387 },\n { id: 27425, x: 4693730.269, y: 8791468.9142 },\n { id: 27426, x: 4693878.8943, y: 8805003.6263 },\n { id: 56121, x: 4671042.8416, y: 8598372.3761 },\n { id: 31527, x: 4597492.0651, y: 8652560.0046 },\n { id: 31528, x: 4595753.3567, y: 8657898.8097 },\n { id: 31530, x: 4593868.8598, y: 8664530.9799 },\n { id: 27432, x: 4688868.0075, y: 8802876.2647 },\n { id: 31533, x: 4589095.6291, y: 8656116.3976 },\n { id: 27434, x: 4687697.6279, y: 8798191.8161 },\n { id: 27435, x: 4686169.3544, y: 8794562.3867 },\n { id: 27439, x: 4684256.4194, y: 8808937.2207 },\n { id: 27440, x: 4681795.4624, y: 8790633.1577 },\n { id: 31540, x: 4585878.746, y: 8648667.1466 },\n { id: 60235, x: 4765650.7239, y: 8416121.7521 },\n { id: 31542, x: 4584579.3239, y: 8652908.5421 },\n { id: 27443, x: 4680063.4724, y: 8802801.3462 },\n { id: 60236, x: 4765428.4296, y: 8407857.8713 },\n { id: 31544, x: 4583540.0974, y: 8666970.2477 },\n { id: 27448, x: 4676928.9424, y: 8790959.9156 },\n { id: 31548, x: 4579746.1034, y: 8648782.9711 },\n { id: 27449, x: 4676878.2276, y: 8797773.7668 },\n { id: 31549, x: 4579977.5523, y: 8657440.8969 },\n { id: 35653, x: 4854469.6736, y: 8850001.8137 },\n { id: 35654, x: 4853544.7512, y: 8843279.5405 },\n { id: 35658, x: 4852697.039, y: 8862113.1131 },\n { id: 15163, x: 4744231.6652, y: 8630246.732 },\n { id: 35660, x: 4850869.3589, y: 8856931.6452 },\n { id: 35663, x: 4848245.8707, y: 8845581.0938 },\n { id: 6972, x: 4738565.0575, y: 8595089.2682 },\n { id: 35666, x: 4847354.8688, y: 8850651.7104 },\n { id: 6973, x: 4737829.0661, y: 8583487.3164 },\n { id: 68459, x: 4706752.1211, y: 8479544.181 },\n { id: 68461, x: 4703837.6894, y: 8495464.9706 },\n { id: 15174, x: 4736133.8596, y: 8630921.6152 },\n { id: 68463, x: 4702696.0291, y: 8488421.9726 },\n { id: 6978, x: 4732042.6549, y: 8589518.4615 },\n { id: 15179, x: 4732346.7264, y: 8627234.1449 },\n { id: 15182, x: 4729742.0512, y: 8641197.8439 },\n { id: 68470, x: 4695758.7472, y: 8480621.6991 },\n { id: 68472, x: 4694241.0284, y: 8493967.8704 },\n { id: 43880, x: 4778815.1556, y: 8691707.7044 },\n { id: 43881, x: 4777547.7437, y: 8700077.7035 },\n { id: 43882, x: 4775723.0165, y: 8687250.2345 },\n { id: 68478, x: 4689194.7286, y: 8494338.1466 },\n { id: 68480, x: 4689426.5029, y: 8480560.5398 },\n { id: 43886, x: 4773419.5373, y: 8700805.4379 },\n { id: 43888, x: 4772380.7778, y: 8695990.7745 },\n { id: 43894, x: 4767194.13, y: 8691046.7612 },\n { id: 47997, x: 4807574.2241, y: 8829116.1499 },\n { id: 48000, x: 4802912.5591, y: 8825255.7631 },\n { id: 48002, x: 4799989.5738, y: 8825065.5745 },\n { id: 64403, x: 4742030.7656, y: 8497708.6697 },\n { id: 64405, x: 4740579.658, y: 8482431.4457 },\n { id: 72603, x: 4613648.9944, y: 8444678.2684 },\n { id: 72604, x: 4612885.1503, y: 8453769.9729 },\n { id: 64407, x: 4738551.2609, y: 8491580.5467 },\n { id: 72606, x: 4612392.8084, y: 8438159.2152 },\n { id: 64409, x: 4735621.3885, y: 8498088.7535 },\n { id: 64411, x: 4734471.9654, y: 8485198.8911 },\n { id: 72611, x: 4605033.6819, y: 8454833.2151 },\n { id: 64414, x: 4731342.7414, y: 8491779.8149 },\n { id: 72612, x: 4604199.225, y: 8439683.1904 },\n { id: 64416, x: 4729221.6532, y: 8498128.6431 },\n { id: 60317, x: 4764946.3837, y: 8443760.0447 },\n { id: 60319, x: 4764108.3496, y: 8454245.8981 },\n { id: 72616, x: 4598363.8559, y: 8447433.7833 },\n { id: 64419, x: 4727143.8343, y: 8487353.8224 },\n { id: 60320, x: 4763899.8742, y: 8448541.4778 },\n { id: 7042, x: 4869136.0719, y: 8372279.0901 },\n { id: 7043, x: 4867600.6086, y: 8379079.3827 },\n { id: 15242, x: 4752763.7365, y: 8682501.1131 },\n { id: 15243, x: 4751688.2291, y: 8676647.5907 },\n { id: 15245, x: 4750972.3237, y: 8666550.541 },\n { id: 7049, x: 4859289.1182, y: 8375739.8279 },\n { id: 39844, x: 4839437.3266, y: 8785450.7633 },\n { id: 39847, x: 4837718.1482, y: 8796932.3609 },\n { id: 52151, x: 4706846.4699, y: 8553474.5612 },\n { id: 39855, x: 4831415.0865, y: 8785681.4838 },\n { id: 11163, x: 4834123.3917, y: 8490010.6927 },\n { id: 52154, x: 4705771.7823, y: 8546060.8707 },\n { id: 39857, x: 4829914.1636, y: 8792647.9854 },\n { id: 11164, x: 4833657.3771, y: 8496207.1451 },\n { id: 52156, x: 4702962.3033, y: 8550300.5151 },\n { id: 11166, x: 4831443.4578, y: 8481074.6925 },\n { id: 52158, x: 4701480.9781, y: 8560093.902 },\n { id: 52159, x: 4700402.8225, y: 8555009.6054 },\n { id: 52161, x: 4698900.0089, y: 8545588.6663 },\n { id: 39864, x: 4825586.8119, y: 8783659.702 },\n { id: 39865, x: 4825884.4138, y: 8793047.1113 },\n { id: 11173, x: 4825850.6167, y: 8490570.9832 },\n { id: 52164, x: 4695404.9902, y: 8552480.4248 },\n { id: 52165, x: 4692588.0839, y: 8560612.7064 },\n { id: 11175, x: 4825424.0788, y: 8480229.1682 },\n { id: 52167, x: 4690381.4951, y: 8541920.2064 },\n { id: 11177, x: 4822709.5306, y: 8499648.2397 },\n { id: 11181, x: 4820726.3692, y: 8490768.8062 },\n { id: 27584, x: 4692832.9013, y: 8810089.9267 },\n { id: 27586, x: 4681955.2163, y: 8812173.7719 },\n { id: 19388, x: 4726909.1125, y: 8674821.5799 },\n { id: 15289, x: 4749944.2986, y: 8697397.0685 },\n { id: 19389, x: 4726243.6867, y: 8668883.2374 },\n { id: 27590, x: 4678034.0936, y: 8818400.5657 },\n { id: 60383, x: 4765782.1672, y: 8431711.9188 },\n { id: 19394, x: 4723665.6478, y: 8666431.2341 },\n { id: 19395, x: 4721793.777, y: 8681956.369 },\n { id: 60386, x: 4764940.3026, y: 8425561.9132 },\n { id: 19396, x: 4721119.5059, y: 8677429.8344 },\n { id: 60387, x: 4763396.2482, y: 8436289.9447 },\n { id: 19397, x: 4719467.3987, y: 8672194.9811 },\n { id: 19401, x: 4716500.8699, y: 8681072.1674 },\n { id: 19406, x: 4712366.6321, y: 8669109.4021 },\n { id: 35804, x: 4859657.7761, y: 8831373.2947 },\n { id: 19408, x: 4711717.1985, y: 8684483.0018 },\n { id: 23508, x: 4688815.5424, y: 8604920.3124 },\n { id: 19409, x: 4710848.8761, y: 8676077.4084 },\n { id: 23509, x: 4688730.084, y: 8613963.2096 },\n { id: 35808, x: 4856748.4547, y: 8824716.7837 },\n { id: 23512, x: 4683894.9269, y: 8605720.8035 },\n { id: 7118, x: 4856450.6469, y: 8369116.9962 },\n { id: 23515, x: 4683492.1749, y: 8618643.8561 },\n { id: 35814, x: 4853595.5175, y: 8833546.128 },\n { id: 35815, x: 4853041.4617, y: 8827324.7212 },\n { id: 35816, x: 4852428.1918, y: 8837775.1246 },\n { id: 7123, x: 4849642.6315, y: 8377692.0447 },\n { id: 23520, x: 4679396.8559, y: 8622680.9151 },\n { id: 23522, x: 4677413.3464, y: 8613408.0154 },\n { id: 7126, x: 4843736.5447, y: 8371552.3041 },\n { id: 7127, x: 4843246.2565, y: 8376727.2153 },\n { id: 23524, x: 4675137.972, y: 8606051.7149 },\n { id: 60420, x: 4763833.936, y: 8492819.2274 },\n { id: 35826, x: 4846754.1962, y: 8826536.7963 },\n { id: 31743, x: 4596927.1834, y: 8633258.2923 },\n { id: 31744, x: 4597100.2843, y: 8645284.2803 },\n { id: 31745, x: 4595812.3449, y: 8639440.353 },\n { id: 31746, x: 4595294.8531, y: 8627891.2083 },\n { id: 60440, x: 4765694.366, y: 8466018.6087 },\n { id: 60441, x: 4765257.6061, y: 8476583.7424 },\n { id: 60442, x: 4764315.006, y: 8470944.7399 },\n { id: 31755, x: 4590602.4788, y: 8638367.103 },\n { id: 31756, x: 4588932.9547, y: 8633131.0268 },\n { id: 31759, x: 4587315.051, y: 8643933.7218 },\n { id: 31760, x: 4586612.6471, y: 8637140.5711 },\n { id: 31761, x: 4584221.96, y: 8629621.2427 },\n { id: 31763, x: 4582978.1498, y: 8626897.8609 },\n { id: 44061, x: 4780079.2968, y: 8666955.1583 },\n { id: 31764, x: 4583182.3512, y: 8633916.652 },\n { id: 31766, x: 4580809.5462, y: 8637785.6486 },\n { id: 31767, x: 4580607.1591, y: 8643595.4886 },\n { id: 44067, x: 4775290.8016, y: 8673313.6129 },\n { id: 44068, x: 4774097.2153, y: 8679796.5753 },\n { id: 60467, x: 4744625.9125, y: 8372783.5654 },\n { id: 44071, x: 4772301.7212, y: 8665078.1019 },\n { id: 44072, x: 4770191.1134, y: 8676990.2348 },\n { id: 60469, x: 4738122.9668, y: 8375406.6451 },\n { id: 35876, x: 4851169.1398, y: 8868381.0129 },\n { id: 60471, x: 4727947.5968, y: 8375198.8891 },\n { id: 44075, x: 4768376.5373, y: 8670934.9226 },\n { id: 72791, x: 4591925.1916, y: 8449605.7573 },\n { id: 72792, x: 4591793.1543, y: 8438140.4167 },\n { id: 72794, x: 4589025.1829, y: 8455434.7022 },\n { id: 72798, x: 4586037.5016, y: 8440874.8779 },\n { id: 48218, x: 4758414.2609, y: 8624023.5748 },\n { id: 48221, x: 4756360.7643, y: 8637284.5155 },\n { id: 48223, x: 4753919.8326, y: 8630222.0155 },\n { id: 52328, x: 4725882.023, y: 8595553.6236 },\n { id: 27736, x: 4676001.9097, y: 8811581.6751 },\n { id: 52331, x: 4722826.1911, y: 8583530.9955 },\n { id: 60530, x: 4750986.5686, y: 8397259.2529 },\n { id: 27739, x: 4673117.2356, y: 8812630.5239 },\n { id: 60532, x: 4750162.2444, y: 8389034.5346 },\n { id: 27741, x: 4671314.8466, y: 8818291.3551 },\n { id: 60534, x: 4748590.9949, y: 8383700.8132 },\n { id: 52336, x: 4719875.2208, y: 8591045.4587 },\n { id: 27742, x: 4670567.4956, y: 8826494.0412 },\n { id: 68733, x: 4705360.5856, y: 8461230.8615 },\n { id: 52337, x: 4719618.2802, y: 8595101.4092 },\n { id: 68735, x: 4702569.3706, y: 8471563.3328 },\n { id: 60539, x: 4746253.9861, y: 8394651.3917 },\n { id: 52341, x: 4715325.3592, y: 8592250.7333 },\n { id: 52342, x: 4714428.9466, y: 8584577.1198 },\n { id: 68739, x: 4697802.8899, y: 8475436.6682 },\n { id: 52343, x: 4713210.1265, y: 8598476.9862 },\n { id: 68741, x: 4695447.3779, y: 8466672.4476 },\n { id: 27752, x: 4664076.2759, y: 8830501.3366 },\n { id: 52347, x: 4709102.3921, y: 8587048.2455 },\n { id: 27753, x: 4663516.5567, y: 8817044.3187 },\n { id: 52348, x: 4708798.7722, y: 8594842.6087 },\n { id: 27754, x: 4662780.5586, y: 8823337.4465 },\n { id: 68747, x: 4690426.6179, y: 8461563.4656 },\n { id: 27758, x: 4659700.2201, y: 8811418.4152 },\n { id: 27759, x: 4658886.4446, y: 8818671.3326 },\n { id: 31887, x: 4614189.6969, y: 8673881.1995 },\n { id: 3194, x: 4796377.8389, y: 8507034.7352 },\n { id: 31888, x: 4611681.8273, y: 8666843.0356 },\n { id: 31889, x: 4611259.6497, y: 8671337.2656 },\n { id: 3197, x: 4795308.2329, y: 8517107.3102 },\n { id: 56485, x: 4666457.4214, y: 8587621.5212 },\n { id: 31891, x: 4610388.1676, y: 8679474.6713 },\n { id: 56486, x: 4665135.1186, y: 8599677.5428 },\n { id: 3199, x: 4792215.0375, y: 8502152.8846 },\n { id: 56487, x: 4663634.3371, y: 8593501.524 },\n { id: 3200, x: 4792253.5527, y: 8497106.506 },\n { id: 3201, x: 4789593.2991, y: 8505095.2996 },\n { id: 31895, x: 4604041.7899, y: 8671870.8398 },\n { id: 3202, x: 4789089.536, y: 8511638.638 },\n { id: 31896, x: 4603803.7559, y: 8677201.6758 },\n { id: 3203, x: 4789180.9244, y: 8519795.5757 },\n { id: 56491, x: 4659202.6072, y: 8599379.7088 },\n { id: 56492, x: 4657487.8943, y: 8593020.2995 },\n { id: 3205, x: 4787563.1309, y: 8506555.5119 },\n { id: 56493, x: 4656071.9213, y: 8585040.3136 },\n { id: 31899, x: 4600408.1047, y: 8681647.1122 },\n { id: 31900, x: 4598550.4189, y: 8672344.185 },\n { id: 3207, x: 4786008.1231, y: 8500307.1807 },\n { id: 68792, x: 4680504.3747, y: 8371305.0802 },\n { id: 56495, x: 4652574.2311, y: 8584474.8142 },\n { id: 31901, x: 4596677.8856, y: 8678413.9659 },\n { id: 56497, x: 4652885.673, y: 8599898.5541 },\n { id: 3211, x: 4782275.6341, y: 8508733.3417 },\n { id: 31905, x: 4592082.7002, y: 8681966.4712 },\n { id: 3212, x: 4782075.0425, y: 8520294.164 },\n { id: 31906, x: 4590536.1233, y: 8674077.6575 },\n { id: 31911, x: 4582902.6309, y: 8674031.6731 },\n { id: 15518, x: 4746190.5066, y: 8686690.3756 },\n { id: 15524, x: 4741600.9817, y: 8698643.4161 },\n { id: 7327, x: 4873123.0162, y: 8389885.6094 },\n { id: 15527, x: 4737367.3066, y: 8690208.3799 },\n { id: 48321, x: 4761588.5201, y: 8652039.7496 },\n { id: 7331, x: 4869455.8762, y: 8395269.8847 },\n { id: 36025, x: 4830611.1119, y: 8605790.2567 },\n { id: 48323, x: 4760901.9216, y: 8645149.2803 },\n { id: 36027, x: 4830099.2068, y: 8617334.3729 },\n { id: 15533, x: 4733460.7976, y: 8699916.7346 },\n { id: 7335, x: 4867043.2533, y: 8386394.3218 },\n { id: 48329, x: 4754563.8496, y: 8649394.6757 },\n { id: 15537, x: 4729877.9826, y: 8685939.0275 },\n { id: 36033, x: 4826829.2716, y: 8610275.1266 },\n { id: 36035, x: 4824186.5383, y: 8601651.2998 },\n { id: 7342, x: 4860205.6182, y: 8395111.5186 },\n { id: 7343, x: 4859548.459, y: 8383959.9344 },\n { id: 36040, x: 4821386.381, y: 8611210.526 },\n { id: 11452, x: 4817244.0232, y: 8483175.3476 },\n { id: 11453, x: 4816123.836, y: 8496535.8263 },\n { id: 11458, x: 4811968.3832, y: 8486156.7447 },\n { id: 11466, x: 4805975.9145, y: 8495739.3638 },\n { id: 11472, x: 4801483.916, y: 8487135.1927 },\n { id: 31968, x: 4575546.118, y: 8619869.4438 },\n { id: 31969, x: 4573847.5049, y: 8604854.7815 },\n { id: 31970, x: 4574136.2295, y: 8615799.4428 },\n { id: 31971, x: 4573697.7461, y: 8623482.7465 },\n { id: 31978, x: 4567637.6508, y: 8608101.4653 },\n { id: 23792, x: 4670913.2338, y: 8610923.3377 },\n { id: 23794, x: 4671011.5666, y: 8620370.6256 },\n { id: 23796, x: 4668255.2145, y: 8607629.661 },\n { id: 23798, x: 4666622.7972, y: 8616809.0364 },\n { id: 23800, x: 4664738.7201, y: 8621713.8846 },\n { id: 31999, x: 4577426.7503, y: 8630741.615 },\n { id: 32000, x: 4577403.0152, y: 8646065.2668 },\n { id: 23803, x: 4662144.0923, y: 8605856.9841 },\n { id: 23805, x: 4661113.3981, y: 8616409.2534 },\n { id: 32006, x: 4578053.7313, y: 8663224.2653 },\n { id: 23809, x: 4659139.0486, y: 8622235.6372 },\n { id: 32009, x: 4837940.0445, y: 8600323.9616 },\n { id: 48406, x: 4762991.7962, y: 8664680.4528 },\n { id: 23812, x: 4656831.016, y: 8605713.7999 },\n { id: 48409, x: 4760585.1907, y: 8679912.6452 },\n { id: 48412, x: 4757617.7666, y: 8670279.402 },\n { id: 56611, x: 4648154.5328, y: 8504774.1446 },\n { id: 56613, x: 4647217.7871, y: 8518490.6375 },\n { id: 40220, x: 4843364.1868, y: 8817706.5045 },\n { id: 56618, x: 4640174.6149, y: 8501891.1134 },\n { id: 27925, x: 4676729.5736, y: 8803872.1792 },\n { id: 56619, x: 4640213.2543, y: 8512064.7463 },\n { id: 40224, x: 4840859.4693, y: 8805733.1725 },\n { id: 73019, x: 4594701.2556, y: 8421914.138 },\n { id: 27931, x: 4671625.176, y: 8798794.2099 },\n { id: 27934, x: 4668853.0473, y: 8804952.9833 },\n { id: 27936, x: 4667805.6151, y: 8794824.3031 },\n { id: 40234, x: 4836328.4724, y: 8816980.7769 },\n { id: 27937, x: 4666808.1934, y: 8809325.7745 },\n { id: 27938, x: 4666453.565, y: 8801235.1198 },\n { id: 73027, x: 4585847.2851, y: 8421326.9022 },\n { id: 40237, x: 4833130.0678, y: 8811569.2169 },\n { id: 73029, x: 4585160.2204, y: 8429895.7366 },\n { id: 40239, x: 4832441.1462, y: 8805004.3998 },\n { id: 40241, x: 4829910.0666, y: 8819341.5242 },\n { id: 27944, x: 4663202.2178, y: 8807955.2018 },\n { id: 27946, x: 4661657.6902, y: 8795577.6605 },\n { id: 73036, x: 4579754.3815, y: 8423667.7304 },\n { id: 40247, x: 4826012.8819, y: 8804194.5579 },\n { id: 27952, x: 4658515.3525, y: 8793126.7642 },\n { id: 64851, x: 4741716.6096, y: 8461902.7123 },\n { id: 64853, x: 4740127.3156, y: 8466288.1405 },\n { id: 64857, x: 4737235.5465, y: 8478860.184 },\n { id: 64858, x: 4735924.9475, y: 8469035.082 },\n { id: 64860, x: 4734286.8368, y: 8460009.608 },\n { id: 3375, x: 4795444.5359, y: 8536419.9356 },\n { id: 3376, x: 4794714.7384, y: 8521728.6605 },\n { id: 3377, x: 4794180.2614, y: 8529790.5032 },\n { id: 36171, x: 4818331.874, y: 8605689.7089 },\n { id: 64865, x: 4731072.1921, y: 8463740.0196 },\n { id: 3386, x: 4786554.0049, y: 8528314.3789 },\n { id: 64872, x: 4727826.1914, y: 8469969.9573 },\n { id: 52575, x: 4703652.8696, y: 8595037.5817 },\n { id: 48476, x: 4765604.5018, y: 8698859.6765 },\n { id: 36179, x: 4813969.7314, y: 8618226.0384 },\n { id: 52576, x: 4701945.3746, y: 8586606.0965 },\n { id: 3388, x: 4785777.9134, y: 8538481.3497 },\n { id: 64874, x: 4726014.6408, y: 8461351.0108 },\n { id: 52577, x: 4701522.6886, y: 8600274.8689 },\n { id: 52578, x: 4701102.2585, y: 8592147.1851 },\n { id: 36183, x: 4810562.0363, y: 8613714.7113 },\n { id: 3391, x: 4782442.9439, y: 8528448.9891 },\n { id: 48481, x: 4760422.094, y: 8684536.0725 },\n { id: 48482, x: 4759315.429, y: 8694760.1308 },\n { id: 52582, x: 4697019.3516, y: 8596997.3808 },\n { id: 52583, x: 4696676.7185, y: 8590982.4972 },\n { id: 48484, x: 4757801.0651, y: 8701155.3325 },\n { id: 52586, x: 4692720.077, y: 8586548.3271 },\n { id: 36190, x: 4806981.3301, y: 8603457.3927 },\n { id: 60785, x: 4761067.0281, y: 8410670.9625 },\n { id: 52587, x: 4692253.8793, y: 8597031.6144 },\n { id: 48488, x: 4753477.0263, y: 8688466.8415 },\n { id: 36191, x: 4805342.3825, y: 8613177.836 },\n { id: 60786, x: 4761109.7437, y: 8403677.2475 },\n { id: 52589, x: 4690669.3258, y: 8592568.1231 },\n { id: 64887, x: 4715720.0197, y: 8371962.6068 },\n { id: 60789, x: 4757523.2575, y: 8415241.0775 },\n { id: 60792, x: 4755389.1364, y: 8409111.6643 },\n { id: 60794, x: 4754402.1323, y: 8403993.0382 },\n { id: 64894, x: 4693749.7214, y: 8373677.1458 },\n { id: 60796, x: 4752980.8739, y: 8418226.8654 },\n { id: 60802, x: 4750482.9355, y: 8407290.783 },\n { id: 60803, x: 4749798.7104, y: 8412863.2964 },\n { id: 19814, x: 4727558.6558, y: 8689285.3555 },\n { id: 19817, x: 4727309.1134, y: 8697859.8887 },\n { id: 60809, x: 4746134.7139, y: 8404222.1864 },\n { id: 60810, x: 4745422.7565, y: 8412750.9143 },\n { id: 19822, x: 4722893.3752, y: 8696528.6861 },\n { id: 19823, x: 4722325.1005, y: 8688459.1518 },\n { id: 19824, x: 4722441.3829, y: 8704020.7356 },\n { id: 19826, x: 4719918.8513, y: 8694576.3525 },\n { id: 19830, x: 4718093.3452, y: 8690455.5176 },\n { id: 19831, x: 4715895.4889, y: 8697141.5507 },\n { id: 19832, x: 4715578.5783, y: 8703451.63 },\n { id: 19834, x: 4713430.881, y: 8690986.0307 },\n { id: 7575, x: 4873679.0009, y: 8410503.5609 },\n { id: 7576, x: 4872942.1601, y: 8399910.658 },\n { id: 7577, x: 4872137.7396, y: 8403890.1801 },\n { id: 56770, x: 4649888.398, y: 8527898.8645 },\n { id: 7583, x: 4865210.1547, y: 8399669.1141 },\n { id: 56772, x: 4647334.3463, y: 8531325.305 },\n { id: 56773, x: 4646507.4002, y: 8523241.7574 },\n { id: 15783, x: 4745320.1421, y: 8680854.1997 },\n { id: 56775, x: 4643101.7436, y: 8540950.2451 },\n { id: 15785, x: 4744072.2123, y: 8673447.1206 },\n { id: 7588, x: 4858284.6377, y: 8402214.1992 },\n { id: 48579, x: 4760299.9148, y: 8709847.45 },\n { id: 15787, x: 4739646.2859, y: 8669602.0901 },\n { id: 7589, x: 4856256.0735, y: 8407306.3423 },\n { id: 56778, x: 4641500.5531, y: 8527502.3165 },\n { id: 48580, x: 4759122.1844, y: 8721796.0294 },\n { id: 11689, x: 4817226.6415, y: 8475990.5123 },\n { id: 56779, x: 4639034.6923, y: 8520904.9731 },\n { id: 44482, x: 4801811.3283, y: 8708254.6294 },\n { id: 15789, x: 4739505.0165, y: 8679465.5806 },\n { id: 56782, x: 4638548.5154, y: 8532764.605 },\n { id: 56783, x: 4636684.1039, y: 8525742.2908 },\n { id: 48585, x: 4754824.7209, y: 8719146.5161 },\n { id: 56784, x: 4635848.5912, y: 8529258.649 },\n { id: 44488, x: 4796929.1039, y: 8714796.6656 },\n { id: 11696, x: 4812387.5717, y: 8463886.4578 },\n { id: 56786, x: 4633454.6353, y: 8531828.4351 },\n { id: 15796, x: 4733901.7586, y: 8683774.1118 },\n { id: 44490, x: 4795694.5361, y: 8706960.9931 },\n { id: 11698, x: 4811082.4076, y: 8476158.0403 },\n { id: 73184, x: 4614514.6816, y: 8476732.378 },\n { id: 15800, x: 4731153.6405, y: 8675491.2872 },\n { id: 11703, x: 4807457.7826, y: 8469370.8531 },\n { id: 44496, x: 4791136.9196, y: 8718866.7709 },\n { id: 73189, x: 4605376.4159, y: 8478083.487 },\n { id: 44497, x: 4790544.8026, y: 8711893.2078 },\n { id: 73191, x: 4605082.6871, y: 8469415.8977 },\n { id: 44500, x: 4787199.3746, y: 8704804.0407 },\n { id: 40401, x: 4823345.3291, y: 8812346.528 },\n { id: 11708, x: 4803451.3988, y: 8479204.0031 },\n { id: 73193, x: 4604113.4972, y: 8467805.4635 },\n { id: 11712, x: 4801082.6176, y: 8460707.3917 },\n { id: 40406, x: 4819688.5988, y: 8822422.4246 },\n { id: 11714, x: 4800085.4634, y: 8467528.1728 },\n { id: 40408, x: 4818321.324, y: 8816048.6315 },\n { id: 73200, x: 4598402.8008, y: 8461398.2417 },\n { id: 73201, x: 4597482.1084, y: 8470944.6292 },\n { id: 40411, x: 4816565.3904, y: 8808219.1682 },\n { id: 40416, x: 4813551.7908, y: 8822023.0257 },\n { id: 69112, x: 4688857.544, y: 8395070.7402 },\n { id: 40419, x: 4810892.9995, y: 8817631.5099 },\n { id: 40421, x: 4810046.9979, y: 8805052.4951 },\n { id: 69115, x: 4688408.9935, y: 8379522.9991 },\n { id: 40425, x: 4808148.0858, y: 8808611.849 },\n { id: 69119, x: 4684986.5962, y: 8382208.5119 },\n { id: 69122, x: 4679410.9219, y: 8389284.1266 },\n { id: 15839, x: 4750943.417, y: 8704978.6468 },\n { id: 69127, x: 4675163.8289, y: 8383339.2259 },\n { id: 15844, x: 4747965.4799, y: 8722958.2503 },\n { id: 65047, x: 4726479.4883, y: 8381375.1622 },\n { id: 65048, x: 4724994.3561, y: 8393417.477 },\n { id: 11766, x: 4797665.9077, y: 8411855.2864 },\n { id: 65054, x: 4720086.3147, y: 8396658.8012 },\n { id: 11767, x: 4797304.644, y: 8405856.3708 },\n { id: 65055, x: 4719794.4661, y: 8379165.2324 },\n { id: 48659, x: 4764851.0833, y: 8736077.4997 },\n { id: 11769, x: 4795247.9026, y: 8417563.3143 },\n { id: 65059, x: 4717280.6231, y: 8386025.9653 },\n { id: 11772, x: 4793170.491, y: 8408295.3964 },\n { id: 48665, x: 4760195.7336, y: 8732492.1648 },\n { id: 48666, x: 4758677.1325, y: 8742862.0765 },\n { id: 48667, x: 4757558.1204, y: 8727563.7814 },\n { id: 3578, x: 4779644.7958, y: 8538615.4491 },\n { id: 11777, x: 4787037.8176, y: 8413001.9877 },\n { id: 32273, x: 4855815.966, y: 8658596.6429 },\n { id: 3580, x: 4777051.3084, y: 8529738.5698 },\n { id: 36373, x: 4833672.8007, y: 8632819.1804 },\n { id: 65069, x: 4709515.5408, y: 8392417.1822 },\n { id: 36376, x: 4830800.8744, y: 8622629.4921 },\n { id: 32277, x: 4851218.0433, y: 8653216.1062 },\n { id: 36377, x: 4831227.987, y: 8641194.1372 },\n { id: 36380, x: 4828538.0414, y: 8635144.4819 },\n { id: 32281, x: 4846861.3427, y: 8656073.6781 },\n { id: 36381, x: 4826457.1676, y: 8639968.6277 },\n { id: 32282, x: 4845377.9777, y: 8647918.2833 },\n { id: 3589, x: 4770765.2349, y: 8527912.735 },\n { id: 3592, x: 4768003.286, y: 8535328.4588 },\n { id: 32286, x: 4841953.1098, y: 8651677.878 },\n { id: 36386, x: 4823431.7537, y: 8621571.2233 },\n { id: 32287, x: 4840013.4709, y: 8642784.9053 },\n { id: 28188, x: 4652374.3512, y: 8617567.9364 },\n { id: 32288, x: 4840472.2043, y: 8657956.128 },\n { id: 36388, x: 4821883.1275, y: 8631801.3718 },\n { id: 28190, x: 4650541.8493, y: 8607579.7826 },\n { id: 28191, x: 4649882.1636, y: 8612863.8448 },\n { id: 28196, x: 4647334.6459, y: 8617706.9886 },\n { id: 24098, x: 4688375.6733, y: 8633881.8356 },\n { id: 28199, x: 4645330.7488, y: 8614557.6896 },\n { id: 24100, x: 4686038.6676, y: 8626964.7695 },\n { id: 15903, x: 4751384.6578, y: 8739559.6554 },\n { id: 28201, x: 4641983.4834, y: 8621393.9442 },\n { id: 24102, x: 4684470.4205, y: 8635560.9742 },\n { id: 28202, x: 4641440.4064, y: 8607654.3039 },\n { id: 24103, x: 4684279.2591, y: 8640191.1454 },\n { id: 15905, x: 4750048.6664, y: 8732424.4404 },\n { id: 28203, x: 4641600.263, y: 8616857.8736 },\n { id: 28204, x: 4639340.388, y: 8604087.2429 },\n { id: 24107, x: 4679539.132, y: 8638635.9038 },\n { id: 24108, x: 4678923.9083, y: 8627528.9842 },\n { id: 28208, x: 4637725.1185, y: 8615362.4905 },\n { id: 24110, x: 4678130.8914, y: 8642678.4939 },\n { id: 24111, x: 4676446.8491, y: 8634675.4011 },\n { id: 28211, x: 4634722.1043, y: 8620832.2276 },\n { id: 24112, x: 4675754.5803, y: 8624281.1349 },\n { id: 24113, x: 4674590.6535, y: 8629758.8845 },\n { id: 24115, x: 4674058.9706, y: 8639074.3663 },\n { id: 20024, x: 4709817.4875, y: 8700219.0444 },\n { id: 20027, x: 4708999.3584, y: 8696446.566 },\n { id: 20028, x: 4708459.3053, y: 8692144.1604 },\n { id: 20031, x: 4705375.3363, y: 8698905.5114 },\n { id: 11835, x: 4776797.0661, y: 8417546.5941 },\n { id: 20034, x: 4702888.741, y: 8694218.6216 },\n { id: 20035, x: 4702145.7856, y: 8702318.8999 },\n { id: 11837, x: 4772300.932, y: 8412046.8814 },\n { id: 20040, x: 4699500.4651, y: 8704709.1791 },\n { id: 20043, x: 4697129.7209, y: 8697221.3377 },\n { id: 20045, x: 4695204.7134, y: 8704658.9607 },\n { id: 20046, x: 4694190.0859, y: 8687998.3067 },\n { id: 61038, x: 4744692.5426, y: 8400584.0834 },\n { id: 56939, x: 4631016.4416, y: 8526581.9605 },\n { id: 48742, x: 4766594.3896, y: 8762002.9658 },\n { id: 61040, x: 4742234.6365, y: 8415580.1598 },\n { id: 56942, x: 4629575.5362, y: 8532297.4258 },\n { id: 7754, x: 4851591.6759, y: 8413937.9882 },\n { id: 56943, x: 4626659.5948, y: 8529306.7815 },\n { id: 61043, x: 4741092.3701, y: 8404425.871 },\n { id: 56944, x: 4626347.4859, y: 8524487.5422 },\n { id: 61044, x: 4739877.2313, y: 8411243.5004 },\n { id: 56945, x: 4626557.3829, y: 8539427.7593 },\n { id: 48748, x: 4761253.7175, y: 8756527.5071 },\n { id: 7758, x: 4849397.7824, y: 8407452.5303 },\n { id: 48749, x: 4760530.2861, y: 8750571.8561 },\n { id: 61047, x: 4738528.8542, y: 8407620.5995 },\n { id: 48750, x: 4758967.9752, y: 8765059.1254 },\n { id: 56951, x: 4620127.8425, y: 8529396.1408 },\n { id: 56952, x: 4619223.9818, y: 8521221.0225 },\n { id: 48754, x: 4756378.6979, y: 8758563.7683 },\n { id: 61052, x: 4735697.3858, y: 8416480.1533 },\n { id: 48755, x: 4755339.0319, y: 8747792.3823 },\n { id: 7765, x: 4845763.9891, y: 8400317.8373 },\n { id: 61054, x: 4735185.9469, y: 8402846.4295 },\n { id: 56956, x: 4615903.7988, y: 8536896.3124 },\n { id: 7768, x: 4843754.8318, y: 8411610.5902 },\n { id: 61056, x: 4733331.0783, y: 8411148.8857 },\n { id: 61059, x: 4731631.9085, y: 8417070.5093 },\n { id: 7773, x: 4842144.9598, y: 8405602.4094 },\n { id: 61063, x: 4730064.6012, y: 8403332.8132 },\n { id: 61065, x: 4728057.4316, y: 8412051.2204 },\n { id: 7778, x: 4838417.1561, y: 8418849.4809 },\n { id: 7779, x: 4837971.2232, y: 8401302.3061 },\n { id: 61067, x: 4726926.7445, y: 8417716.5214 },\n { id: 61069, x: 4726462.4432, y: 8407951.2445 },\n { id: 40611, x: 4819650.2324, y: 8795447.2662 },\n { id: 40616, x: 4816842.3702, y: 8787989.1194 },\n { id: 73409, x: 4611941.6837, y: 8488185.2985 },\n { id: 40618, x: 4815881.1276, y: 8803525.9224 },\n { id: 73411, x: 4609333.744, y: 8482022.2154 },\n { id: 73414, x: 4607048.2673, y: 8495334.1419 },\n { id: 40623, x: 4813487.7818, y: 8797380.6557 },\n { id: 40625, x: 4812366.2281, y: 8791347.2225 },\n { id: 73417, x: 4605415.3968, y: 8486248.5397 },\n { id: 48825, x: 4768687.2213, y: 8785313.0322 },\n { id: 48827, x: 4766753.4304, y: 8780491.2801 },\n { id: 73421, x: 4598950.4208, y: 8484415.3296 },\n { id: 48828, x: 4765881.9084, y: 8766372.0631 },\n { id: 48830, x: 4763935.3729, y: 8772318.5351 },\n { id: 48834, x: 4758378.9263, y: 8774668.728 },\n { id: 48835, x: 4758218.2367, y: 8781340.0742 },\n { id: 52952, x: 4687934.8698, y: 8505243.2136 },\n { id: 16061, x: 4744464.3082, y: 8742737.655 },\n { id: 16062, x: 4743851.2824, y: 8728916.782 },\n { id: 16067, x: 4738126.9217, y: 8736476.5622 },\n { id: 52959, x: 4680055.2476, y: 8516865.0495 },\n { id: 52960, x: 4676795.6567, y: 8502551.9369 },\n { id: 16069, x: 4735966.8843, y: 8725591.4597 },\n { id: 52961, x: 4676642.7036, y: 8508435.164 },\n { id: 52963, x: 4672959.5529, y: 8516238.836 },\n { id: 16072, x: 4734160.4339, y: 8743305.8727 },\n { id: 16075, x: 4731275.964, y: 8733950.8897 },\n { id: 73469, x: 4593892.9466, y: 8493243.2005 },\n { id: 73473, x: 4589632.2516, y: 8486590.2048 },\n { id: 73474, x: 4586119.4848, y: 8479740.6432 },\n { id: 57081, x: 4631768.6434, y: 8509755.6718 },\n { id: 36586, x: 4836850.7498, y: 8654055.5618 },\n { id: 57082, x: 4631730.736, y: 8518376.6075 },\n { id: 57083, x: 4628244.289, y: 8501288.8801 },\n { id: 57084, x: 4627610.9814, y: 8512203.9834 },\n { id: 36593, x: 4831555.0436, y: 8651759.0198 },\n { id: 57089, x: 4622745.5648, y: 8506434.5748 },\n { id: 3807, x: 4780271.7826, y: 8504116.545 },\n { id: 36603, x: 4823739.9596, y: 8648744.9395 },\n { id: 3811, x: 4776340.6605, y: 8514126.7332 },\n { id: 12010, x: 4798178.032, y: 8435466.9505 },\n { id: 3812, x: 4774889.6233, y: 8504880.1424 },\n { id: 36606, x: 4821104.8488, y: 8653776.0957 },\n { id: 12012, x: 4795943.7322, y: 8430176.3145 },\n { id: 48905, x: 4767893.7948, y: 8797850.8649 },\n { id: 3817, x: 4771425.3087, y: 8510950.4135 },\n { id: 3818, x: 4770364.04, y: 8520302.2214 },\n { id: 12017, x: 4794434.0745, y: 8421317.6404 },\n { id: 69404, x: 4683204.6471, y: 8413744.4506 },\n { id: 3820, x: 4767908.8434, y: 8514359.7271 },\n { id: 32514, x: 4873581.6616, y: 8675787.6963 },\n { id: 12020, x: 4790819.8395, y: 8426925.8203 },\n { id: 3822, x: 4766646.0161, y: 8504686.9341 },\n { id: 48912, x: 4761529.0322, y: 8791688.0696 },\n { id: 69408, x: 4679733.936, y: 8400326.4786 },\n { id: 48913, x: 4759980.0572, y: 8787525.517 },\n { id: 12022, x: 4789114.0146, y: 8435802.0319 },\n { id: 69409, x: 4677723.3118, y: 8407315.1456 },\n { id: 32518, x: 4869337.9685, y: 8668537.8925 },\n { id: 48915, x: 4759681.928, y: 8798249.4322 },\n { id: 48916, x: 4758002.4808, y: 8804844.2531 },\n { id: 12025, x: 4787925.0054, y: 8421003.1085 },\n { id: 32522, x: 4866111.6155, y: 8678170.1375 },\n { id: 12029, x: 4784644.4021, y: 8432422.7886 },\n { id: 69416, x: 4672111.6919, y: 8402627.6773 },\n { id: 32526, x: 4861691.3909, y: 8672835.2063 },\n { id: 12031, x: 4783697.4605, y: 8426483.5668 },\n { id: 12032, x: 4782595.5698, y: 8423047.1225 },\n { id: 32529, x: 4859692.0574, y: 8665802.5103 },\n { id: 32530, x: 4859912.753, y: 8680228.79 },\n { id: 7955, x: 4854844.7231, y: 8391189.9261 },\n { id: 28453, x: 4632866.4372, y: 8612295.8359 },\n { id: 7958, x: 4851558.3282, y: 8398510.2158 },\n { id: 7959, x: 4851591.5654, y: 8385579.7948 },\n { id: 28455, x: 4630291.4997, y: 8605434.2776 },\n { id: 28458, x: 4628538.6665, y: 8616515.2768 },\n { id: 28459, x: 4628659.8954, y: 8620157.0074 },\n { id: 7964, x: 4847482.4049, y: 8391951.7319 },\n { id: 28460, x: 4626400.7589, y: 8613510.1318 },\n { id: 28462, x: 4625809.8208, y: 8605686.629 },\n { id: 28465, x: 4624098.7795, y: 8621834.1691 },\n { id: 7971, x: 4844905.2441, y: 8385791.4833 },\n { id: 28468, x: 4621284.4642, y: 8610006.2064 },\n { id: 28469, x: 4621097.5313, y: 8619101.9488 },\n { id: 28470, x: 4619041.794, y: 8615773.9868 },\n { id: 7975, x: 4841598.5488, y: 8394020.6203 },\n { id: 28472, x: 4617691.8865, y: 8605961.024 },\n { id: 73561, x: 4595333.8034, y: 8478660.2839 },\n { id: 28473, x: 4617590.2486, y: 8611421.4636 },\n { id: 28474, x: 4617586.6691, y: 8621740.2826 },\n { id: 24379, x: 4690121.7344, y: 8663105.2455 },\n { id: 73567, x: 4589485.6745, y: 8462474.2818 },\n { id: 24382, x: 4686209.0235, y: 8651560.9395 },\n { id: 73570, x: 4585120.5496, y: 8470052.4293 },\n { id: 24384, x: 4685301.6976, y: 8657340.7817 },\n { id: 24386, x: 4684444.5114, y: 8663310.3066 },\n { id: 73574, x: 4577911.6447, y: 8416665.8356 },\n { id: 24388, x: 4681896.714, y: 8644994.3606 },\n { id: 7992, x: 4856169.6788, y: 8451969.1808 },\n { id: 73576, x: 4576698.1607, y: 8431036.0443 },\n { id: 24389, x: 4681743.7239, y: 8653972.2333 },\n { id: 73577, x: 4576675.8992, y: 8426499.2564 },\n { id: 24390, x: 4681247.5662, y: 8660652.9042 },\n { id: 73578, x: 4576669.0287, y: 8426495.7681 },\n { id: 24392, x: 4679932.3355, y: 8664347.6138 },\n { id: 24394, x: 4676145.3063, y: 8659885.0588 },\n { id: 24397, x: 4674241.6145, y: 8652893.7227 },\n { id: 40797, x: 4844370.3246, y: 8833950.9217 },\n { id: 40798, x: 4844345.1848, y: 8841141.972 },\n { id: 40806, x: 4839237.8892, y: 8835591.8745 },\n { id: 40809, x: 4836908.4723, y: 8823844.0015 },\n { id: 44910, x: 4802508.5515, y: 8724277.7698 },\n { id: 40811, x: 4835539.146, y: 8828930.8879 },\n { id: 44913, x: 4799511.8306, y: 8743467.7328 },\n { id: 40814, x: 4834309.6705, y: 8836208.7818 },\n { id: 44915, x: 4798303.7117, y: 8734815.9464 },\n { id: 61313, x: 4744288.073, y: 8379376.2054 },\n { id: 61314, x: 4743804.5792, y: 8389790.2952 },\n { id: 40819, x: 4830128.1592, y: 8829970.9375 },\n { id: 40820, x: 4829714.7902, y: 8823810.0905 },\n { id: 44920, x: 4793909.4736, y: 8736774.8363 },\n { id: 44922, x: 4792742.5621, y: 8729621.7335 },\n { id: 40823, x: 4828476.8563, y: 8837142.3806 },\n { id: 16231, x: 4746537.1515, y: 8714918.3587 },\n { id: 61321, x: 4739825.959, y: 8383454.3996 },\n { id: 69520, x: 4670660.1361, y: 8413299.9922 },\n { id: 61322, x: 4738886.3014, y: 8396033.7215 },\n { id: 57224, x: 4648961.9443, y: 8545724.9439 },\n { id: 44928, x: 4788017.9428, y: 8743188.9633 },\n { id: 20334, x: 4706938.0929, y: 8664800.4155 },\n { id: 57226, x: 4647987.4923, y: 8552979.2721 },\n { id: 16236, x: 4741538.6949, y: 8720072.0112 },\n { id: 57227, x: 4647418.8178, y: 8561217.1055 },\n { id: 20336, x: 4705836.9661, y: 8683854.6125 },\n { id: 20337, x: 4704711.4125, y: 8678112.482 },\n { id: 69526, x: 4665278.2108, y: 8401671.8275 },\n { id: 61328, x: 4735426.1301, y: 8390228.3868 },\n { id: 57229, x: 4645044.821, y: 8553780.7723 },\n { id: 20338, x: 4703745.3787, y: 8671417.0436 },\n { id: 16239, x: 4738760.1121, y: 8707547.8763 },\n { id: 61330, x: 4734845.1945, y: 8377519.3754 },\n { id: 57231, x: 4644415.7423, y: 8547741.4886 },\n { id: 20340, x: 4702043.4885, y: 8684587.3915 },\n { id: 57232, x: 4643920.2906, y: 8560319.5575 },\n { id: 57233, x: 4640848.5619, y: 8553888.1878 },\n { id: 20342, x: 4700274.4251, y: 8674430.1766 },\n { id: 16244, x: 4734976.7525, y: 8715521.8727 },\n { id: 69532, x: 4660725.5468, y: 8398992.3317 },\n { id: 57235, x: 4639360.1549, y: 8544831.085 },\n { id: 49037, x: 4767825.5634, y: 8813784.064 },\n { id: 69533, x: 4656801.4558, y: 8407049.3787 },\n { id: 16246, x: 4731570.1936, y: 8707347.3069 },\n { id: 69534, x: 4655685.4588, y: 8401934.8994 },\n { id: 61336, x: 4731567.0872, y: 8382291.1822 },\n { id: 57237, x: 4639259.2462, y: 8561123.5609 },\n { id: 49039, x: 4765682.6747, y: 8806963.2101 },\n { id: 20346, x: 4696895.7608, y: 8683923.7449 },\n { id: 61337, x: 4730317.2456, y: 8390078.6654 },\n { id: 20347, x: 4695681.556, y: 8678395.7966 },\n { id: 16248, x: 4730836.6815, y: 8724583.8452 },\n { id: 61338, x: 4730133.8238, y: 8395091.8834 },\n { id: 57239, x: 4636613.079, y: 8551811.582 },\n { id: 20349, x: 4693999.6652, y: 8669271.8627 },\n { id: 49045, x: 4760393.8476, y: 8812720.5768 },\n { id: 61343, x: 4726814.1517, y: 8386342.7524 },\n { id: 49047, x: 4881209.044, y: 8699772.2396 },\n { id: 49049, x: 4879537.1009, y: 8689735.9906 },\n { id: 36759, x: 4818491.3767, y: 8644307.9927 },\n { id: 36766, x: 4813894.055, y: 8658617.5844 },\n { id: 36767, x: 4813185.396, y: 8650286.0365 },\n { id: 69567, x: 4670377.5363, y: 8377494.7954 },\n { id: 69568, x: 4669710.9872, y: 8393032.9287 },\n { id: 36776, x: 4808179.0765, y: 8644801.1242 },\n { id: 69569, x: 4667647.2641, y: 8386348.5685 },\n { id: 36782, x: 4804054.7417, y: 8653336.2456 },\n { id: 65481, x: 4724789.8, y: 8413550.5338 },\n { id: 65487, x: 4721829.9985, y: 8406034.0266 },\n { id: 65492, x: 4715132.4831, y: 8398725.5141 },\n { id: 65494, x: 4714187.4131, y: 8410049.3331 },\n { id: 16311, x: 4751680.5311, y: 8759309.9288 },\n { id: 16312, x: 4751260.0612, y: 8751278.642 },\n { id: 32733, x: 4873302.4236, y: 8689775.479 },\n { id: 4040, x: 4799311.724, y: 8557396.3074 },\n { id: 32734, x: 4870722.4828, y: 8682866.2925 },\n { id: 32735, x: 4871245.2292, y: 8698655.7383 },\n { id: 4045, x: 4796390.6093, y: 8542914.9838 },\n { id: 32742, x: 4866568.2567, y: 8689682.9625 },\n { id: 12247, x: 4798524.579, y: 8454743.4924 },\n { id: 32743, x: 4865448.8209, y: 8685260.3801 },\n { id: 32745, x: 4864809.1363, y: 8696739.5802 },\n { id: 12250, x: 4797041.9895, y: 8446932.9247 },\n { id: 12251, x: 4796871.8571, y: 8442366.0056 },\n { id: 4053, x: 4789607.46, y: 8554344.8872 },\n { id: 32751, x: 4859453.547, y: 8687213.0774 },\n { id: 12256, x: 4792315.1585, y: 8439527.0058 },\n { id: 4058, x: 4785500.7597, y: 8546415.7885 },\n { id: 12257, x: 4791508.3658, y: 8448738.4409 },\n { id: 12258, x: 4790795.3518, y: 8454082.5426 },\n { id: 16359, x: 4754780.4343, y: 8769273.0841 },\n { id: 12262, x: 4787624.7294, y: 8441596.8395 },\n { id: 16362, x: 4752640.8129, y: 8776370.9604 },\n { id: 16364, x: 4751510.0999, y: 8782936.9655 },\n { id: 16365, x: 4749820.4489, y: 8767463.1311 },\n { id: 12266, x: 4784114.9053, y: 8449638.3353 },\n { id: 12267, x: 4783152.4975, y: 8439503.7021 },\n { id: 12270, x: 4782318.3458, y: 8445322.7555 },\n { id: 40973, x: 4845354.9492, y: 8859900.9979 },\n { id: 40977, x: 4842332.3119, y: 8850468.2208 },\n { id: 40978, x: 4842285.4768, y: 8856269.411 },\n { id: 40984, x: 4838372.9868, y: 8852145.4612 },\n { id: 40985, x: 4837773.5254, y: 8843467.5493 },\n { id: 40989, x: 4835920.4719, y: 8860652.712 },\n { id: 49188, x: 4887331.0593, y: 8728475.6178 }\n ];\n }", "set point(value) {}", "function displayPoint( latLng ) {\n var marker = new google.maps.Marker( {\n \tposition: latLng,\n \tmap: map,\n \ttitle: \"point you made\"\n } );\n markersArray.push( marker );\n}", "validatePoints() {}", "addPoints(points) {\n this.setState(state => ({\n points: this.state.points + points\n }));\n }", "function getPoints() {\n return [\n new google.maps.LatLng(-9.271064, -75.98777),\n ];\n}", "function ajoutPDuck(){ //fonction pour ajouter les points au canard\n scoreCanard++; \n CanardPoint.innerText = scoreCanard;//inserer les points a leurs place\n \n}", "startData() { return {\r\n //part1\r\n unlocked: true,\r\n\t\tpoints: new ExpantaNum(0),\r\n total: new ExpantaNum(0)\r\n }}", "primo(){\n localStorage.setItem('points_' + this.props.type + '_3', localStorage.getItem('points_' + this.props.type + '_2'));\n localStorage.setItem('time_' + this.props.type + '_3', localStorage.getItem('time_' + this.props.type + '_2'));\n localStorage.setItem('points_' + this.props.type + '_2', localStorage.getItem('points_' + this.props.type + '_1'));\n localStorage.setItem('time_' + this.props.type + '_2', localStorage.getItem('time_' + this.props.type + '_1'));\n localStorage.setItem('points_' + this.props.type + '_1', this.props.points);\n localStorage.setItem('time_' + this.props.type + '_1', this.props.time);\n }", "function getNewPoints() {\n\t$.ajax(queryNew + updated).done(function(newPoints){\n\t\tvar length = newPoints.length || 0;\n\t\tvar max = $('#slider-range').slider('option').max;\n\t\tvar min = $('#slider-range').slider('option').min;\n\t\tvar valid= 0;\n\t\tlost.debug.log('getNewPoints(): Received ' + length + ' new points');\n\t\t\n\t\tif(length > 0) {\n\t\t\tfor(var i = 0; i < length; i++) {\n\t\t\t\t//oms.addMarker(newPoints[i]);\n\t\t\t\t//clusterer.addMarker(newPoints[i]);\n\t\t\t\tnewPoints[i] = createNewMarker(newPoints[i]);\n\t\t\t\t\n\t\t\t\tvar ll = newPoints[i].getPosition();\n\t\t\t\tif( ll.lat() == 0 && ll.lng() == 0 )\n\t\t\t\t\tcontinue;\n\t\t\t\t\t\n\t\t\t\taddNewPoint(newPoints[i]);\n\t\t\t\tbounds.extend(ll);\n\t\t\t\tvalid++;\n\t\t\t\t//newPoints[i].setAnimation(google.maps.Animation.DROP);\n\t\t\t\t\n\t\t\t\t// update min/max timestamp\n\t\t\t\tif(newPoints[i].timestamp > max)\n\t\t\t\t\tmax = newPoints[i].timestamp;\n\n\t\t\t\tif(newPoints[i].timestamp < min)\n\t\t\t\t\tmin = newPoints[i].timestamp;\n\t\t\t\t\n\t\t\t\t// update timestamp for future request\n\t\t\t\tif(newPoints[i].added >= updated)\n\t\t\t\t\tupdated = newPoints[i].added + 1;\n\t\t\t\t\n\t\t\t\t// add support for marker outside the viewport\n\t\t\t\t/*var hiddenOtions = {\n\t\t\t\t\t\tmap: map,\n\t\t\t\t\t\tposition: {\n\t\t\t\t\t\t\tlatitude: newPoints[i].getPosition().lat(),\n\t\t\t\t\t\t\tlongitude: newPoints[i].getPosition().lng(),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmarker: newPoints[i],\n\t\t\t\t\t\ticon: 'assets/imgs/markers/default.png',\n\t\t\t\t\t\ticon_size: [15,27]\n\t\t\t\t};\n\t\t\t\tnewPoints[i].hiddenMarker = new my.ggmaps.DirectionMarker(hiddenOtions);*/\n\t\t\t\tupdateMarkerIcon(newPoints[i]);\n\t\t\t}\n\t\t\t\n\t\t\tif(valid > 0) {\n\t\t\t\t\t// update timeline to new max time\n\t\t\t\t\tmax += 10*60*1000; // usability\n\t\t\t\t\tmin -= 10*60*1000; // usability\n\t\t\t\t\t\n\t\t\t\t\tlost.debug.log('getNewPoints(): Will adjust maximum to ' + max);\n\t\t\t\t\t\n\t\t\t\t\t$('#slider-range').slider( 'option', 'max', max );\n\t\t\t\t\t$('#slider-range').slider( 'values', 1, max );\n\t\t\t\t\t$('#slider-range').slider( 'option', 'min', min );\n\t\t\t\t\t$('#slider-range').slider( 'values', 0, min );\n\t\t\t\t\t\n\t\t\t\t\tchangeScaleText($('#timeline').slider('option'));\n\t\t\t\t\tupdateMapPoints($('#timeline').slider('option'));\n\t\t\t\t\t\n\t\t\t\t\trecalculateStats();\n\t\t\t\t\t\n\t\t\t\t\t// update existing path\n\t\t\t\t\tif(curPath != false)\n\t\t\t\t\t\tshowPath(markerPath);\n\t\t\t}\n\t\t}\n\t});\n}", "function makePoint() {\n // Pull start time from req and log responseTime\n var responseTime = Date.now() - req.start;\n var ip = req.headers['X-Real-IP'] || req.connection.remoteAddress;\n var geo = geoip.lookup(ip);\n \n if(!geo) {\n geo = {\n country: 'n/a',\n region: 'n/a',\n city: 'n/a',\n metro: 0,\n zip: 0,\n ll: [0.0, 0.0]\n }\n }\n \n var coords = geo.ll;\n var latitude = coords[0];\n var longitude = coords[1];\n \n var point = {\n measurement: \"requests\",\n \"tags\": {\n \"path\": req.path,\n \"host\": req.hostname,\n \"verb\": req.method,\n \"status\": res.statusCode,\n \"user\" : (req.user && req.user.email)? req.user.email || 'n/a';\n \"ip\": ip,\n \"geohash\": geohash.encode(latitude, longitude),\n \"country\": geo.country || 'n/a',\n \"region\": geo.region || 'n/a',\n \"city\": geo.city || 'n/a',\n \"metro\": geo.metro || 0,\n \"zip\" : geo.zip || 0\n },\n \"fields\": {\n \"responseTime\": responseTime,\n },\n }\n\n if (process.env.POINT_LABEL_NAME) {\n point.tags[process.env.POINT_LABEL_NAME] = process.env.POINT_LABEL_VALUE;\n }\n\n // Add the new point to the batch of points\n batch.points.push(point)\n\n // Emit the 'addPoint' event\n batch.emit(\"addPoint\")\n }", "function getPointProche(posX,posY){\r\n\tvar distanceLaPlusProche = 9999;\r\n\tvar pointLePlusProche;\r\n\tcanvas = document.getElementById(\"myCanvas\");\r\n\t$.each(firstArea.map.vertices,function(i,item){\r\n\t\tvar distance = calculeDistance(widthCanvas*posX,heightCanvas*posY,widthCanvas*item.x,heightCanvas*item.y);\r\n\t\tif (distance < distanceLaPlusProche) {\r\n\t\t\tdistanceLaPlusProche = distance;\r\n\t\t\tpointLePlusProche = item;\r\n\t\t};\r\n\t});\r\n\tconsole.log(pointLePlusProche);\r\n\tconsole.log(distanceLaPlusProche);\r\n\r\n\t//dessine le marker\r\n\tcheminAppelPoint = paperGlobal.path(\"M \"+widthCanvas*posX+\",\"+heightCanvas*posY+\" L\"+widthCanvas*pointLePlusProche.x+\",\"+heightCanvas*pointLePlusProche.y);\r\n\tmarker = paperGlobal.image(\"/static/img/marker.png\", widthCanvas*posX-25, heightCanvas*posY-25, 50, 50);\r\n\tcheminAppelPoint.attr({\"stroke-dasharray\" :\".\",\"stroke-width\":3});\r\n\r\n\t//doSendCabRequest(areaName,pointLePlusProche.name);\r\n\t$(\"#lastNotification\").html(\"Un Taxi a été appelé sur le point <strong>\"+pointLePlusProche.name+\"</strong>\");\r\n\tlastNotification = pointLePlusProche.name;\r\n\r\n\treturn pointLePlusProche.name;\r\n\r\n\t//alert(\"Un Taxi a été appelé sur le point \"+pointLePlusProche.name);\r\n\r\n}", "function getPointsCallback(gistList) {\n // Set Gist list:\n tmpGistList = gistList;\n // Get ID from gistlist:\n var gistID = getGistIDFromGistList(gistList, gistName);\n if (gistID == null) {\n callback(null);\n return null;\n }\n // output result:\n if (gistID != null) {\n callback(gistID);\n // Save current data to cache list:\n var cacheInfo = {\n area: areaName,\n site_positon: locationName,\n gist: gistName,\n gist_id: gistID\n };\n localCacheForGistID.push(cacheInfo);\n return true;\n } else {\n callback(null);\n }\n }", "function success(position) {\n\t\t\tvar longitude = position.coords.longitude;\n\t\t\tvar latitude = position.coords.latitude;\n\t\t\t$scope.points.push([latitude, longitude]);\n\t\t}", "function saveData(){\n \n plan = $(`[data-time=\"${event.target.dataset.time}\"]`).val();\n\n timeBlock = $(this).attr(\"data-time\");\n\n var plannerData = JSON.parse(localStorage.getItem(\"plannerDataKey\"));\n\n for(i=0;i<plannerData.length;i++)\n {\n if(plannerData[i].time == timeBlock)\n {\n plannerData[i].currentPlan = plan;\n }\n \n }\n \n localStorage.setItem(\"plannerDataKey\", JSON.stringify(plannerData));\n}", "initPoints() {\n this._points = [\n { id: 1, x: 4845196.3236, y: 8538521.2622 },\n { id: 40991, x: 4833644.7969, y: 8851764.3741 },\n { id: 3, x: 4840744.855, y: 8533088.6782 },\n { id: 49192, x: 4886186.3963, y: 8735776.8481 },\n { id: 40994, x: 4831870.068, y: 8843991.9019 },\n { id: 6, x: 4837763.3101, y: 8522427.4171 },\n { id: 7, x: 4837078.6992, y: 8539194.421 },\n { id: 49196, x: 4882592.8273, y: 8724040.2113 },\n { id: 40999, x: 4829746.821, y: 8859707.0537 },\n { id: 49198, x: 4882361.9601, y: 8731239.2658 },\n { id: 45108, x: 4785255.6563, y: 8736415.4892 },\n { id: 45111, x: 4783436.382, y: 8741565.3575 },\n { id: 45112, x: 4781506.5049, y: 8723980.5635 },\n { id: 45115, x: 4778448.2647, y: 8730727.894 },\n { id: 45121, x: 4774029.912, y: 8737457.7923 },\n { id: 45123, x: 4771837.4088, y: 8730847.2473 },\n { id: 45124, x: 4770400.618, y: 8724229.9787 },\n { id: 45126, x: 4770499.4249, y: 8742629.9617 },\n { id: 57430, x: 4650775.8241, y: 8564243.1184 },\n { id: 57431, x: 4649590.2675, y: 8574603.1762 },\n { id: 57432, x: 4648063.0178, y: 8582007.6803 },\n { id: 57433, x: 4646342.5335, y: 8566964.3161 },\n { id: 24642, x: 4671382.7823, y: 8648558.4637 },\n { id: 8247, x: 4852374.9012, y: 8441466.4075 },\n { id: 24645, x: 4669805.9782, y: 8656269.1397 },\n { id: 8249, x: 4850390.8286, y: 8449553.921 },\n { id: 57437, x: 4643507.9267, y: 8582628.1467 },\n { id: 57438, x: 4642690.6807, y: 8575128.4801 },\n { id: 57440, x: 4641127.5278, y: 8568976.0612 },\n { id: 24651, x: 4665307.5445, y: 8662304.316 },\n { id: 8255, x: 4846724.9528, y: 8444503.3914 },\n { id: 24652, x: 4664368.3197, y: 8645368.2937 },\n { id: 57444, x: 4637203.741, y: 8581061.2033 },\n { id: 57445, x: 4636612.5921, y: 8571933.0244 },\n { id: 57447, x: 4634995.3452, y: 8565334.4165 },\n { id: 24656, x: 4662356.542, y: 8651817.1346 },\n { id: 8260, x: 4842963.0587, y: 8449164.7733 },\n { id: 24657, x: 4661955.5825, y: 8658406.4574 },\n { id: 24658, x: 4661977.6057, y: 8663118.0352 },\n { id: 8262, x: 4841144.4604, y: 8458800.7543 },\n { id: 8264, x: 4839893.8899, y: 8442815.5277 },\n { id: 24662, x: 4658775.3503, y: 8645983.8338 },\n { id: 8266, x: 4837333.3711, y: 8456810.2902 },\n { id: 24663, x: 4657881.5861, y: 8664044.317 },\n { id: 8267, x: 4837625.327, y: 8447787.0568 },\n { id: 24664, x: 4657462.9008, y: 8654224.8825 },\n { id: 24667, x: 4655247.0718, y: 8659177.7171 },\n { id: 36978, x: 4815446.5932, y: 8629092.0781 },\n { id: 36980, x: 4814068.7107, y: 8639488.5807 },\n { id: 36986, x: 4808852.2493, y: 8629707.6407 },\n { id: 36987, x: 4807414.7475, y: 8622297.8737 },\n { id: 36993, x: 4802238.9547, y: 8640756.5897 },\n { id: 36994, x: 4801734.0043, y: 8630205.1323 },\n { id: 61596, x: 4759486.6127, y: 8429038.0365 },\n { id: 61597, x: 4758641.6908, y: 8438783.8508 },\n { id: 61599, x: 4758366.8187, y: 8424841.386 },\n { id: 49302, x: 4883959.4894, y: 8716189.4969 },\n { id: 61601, x: 4758323.8844, y: 8419697.473 },\n { id: 49304, x: 4882412.6839, y: 8708668.917 },\n { id: 61602, x: 4756967.4668, y: 8434411.0399 },\n { id: 20612, x: 4727247.3073, y: 8712704.8842 },\n { id: 20615, x: 4726347.0307, y: 8719332.2008 },\n { id: 61608, x: 4754305.9834, y: 8428351.3131 },\n { id: 20618, x: 4721766.3141, y: 8719011.1448 },\n { id: 20619, x: 4721402.7657, y: 8711204.4786 },\n { id: 61612, x: 4752959.9224, y: 8422787.2783 },\n { id: 20624, x: 4716782.7853, y: 8721143.3353 },\n { id: 61615, x: 4750986.8881, y: 8434632.3865 },\n { id: 20625, x: 4716063.5516, y: 8709786.4158 },\n { id: 20628, x: 4712473.3755, y: 8717753.5293 },\n { id: 53421, x: 4687440.4836, y: 8532828.8067 },\n { id: 53422, x: 4686510.5651, y: 8521368.1555 },\n { id: 61621, x: 4748065.9641, y: 8418657.8795 },\n { id: 12434, x: 4778935.7205, y: 8451080.8125 },\n { id: 61623, x: 4747015.4702, y: 8423560.8911 },\n { id: 12435, x: 4777336.1153, y: 8457338.597 },\n { id: 61624, x: 4745858.8766, y: 8428891.7655 },\n { id: 53426, x: 4681765.1535, y: 8539545.2625 },\n { id: 12436, x: 4776343.4395, y: 8442966.2149 },\n { id: 61625, x: 4744681.0893, y: 8435384.0016 },\n { id: 53427, x: 4679518.0852, y: 8527123.3353 },\n { id: 53428, x: 4678737.5137, y: 8532985.4268 },\n { id: 53432, x: 4672808.2188, y: 8523080.5666 },\n { id: 53433, x: 4671743.5054, y: 8537772.7908 },\n { id: 12443, x: 4772971.6282, y: 8439392.5927 },\n { id: 12444, x: 4771278.742, y: 8454979.7101 },\n { id: 12447, x: 4769632.7761, y: 8447176.1296 },\n { id: 154, x: 4837546.2851, y: 8503768.8028 },\n { id: 155, x: 4837082.798, y: 8512085.8075 },\n { id: 12453, x: 4766703.0307, y: 8439750.1014 },\n { id: 69859, x: 4684010.9171, y: 8436196.4252 },\n { id: 69861, x: 4682838.5734, y: 8425470.4579 },\n { id: 32973, x: 4857122.7117, y: 8695990.1652 },\n { id: 32976, x: 4853541.795, y: 8687079.3727 },\n { id: 69869, x: 4675012.1618, y: 8435702.9995 },\n { id: 32978, x: 4849736.0425, y: 8692972.3151 },\n { id: 32979, x: 4849108.2752, y: 8685361.5363 },\n { id: 32981, x: 4846768.5624, y: 8700386.5976 },\n { id: 32984, x: 4842835.6161, y: 8687112.8444 },\n { id: 4296, x: 4798840.4037, y: 8564652.3306 },\n { id: 4297, x: 4798287.8631, y: 8573882.1154 },\n { id: 28893, x: 4651620.4881, y: 8635263.597 },\n { id: 16596, x: 4748553.6246, y: 8775562.7244 },\n { id: 16597, x: 4747277.249, y: 8782411.3328 },\n { id: 41192, x: 4825411.4956, y: 8850441.5601 },\n { id: 28895, x: 4649871.1415, y: 8625167.2618 },\n { id: 41194, x: 4824765.7621, y: 8843780.4093 },\n { id: 28898, x: 4647233.5759, y: 8632798.3433 },\n { id: 16601, x: 4742928.8987, y: 8767227.0928 },\n { id: 4304, x: 4793155.612, y: 8565362.3567 },\n { id: 28899, x: 4646960.8939, y: 8637513.7143 },\n { id: 28901, x: 4647065.1338, y: 8643091.7158 },\n { id: 16604, x: 4740241.5164, y: 8771611.6541 },\n { id: 41200, x: 4821755.3087, y: 8857313.4801 },\n { id: 16606, x: 4740095.6642, y: 8777148.6227 },\n { id: 28904, x: 4643059.9294, y: 8629307.5664 },\n { id: 16607, x: 4739331.4793, y: 8786015.9181 },\n { id: 211, x: 4841382.8941, y: 8574380.9496 },\n { id: 41202, x: 4819000.5697, y: 8849289.5667 },\n { id: 28906, x: 4643159.1115, y: 8643284.5583 },\n { id: 4312, x: 4787818.6312, y: 8574921.7418 },\n { id: 28907, x: 4642769.6994, y: 8638963.8339 },\n { id: 28908, x: 4642374.5974, y: 8635140.5631 },\n { id: 4314, x: 4786838.4559, y: 8563494.7058 },\n { id: 215, x: 4837948.9329, y: 8562787.8843 },\n { id: 41206, x: 4816393.974, y: 8857630.5762 },\n { id: 28909, x: 4640562.8239, y: 8631074.2336 },\n { id: 216, x: 4838142.6879, y: 8569979.4298 },\n { id: 28913, x: 4639526.3344, y: 8644635.0087 },\n { id: 16616, x: 4731984.8403, y: 8781553.4017 },\n { id: 4319, x: 4783071.6172, y: 8571201.0678 },\n { id: 28916, x: 4636531.2125, y: 8639719.7747 },\n { id: 28917, x: 4636309.6663, y: 8635408.9937 },\n { id: 49413, x: 4890823.6958, y: 8760810.1049 },\n { id: 45314, x: 4783301.9421, y: 8715570.9869 },\n { id: 28918, x: 4635709.6328, y: 8628809.8305 },\n { id: 49418, x: 4882680.5438, y: 8778124.8092 },\n { id: 49419, x: 4882110.1834, y: 8765438.536 },\n { id: 49421, x: 4881310.4756, y: 8772592.5879 },\n { id: 45322, x: 4777319.9389, y: 8710693.9784 },\n { id: 45323, x: 4775568.1393, y: 8706510.1336 },\n { id: 45324, x: 4775869.6493, y: 8718632.7153 },\n { id: 12536, x: 4777692.2303, y: 8434815.5071 },\n { id: 45330, x: 4768555.4905, y: 8713701.3537 },\n { id: 12539, x: 4776659.9744, y: 8428380.1498 },\n { id: 45332, x: 4767568.0541, y: 8708627.1262 },\n { id: 12540, x: 4775456.5012, y: 8423833.0984 },\n { id: 12544, x: 4772479.0176, y: 8432247.1443 },\n { id: 12547, x: 4770470.3044, y: 8436314.1842 },\n { id: 12548, x: 4768934.4016, y: 8419734.0048 },\n { id: 12549, x: 4768639.3872, y: 8427181.1184 },\n { id: 255, x: 4845110.0987, y: 8546729.2103 },\n { id: 259, x: 4841604.9114, y: 8553640.6107 },\n { id: 260, x: 4840853.3019, y: 8541480.2643 },\n { id: 65846, x: 4703934.6143, y: 8401892.0061 },\n { id: 262, x: 4838371.5187, y: 8544904.4627 },\n { id: 65848, x: 4703421.9803, y: 8409776.9106 },\n { id: 65853, x: 4695224.3211, y: 8412051.1341 },\n { id: 65859, x: 4690262.2901, y: 8404584.5274 },\n { id: 20785, x: 4729215.8743, y: 8728025.9993 },\n { id: 20786, x: 4727391.8577, y: 8733698.7694 },\n { id: 20788, x: 4725810.498, y: 8742993.5002 },\n { id: 20790, x: 4724162.6782, y: 8725641.8225 },\n { id: 20793, x: 4721902.7791, y: 8732512.0606 },\n { id: 20797, x: 4719274.3126, y: 8740345.4916 },\n { id: 20798, x: 4718735.9551, y: 8736031.2095 },\n { id: 20801, x: 4716118.8574, y: 8745789.1329 },\n { id: 57693, x: 4632315.3087, y: 8571117.1988 },\n { id: 20802, x: 4714447.6208, y: 8729809.6305 },\n { id: 57695, x: 4630260.3685, y: 8580316.583 },\n { id: 20805, x: 4713071.7449, y: 8737354.9842 },\n { id: 57697, x: 4629678.6652, y: 8574660.7259 },\n { id: 8509, x: 4850578.9858, y: 8430361.7403 },\n { id: 57702, x: 4624897.4416, y: 8569261.133 },\n { id: 8514, x: 4847110.0358, y: 8420284.3172 },\n { id: 57703, x: 4623956.8043, y: 8563605.1537 },\n { id: 8515, x: 4846318.6683, y: 8437846.0786 },\n { id: 57704, x: 4623611.4643, y: 8575351.9171 },\n { id: 57705, x: 4623531.3613, y: 8581380.7974 },\n { id: 37210, x: 4835145.7911, y: 8680941.2719 },\n { id: 37211, x: 4834965.4487, y: 8676228.8768 },\n { id: 37212, x: 4834227.5845, y: 8671034.5829 },\n { id: 57708, x: 4621549.2709, y: 8567804.7674 },\n { id: 37213, x: 4833698.8527, y: 8665783.8714 },\n { id: 57710, x: 4619845.8701, y: 8575663.42 },\n { id: 37216, x: 4829693.076, y: 8661734.3745 },\n { id: 8524, x: 4840265.7713, y: 8429645.7882 },\n { id: 37219, x: 4827554.7576, y: 8680148.0247 },\n { id: 57715, x: 4616587.5891, y: 8570299.013 },\n { id: 37220, x: 4826867.9773, y: 8674547.7427 },\n { id: 57717, x: 4615627.0313, y: 8577886.2287 },\n { id: 70026, x: 4685533.9566, y: 8451108.6709 },\n { id: 70029, x: 4682847.8049, y: 8444694.8573 },\n { id: 33141, x: 4852567.6896, y: 8676283.5465 },\n { id: 33143, x: 4852073.142, y: 8669766.3451 },\n { id: 33147, x: 4847918.9192, y: 8663990.3472 },\n { id: 70041, x: 4672139.8671, y: 8453433.5074 },\n { id: 70042, x: 4671315.5787, y: 8439476.4201 },\n { id: 33151, x: 4845715.6409, y: 8676397.0296 },\n { id: 33157, x: 4840936.9928, y: 8669040.4401 },\n { id: 24985, x: 4668807.7302, y: 8643206.4267 },\n { id: 24987, x: 4667772.225, y: 8636716.6527 },\n { id: 24988, x: 4666006.5614, y: 8631514.0125 },\n { id: 24994, x: 4661687.9395, y: 8640229.9524 },\n { id: 24996, x: 4658356.5306, y: 8631942.9465 },\n { id: 24999, x: 4656108.9299, y: 8637774.5863 },\n { id: 25000, x: 4654754.9499, y: 8627472.7345 },\n { id: 25001, x: 4653540.5659, y: 8630712.8563 },\n { id: 16806, x: 4748500.0003, y: 8752939.7574 },\n { id: 16811, x: 4744197.1825, y: 8749627.6362 },\n { id: 16815, x: 4741338.3237, y: 8758716.8525 },\n { id: 70103, x: 4664964.2249, y: 8451047.1805 },\n { id: 16817, x: 4739965.3745, y: 8748317.9856 },\n { id: 70106, x: 4660960.9343, y: 8439783.4252 },\n { id: 16821, x: 4736934.8524, y: 8765354.2687 },\n { id: 70109, x: 4658422.5005, y: 8453722.642 },\n { id: 16826, x: 4734065.1019, y: 8755338.621 },\n { id: 70114, x: 4651751.0091, y: 8448752.2424 },\n { id: 16827, x: 4732833.6814, y: 8748826.8871 },\n { id: 66018, x: 4707297.8897, y: 8381375.2603 },\n { id: 66026, x: 4699342.3582, y: 8386123.4877 },\n { id: 66028, x: 4698322.0743, y: 8396979.9259 },\n { id: 4543, x: 4778733.2341, y: 8577088.4885 },\n { id: 41435, x: 4824414.6358, y: 8827905.1508 },\n { id: 41437, x: 4822507.168, y: 8836577.2438 },\n { id: 4546, x: 4777522.3553, y: 8564871.387 },\n { id: 66033, x: 4694836.3949, y: 8382738.6968 },\n { id: 41445, x: 4816879.5564, y: 8838439.0084 },\n { id: 41447, x: 4815229.6338, y: 8830178.4105 },\n { id: 4556, x: 4771029.4327, y: 8572882.736 },\n { id: 4560, x: 4768511.7242, y: 8580840.9903 },\n { id: 4562, x: 4766524.7601, y: 8564835.4789 },\n { id: 57852, x: 4632709.1336, y: 8546396.1578 },\n { id: 16862, x: 4754446.0448, y: 8792182.4664 },\n { id: 57853, x: 4632879.7801, y: 8561497.1511 },\n { id: 16863, x: 4753478.4325, y: 8799447.422 },\n { id: 4566, x: 4764728.3967, y: 8575775.0557 },\n { id: 61954, x: 4756959.5054, y: 8452288.6795 },\n { id: 49657, x: 4893131.1819, y: 8741699.6035 },\n { id: 61955, x: 4756509.0957, y: 8457090.6428 },\n { id: 61956, x: 4756014.4021, y: 8443468.3688 },\n { id: 57857, x: 4628124.7258, y: 8552666.0854 },\n { id: 49661, x: 4890537.3426, y: 8749196.2107 },\n { id: 57860, x: 4624837.4908, y: 8546554.7066 },\n { id: 61960, x: 4751810.4902, y: 8448850.8157 },\n { id: 475, x: 4832556.0028, y: 8516169.9961 },\n { id: 61962, x: 4751091.5334, y: 8457428.0913 },\n { id: 477, x: 4830522.5745, y: 8509763.2798 },\n { id: 61963, x: 4749608.0521, y: 8440032.5861 },\n { id: 57864, x: 4621903.2777, y: 8550007.4327 },\n { id: 49666, x: 4888604.6573, y: 8756662.8034 },\n { id: 61964, x: 4748639.3542, y: 8453112.7135 },\n { id: 49667, x: 4887777.3225, y: 8741464.3253 },\n { id: 20974, x: 4710512.1161, y: 8726610.2275 },\n { id: 479, x: 4829450.3734, y: 8501009.9382 },\n { id: 20976, x: 4709852.5505, y: 8740955.7227 },\n { id: 61967, x: 4746128.8888, y: 8452009.9363 },\n { id: 20977, x: 4709394.5453, y: 8745403.6732 },\n { id: 61968, x: 4745442.7762, y: 8457386.137 },\n { id: 57869, x: 4617443.236, y: 8555517.7228 },\n { id: 20978, x: 4708013.1619, y: 8730758.9389 },\n { id: 61969, x: 4745233.4922, y: 8440776.3017 },\n { id: 49672, x: 4885178.249, y: 8750886.2229 },\n { id: 484, x: 4825331.5471, y: 8501443.8635 },\n { id: 485, x: 4825734.9125, y: 8514632.761 },\n { id: 20981, x: 4704263.458, y: 8737981.2182 },\n { id: 20982, x: 4703822.1015, y: 8728798.9087 },\n { id: 487, x: 4823987.3429, y: 8508510.0644 },\n { id: 20983, x: 4702359.3021, y: 8733663.3461 },\n { id: 20984, x: 4702019.979, y: 8726360.7794 },\n { id: 20986, x: 4700861.3395, y: 8742876.7171 },\n { id: 493, x: 4819023.8385, y: 8501372.4258 },\n { id: 20992, x: 4696281.8876, y: 8733175.6031 },\n { id: 29192, x: 4652746.0283, y: 8650514.2304 },\n { id: 20994, x: 4694679.0276, y: 8741805.3068 },\n { id: 29193, x: 4651225.6965, y: 8645060.3781 },\n { id: 29194, x: 4651463.5398, y: 8661552.2134 },\n { id: 29195, x: 4650944.7322, y: 8655434.9539 },\n { id: 29198, x: 4647465.7827, y: 8655418.4811 },\n { id: 49695, x: 4764772.3861, y: 8501250.5202 },\n { id: 29202, x: 4645978.7274, y: 8659325.0012 },\n { id: 45599, x: 4799305.7561, y: 8753815.5975 },\n { id: 45601, x: 4796542.4044, y: 8761275.0003 },\n { id: 29207, x: 4641569.7632, y: 8655218.5133 },\n { id: 45604, x: 4793280.7898, y: 8747027.567 },\n { id: 29209, x: 4640788.9037, y: 8660699.8683 },\n { id: 8714, x: 4843200.0241, y: 8497440.3446 },\n { id: 8715, x: 4843504.3958, y: 8484158.7755 },\n { id: 45607, x: 4790457.73, y: 8754611.0294 },\n { id: 8717, x: 4840626.9997, y: 8490518.6227 },\n { id: 45610, x: 4788080.3603, y: 8762794.2187 },\n { id: 29216, x: 4636583.1822, y: 8652435.0102 },\n { id: 8721, x: 4837919.1645, y: 8482202.0182 },\n { id: 29217, x: 4636529.6799, y: 8657115.3002 },\n { id: 37420, x: 4839192.0381, y: 8698484.5386 },\n { id: 37424, x: 4833161.1317, y: 8685492.6952 },\n { id: 37425, x: 4833093.7519, y: 8693478.2403 },\n { id: 16933, x: 4757943.5748, y: 8815865.2542 },\n { id: 37429, x: 4829680.2456, y: 8699277.8109 },\n { id: 37430, x: 4827716.8906, y: 8688814.0622 },\n { id: 33332, x: 4877198.1998, y: 8717704.9556 },\n { id: 16936, x: 4754970.3786, y: 8811386.4788 },\n { id: 33335, x: 4875215.0529, y: 8706156.0081 },\n { id: 37435, x: 4822340.1177, y: 8686697.0548 },\n { id: 37437, x: 4821969.253, y: 8696792.6717 },\n { id: 33341, x: 4870804.1933, y: 8713672.1884 },\n { id: 33345, x: 4866585.159, y: 8703705.6653 },\n { id: 33350, x: 4863278.3241, y: 8719556.066 },\n { id: 33351, x: 4861936.5992, y: 8711792.9938 },\n { id: 49784, x: 4746553.0635, y: 8511610.4528 },\n { id: 53895, x: 4666998.9222, y: 8527685.7334 },\n { id: 53897, x: 4665575.7197, y: 8533468.1507 },\n { id: 53901, x: 4661556.0389, y: 8538780.1542 },\n { id: 41606, x: 4843453.6392, y: 8864930.0851 },\n { id: 53908, x: 4653006.9465, y: 8537139.6176 },\n { id: 41612, x: 4833907.2648, y: 8871077.3014 },\n { id: 41615, x: 4829564.2059, y: 8867328.5101 },\n { id: 49828, x: 4749377.4988, y: 8539149.5762 },\n { id: 49830, x: 4747071.7496, y: 8521202.2762 },\n { id: 49831, x: 4746824.4196, y: 8531672.8673 },\n { id: 12941, x: 4795447.0686, y: 8470384.8893 },\n { id: 12943, x: 4794594.7468, y: 8475257.0691 },\n { id: 12944, x: 4794681.4661, y: 8459965.4285 },\n { id: 12945, x: 4792636.3048, y: 8465105.6843 },\n { id: 12949, x: 4789788.8454, y: 8469572.2253 },\n { id: 12952, x: 4788363.0165, y: 8475375.7997 },\n { id: 12953, x: 4788515.5104, y: 8462320.483 },\n { id: 12957, x: 4784667.9907, y: 8460073.062 },\n { id: 12958, x: 4784128.5686, y: 8470685.3928 },\n { id: 8861, x: 4850907.7149, y: 8462718.2729 },\n { id: 58050, x: 4651286.1153, y: 8594874.0302 },\n { id: 12961, x: 4781897.1933, y: 8464777.2225 },\n { id: 8862, x: 4850409.6292, y: 8472179.265 },\n { id: 58051, x: 4648589.8933, y: 8587888.2231 },\n { id: 58053, x: 4647364.8782, y: 8601791.5723 },\n { id: 58054, x: 4646684.0306, y: 8592984.6472 },\n { id: 8868, x: 4845746.0711, y: 8475885.3063 },\n { id: 58057, x: 4642256.4253, y: 8589117.0426 },\n { id: 8870, x: 4845728.7383, y: 8460124.4251 },\n { id: 58059, x: 4641113.8802, y: 8599262.9502 },\n { id: 8871, x: 4843929.6668, y: 8469411.0607 },\n { id: 29370, x: 4632144.3863, y: 8651743.484 },\n { id: 58064, x: 4635582.5368, y: 8594541.406 },\n { id: 29371, x: 4631318.2118, y: 8646187.6109 },\n { id: 58065, x: 4634792.3039, y: 8585159.1609 },\n { id: 29372, x: 4631802.188, y: 8665154.5049 },\n { id: 29373, x: 4630724.9392, y: 8654858.4696 },\n { id: 8879, x: 4838133.7511, y: 8471937.9166 },\n { id: 41672, x: 4822005.7629, y: 8864828.127 },\n { id: 8881, x: 4828445.414, y: 8378764.8144 },\n { id: 17080, x: 4748423.4395, y: 8814332.8774 },\n { id: 17081, x: 4745691.1405, y: 8818112.9112 },\n { id: 29380, x: 4625100.5814, y: 8646485.7623 },\n { id: 29381, x: 4624275.6954, y: 8656728.6524 },\n { id: 17084, x: 4742596.0805, y: 8807783.9981 },\n { id: 29382, x: 4623866.4001, y: 8661934.6953 },\n { id: 17085, x: 4739529.681, y: 8817204.9252 },\n { id: 29383, x: 4623015.118, y: 8650525.342 },\n { id: 691, x: 4836288.2447, y: 8532935.9735 },\n { id: 693, x: 4835158.8636, y: 8538763.6823 },\n { id: 29390, x: 4617144.5351, y: 8656630.7413 },\n { id: 25292, x: 4690126.8467, y: 8674030.3924 },\n { id: 25293, x: 4689990.2667, y: 8681410.5557 },\n { id: 699, x: 4829447.5043, y: 8523594.0837 },\n { id: 700, x: 4829560.7298, y: 8532916.0795 },\n { id: 4801, x: 4780864.9237, y: 8557245.7687 },\n { id: 702, x: 4827910.7803, y: 8538081.312 },\n { id: 25297, x: 4686938.9483, y: 8681550.7473 },\n { id: 70387, x: 4667676.0465, y: 8429626.6523 },\n { id: 25298, x: 4684492.9735, y: 8671182.9436 },\n { id: 25299, x: 4684428.6779, y: 8678642.4498 },\n { id: 4804, x: 4778051.8854, y: 8550238.6239 },\n { id: 70389, x: 4667209.1662, y: 8422439.6821 },\n { id: 709, x: 4821839.4248, y: 8527494.6026 },\n { id: 25304, x: 4678654.0745, y: 8672190.4295 },\n { id: 25305, x: 4678496.3579, y: 8680805.4593 },\n { id: 711, x: 4819670.2541, y: 8533461.2159 },\n { id: 70395, x: 4658395.1271, y: 8424818.5627 },\n { id: 4811, x: 4773409.8443, y: 8543995.0958 },\n { id: 25307, x: 4676805.3921, y: 8666939.3506 },\n { id: 4812, x: 4773247.017, y: 8556403.0085 },\n { id: 25310, x: 4673896.2234, y: 8684912.5107 },\n { id: 70400, x: 4654554.292, y: 8428060.3854 },\n { id: 25311, x: 4672847.869, y: 8677204.1038 },\n { id: 70401, x: 4653586.1974, y: 8418136.0025 },\n { id: 4824, x: 4765068.6407, y: 8552909.5021 },\n { id: 4825, x: 4763417.2916, y: 8541913.7245 },\n { id: 33532, x: 4876448.8303, y: 8739719.6005 },\n { id: 45830, x: 4803777.5306, y: 8781598.8451 },\n { id: 45831, x: 4801265.8848, y: 8768485.416 },\n { id: 33534, x: 4873928.4571, y: 8730593.6443 },\n { id: 45832, x: 4800481.9672, y: 8778267.0345 },\n { id: 33535, x: 4872764.0313, y: 8722496.2763 },\n { id: 33537, x: 4871332.9743, y: 8733944.5039 },\n { id: 45837, x: 4796441.7865, y: 8772932.3716 },\n { id: 33542, x: 4866472.3784, y: 8740563.7341 },\n { id: 45840, x: 4793980.3499, y: 8782320.3501 },\n { id: 45841, x: 4792585.5728, y: 8769392.7344 },\n { id: 45842, x: 4791875.1686, y: 8775145.8129 },\n { id: 33546, x: 4863110.6008, y: 8727175.7812 },\n { id: 54050, x: 4665196.6263, y: 8505383.9546 },\n { id: 54052, x: 4662857.8674, y: 8512784.6368 },\n { id: 54057, x: 4657782.1742, y: 8508199.6768 },\n { id: 54059, x: 4656162.7228, y: 8501454.3045 },\n { id: 54061, x: 4654642.6258, y: 8518665.4194 },\n { id: 54064, x: 4651818.7051, y: 8512384.9743 },\n { id: 49969, x: 4739708.7799, y: 8540621.526 },\n { id: 58171, x: 4632628.4325, y: 8596328.6231 },\n { id: 49973, x: 4735866.3884, y: 8526625.8721 },\n { id: 49975, x: 4735015.304, y: 8533519.3512 },\n { id: 58175, x: 4631158.9257, y: 8601237.9394 },\n { id: 37684, x: 4812931.1996, y: 8698468.4858 },\n { id: 13090, x: 4796431.0522, y: 8493778.2589 },\n { id: 37685, x: 4812200.7036, y: 8688529.7953 },\n { id: 13092, x: 4795444.3645, y: 8499460.86 },\n { id: 58182, x: 4625217.1263, y: 8589636.5258 },\n { id: 49984, x: 4726399.2374, y: 8522159.7294 },\n { id: 13094, x: 4794629.738, y: 8488443.2858 },\n { id: 58184, x: 4621196.7133, y: 8586267.9911 },\n { id: 58185, x: 4621015.1445, y: 8598328.7185 },\n { id: 13096, x: 4793632.7276, y: 8480188.4761 },\n { id: 58186, x: 4620716.9083, y: 8592436.1001 },\n { id: 37691, x: 4804703.1364, y: 8689871.6726 },\n { id: 13099, x: 4791880.9457, y: 8497188.3433 },\n { id: 58189, x: 4617536.998, y: 8588503.7314 },\n { id: 58190, x: 4616686.7312, y: 8583655.1793 },\n { id: 13101, x: 4791064.7699, y: 8491106.3002 },\n { id: 13103, x: 4789782.4319, y: 8485195.3489 },\n { id: 13110, x: 4785656.2815, y: 8480783.4396 },\n { id: 13113, x: 4783823.7073, y: 8493044.715 },\n { id: 13115, x: 4782965.0561, y: 8488356.1469 },\n { id: 70547, x: 4683466.689, y: 8460996.9808 },\n { id: 70548, x: 4682821.1619, y: 8469752.4582 },\n { id: 70555, x: 4676166.4047, y: 8472334.1275 },\n { id: 70556, x: 4671828.7006, y: 8479071.9291 },\n { id: 70557, x: 4671398.2865, y: 8465938.5993 },\n { id: 21378, x: 4709643.4324, y: 8707710.5987 },\n { id: 21382, x: 4706305.5317, y: 8715911.4774 },\n { id: 21383, x: 4705610.9179, y: 8709639.7 },\n { id: 29582, x: 4632156.9857, y: 8632721.8077 },\n { id: 21384, x: 4705578.442, y: 8720447.5974 },\n { id: 41880, x: 4798913.1245, y: 8611292.9216 },\n { id: 29583, x: 4631225.5622, y: 8637420.9912 },\n { id: 29585, x: 4629449.2822, y: 8640666.6502 },\n { id: 41883, x: 4796310.3282, y: 8618535.1919 },\n { id: 29586, x: 4628111.6113, y: 8629499.2053 },\n { id: 29587, x: 4627577.5616, y: 8624840.6533 },\n { id: 29588, x: 4626476.0939, y: 8636845.8871 },\n { id: 21390, x: 4700765.1788, y: 8714311.6314 },\n { id: 17292, x: 4751167.2828, y: 8806158.9269 },\n { id: 29590, x: 4625331.7601, y: 8640066.6729 },\n { id: 29591, x: 4624693.9039, y: 8633558.5802 },\n { id: 21395, x: 4697391.6962, y: 8722841.8941 },\n { id: 29594, x: 4623033.262, y: 8638101.2904 },\n { id: 21396, x: 4695994.2982, y: 8715226.8377 },\n { id: 17297, x: 4747815.6788, y: 8790660.2308 },\n { id: 29595, x: 4621118.2899, y: 8624899.8769 },\n { id: 17298, x: 4747315.7382, y: 8799060.4866 },\n { id: 29597, x: 4621048.2759, y: 8629601.1655 },\n { id: 21399, x: 4692514.3119, y: 8708730.1677 },\n { id: 41895, x: 4789150.8327, y: 8619263.4644 },\n { id: 29598, x: 4620126.2097, y: 8641276.1681 },\n { id: 41897, x: 4788371.6743, y: 8606445.2771 },\n { id: 29600, x: 4619030.2863, y: 8635252.0638 },\n { id: 29603, x: 4616736.6562, y: 8642398.0128 },\n { id: 17306, x: 4737481.7047, y: 8800147.0098 },\n { id: 58308, x: 4611989.3787, y: 8510402.8984 },\n { id: 25523, x: 4691554.8004, y: 8698397.7705 },\n { id: 929, x: 4815665.1253, y: 8521077.6839 },\n { id: 58317, x: 4599541.0169, y: 8502521.3853 },\n { id: 58318, x: 4599705.1468, y: 8516498.5514 },\n { id: 932, x: 4812884.0869, y: 8535881.508 },\n { id: 934, x: 4811263.6479, y: 8526384.1475 },\n { id: 25530, x: 4686381.2633, y: 8701626.8075 },\n { id: 9135, x: 4837287.2013, y: 8389877.3273 },\n { id: 5036, x: 4798179.5166, y: 8582801.0328 },\n { id: 25532, x: 4684274.1001, y: 8694487.3916 },\n { id: 938, x: 4807596.0729, y: 8534265.6929 },\n { id: 25533, x: 4683835.9107, y: 8685705.2551 },\n { id: 9138, x: 4836222.2853, y: 8379682.324 },\n { id: 9139, x: 4833054.3962, y: 8395878.324 },\n { id: 5040, x: 4795047.7322, y: 8589934.9169 },\n { id: 13239, x: 4779122.3034, y: 8499381.8177 },\n { id: 25537, x: 4679818.5287, y: 8699574.2484 },\n { id: 13240, x: 4779501.8721, y: 8481432.5658 },\n { id: 5042, x: 4794193.5567, y: 8598677.5955 },\n { id: 943, x: 4803202.172, y: 8527601.1577 },\n { id: 25538, x: 4679276.6629, y: 8693400.4734 },\n { id: 9143, x: 4831825.6218, y: 8385497.3845 },\n { id: 13243, x: 4776209.5206, y: 8490656.4447 },\n { id: 5047, x: 4787943.3562, y: 8583577.7563 },\n { id: 25543, x: 4675029.2879, y: 8701400.3278 },\n { id: 13248, x: 4773069.9173, y: 8496756.505 },\n { id: 5050, x: 4785304.3077, y: 8594346.5764 },\n { id: 13249, x: 4773391.5861, y: 8482273.5515 },\n { id: 9151, x: 4825851.6242, y: 8391140.9366 },\n { id: 13256, x: 4767969.4649, y: 8497196.2775 },\n { id: 13257, x: 4768014.3432, y: 8488550.8305 },\n { id: 13258, x: 4766094.1323, y: 8483071.7933 },\n { id: 9160, x: 4820844.9453, y: 8382810.5424 },\n { id: 66550, x: 4725576.5331, y: 8424654.4504 },\n { id: 66552, x: 4724200.6296, y: 8432268.4075 },\n { id: 46062, x: 4784211.5035, y: 8768145.5307 },\n { id: 46063, x: 4784496.3235, y: 8781086.5818 },\n { id: 66561, x: 4717538.9374, y: 8429313.3766 },\n { id: 66565, x: 4715137.0231, y: 8418800.9964 },\n { id: 46070, x: 4779169.7321, y: 8774996.5223 },\n { id: 46071, x: 4778184.7606, y: 8783631.35 },\n { id: 46072, x: 4776812.3821, y: 8769882.4565 },\n { id: 66571, x: 4708290.7049, y: 8426841.5312 },\n { id: 46079, x: 4770453.3085, y: 8769028.2258 },\n { id: 46081, x: 4769415.4619, y: 8775483.6104 },\n { id: 33792, x: 4859720.5305, y: 8735574.4591 },\n { id: 33794, x: 4857537.0055, y: 8726174.214 },\n { id: 33800, x: 4852579.7596, y: 8731284.8422 },\n { id: 33807, x: 4848340.9965, y: 8723486.4975 },\n { id: 33810, x: 4846697.3758, y: 8728529.547 },\n { id: 33815, x: 4843787.5263, y: 8740806.0415 },\n { id: 58429, x: 4608035.0923, y: 8523612.4556 },\n { id: 58430, x: 4608024.5386, y: 8530670.0558 },\n { id: 58435, x: 4601852.3582, y: 8530076.0756 },\n { id: 58436, x: 4601932.3733, y: 8541406.4352 },\n { id: 50242, x: 4741266.6643, y: 8504436.9801 },\n { id: 50246, x: 4736428.8516, y: 8509418.381 },\n { id: 50247, x: 4736177.6975, y: 8517238.2981 },\n { id: 50251, x: 4732901.6648, y: 8504057.877 },\n { id: 50260, x: 4725905.1766, y: 8509989.2064 },\n { id: 29767, x: 4653382.0233, y: 8666827.1296 },\n { id: 42066, x: 4779623.9036, y: 8603638.7652 },\n { id: 42067, x: 4779835.1629, y: 8613937.2262 },\n { id: 29772, x: 4651349.7226, y: 8679500.0105 },\n { id: 50268, x: 4734198.228, y: 8602721.0285 },\n { id: 54374, x: 4686800.3785, y: 8556983.239 },\n { id: 29780, x: 4645936.1845, y: 8671663.3363 },\n { id: 29781, x: 4644149.4466, y: 8677330.7071 },\n { id: 54376, x: 4684829.3026, y: 8548259.386 },\n { id: 29783, x: 4644026.1531, y: 8682244.6934 },\n { id: 42081, x: 4769613.5479, y: 8611500.7453 },\n { id: 54379, x: 4683125.9147, y: 8560661.6194 },\n { id: 29787, x: 4639680.4067, y: 8673421.1595 },\n { id: 54382, x: 4678361.1403, y: 8545991.8315 },\n { id: 29788, x: 4639567.428, y: 8680770.1156 },\n { id: 42086, x: 4766821.8546, y: 8618863.8957 },\n { id: 29789, x: 4637801.8868, y: 8667485.8834 },\n { id: 54384, x: 4677173.0192, y: 8556523.3104 },\n { id: 42087, x: 4765715.2456, y: 8604561.0182 },\n { id: 29791, x: 4636495.3194, y: 8680026.7392 },\n { id: 29792, x: 4636122.4313, y: 8685741.4217 },\n { id: 21596, x: 4729438.1884, y: 8760004.4477 },\n { id: 54389, x: 4673036.0016, y: 8561664.8854 },\n { id: 21597, x: 4728488.1427, y: 8754291.926 },\n { id: 54390, x: 4671723.5425, y: 8552404.7515 },\n { id: 21599, x: 4726281.986, y: 8749244.8501 },\n { id: 21601, x: 4725670.1418, y: 8763471.1162 },\n { id: 21602, x: 4723998.9556, y: 8755793.8231 },\n { id: 21606, x: 4721029.1955, y: 8764765.8754 },\n { id: 21607, x: 4719821.4867, y: 8751651.0764 },\n { id: 38006, x: 4819547.389, y: 8677198.4209 },\n { id: 21610, x: 4717464.8373, y: 8759343.6544 },\n { id: 38008, x: 4818912.7452, y: 8664504.008 },\n { id: 21612, x: 4714760.7325, y: 8764067.5072 },\n { id: 38009, x: 4818478.7318, y: 8670702.8702 },\n { id: 21613, x: 4714410.046, y: 8756066.6341 },\n { id: 21615, x: 4712791.0207, y: 8749911.6291 },\n { id: 38012, x: 4814429.6052, y: 8681130.2112 },\n { id: 38015, x: 4808186.7511, y: 8670753.1381 },\n { id: 38017, x: 4807948.9807, y: 8677443.1566 },\n { id: 38018, x: 4807352.7266, y: 8662765.146 },\n { id: 25722, x: 4670815.4759, y: 8705027.2841 },\n { id: 70812, x: 4680323.7934, y: 8497946.8849 },\n { id: 25723, x: 4670276.6924, y: 8698728.6739 },\n { id: 70814, x: 4678915.182, y: 8486665.0759 },\n { id: 25725, x: 4668891.3742, y: 8692028.3059 },\n { id: 25730, x: 4665213.4858, y: 8700455.0644 },\n { id: 25732, x: 4663870.9329, y: 8690047.375 },\n { id: 25736, x: 4660548.0905, y: 8694377.6111 },\n { id: 25739, x: 4659313.5849, y: 8700458.0461 },\n { id: 25741, x: 4657102.0458, y: 8688285.0962 },\n { id: 17543, x: 4724985.0584, y: 8610830.9438 },\n { id: 25742, x: 4656866.157, y: 8700527.6193 },\n { id: 17546, x: 4723079.0114, y: 8616175.7216 },\n { id: 17548, x: 4721481.3489, y: 8622382.7646 },\n { id: 17550, x: 4719795.6619, y: 8603321.0636 },\n { id: 17554, x: 4717676.6367, y: 8608946.6252 },\n { id: 9357, x: 4836935.834, y: 8406643.5109 },\n { id: 17556, x: 4716189.6024, y: 8620476.389 },\n { id: 17557, x: 4714722.8942, y: 8604536.6624 },\n { id: 17558, x: 4713589.2377, y: 8614883.7443 },\n { id: 9360, x: 4834809.181, y: 8414087.4629 },\n { id: 46253, x: 4781732.9119, y: 8756382.2372 },\n { id: 46254, x: 4780230.5233, y: 8749450.0828 },\n { id: 17562, x: 4710197.7753, y: 8615254.5888 },\n { id: 46256, x: 4780056.7697, y: 8761284.5658 },\n { id: 13465, x: 4779627.4456, y: 8475219.0758 },\n { id: 9367, x: 4829382.4116, y: 8413829.596 },\n { id: 17566, x: 4707935.6671, y: 8605302.8493 },\n { id: 13467, x: 4778001.5057, y: 8465448.0137 },\n { id: 46260, x: 4775763.9284, y: 8746128.6132 },\n { id: 13468, x: 4777871.1478, y: 8460724.2761 },\n { id: 46261, x: 4774800.7463, y: 8762208.9113 },\n { id: 13470, x: 4776302.2965, y: 8470514.499 },\n { id: 9371, x: 4827127.4472, y: 8407351.136 },\n { id: 13472, x: 4775111.2696, y: 8477182.401 },\n { id: 46265, x: 4771627.6288, y: 8753417.0011 },\n { id: 13474, x: 4774617.5152, y: 8460857.6692 },\n { id: 9377, x: 4823202.2094, y: 8418795.457 },\n { id: 13477, x: 4772069.0392, y: 8466613.4436 },\n { id: 13479, x: 4769937.7323, y: 8477668.8092 },\n { id: 9381, x: 4821282.7825, y: 8399500.7118 },\n { id: 13481, x: 4768812.4193, y: 8471112.4141 },\n { id: 9383, x: 4819728.4732, y: 8408733.1978 },\n { id: 5284, x: 4779111.7068, y: 8589878.3198 },\n { id: 13485, x: 4767190.6503, y: 8460884.4817 },\n { id: 5293, x: 4769171.5013, y: 8589780.8676 },\n { id: 5294, x: 4768827.999, y: 8597040.4669 },\n { id: 1226, x: 4817059.0367, y: 8507951.9821 },\n { id: 1232, x: 4811521.6167, y: 8517351.5591 },\n { id: 50421, x: 4721438.5646, y: 8501823.0467 },\n { id: 1236, x: 4809423.2886, y: 8509617.7993 },\n { id: 50425, x: 4717462.837, y: 8513276.1085 },\n { id: 1238, x: 4806867.8669, y: 8502252.156 },\n { id: 42231, x: 4797746.1476, y: 8626217.8568 },\n { id: 34035, x: 4858491.3627, y: 8705232.6055 },\n { id: 1243, x: 4801879.7844, y: 8501907.7042 },\n { id: 1244, x: 4801747.5501, y: 8510319.6959 },\n { id: 50434, x: 4710609.0154, y: 8503338.9441 },\n { id: 34038, x: 4855747.4715, y: 8712127.127 },\n { id: 1246, x: 4800943.1559, y: 8516690.3047 },\n { id: 42241, x: 4790821.69, y: 8630819.6224 },\n { id: 50440, x: 4707764.781, y: 8518712.7859 },\n { id: 34044, x: 4850769.2422, y: 8716969.5646 },\n { id: 29945, x: 4653778.1941, y: 8686600.5753 },\n { id: 29946, x: 4653887.3772, y: 8692841.4474 },\n { id: 34047, x: 4848154.9271, y: 8707516.1085 },\n { id: 29948, x: 4652473.3517, y: 8703698.8143 },\n { id: 29949, x: 4651785.7385, y: 8694029.7705 },\n { id: 34051, x: 4844396.1647, y: 8718909.424 },\n { id: 42250, x: 4784298.3587, y: 8636520.8073 },\n { id: 34054, x: 4840696.6717, y: 8712061.3476 },\n { id: 29956, x: 4645258.5368, y: 8700138.3372 },\n { id: 29958, x: 4643479.917, y: 8688184.4671 },\n { id: 29959, x: 4643986.288, y: 8705607.5581 },\n { id: 29960, x: 4642326.8653, y: 8696710.8297 },\n { id: 29966, x: 4638886.9605, y: 8699930.7745 },\n { id: 29969, x: 4638269.3163, y: 8705998.9538 },\n { id: 70968, x: 4669756.13, y: 8493632.092 },\n { id: 70972, x: 4666740.7693, y: 8485001.999 },\n { id: 70975, x: 4663826.7664, y: 8496970.1588 },\n { id: 70977, x: 4660311.2908, y: 8483017.1353 },\n { id: 70980, x: 4658091.953, y: 8492306.4865 },\n { id: 70982, x: 4656712.5461, y: 8483676.2571 },\n { id: 9504, x: 4814927.2408, y: 8417641.0893 },\n { id: 9512, x: 4810876.7033, y: 8401598.882 },\n { id: 9514, x: 4809455.9346, y: 8408189.0627 },\n { id: 25913, x: 4671429.0349, y: 8670651.6287 },\n { id: 9517, x: 4807614.3094, y: 8415471.1648 },\n { id: 9519, x: 4805929.0612, y: 8405115.0301 },\n { id: 25917, x: 4667613.1412, y: 8683975.1691 },\n { id: 25918, x: 4666966.7441, y: 8672159.5094 },\n { id: 9523, x: 4802650.0024, y: 8417669.5026 },\n { id: 25920, x: 4666837.5775, y: 8677262.8325 },\n { id: 9524, x: 4802555.6508, y: 8412180.6029 },\n { id: 25923, x: 4664393.4554, y: 8680379.8519 },\n { id: 9527, x: 4801359.4942, y: 8402427.9705 },\n { id: 25924, x: 4663297.354, y: 8670823.2535 },\n { id: 25926, x: 4662340.2417, y: 8685335.5291 },\n { id: 25927, x: 4660354.5238, y: 8674662.1339 },\n { id: 25928, x: 4659783.4943, y: 8667074.6634 },\n { id: 25933, x: 4657749.1387, y: 8677716.9805 },\n { id: 25934, x: 4657065.1286, y: 8670842.4872 },\n { id: 58727, x: 4613641.1489, y: 8561007.5433 },\n { id: 58730, x: 4611181.062, y: 8556746.4668 },\n { id: 30038, x: 4635378.5906, y: 8703842.7836 },\n { id: 58732, x: 4610136.5952, y: 8545386.8332 },\n { id: 30039, x: 4634769.5606, y: 8694599.5133 },\n { id: 30040, x: 4632192.4347, y: 8689236.23 },\n { id: 58734, x: 4608014.2437, y: 8550804.1118 },\n { id: 5447, x: 4757743.8068, y: 8507802.0237 },\n { id: 58735, x: 4607336.0474, y: 8548082.6419 },\n { id: 30042, x: 4627662.3295, y: 8692015.0816 },\n { id: 58736, x: 4606699.246, y: 8555104.4901 },\n { id: 58739, x: 4602906.3729, y: 8557192.1152 },\n { id: 58740, x: 4602389.0254, y: 8552893.3796 },\n { id: 58742, x: 4600467.1865, y: 8550047.3629 },\n { id: 17758, x: 4706671.9338, y: 8622849.206 },\n { id: 17759, x: 4706077.2713, y: 8612013.8696 },\n { id: 17762, x: 4703612.3222, y: 8604277.8626 },\n { id: 17763, x: 4702785.4737, y: 8620382.3274 },\n { id: 38261, x: 4835283.2067, y: 8705100.2251 },\n { id: 17766, x: 4700683.6203, y: 8607757.7704 },\n { id: 17769, x: 4699342.5916, y: 8613980.2902 },\n { id: 9572, x: 4818809.6461, y: 8390111.5153 },\n { id: 50564, x: 4723385.8559, y: 8533636.0537 },\n { id: 17772, x: 4698781.3712, y: 8622016.6187 },\n { id: 38268, x: 4828415.6694, y: 8704937.9509 },\n { id: 9575, x: 4816887.0359, y: 8395609.5189 },\n { id: 38269, x: 4828241.8075, y: 8711510.4798 },\n { id: 17774, x: 4695405.8789, y: 8605173.8789 },\n { id: 17775, x: 4695620.3052, y: 8611774.1059 },\n { id: 50568, x: 4718948.863, y: 8538067.1967 },\n { id: 17776, x: 4694990.4026, y: 8619352.275 },\n { id: 9578, x: 4815011.7769, y: 8384946.4983 },\n { id: 50569, x: 4717222.386, y: 8526706.9436 },\n { id: 50572, x: 4712544.9763, y: 8534326.3216 },\n { id: 9582, x: 4811587.7728, y: 8389976.0336 },\n { id: 17782, x: 4691141.7524, y: 8621510.6383 },\n { id: 9585, x: 4807221.0647, y: 8393069.8903 },\n { id: 54687, x: 4687330.8925, y: 8576739.276 },\n { id: 54688, x: 4686064.7473, y: 8568212.3218 },\n { id: 54689, x: 4683785.7424, y: 8581327.1913 },\n { id: 54693, x: 4680650.718, y: 8574678.6258 },\n { id: 54695, x: 4676359.4387, y: 8567379.2605 },\n { id: 54696, x: 4676273.0184, y: 8577749.0222 },\n { id: 42400, x: 4795764.7133, y: 8660835.9237 },\n { id: 54699, x: 4671010.722, y: 8565412.288 },\n { id: 42402, x: 4792125.8768, y: 8643298.3852 },\n { id: 54700, x: 4671216.0876, y: 8577753.6033 },\n { id: 42404, x: 4791799.0471, y: 8649722.0282 },\n { id: 42410, x: 4787891.0536, y: 8655213.4099 },\n { id: 42414, x: 4784154.1578, y: 8645642.3606 },\n { id: 71117, x: 4668678.8142, y: 8459052.1519 },\n { id: 71123, x: 4662828.3892, y: 8464826.7056 },\n { id: 71127, x: 4658797.3048, y: 8475486.9926 },\n { id: 71132, x: 4652061.9721, y: 8465976.9594 },\n { id: 34242, x: 4878180.9195, y: 8749135.2923 },\n { id: 34243, x: 4877852.5506, y: 8759559.9664 },\n { id: 71136, x: 4628095.0397, y: 8468691.2526 },\n { id: 71137, x: 4623048.6514, y: 8468377.3513 },\n { id: 34248, x: 4872721.6215, y: 8745321.2516 },\n { id: 34249, x: 4872479.5171, y: 8756272.4253 },\n { id: 71142, x: 4616703.1383, y: 8468229.0479 },\n { id: 71143, x: 4614631.0094, y: 8460616.347 },\n { id: 34252, x: 4867697.0747, y: 8752306.841 },\n { id: 34255, x: 4864808.5465, y: 8759653.8217 },\n { id: 1463, x: 4836027.6563, y: 8551906.8251 },\n { id: 1465, x: 4833047.9991, y: 8546667.749 },\n { id: 1469, x: 4831078.9257, y: 8559551.7409 },\n { id: 1473, x: 4827017.7532, y: 8548793.6107 },\n { id: 1482, x: 4821744.0553, y: 8553967.675 },\n { id: 5597, x: 4760672.3833, y: 8526955.4798 },\n { id: 30194, x: 4633667.6714, y: 8670363.0734 },\n { id: 5600, x: 4757283.2626, y: 8537397.4417 },\n { id: 5602, x: 4756462.36, y: 8520593.742 },\n { id: 13802, x: 4892588.9762, y: 8400164.3485 },\n { id: 5604, x: 4754613.4808, y: 8528931.4251 },\n { id: 30199, x: 4632116.2566, y: 8676186.6142 },\n { id: 30200, x: 4632173.1978, y: 8682226.5723 },\n { id: 13805, x: 4886687.5127, y: 8407020.5886 },\n { id: 30204, x: 4628781.4408, y: 8675163.631 },\n { id: 30205, x: 4629007.5304, y: 8686276.782 },\n { id: 13809, x: 4884480.276, y: 8416438.2174 },\n { id: 30207, x: 4627402.3926, y: 8679469.502 },\n { id: 13811, x: 4884001.7971, y: 8400983.8956 },\n { id: 30211, x: 4622571.7669, y: 8668804.7214 },\n { id: 13818, x: 4878621.1266, y: 8411019.0339 },\n { id: 13820, x: 4877425.8136, y: 8405188.3734 },\n { id: 13821, x: 4876073.6044, y: 8416060.5371 },\n { id: 22021, x: 4730751.7831, y: 8773867.4016 },\n { id: 22023, x: 4729223.3877, y: 8778478.7703 },\n { id: 22025, x: 4727332.1133, y: 8767200.5625 },\n { id: 22029, x: 4724694.4728, y: 8783971.4297 },\n { id: 22032, x: 4721842.8161, y: 8774149.989 },\n { id: 22033, x: 4719816.8626, y: 8780560.0209 },\n { id: 22034, x: 4719000.5711, y: 8769428.9797 },\n { id: 22039, x: 4714959.7554, y: 8773065.5063 },\n { id: 22040, x: 4715156.8654, y: 8784284.9033 },\n { id: 38438, x: 4840100.3654, y: 8728118.2258 },\n { id: 38442, x: 4836412.1605, y: 8721999.612 },\n { id: 38443, x: 4835763.5509, y: 8737644.2427 },\n { id: 38448, x: 4830170.9605, y: 8722421.9854 },\n { id: 38450, x: 4829584.9605, y: 8733119.6861 },\n { id: 38456, x: 4822687.0335, y: 8728327.3118 },\n { id: 26167, x: 4689736.9553, y: 8722051.6278 },\n { id: 26168, x: 4689152.6602, y: 8706311.2545 },\n { id: 26171, x: 4686777.6016, y: 8716876.0352 },\n { id: 26177, x: 4681932.6244, y: 8707676.5782 },\n { id: 26178, x: 4680874.0505, y: 8716061.6121 },\n { id: 26181, x: 4678283.7276, y: 8721959.1139 },\n { id: 71272, x: 4632740.8239, y: 8499780.1052 },\n { id: 71273, x: 4632621.2235, y: 8481666.9857 },\n { id: 46679, x: 4803708.1788, y: 8785235.1561 },\n { id: 26184, x: 4675457.4273, y: 8717310.3223 },\n { id: 26185, x: 4674840.6648, y: 8708267.3896 },\n { id: 71275, x: 4627880.401, y: 8489096.1304 },\n { id: 46682, x: 4800637.0213, y: 8797628.4404 },\n { id: 30286, x: 4655198.2442, y: 8710892.6317 },\n { id: 46683, x: 4800260.8733, y: 8788885.055 },\n { id: 71278, x: 4622378.8747, y: 8482156.4016 },\n { id: 46684, x: 4799572.8976, y: 8801361.8202 },\n { id: 30288, x: 4653550.6023, y: 8724582.1682 },\n { id: 30290, x: 4653035.3723, y: 8717244.2807 },\n { id: 71281, x: 4618692.4633, y: 8493050.2033 },\n { id: 46688, x: 4794280.0668, y: 8795507.3192 },\n { id: 42589, x: 4778588.0568, y: 8658471.9054 },\n { id: 30292, x: 4650871.8626, y: 8708096.7544 },\n { id: 46690, x: 4793081.2637, y: 8788092.6265 },\n { id: 42591, x: 4775871.1554, y: 8653048.023 },\n { id: 30294, x: 4647000.4524, y: 8709555.1239 },\n { id: 46691, x: 4793101.5615, y: 8804213.8106 },\n { id: 30297, x: 4638419.341, y: 8711977.6541 },\n { id: 18000, x: 4724991.854, y: 8631458.9709 },\n { id: 46694, x: 4789157.2764, y: 8791370.0758 },\n { id: 18001, x: 4724901.9551, y: 8629719.8064 },\n { id: 18003, x: 4724741.1738, y: 8641277.9873 },\n { id: 42600, x: 4769623.3504, y: 8643339.6175 },\n { id: 42602, x: 4769197.6828, y: 8655817.963 },\n { id: 30305, x: 4656041.0589, y: 8745739.1752 },\n { id: 30308, x: 4654726.7383, y: 8730957.1796 },\n { id: 18011, x: 4719036.3214, y: 8632024.828 },\n { id: 63101, x: 4743066.5503, y: 8445964.714 },\n { id: 18013, x: 4718177.4623, y: 8642871.6114 },\n { id: 18014, x: 4716736.1002, y: 8628494.0696 },\n { id: 63105, x: 4740876.2034, y: 8458269.6155 },\n { id: 63108, x: 4738743.3621, y: 8439543.2516 },\n { id: 9821, x: 4835406.1997, y: 8437233.1752 },\n { id: 63110, x: 4737680.5633, y: 8443960.2388 },\n { id: 18021, x: 4711024.2854, y: 8625503.5534 },\n { id: 63111, x: 4737241.4739, y: 8444186.0542 },\n { id: 63112, x: 4737048.8881, y: 8447710.7072 },\n { id: 18023, x: 4710224.9077, y: 8633897.1791 },\n { id: 9825, x: 4832634.6413, y: 8424976.897 },\n { id: 9826, x: 4831055.6194, y: 8431600.7872 },\n { id: 67213, x: 4724730.5893, y: 8452300.0984 },\n { id: 67216, x: 4723280.5016, y: 8441793.8615 },\n { id: 67220, x: 4719966.8922, y: 8454720.4419 },\n { id: 30329, x: 4654169.2177, y: 8789292.7734 },\n { id: 63122, x: 4730398.6007, y: 8441920.5126 },\n { id: 67223, x: 4718372.6308, y: 8447853.4419 },\n { id: 9838, x: 4824739.0265, y: 8425817.7056 },\n { id: 63126, x: 4727987.9469, y: 8447524.9085 },\n { id: 9841, x: 4822749.3846, y: 8435254.0819 },\n { id: 67228, x: 4714381.8898, y: 8441910.513 },\n { id: 67229, x: 4714276.6871, y: 8440971.5821 },\n { id: 67230, x: 4713245.8803, y: 8450445.7806 },\n { id: 34440, x: 4877273.5155, y: 8778349.8286 },\n { id: 67236, x: 4708488.999, y: 8451584.4225 },\n { id: 34447, x: 4872054.8331, y: 8770175.3929 },\n { id: 34448, x: 4872210.6241, y: 8777830.6893 },\n { id: 34449, x: 4871436.8006, y: 8763767.1789 },\n { id: 1657, x: 4833300.7454, y: 8573917.0422 },\n { id: 50848, x: 4706756.9059, y: 8537337.5556 },\n { id: 50852, x: 4704428.1446, y: 8525375.0516 },\n { id: 1664, x: 4827841.2224, y: 8567059.1553 },\n { id: 1666, x: 4827285.998, y: 8576907.1537 },\n { id: 13965, x: 4891216.2178, y: 8393061.4563 },\n { id: 34461, x: 4863485.0884, y: 8775088.4716 },\n { id: 1669, x: 4824086.6376, y: 8561107.4356 },\n { id: 34464, x: 4861514.9148, y: 8768565.5774 },\n { id: 1673, x: 4822123.0753, y: 8569830.4282 },\n { id: 50862, x: 4697236.758, y: 8525439.5875 },\n { id: 13972, x: 4882811.7457, y: 8389705.6711 },\n { id: 50864, x: 4696354.1787, y: 8534155.1587 },\n { id: 13973, x: 4880947.6615, y: 8395881.3559 },\n { id: 50869, x: 4691017.8061, y: 8527504.4432 },\n { id: 13979, x: 4877348.6191, y: 8382556.301 },\n { id: 71382, x: 4650930.8152, y: 8484208.0119 },\n { id: 71388, x: 4645012.5484, y: 8493146.4529 },\n { id: 71391, x: 4642764.1947, y: 8484710.9697 },\n { id: 71397, x: 4637092.4558, y: 8485874.6504 },\n { id: 71400, x: 4634650.5141, y: 8493562.1969 },\n { id: 30410, x: 4656376.7885, y: 8798675.0585 },\n { id: 30415, x: 4649829.6235, y: 8794774.3428 },\n { id: 30419, x: 4658912.2275, y: 8825639.8295 },\n { id: 30422, x: 4656614.272, y: 8812162.9576 },\n { id: 30433, x: 4659183.8161, y: 8833206.4483 },\n { id: 26340, x: 4692780.0181, y: 8727152.1976 },\n { id: 59134, x: 4607766.348, y: 8573690.4402 },\n { id: 26342, x: 4692361.0518, y: 8744433.0287 },\n { id: 59135, x: 4607500.6086, y: 8566109.6119 },\n { id: 26343, x: 4690331.1339, y: 8732763.3905 },\n { id: 59136, x: 4607309.1239, y: 8580024.3205 },\n { id: 26346, x: 4686901.1679, y: 8737777.9617 },\n { id: 26347, x: 4686044.659, y: 8728284.4112 },\n { id: 26348, x: 4685464.6706, y: 8733073.2497 },\n { id: 26349, x: 4684866.6158, y: 8745299.1018 },\n { id: 59143, x: 4602029.4538, y: 8565330.6067 },\n { id: 59144, x: 4600148.6929, y: 8571582.7377 },\n { id: 26352, x: 4681715.3099, y: 8727381.9355 },\n { id: 59146, x: 4598579.4632, y: 8580446.8309 },\n { id: 26354, x: 4680932.4569, y: 8739177.6372 },\n { id: 59148, x: 4596996.9577, y: 8566917.924 },\n { id: 26359, x: 4677408.3543, y: 8733400.6029 },\n { id: 26365, x: 4674276.6894, y: 8727300.9582 },\n { id: 38675, x: 4822569.092, y: 8733893.7805 },\n { id: 38677, x: 4818232.5864, y: 8738792.4594 },\n { id: 5886, x: 4757076.167, y: 8555158.2225 },\n { id: 38679, x: 4817352.7008, y: 8725737.6838 },\n { id: 38682, x: 4812040.4113, y: 8732335.8236 },\n { id: 38683, x: 4811520.3172, y: 8726304.466 },\n { id: 5891, x: 4752559.5722, y: 8548375.6469 },\n { id: 38688, x: 4806946.8411, y: 8740916.8166 },\n { id: 5896, x: 4747999.4146, y: 8556078.6175 },\n { id: 5899, x: 4746360.3044, y: 8547006.1561 },\n { id: 67411, x: 4705644.0668, y: 8456371.6006 },\n { id: 67414, x: 4703973.9957, y: 8448960.9749 },\n { id: 67422, x: 4697128.786, y: 8455020.3575 },\n { id: 67423, x: 4695592.7558, y: 8448359.2123 },\n { id: 34631, x: 4855204.0964, y: 8769099.9985 },\n { id: 67425, x: 4695043.1958, y: 8439460.5385 },\n { id: 34635, x: 4853915.5279, y: 8776748.5258 },\n { id: 34641, x: 4849963.3723, y: 8762715.6844 },\n { id: 71537, x: 4648363.5533, y: 8477770.801 },\n { id: 34648, x: 4845333.0319, y: 8776063.733 },\n { id: 71541, x: 4644834.4999, y: 8468494.9424 },\n { id: 34651, x: 4843243.4213, y: 8763885.4732 },\n { id: 71544, x: 4640403.1304, y: 8475006.3424 },\n { id: 71546, x: 4637631.7335, y: 8463524.4849 },\n { id: 18277, x: 4724404.7308, y: 8650278.6417 },\n { id: 18278, x: 4723008.0863, y: 8659008.9845 },\n { id: 18283, x: 4718360.2878, y: 8647734.1149 },\n { id: 18284, x: 4717659.9272, y: 8661779.6806 },\n { id: 18286, x: 4716019.9148, y: 8653611.5683 },\n { id: 10089, x: 4829034.4372, y: 8454191.4575 },\n { id: 18288, x: 4713841.9048, y: 8644265.7871 },\n { id: 10090, x: 4829123.2867, y: 8445012.8046 },\n { id: 18290, x: 4713537.1617, y: 8644399.3054 },\n { id: 10093, x: 4826336.0187, y: 8439785.8867 },\n { id: 18293, x: 4711307.9075, y: 8654519.9574 },\n { id: 51087, x: 4705835.5309, y: 8512623.9647 },\n { id: 10101, x: 4820453.4973, y: 8452010.7667 },\n { id: 10104, x: 4819212.8504, y: 8443969.4667 },\n { id: 51095, x: 4700055.8982, y: 8507117.2756 },\n { id: 22402, x: 4711093.4162, y: 8769598.6174 },\n { id: 22406, x: 4708461.2092, y: 8778087.8303 },\n { id: 22408, x: 4707452.8714, y: 8785657.6189 },\n { id: 51102, x: 4695686.8511, y: 8514234.5801 },\n { id: 22410, x: 4705884.3566, y: 8772029.8142 },\n { id: 1916, x: 4815182.0766, y: 8561991.7227 },\n { id: 22413, x: 4703075.3993, y: 8781031.7262 },\n { id: 1919, x: 4813813.5899, y: 8567884.605 },\n { id: 22416, x: 4698587.3462, y: 8778230.2097 },\n { id: 22419, x: 4697491.8713, y: 8771551.4243 },\n { id: 22420, x: 4696982.1275, y: 8783167.849 },\n { id: 1925, x: 4810298.5609, y: 8574782.7213 },\n { id: 1930, x: 4806021.3588, y: 8561510.9093 },\n { id: 1934, x: 4803791.1471, y: 8578486.3416 },\n { id: 1935, x: 4803097.1773, y: 8568512.8147 },\n { id: 26548, x: 4673421.3853, y: 8742944.8432 },\n { id: 26549, x: 4672534.6986, y: 8735559.0813 },\n { id: 26555, x: 4667785.02, y: 8728676.3739 },\n { id: 26556, x: 4667588.0416, y: 8736427.9353 },\n { id: 26558, x: 4666901.8679, y: 8744493.7191 },\n { id: 26560, x: 4664167.8987, y: 8731193.2951 },\n { id: 26561, x: 4663881.0931, y: 8736275.2024 },\n { id: 26567, x: 4659036.6227, y: 8737507.1742 },\n { id: 26568, x: 4658438.5275, y: 8730189.6008 },\n { id: 71679, x: 4632188.3683, y: 8421480.183 },\n { id: 71680, x: 4630382.7395, y: 8426720.0781 },\n { id: 71683, x: 4627432.3826, y: 8431539.1019 },\n { id: 71685, x: 4626505.1233, y: 8422427.2211 },\n { id: 71689, x: 4620802.4525, y: 8419874.2662 },\n { id: 71690, x: 4619176.2984, y: 8427585.3168 },\n { id: 71693, x: 4616940.5385, y: 8423727.8517 },\n { id: 30717, x: 4611241.5007, y: 8606395.2529 },\n { id: 30718, x: 4610548.1354, y: 8622076.464 },\n { id: 55313, x: 4669820.566, y: 8570354.564 },\n { id: 55314, x: 4666113.5418, y: 8581981.0753 },\n { id: 30720, x: 4608173.7814, y: 8617085.1332 },\n { id: 55318, x: 4661765.757, y: 8566778.443 },\n { id: 55320, x: 4657966.7189, y: 8575440.2407 },\n { id: 30728, x: 4603590.2204, y: 8611694.4631 },\n { id: 30729, x: 4603021.7598, y: 8621876.267 },\n { id: 30731, x: 4599153.025, y: 8622353.4752 },\n { id: 30732, x: 4598534.589, y: 8613730.1981 },\n { id: 38957, x: 4820750.9823, y: 8717027.6504 },\n { id: 38958, x: 4819189.9885, y: 8703599.6936 },\n { id: 34859, x: 4859611.5549, y: 8747811.088 },\n { id: 34860, x: 4858501.0437, y: 8756948.7022 },\n { id: 38960, x: 4817604.3283, y: 8709827.204 },\n { id: 38966, x: 4811548.6322, y: 8704357.7042 },\n { id: 6176, x: 4756810.065, y: 8579623.2023 },\n { id: 34869, x: 4852732.1717, y: 8741595.5961 },\n { id: 38969, x: 4809731.9414, y: 8714360.9887 },\n { id: 34870, x: 4852447.4067, y: 8751561.5923 },\n { id: 6178, x: 4755929.7782, y: 8572296.6182 },\n { id: 6180, x: 4753406.5489, y: 8561969.3366 },\n { id: 6184, x: 4750952.5556, y: 8569305.8629 },\n { id: 6186, x: 4749332.2774, y: 8575892.9707 },\n { id: 34880, x: 4845620.2568, y: 8753152.4126 },\n { id: 34884, x: 4844034.0596, y: 8747845.7773 },\n { id: 14412, x: 4759599.3499, y: 8613812.5164 },\n { id: 14414, x: 4755767.3238, y: 8603810.1447 },\n { id: 14417, x: 4753957.7908, y: 8610048.7911 },\n { id: 14419, x: 4751321.1026, y: 8617732.4857 },\n { id: 67710, x: 4704882.2782, y: 8436939.2339 },\n { id: 22622, x: 4711162.9318, y: 8759530.1104 },\n { id: 10325, x: 4813553.1442, y: 8457455.3909 },\n { id: 51315, x: 4721292.2293, y: 8556611.2321 },\n { id: 14425, x: 4746628.2619, y: 8621745.523 },\n { id: 51316, x: 4720926.7745, y: 8550209.9947 },\n { id: 14426, x: 4746114.2137, y: 8608446.9381 },\n { id: 51317, x: 4719067.8409, y: 8542295.4335 },\n { id: 67714, x: 4701080.9831, y: 8425500.006 },\n { id: 59517, x: 4595179.6252, y: 8583429.7968 },\n { id: 10331, x: 4810140.0031, y: 8443855.1508 },\n { id: 59519, x: 4594676.9358, y: 8574715.2298 },\n { id: 22629, x: 4707326.0061, y: 8755238.7487 },\n { id: 51322, x: 4715221.7245, y: 8544079.5149 },\n { id: 22631, x: 4705973.472, y: 8750525.3669 },\n { id: 59522, x: 4591702.869, y: 8569949.0755 },\n { id: 51324, x: 4714247.3373, y: 8551096.6551 },\n { id: 26731, x: 4671760.8966, y: 8722057.213 },\n { id: 67721, x: 4695132.5711, y: 8420085.6931 },\n { id: 51326, x: 4713650.9087, y: 8557174.9736 },\n { id: 10336, x: 4805899.1962, y: 8458529.4895 },\n { id: 22634, x: 4705423.6522, y: 8759437.0769 },\n { id: 51328, x: 4710373.6765, y: 8550121.8393 },\n { id: 22636, x: 4702446.9198, y: 8762727.4253 },\n { id: 10339, x: 4802800.936, y: 8449799.6853 },\n { id: 59527, x: 4589341.2926, y: 8575318.3347 },\n { id: 26736, x: 4668509.3383, y: 8715229.6873 },\n { id: 59528, x: 4589434.9117, y: 8580185.2057 },\n { id: 51331, x: 4707651.8733, y: 8541987.1921 },\n { id: 22638, x: 4701947.5217, y: 8757149.751 },\n { id: 71826, x: 4627726.5314, y: 8442640.7938 },\n { id: 67727, x: 4689834.7048, y: 8427996.8031 },\n { id: 26738, x: 4667762.1541, y: 8710578.4612 },\n { id: 71827, x: 4626482.7723, y: 8458055.082 },\n { id: 71828, x: 4625734.4546, y: 8450223.4141 },\n { id: 22641, x: 4697880.6246, y: 8754078.3163 },\n { id: 59533, x: 4585134.9247, y: 8574488.3362 },\n { id: 26742, x: 4664795.437, y: 8725105.2283 },\n { id: 22643, x: 4696908.9542, y: 8765906.7885 },\n { id: 71831, x: 4620997.6861, y: 8458288.7841 },\n { id: 59534, x: 4584535.2807, y: 8563383.2165 },\n { id: 71832, x: 4621165.1515, y: 8437978.7265 },\n { id: 59535, x: 4580627.8514, y: 8565865.8014 },\n { id: 26744, x: 4662375.2392, y: 8712924.404 },\n { id: 22645, x: 4696191.545, y: 8748297.0485 },\n { id: 71833, x: 4619999.8358, y: 8445306.254 },\n { id: 26746, x: 4661631.9532, y: 8719226.2575 },\n { id: 26748, x: 4659425.0943, y: 8708195.3329 },\n { id: 26750, x: 4658280.3828, y: 8726095.8872 },\n { id: 18552, x: 4708933.7124, y: 8647042.5407 },\n { id: 26752, x: 4656339.2859, y: 8720409.5787 },\n { id: 18554, x: 4707771.0016, y: 8653317.2736 },\n { id: 18556, x: 4706761.6085, y: 8658877.1957 },\n { id: 18557, x: 4705543.2044, y: 8650173.3981 },\n { id: 18562, x: 4701465.8699, y: 8663288.7109 },\n { id: 18563, x: 4700739.4316, y: 8653575.5712 },\n { id: 18567, x: 4698144.3956, y: 8663590.857 },\n { id: 43165, x: 4780604.5597, y: 8622098.6352 },\n { id: 18571, x: 4696362.4184, y: 8659743.2085 },\n { id: 18572, x: 4694691.2874, y: 8647304.5297 },\n { id: 18573, x: 4694289.2379, y: 8653828.7581 },\n { id: 43170, x: 4776610.4949, y: 8629943.3843 },\n { id: 18577, x: 4691341.1224, y: 8657364.8864 },\n { id: 43172, x: 4775490.5011, y: 8638137.5292 },\n { id: 43183, x: 4768220.0356, y: 8635368.5077 },\n { id: 59581, x: 4595234.7323, y: 8547556.0825 },\n { id: 43185, x: 4766680.5433, y: 8627501.8824 },\n { id: 59582, x: 4595383.4063, y: 8556676.5086 },\n { id: 59583, x: 4593637.1719, y: 8562674.6211 },\n { id: 59584, x: 4592955.0027, y: 8551369.6599 },\n { id: 59586, x: 4587601.9917, y: 8551557.2599 },\n { id: 59587, x: 4587051.7245, y: 8558155.8733 },\n { id: 35019, x: 4879590.197, y: 8787548.8914 },\n { id: 63715, x: 4739497.8218, y: 8431596.5145 },\n { id: 63716, x: 4739481.0905, y: 8426601.507 },\n { id: 35023, x: 4877384.6937, y: 8797242.3208 },\n { id: 63717, x: 4739144.2825, y: 8419847.4972 },\n { id: 35028, x: 4873570.3551, y: 8794181.5387 },\n { id: 71920, x: 4646636.5246, y: 8457252.3991 },\n { id: 71921, x: 4645483.7375, y: 8446962.926 },\n { id: 71922, x: 4644820.075, y: 8440896.072 },\n { id: 63724, x: 4733761.7139, y: 8432451.4094 },\n { id: 35031, x: 4872138.6697, y: 8787286.7615 },\n { id: 6339, x: 4742609.0692, y: 8567356.2592 },\n { id: 6340, x: 4742898.8837, y: 8580177.0872 },\n { id: 71925, x: 4635485.0402, y: 8454413.4016 },\n { id: 63727, x: 4732786.9398, y: 8424384.7314 },\n { id: 35034, x: 4869422.2441, y: 8783658.2319 },\n { id: 71927, x: 4634657.8689, y: 8441472.009 },\n { id: 6343, x: 4740544.472, y: 8561776.0539 },\n { id: 35037, x: 4867617.5451, y: 8797138.1198 },\n { id: 6344, x: 4737961.1436, y: 8571236.2512 },\n { id: 35038, x: 4866361.019, y: 8790095.714 },\n { id: 71930, x: 4650494.3725, y: 8434735.6331 },\n { id: 35039, x: 4864530.14, y: 8783942.4474 },\n { id: 63733, x: 4726237.0376, y: 8436251.0177 },\n { id: 71932, x: 4646807.3869, y: 8427077.6152 },\n { id: 6352, x: 4731674.865, y: 8564162.3276 },\n { id: 6353, x: 4731511.138, y: 8575340.0154 },\n { id: 6354, x: 4731278.077, y: 8575187.406 },\n { id: 71939, x: 4640796.88, y: 8421993.4072 },\n { id: 71940, x: 4640311.7768, y: 8432193.5362 },\n { id: 71946, x: 4634834.9888, y: 8431063.6534 },\n { id: 39163, x: 4837870.8478, y: 8760242.1741 },\n { id: 39164, x: 4837340.6051, y: 8753024.4883 },\n { id: 39166, x: 4835570.9801, y: 8748175.0076 },\n { id: 39175, x: 4827549.4061, y: 8756898.5928 },\n { id: 39176, x: 4826429.0478, y: 8748992.1751 },\n { id: 39178, x: 4824355.6222, y: 8744398.3049 },\n { id: 30985, x: 4595349.8197, y: 8605654.0843 },\n { id: 30988, x: 4593989.1158, y: 8618072.1112 },\n { id: 30992, x: 4591446.9534, y: 8610572.7684 },\n { id: 26893, x: 4693360.7122, y: 8756550.5548 },\n { id: 30993, x: 4590658.5918, y: 8624043.5176 },\n { id: 26897, x: 4690041.0473, y: 8754556.3245 },\n { id: 30998, x: 4588458.8648, y: 8604682.4897 },\n { id: 26899, x: 4689776.7542, y: 8761240.9113 },\n { id: 30999, x: 4586625.3045, y: 8613450.8809 },\n { id: 26900, x: 4688427.131, y: 8749326.8283 },\n { id: 31000, x: 4586273.1857, y: 8617865.4775 },\n { id: 31001, x: 4585611.2471, y: 8608034.1051 },\n { id: 31002, x: 4586014.6205, y: 8621731.8646 },\n { id: 31005, x: 4582740.2095, y: 8610875.7412 },\n { id: 26907, x: 4682941.0748, y: 8756818.0029 },\n { id: 31007, x: 4581326.8892, y: 8615631.5307 },\n { id: 31008, x: 4580964.4083, y: 8607048.4136 },\n { id: 31009, x: 4580979.1204, y: 8621077.1751 },\n { id: 31011, x: 4578958.1984, y: 8608327.9797 },\n { id: 31012, x: 4578540.3713, y: 8615433.6147 },\n { id: 26913, x: 4678919.6929, y: 8750032.6147 },\n { id: 31013, x: 4578263.73, y: 8611802.3848 },\n { id: 26915, x: 4678163.8433, y: 8761535.1114 },\n { id: 26917, x: 4676598.8318, y: 8758278.8278 },\n { id: 14655, x: 4741185.458, y: 8615236.5636 },\n { id: 47456, x: 4807143.2188, y: 8819693.3871 },\n { id: 14664, x: 4733942.7419, y: 8616694.0101 },\n { id: 35162, x: 4880198.7703, y: 8816436.9322 },\n { id: 47462, x: 4802682.338, y: 8810433.1766 },\n { id: 2373, x: 4816960.8214, y: 8547361.6119 },\n { id: 47463, x: 4801873.2607, y: 8820883.8125 },\n { id: 47465, x: 4800373.3395, y: 8813464.2895 },\n { id: 47467, x: 4798668.7049, y: 8816546.5967 },\n { id: 35170, x: 4873726.592, y: 8812674.043 },\n { id: 35171, x: 4872144.6348, y: 8806432.3031 },\n { id: 47469, x: 4798140.1662, y: 8819896.4793 },\n { id: 35175, x: 4871008.0715, y: 8819462.8873 },\n { id: 2384, x: 4810007.9078, y: 8555729.9642 },\n { id: 47474, x: 4795474.826, y: 8808895.2903 },\n { id: 2385, x: 4807927.1325, y: 8545509.8756 },\n { id: 35181, x: 4866151.9555, y: 8805532.0617 },\n { id: 47479, x: 4790415.9365, y: 8814131.8386 },\n { id: 35184, x: 4863763.3979, y: 8813572.3447 },\n { id: 2392, x: 4801956.7376, y: 8541759.1943 },\n { id: 2394, x: 4801508.9418, y: 8550511.563 },\n { id: 43395, x: 4801057.2249, y: 8665271.5174 },\n { id: 43396, x: 4799771.3312, y: 8672854.0576 },\n { id: 43400, x: 4796003.5928, y: 8681652.0076 },\n { id: 22909, x: 4732246.9246, y: 8793415.4107 },\n { id: 43406, x: 4790897.9284, y: 8671151.0768 },\n { id: 22911, x: 4732356.3099, y: 8804955.1213 },\n { id: 63903, x: 4760867.0657, y: 8463148.6152 },\n { id: 43408, x: 4788963.442, y: 8662906.3742 },\n { id: 63905, x: 4758337.0267, y: 8474508.1054 },\n { id: 63907, x: 4757836.2532, y: 8469399.1801 },\n { id: 22918, x: 4721839.6061, y: 8791074.0529 },\n { id: 63909, x: 4756629.2426, y: 8460772.9975 },\n { id: 43414, x: 4785919.0598, y: 8669381.4514 },\n { id: 43415, x: 4784423.8827, y: 8677201.173 },\n { id: 22920, x: 4720069.0897, y: 8799459.8651 },\n { id: 63914, x: 4751943.286, y: 8474926.2008 },\n { id: 63915, x: 4751525.5934, y: 8467029.649 },\n { id: 6529, x: 4736576.9397, y: 8552683.3734 },\n { id: 63918, x: 4748964.9138, y: 8464448.4331 },\n { id: 63919, x: 4748462.7376, y: 8477205.6069 },\n { id: 68019, x: 4724711.7902, y: 8474927.6816 },\n { id: 14733, x: 4749760.5598, y: 8641075.8602 },\n { id: 63922, x: 4746336.6659, y: 8467217.2413 },\n { id: 39329, x: 4839645.9509, y: 8774100.6435 },\n { id: 63924, x: 4743977.7849, y: 8473098.3167 },\n { id: 68026, x: 4721503.0128, y: 8467453.2641 },\n { id: 6541, x: 4725819.542, y: 8545046.8808 },\n { id: 39338, x: 4833178.9951, y: 8767599.8236 },\n { id: 68032, x: 4718152.2314, y: 8474415.4412 },\n { id: 68035, x: 4716174.3646, y: 8461011.6208 },\n { id: 39346, x: 4829645.0942, y: 8776519.0927 },\n { id: 39347, x: 4827830.8064, y: 8764153.2413 },\n { id: 68042, x: 4710457.2001, y: 8472629.5884 },\n { id: 10665, x: 4818059.6473, y: 8437964.6099 },\n { id: 59854, x: 4614439.8374, y: 8596877.2996 },\n { id: 10666, x: 4816685.8852, y: 8431079.6413 },\n { id: 59855, x: 4614220.9456, y: 8591551.7845 },\n { id: 59856, x: 4614482.7348, y: 8602709.6901 },\n { id: 10671, x: 4813231.1876, y: 8425370.0882 },\n { id: 59860, x: 4610907.6393, y: 8586913.2705 },\n { id: 59861, x: 4610782.3639, y: 8595846.0999 },\n { id: 59862, x: 4608791.2609, y: 8603935.1152 },\n { id: 14774, x: 4751899.0273, y: 8654578.0064 },\n { id: 51666, x: 4720385.2055, y: 8569423.51 },\n { id: 10676, x: 4809743.3234, y: 8430989.4252 },\n { id: 59865, x: 4606686.8178, y: 8590130.3761 },\n { id: 51667, x: 4718604.7357, y: 8564137.05 },\n { id: 27073, x: 4692008.6011, y: 8775605.1729 },\n { id: 51668, x: 4718561.524, y: 8579342.9068 },\n { id: 27074, x: 4689902.9025, y: 8769781.9585 },\n { id: 27075, x: 4690404.3563, y: 8787682.539 },\n { id: 14778, x: 4747782.1346, y: 8646647.7243 },\n { id: 59868, x: 4605455.7787, y: 8599065.1447 },\n { id: 27076, x: 4690178.9398, y: 8782684.3874 },\n { id: 59869, x: 4603958.7874, y: 8603565.196 },\n { id: 10682, x: 4806521.2999, y: 8420210.4919 },\n { id: 51674, x: 4712750.6611, y: 8571726.4485 },\n { id: 51675, x: 4711807.8534, y: 8563737.861 },\n { id: 27081, x: 4685404.7719, y: 8774254.7793 },\n { id: 59874, x: 4599924.2667, y: 8585653.282 },\n { id: 27083, x: 4684629.9109, y: 8770015.2139 },\n { id: 10687, x: 4802675.131, y: 8430544.2717 },\n { id: 59876, x: 4598049.3222, y: 8595700.5741 },\n { id: 51678, x: 4709655.6478, y: 8580500.8676 },\n { id: 10688, x: 4801940.7213, y: 8438759.4553 },\n { id: 51680, x: 4707204.9475, y: 8564643.3972 },\n { id: 31185, x: 4615893.3179, y: 8631144.2956 },\n { id: 72175, x: 4628523.4738, y: 8414163.2174 },\n { id: 31186, x: 4615151.0607, y: 8624810.2699 },\n { id: 27088, x: 4680044.352, y: 8768669.6076 },\n { id: 10692, x: 4800337.1418, y: 8422466.3753 },\n { id: 27090, x: 4678607.181, y: 8785040.1566 },\n { id: 31190, x: 4612360.8365, y: 8637747.4811 },\n { id: 27091, x: 4678186.2101, y: 8775595.4422 },\n { id: 31193, x: 4609608.9735, y: 8644876.7117 },\n { id: 31194, x: 4609398.1222, y: 8639825.0714 },\n { id: 31195, x: 4608793.6865, y: 8631475.5906 },\n { id: 72186, x: 4647697.9983, y: 8416357.0455 },\n { id: 31197, x: 4605786.1801, y: 8642426.419 },\n { id: 72187, x: 4644041.5257, y: 8409847.0192 },\n { id: 31200, x: 4602653.4746, y: 8634140.6425 },\n { id: 72190, x: 4638515.4979, y: 8415973.4632 },\n { id: 72193, x: 4635433.5832, y: 8411452.0902 },\n { id: 31204, x: 4599708.8108, y: 8628258.8899 },\n { id: 31207, x: 4598139.0679, y: 8636837.1402 },\n { id: 55820, x: 4669708.4415, y: 8544694.2377 },\n { id: 55823, x: 4666868.1325, y: 8560709.385 },\n { id: 55825, x: 4664666.9649, y: 8547889.6201 },\n { id: 55827, x: 4661602.9191, y: 8557393.5652 },\n { id: 55829, x: 4659936.1593, y: 8544456.3756 },\n { id: 55830, x: 4658707.855, y: 8549496.5181 },\n { id: 55832, x: 4656442.6311, y: 8561826.2366 },\n { id: 55836, x: 4652047.7326, y: 8556716.6653 },\n { id: 72249, x: 4608610.1456, y: 8412800.6944 },\n { id: 2570, x: 4835330.1343, y: 8580805.1983 },\n { id: 2571, x: 4835238.4291, y: 8591130.8754 },\n { id: 47662, x: 4788170.1665, y: 8817470.7547 },\n { id: 47665, x: 4786236.268, y: 8811264.0114 },\n { id: 72259, x: 4590632.896, y: 8416260.5907 },\n { id: 72261, x: 4578700.7635, y: 8411101.3854 },\n { id: 27173, x: 4674612.8051, y: 8771043.9432 },\n { id: 2581, x: 4827327.7128, y: 8589534.2358 },\n { id: 2582, x: 4826660.1984, y: 8596106.352 },\n { id: 47672, x: 4781739.2251, y: 8812724.8994 },\n { id: 27177, x: 4672103.8061, y: 8788649.2748 },\n { id: 35376, x: 4862464.4096, y: 8821254.0082 },\n { id: 27178, x: 4670388.0509, y: 8781244.2646 },\n { id: 2584, x: 4825568.6479, y: 8582415.3217 },\n { id: 35377, x: 4861401.7269, y: 8803570.3458 },\n { id: 27179, x: 4669314.9376, y: 8773789.2402 },\n { id: 47675, x: 4779350.0733, y: 8817468.5507 },\n { id: 27180, x: 4668911.754, y: 8770295.3586 },\n { id: 47676, x: 4777674.5731, y: 8808566.2917 },\n { id: 35381, x: 4857843.6647, y: 8807247.9522 },\n { id: 27186, x: 4665638.8657, y: 8778259.7438 },\n { id: 27187, x: 4663979.83, y: 8787619.9281 },\n { id: 35387, x: 4853593.8325, y: 8815063.349 },\n { id: 2595, x: 4818999.2766, y: 8595455.8926 },\n { id: 35389, x: 4852257.2483, y: 8821020.7362 },\n { id: 27192, x: 4658132.7472, y: 8782202.8425 },\n { id: 35392, x: 4851212.8828, y: 8802562.4796 },\n { id: 35393, x: 4849615.7601, y: 8809044.068 },\n { id: 39495, x: 4822589.7986, y: 8765017.4966 },\n { id: 39498, x: 4820867.8332, y: 8772915.4407 },\n { id: 39506, x: 4814239.3935, y: 8771645.7971 },\n { id: 39509, x: 4812753.5373, y: 8780896.1142 },\n { id: 39513, x: 4809930.261, y: 8765986.7239 },\n { id: 39515, x: 4807574.0265, y: 8774552.3343 },\n { id: 68210, x: 4722034.5947, y: 8494117.7524 },\n { id: 68214, x: 4718510.4682, y: 8482683.1664 },\n { id: 43625, x: 4799005.7158, y: 8699115.414 },\n { id: 43626, x: 4796827.4022, y: 8689573.5109 },\n { id: 68222, x: 4712676.5368, y: 8490411.7564 },\n { id: 68223, x: 4712851.0936, y: 8479883.5916 },\n { id: 43632, x: 4793194.6677, y: 8698047.5367 },\n { id: 43634, x: 4790611.3001, y: 8684714.9987 },\n { id: 43635, x: 4790643.0074, y: 8691994.4716 },\n { id: 43639, x: 4786543.2421, y: 8694599.662 },\n { id: 43641, x: 4786128.5885, y: 8686145.3477 },\n { id: 27259, x: 4673798.4591, y: 8751701.5339 },\n { id: 27261, x: 4671578.1456, y: 8764673.425 },\n { id: 27268, x: 4666724.9337, y: 8754057.8102 },\n { id: 27269, x: 4666676.9669, y: 8760588.4776 },\n { id: 27271, x: 4665203.2299, y: 8748219.1803 },\n { id: 23178, x: 4708860.2512, y: 8794975.7507 },\n { id: 23180, x: 4707424.7554, y: 8803684.3762 },\n { id: 23185, x: 4702672.118, y: 8790908.2559 },\n { id: 23186, x: 4702564.4261, y: 8797036.2187 },\n { id: 23188, x: 4700595.0638, y: 8804306.2877 },\n { id: 14992, x: 4740877.9547, y: 8661421.2473 },\n { id: 14995, x: 4737796.221, y: 8650707.1907 },\n { id: 14996, x: 4737531.2019, y: 8643870.9701 },\n { id: 19099, x: 4708887.1, y: 8639559.6486 },\n { id: 15002, x: 4734318.8327, y: 8662824.6862 },\n { id: 19103, x: 4707698.3422, y: 8626632.5698 },\n { id: 51897, x: 4707066.2147, y: 8572389.6192 },\n { id: 19106, x: 4706120.9876, y: 8634570.2826 },\n { id: 51899, x: 4706205.5089, y: 8576647.6423 },\n { id: 51900, x: 4704877.0012, y: 8580180.3511 },\n { id: 15009, x: 4728485.7306, y: 8654815.4316 },\n { id: 31406, x: 4613594.9895, y: 8648240.153 },\n { id: 31407, x: 4612695.4402, y: 8658844.6088 },\n { id: 51904, x: 4702266.3138, y: 8567718.46 },\n { id: 72399, x: 4608546.2186, y: 8419678.0711 },\n { id: 19113, x: 4703987.5196, y: 8642450.3095 },\n { id: 72400, x: 4608219.5997, y: 8425637.4754 },\n { id: 31411, x: 4608305.5541, y: 8650662.4064 },\n { id: 51907, x: 4700414.1277, y: 8574502.5665 },\n { id: 31412, x: 4607903.2279, y: 8654640.9979 },\n { id: 19116, x: 4701703.2185, y: 8629506.029 },\n { id: 72403, x: 4602578.4227, y: 8432431.7638 },\n { id: 19117, x: 4701335.8345, y: 8637491.1311 },\n { id: 51910, x: 4699181.5997, y: 8578129.9638 },\n { id: 31415, x: 4606677.5677, y: 8665049.7637 },\n { id: 72405, x: 4601181.2023, y: 8426066.5387 },\n { id: 72406, x: 4601004.6889, y: 8418912.9704 },\n { id: 31417, x: 4603795.5295, y: 8647548.5496 },\n { id: 19120, x: 4697918.4783, y: 8642134.3444 },\n { id: 31418, x: 4603533.856, y: 8654860.0165 },\n { id: 19121, x: 4696150.591, y: 8625467.9761 },\n { id: 10923, x: 4835279.007, y: 8463506.2347 },\n { id: 51914, x: 4694806.2946, y: 8572059.0987 },\n { id: 19122, x: 4696383.0374, y: 8633724.987 },\n { id: 72409, x: 4596873.3162, y: 8432461.4456 },\n { id: 51915, x: 4693308.8484, y: 8577419.6623 },\n { id: 31420, x: 4603235.48, y: 8659000.4789 },\n { id: 19124, x: 4693901.7257, y: 8629377.357 },\n { id: 10927, x: 4832040.6141, y: 8467115.9129 },\n { id: 31423, x: 4599363.3273, y: 8664361.7965 },\n { id: 19126, x: 4692751.416, y: 8640965.4495 },\n { id: 64218, x: 4761357.9066, y: 8487566.775 },\n { id: 10932, x: 4828614.8939, y: 8475851.0184 },\n { id: 64221, x: 4759163.7423, y: 8495135.9646 },\n { id: 64223, x: 4756235.8971, y: 8484081.8672 },\n { id: 10939, x: 4825884.0544, y: 8460703.501 },\n { id: 10940, x: 4824710.4575, y: 8471606.1947 },\n { id: 64228, x: 4750710.8684, y: 8499401.6794 },\n { id: 35535, x: 4859212.3878, y: 8797951.8654 },\n { id: 35538, x: 4857444.7413, y: 8787253.6582 },\n { id: 64235, x: 4746428.6298, y: 8489506.5606 },\n { id: 10948, x: 4818459.6322, y: 8468742.2262 },\n { id: 35548, x: 4850718.6662, y: 8785373.0765 },\n { id: 6856, x: 4760771.3705, y: 8591058.6977 },\n { id: 6857, x: 4759384.2021, y: 8598708.2506 },\n { id: 6858, x: 4758483.8526, y: 8585049.2302 },\n { id: 35552, x: 4847767.9372, y: 8792818.561 },\n { id: 6870, x: 4747347.5237, y: 8595411.0004 },\n { id: 6871, x: 4745672.3005, y: 8587803.6068 },\n { id: 60162, x: 4595388.8246, y: 8589684.9349 },\n { id: 60166, x: 4593208.1647, y: 8601995.8886 },\n { id: 60168, x: 4590960.2134, y: 8585538.2496 },\n { id: 60170, x: 4588274.8525, y: 8590024.6386 },\n { id: 60172, x: 4585722.3166, y: 8594548.2272 },\n { id: 60176, x: 4581751.7687, y: 8588647.1344 },\n { id: 47882, x: 4785630.1777, y: 8787629.4504 },\n { id: 47883, x: 4785768.8261, y: 8803612.4503 },\n { id: 47884, x: 4783935.5482, y: 8798306.9912 },\n { id: 47886, x: 4781723.9517, y: 8791531.5405 },\n { id: 47892, x: 4776813.0744, y: 8795607.0472 },\n { id: 2804, x: 4818038.0652, y: 8589286.8396 },\n { id: 47894, x: 4774493.8263, y: 8804424.2758 },\n { id: 2805, x: 4816577.9813, y: 8581888.0155 },\n { id: 60192, x: 4575224.8056, y: 8599172.0814 },\n { id: 47896, x: 4770444.7373, y: 8790755.2841 },\n { id: 39703, x: 4820792.3285, y: 8759051.2205 },\n { id: 2812, x: 4813160.8972, y: 8599569.5121 },\n { id: 2813, x: 4811428.4104, y: 8587209.6933 },\n { id: 2814, x: 4811611.6278, y: 8593702.396 },\n { id: 39707, x: 4817622.9699, y: 8749888.3869 },\n { id: 39709, x: 4815794.9646, y: 8758297.3624 },\n { id: 56107, x: 4686143.1177, y: 8589936.3828 },\n { id: 56108, x: 4682872.767, y: 8587219.6776 },\n { id: 56109, x: 4683060.1962, y: 8596468.7239 },\n { id: 2822, x: 4805894.8112, y: 8583154.1858 },\n { id: 56111, x: 4679470.7951, y: 8599121.0309 },\n { id: 56112, x: 4677315.6725, y: 8583553.9271 },\n { id: 39717, x: 4809276.8044, y: 8746935.6669 },\n { id: 56114, x: 4677352.2667, y: 8594664.1399 },\n { id: 2828, x: 4801603.1481, y: 8590857.3075 },\n { id: 39720, x: 4807084.7992, y: 8754373.149 },\n { id: 27423, x: 4695124.7457, y: 8799648.7953 },\n { id: 39721, x: 4805768.2586, y: 8747134.7247 },\n { id: 56118, x: 4672501.7295, y: 8593279.3896 },\n { id: 27425, x: 4694089.3052, y: 8791347.1212 },\n { id: 27426, x: 4694237.8626, y: 8804883.1781 },\n { id: 56121, x: 4670683.5462, y: 8598445.5325 },\n { id: 31527, x: 4597842.3731, y: 8652423.824 },\n { id: 31528, x: 4596103.4601, y: 8657763.1503 },\n { id: 31530, x: 4594218.7363, y: 8664395.9695 },\n { id: 27432, x: 4689226.4915, y: 8802755.5747 },\n { id: 31533, x: 4589445.0806, y: 8655980.5215 },\n { id: 27434, x: 4688056.0242, y: 8798070.6538 },\n { id: 27435, x: 4686527.6211, y: 8794440.8547 },\n { id: 27439, x: 4684614.4087, y: 8808817.1043 },\n { id: 27440, x: 4682153.3189, y: 8790511.2089 },\n { id: 31540, x: 4586227.9215, y: 8648530.5099 },\n { id: 60235, x: 4765279.8113, y: 8416212.0139 },\n { id: 31542, x: 4584928.3451, y: 8652772.3201 },\n { id: 27443, x: 4680421.0829, y: 8802680.595 },\n { id: 60236, x: 4765057.4406, y: 8407948.9639 },\n { id: 31544, x: 4583888.932, y: 8666835.4192 },\n { id: 27448, x: 4677286.3138, y: 8790837.9696 },\n { id: 31548, x: 4580094.668, y: 8648646.3098 },\n { id: 27449, x: 4677235.5525, y: 8797652.4971 },\n { id: 31549, x: 4580326.0889, y: 8657305.099 },\n { id: 35653, x: 4854844.2942, y: 8849886.8343 },\n { id: 35654, x: 4853919.3229, y: 8843163.8878 },\n { id: 35658, x: 4853071.4069, y: 8861999.3246 },\n { id: 15163, x: 4744596.7124, y: 8630109.2193 },\n { id: 35660, x: 4851243.5784, y: 8856817.3308 },\n { id: 35663, x: 4848619.9021, y: 8845465.6361 },\n { id: 6972, x: 4738198.9838, y: 8595161.9545 },\n { id: 35666, x: 4847728.7797, y: 8850536.7503 },\n { id: 6973, x: 4737462.928, y: 8583561.1702 },\n { id: 68459, x: 4706387.8582, y: 8479628.7925 },\n { id: 68461, x: 4703473.9061, y: 8495548.0239 },\n { id: 15174, x: 4736498.0965, y: 8630784.1194 },\n { id: 68463, x: 4702332.2769, y: 8488505.7439 },\n { id: 6978, x: 4731677.1661, y: 8589591.7816 },\n { id: 15179, x: 4732710.609, y: 8627096.2584 },\n { id: 15182, x: 4730105.5885, y: 8641061.3319 },\n { id: 68470, x: 4695395.597, y: 8480706.3325 },\n { id: 68472, x: 4693878.1873, y: 8494051.1866 },\n { id: 43880, x: 4779183.2615, y: 8691576.5241 },\n { id: 43881, x: 4777915.6713, y: 8699947.3476 },\n { id: 43882, x: 4776090.8427, y: 8687118.5916 },\n { id: 68478, x: 4688832.3965, y: 8494421.4852 },\n { id: 68480, x: 4689063.9855, y: 8480645.2539 },\n { id: 43886, x: 4773787.0499, y: 8700675.1284 },\n { id: 43888, x: 4772748.2172, y: 8695859.9798 },\n { id: 43894, x: 4767561.0844, y: 8690915.4424 },\n { id: 47997, x: 4807944.3251, y: 8828998.8007 },\n { id: 48000, x: 4803282.2218, y: 8825138.0013 },\n { id: 48002, x: 4800358.9477, y: 8824947.7754 },\n { id: 64403, x: 4741663.1889, y: 8497791.0462 },\n { id: 64405, x: 4740212.045, y: 8482515.3676 },\n { id: 72603, x: 4613293.6418, y: 8444767.4602 },\n { id: 72604, x: 4612529.9797, y: 8453858.2632 },\n { id: 64407, x: 4738183.9594, y: 8491663.5775 },\n { id: 72606, x: 4612037.5058, y: 8438249.0745 },\n { id: 64409, x: 4735254.4573, y: 8498171.1681 },\n { id: 64411, x: 4734104.9962, y: 8485282.6087 },\n { id: 72611, x: 4604679.3097, y: 8454921.49 },\n { id: 64414, x: 4730976.1633, y: 8491862.9113 },\n { id: 72612, x: 4603844.7606, y: 8439772.9919 },\n { id: 64416, x: 4728855.3626, y: 8498211.1297 },\n { id: 60317, x: 4764575.8714, y: 8443847.5467 },\n { id: 60319, x: 4763738.0464, y: 8454332.3603 },\n { id: 72616, x: 4598010.0657, y: 8447522.8763 },\n { id: 64419, x: 4726777.6238, y: 8487437.4114 },\n { id: 60320, x: 4763529.5237, y: 8448628.5135 },\n { id: 7042, x: 4868754.2589, y: 8372372.4941 },\n { id: 7043, x: 4867219.0322, y: 8379172.1238 },\n { id: 15242, x: 4753129.3089, y: 8682368.8545 },\n { id: 15243, x: 4752053.7308, y: 8676514.7431 },\n { id: 15245, x: 4751337.8168, y: 8666416.6843 },\n { id: 7049, x: 4858908.3346, y: 8375833.0054 },\n { id: 39844, x: 4839810.8658, y: 8785329.2799 },\n { id: 39847, x: 4838091.4439, y: 8796812.0066 },\n { id: 52151, x: 4706483.0708, y: 8553551.78 },\n { id: 39855, x: 4831787.8277, y: 8785559.9725 },\n { id: 11163, x: 4833746.5114, y: 8490092.7359 },\n { id: 52154, x: 4705408.403, y: 8546138.843 },\n { id: 39857, x: 4830286.7117, y: 8792527.1563 },\n { id: 11164, x: 4833280.6183, y: 8496288.5743 },\n { id: 52156, x: 4702599.2547, y: 8550378.097 },\n { id: 11166, x: 4831066.7378, y: 8481157.6617 },\n { id: 52158, x: 4701118.193, y: 8560170.5229 },\n { id: 52159, x: 4700040.0851, y: 8555086.747 },\n { id: 52161, x: 4698537.3106, y: 8545666.7669 },\n { id: 39864, x: 4825958.9872, y: 8783537.953 },\n { id: 39865, x: 4826256.5593, y: 8792926.2964 },\n { id: 11173, x: 4825474.5707, y: 8490653.0701 },\n { id: 52164, x: 4695042.7223, y: 8552557.8781 },\n { id: 52165, x: 4692226.1933, y: 8560689.3803 },\n { id: 11175, x: 4825047.9508, y: 8480312.2946 },\n { id: 52167, x: 4690019.6047, y: 8541998.7741 },\n { id: 11177, x: 4822333.9082, y: 8499729.4569 },\n { id: 11181, x: 4820350.8382, y: 8490850.9351 },\n { id: 27584, x: 4693191.7347, y: 8809969.977 },\n { id: 27586, x: 4682312.9575, y: 8812053.9628 },\n { id: 19388, x: 4727272.1608, y: 8674688.3971 },\n { id: 15289, x: 4750309.4983, y: 8697266.2738 },\n { id: 19389, x: 4726606.7054, y: 8668749.4595 },\n { id: 27590, x: 4678391.4078, y: 8818281.3508 },\n { id: 60383, x: 4765411.4275, y: 8431800.6173 },\n { id: 19394, x: 4724028.4251, y: 8666297.1964 },\n { id: 19395, x: 4722156.2727, y: 8681823.8644 },\n { id: 60386, x: 4764569.5738, y: 8425651.2377 },\n { id: 19396, x: 4721481.9624, y: 8677296.8754 },\n { id: 60387, x: 4763025.8021, y: 8436378.2132 },\n { id: 19397, x: 4719829.723, y: 8672061.491 },\n { id: 19401, x: 4716862.8446, y: 8680939.5422 },\n { id: 19406, x: 4712728.2689, y: 8668975.5613 },\n { id: 35804, x: 4860033.0301, y: 8831256.4991 },\n { id: 19408, x: 4712078.6765, y: 8684350.6866 },\n { id: 23508, x: 4688454.5503, y: 8604992.6057 },\n { id: 19409, x: 4711210.3193, y: 8675944.2516 },\n { id: 23509, x: 4688369.2069, y: 8614034.601 },\n { id: 35808, x: 4857123.4624, y: 8824599.3088 },\n { id: 23512, x: 4683534.4352, y: 8605793.0749 },\n { id: 7118, x: 4856070.0676, y: 8369210.8724 },\n { id: 23515, x: 4683131.8755, y: 8618714.842 },\n { id: 35814, x: 4853970.1562, y: 8833429.5095 },\n { id: 35815, x: 4853416.085, y: 8827207.4816 },\n { id: 35816, x: 4852802.6878, y: 8837658.9185 },\n { id: 7123, x: 4849262.8388, y: 8377785.1442 },\n { id: 23520, x: 4679037.0126, y: 8622751.5463 },\n { id: 23522, x: 4677053.592, y: 8613479.5956 },\n { id: 7126, x: 4843357.2698, y: 8371646.0911 },\n { id: 7127, x: 4842867.0934, y: 8376820.4894 },\n { id: 23524, x: 4674778.3581, y: 8606124.0563 },\n { id: 60420, x: 4763464.1203, y: 8492901.8334 },\n { id: 35826, x: 4847128.2007, y: 8826419.4386 },\n { id: 31743, x: 4597277.5497, y: 8633120.1862 },\n { id: 31744, x: 4597450.5965, y: 8645147.373 },\n { id: 31745, x: 4596162.5636, y: 8639302.856 },\n { id: 31746, x: 4595645.0887, y: 8627752.5578 },\n { id: 60440, x: 4765324.0445, y: 8466103.8737 },\n { id: 60441, x: 4764887.4543, y: 8476667.9555 },\n { id: 60442, x: 4763944.8813, y: 8471029.5284 },\n { id: 31755, x: 4590952.1853, y: 8638229.4684 },\n { id: 31756, x: 4589282.5261, y: 8632992.8608 },\n { id: 31759, x: 4587664.3974, y: 8643796.6222 },\n { id: 31760, x: 4586961.9638, y: 8637002.7908 },\n { id: 31761, x: 4584571.0832, y: 8629482.6993 },\n { id: 31763, x: 4583327.1653, y: 8626759.0388 },\n { id: 44061, x: 4780447.6831, y: 8666821.5238 },\n { id: 31764, x: 4583531.3456, y: 8633778.5304 },\n { id: 31766, x: 4581158.2815, y: 8637647.8985 },\n { id: 31767, x: 4580955.8401, y: 8643458.3159 },\n { id: 44067, x: 4775658.6719, y: 8673180.581 },\n { id: 44068, x: 4774464.9264, y: 8679664.1808 },\n { id: 60467, x: 4744256.5908, y: 8372878.4236 },\n { id: 44071, x: 4772669.3454, y: 8664944.2319 },\n { id: 44072, x: 4770558.4534, y: 8676857.5367 },\n { id: 60469, x: 4737754.3284, y: 8375501.3177 },\n { id: 35876, x: 4851543.3163, y: 8868267.8369 },\n { id: 60471, x: 4727579.9762, y: 8375293.7036 },\n { id: 44075, x: 4768743.7346, y: 8670801.6107 },\n { id: 72791, x: 4591572.0711, y: 8449694.7073 },\n { id: 72792, x: 4591439.9144, y: 8438230.5163 },\n { id: 72794, x: 4588672.4202, y: 8455523.1021 },\n { id: 72798, x: 4585684.8697, y: 8440964.7702 },\n { id: 48218, x: 4758780.7586, y: 8623885.5308 },\n { id: 48221, x: 4756726.9752, y: 8637147.7793 },\n { id: 48223, x: 4754285.8444, y: 8630084.5607 },\n { id: 52328, x: 4725517.2208, y: 8595626.414 },\n { id: 27736, x: 4676359.0637, y: 8811461.7709 },\n { id: 52331, x: 4722461.5515, y: 8583605.0228 },\n { id: 60530, x: 4750616.9005, y: 8397351.5804 },\n { id: 27739, x: 4673474.0969, y: 8812510.7063 },\n { id: 60532, x: 4749792.561, y: 8389127.6967 },\n { id: 27741, x: 4671671.4947, y: 8818172.0885 },\n { id: 60534, x: 4748221.4055, y: 8383794.5289 },\n { id: 52336, x: 4719510.9647, y: 8591118.7705 },\n { id: 27742, x: 4670924.0199, y: 8826375.5843 },\n { id: 68733, x: 4704996.2458, y: 8461317.3221 },\n { id: 52337, x: 4719254.0978, y: 8595174.3189 },\n { id: 68735, x: 4702205.432, y: 8471648.7923 },\n { id: 60539, x: 4745884.7613, y: 8394744.0371 },\n { id: 52341, x: 4714961.5716, y: 8592323.9786 },\n { id: 52342, x: 4714065.1577, y: 8584651.1421 },\n { id: 68739, x: 4697439.474, y: 8475521.7964 },\n { id: 52343, x: 4712846.6237, y: 8598549.6347 },\n { id: 68741, x: 4695084.0944, y: 8466758.4806 },\n { id: 27752, x: 4664432.1318, y: 8830383.2379 },\n { id: 52347, x: 4708739.1642, y: 8587122.084 },\n { id: 27753, x: 4663872.4386, y: 8816924.881 },\n { id: 52348, x: 4708435.6668, y: 8594915.6724 },\n { id: 27754, x: 4663136.3293, y: 8823218.6289 },\n { id: 68747, x: 4690063.7767, y: 8461650.0691 },\n { id: 27758, x: 4660055.7574, y: 8811298.3959 },\n { id: 27759, x: 4659241.8572, y: 8818552.0282 },\n { id: 31887, x: 4614541.5392, y: 8673747.2401 },\n { id: 3194, x: 4796004.9385, y: 8507115.5303 },\n { id: 31888, x: 4612033.4621, y: 8666708.3609 },\n { id: 31889, x: 4611611.2157, y: 8671203.0356 },\n { id: 3197, x: 4794935.5602, y: 8517187.1112 },\n { id: 56485, x: 4666098.4577, y: 8587695.805 },\n { id: 31891, x: 4610739.5985, y: 8679341.2458 },\n { id: 56486, x: 4664776.4282, y: 8599750.6383 },\n { id: 3199, x: 4791842.4949, y: 8502234.2177 },\n { id: 56487, x: 4663275.7241, y: 8593575.2538 },\n { id: 3200, x: 4791880.9457, y: 8497188.3433 },\n { id: 3201, x: 4789221.0539, y: 8505176.37 },\n { id: 31895, x: 4604392.6348, y: 8671736.6201 },\n { id: 3202, x: 4788717.4196, y: 8511719.0603 },\n { id: 31896, x: 4604154.5454, y: 8677067.9851 },\n { id: 3203, x: 4788808.8966, y: 8519875.1813 },\n { id: 56491, x: 4658844.5055, y: 8599452.9037 },\n { id: 56492, x: 4657129.8892, y: 8593094.1495 },\n { id: 3205, x: 4787191.1063, y: 8506636.4606 },\n { id: 56493, x: 4655713.9641, y: 8585114.977 },\n { id: 31899, x: 4600758.5301, y: 8681513.8436 },\n { id: 31900, x: 4598900.7148, y: 8672209.9799 },\n { id: 3207, x: 4785636.1791, y: 8500388.7728 },\n { id: 68792, x: 4680141.4656, y: 8371400.8466 },\n { id: 56495, x: 4652216.6165, y: 8584549.5751 },\n { id: 31901, x: 4597027.9591, y: 8678280.3536 },\n { id: 56497, x: 4652528.2078, y: 8599971.7714 },\n { id: 3211, x: 4781904.1642, y: 8508814.1359 },\n { id: 31905, x: 4592432.2957, y: 8681833.1852 },\n { id: 3212, x: 4781703.7309, y: 8520373.8049 },\n { id: 31906, x: 4590885.6118, y: 8673943.5775 },\n { id: 31911, x: 4583251.3604, y: 8673897.5435 },\n { id: 15518, x: 4746555.3993, y: 8686558.4927 },\n { id: 15524, x: 4741965.3441, y: 8698512.6935 },\n { id: 7327, x: 4872741.0176, y: 8389977.2002 },\n { id: 15527, x: 4737731.3002, y: 8690076.7923 },\n { id: 48321, x: 4761955.1596, y: 8651904.515 },\n { id: 7331, x: 4869074.3107, y: 8395360.9809 },\n { id: 36025, x: 4830235.9792, y: 8605860.7738 },\n { id: 48323, x: 4761268.5356, y: 8645013.3555 },\n { id: 36027, x: 4829724.2643, y: 8617403.7435 },\n { id: 15533, x: 4733824.3428, y: 8699786.0884 },\n { id: 7335, x: 4866661.8217, y: 8386486.3367 },\n { id: 48329, x: 4754929.8065, y: 8649259.134 },\n { id: 15537, x: 4730241.2577, y: 8685806.969 },\n { id: 36033, x: 4826454.5703, y: 8610345.2415 },\n { id: 36035, x: 4823811.9969, y: 8601722.3075 },\n { id: 7342, x: 4859824.9779, y: 8395202.7435 },\n { id: 7343, x: 4859167.7492, y: 8384052.2848 },\n { id: 36040, x: 4821012.2341, y: 8611280.6128 },\n { id: 11452, x: 4816868.7491, y: 8483258.2779 },\n { id: 11453, x: 4815748.8347, y: 8496617.434 },\n { id: 11458, x: 4811593.6727, y: 8486239.4403 },\n { id: 11466, x: 4805601.9187, y: 8495821.1732 },\n { id: 11472, x: 4801110.2662, y: 8487217.9165 },\n { id: 31968, x: 4575196.6023, y: 8619941.5703 },\n { id: 31969, x: 4573497.9853, y: 8604928.4258 },\n { id: 31970, x: 4573786.8075, y: 8615871.9918 },\n { id: 31971, x: 4573348.4566, y: 8623554.5339 },\n { id: 31978, x: 4567288.7884, y: 8608174.8576 },\n { id: 23792, x: 4670554.0987, y: 8610995.2425 },\n { id: 23794, x: 4670652.5327, y: 8620441.5862 },\n { id: 23796, x: 4667896.306, y: 8607701.9259 },\n { id: 23798, x: 4666264.1594, y: 8616880.4041 },\n { id: 23800, x: 4664380.3277, y: 8621784.7848 },\n { id: 31999, x: 4577775.1905, y: 8630603.1433 },\n { id: 32000, x: 4577751.3627, y: 8645928.3212 },\n { id: 23803, x: 4661785.7729, y: 8605929.4978 },\n { id: 23805, x: 4660755.3052, y: 8616480.7258 },\n { id: 32006, x: 4578402.0423, y: 8663089.0317 },\n { id: 23809, x: 4658781.221, y: 8622306.5512 },\n { id: 32009, x: 4837564.1143, y: 8600394.9365 },\n { id: 48406, x: 4763358.4967, y: 8664546.485 },\n { id: 23812, x: 4656473.2251, y: 8605786.3903 },\n { id: 48409, x: 4760951.5571, y: 8679780.1778 },\n { id: 48412, x: 4757983.8977, y: 8670145.9577 },\n { id: 56611, x: 4647796.4277, y: 8504856.921 },\n { id: 56613, x: 4646859.936, y: 8518572.0535 },\n { id: 40220, x: 4843737.911, y: 8817588.2486 },\n { id: 56618, x: 4639817.2741, y: 8501974.2713 },\n { id: 27925, x: 4677086.8467, y: 8803751.5141 },\n { id: 56619, x: 4639856.0284, y: 8512146.8865 },\n { id: 40224, x: 4841233.0209, y: 8805613.712 },\n { id: 73019, x: 4594347.5366, y: 8422005.8295 },\n { id: 27931, x: 4671981.9733, y: 8798673.0096 },\n { id: 27934, x: 4669209.5321, y: 8804832.3776 },\n { id: 27936, x: 4668162.0574, y: 8794702.6854 },\n { id: 40234, x: 4836701.503, y: 8816862.4043 },\n { id: 27937, x: 4667164.4488, y: 8809205.5905 },\n { id: 27938, x: 4666809.8342, y: 8801114.1305 },\n { id: 73027, x: 4585494.4464, y: 8421418.7549 },\n { id: 40237, x: 4833502.8153, y: 8811450.2868 },\n { id: 73029, x: 4584807.5495, y: 8429986.7386 },\n { id: 40239, x: 4832813.8669, y: 8804884.8136 },\n { id: 40241, x: 4830282.4453, y: 8819223.3453 },\n { id: 27944, x: 4663558.1236, y: 8807834.8599 },\n { id: 27946, x: 4662013.5176, y: 8795456.0804 },\n { id: 73036, x: 4579402.1801, y: 8423759.4187 },\n { id: 40247, x: 4826384.9697, y: 8804074.8506 },\n { id: 27952, x: 4658870.8828, y: 8793004.9217 },\n { id: 64851, x: 4741348.6389, y: 8461988.6749 },\n { id: 64853, x: 4739759.556, y: 8466373.6831 },\n { id: 64857, x: 4736868.2256, y: 8478944.5029 },\n { id: 64858, x: 4735557.6411, y: 8469120.3996 },\n { id: 64860, x: 4733919.5872, y: 8460095.8484 },\n { id: 3375, x: 4795072.0812, y: 8536497.8047 },\n { id: 3376, x: 4794342.1805, y: 8521808.0066 },\n { id: 3377, x: 4793807.8536, y: 8529869.05 },\n { id: 36171, x: 4817957.9655, y: 8605760.3838 },\n { id: 64865, x: 4730705.3085, y: 8463825.9248 },\n { id: 3386, x: 4786182.3416, y: 8528393.1645 },\n { id: 64872, x: 4727459.7065, y: 8470055.2774 },\n { id: 52575, x: 4703290.2801, y: 8595110.6867 },\n { id: 48476, x: 4765971.2495, y: 8698729.1247 },\n { id: 36179, x: 4813596.4089, y: 8618295.5138 },\n { id: 52576, x: 4701582.8561, y: 8586680.0637 },\n { id: 3388, x: 4785406.4494, y: 8538559.1285 },\n { id: 64874, x: 4725648.2351, y: 8461437.215 },\n { id: 52577, x: 4701160.3735, y: 8600347.4761 },\n { id: 52578, x: 4700739.8894, y: 8592220.6088 },\n { id: 36183, x: 4810188.9996, y: 8613784.6781 },\n { id: 3391, x: 4782071.6932, y: 8528527.8105 },\n { id: 48481, x: 4760788.4154, y: 8684404.0639 },\n { id: 48482, x: 4759681.5769, y: 8694629.1322 },\n { id: 52582, x: 4696657.4473, y: 8597070.3685 },\n { id: 52583, x: 4696314.7775, y: 8591056.0895 },\n { id: 48484, x: 4758167.0227, y: 8701024.9604 },\n { id: 52586, x: 4692358.4787, y: 8586622.4089 },\n { id: 36190, x: 4806608.5276, y: 8603528.4267 },\n { id: 60785, x: 4760696.5097, y: 8410761.8253 },\n { id: 52587, x: 4691892.4511, y: 8597104.6548 },\n { id: 48488, x: 4753842.6326, y: 8688335.1806 },\n { id: 36191, x: 4804969.8603, y: 8613247.919 },\n { id: 60786, x: 4760739.1376, y: 8403768.8107 },\n { id: 52589, x: 4690308.0032, y: 8592641.6279 },\n { id: 64887, x: 4715353.5869, y: 8372057.8912 },\n { id: 60789, x: 4757153.1486, y: 8415331.5247 },\n { id: 60792, x: 4755019.1683, y: 8409202.7512 },\n { id: 60794, x: 4754032.2021, y: 8404084.6499 },\n { id: 64894, x: 4693385.5119, y: 8373772.518 },\n { id: 60796, x: 4752611.2557, y: 8418317.0676 },\n { id: 60802, x: 4750113.4373, y: 8407382.111 },\n { id: 60803, x: 4749429.3471, y: 8412954.074 },\n { id: 19814, x: 4727921.6797, y: 8689153.6155 },\n { id: 19817, x: 4727672.0596, y: 8697728.9999 },\n { id: 60809, x: 4745765.6149, y: 8404313.8738 },\n { id: 60810, x: 4745053.8303, y: 8412841.7553 },\n { id: 19822, x: 4723255.8906, y: 8696397.6378 },\n { id: 19823, x: 4722687.609, y: 8688327.2973 },\n { id: 19824, x: 4722803.8073, y: 8703890.4295 },\n { id: 19826, x: 4720281.0829, y: 8694445.0917 },\n { id: 19830, x: 4718455.4206, y: 8690323.8357 },\n { id: 19831, x: 4716257.3047, y: 8697010.5202 },\n { id: 19832, x: 4715940.3239, y: 8703321.2251 },\n { id: 19834, x: 4713792.4895, y: 8690854.3728 },\n { id: 7575, x: 4873297.1974, y: 8410593.0796 },\n { id: 7576, x: 4872560.3016, y: 8400001.2466 },\n { id: 7577, x: 4871756.0101, y: 8403980.3799 },\n { id: 56770, x: 4649530.3899, y: 8527979.3088 },\n { id: 7583, x: 4864829.0681, y: 8399759.8214 },\n { id: 56772, x: 4646976.6335, y: 8531405.4367 },\n { id: 56773, x: 4646149.6756, y: 8523322.7068 },\n { id: 15783, x: 4745684.9844, y: 8680721.731 },\n { id: 56775, x: 4642744.5662, y: 8541029.4645 },\n { id: 15785, x: 4744436.9763, y: 8673313.9072 },\n { id: 7588, x: 4857904.2761, y: 8402304.7359 },\n { id: 48579, x: 4760666.0667, y: 8709717.9576 },\n { id: 15787, x: 4740010.6334, y: 8669468.4667 },\n { id: 7589, x: 4855875.9769, y: 8407396.3938 },\n { id: 56778, x: 4641143.3787, y: 8527582.8985 },\n { id: 48580, x: 4759488.1451, y: 8721667.7175 },\n { id: 11689, x: 4816851.2826, y: 8476074.1615 },\n { id: 56779, x: 4638677.6874, y: 8520986.2433 },\n { id: 44482, x: 4802181.617, y: 8708125.2388 },\n { id: 15789, x: 4739869.2891, y: 8679332.9377 },\n { id: 56782, x: 4638191.6975, y: 8532844.6956 },\n { id: 56783, x: 4636327.3904, y: 8525823.1049 },\n { id: 48585, x: 4755190.2709, y: 8719017.914 },\n { id: 56784, x: 4635492.0022, y: 8529339.1215 },\n { id: 44488, x: 4797298.8661, y: 8714667.8946 },\n { id: 11696, x: 4812012.5515, y: 8463971.3762 },\n { id: 56786, x: 4633098.3156, y: 8531908.6787 },\n { id: 15796, x: 4734265.4472, y: 8683641.8627 },\n { id: 44490, x: 4796064.2248, y: 8706831.4354 },\n { id: 11698, x: 4810707.6656, y: 8476241.7467 },\n { id: 73184, x: 4614159.6147, y: 8476818.3512 },\n { id: 15800, x: 4731517.1069, y: 8675358.1972 },\n { id: 11703, x: 4807083.3217, y: 8469455.2821 },\n { id: 44496, x: 4791506.0805, y: 8718738.368 },\n { id: 73189, x: 4605022.279, y: 8478169.4311 },\n { id: 44497, x: 4790913.9484, y: 8711764.108 },\n { id: 73191, x: 4604728.479, y: 8469502.7124 },\n { id: 44500, x: 4787568.2322, y: 8704674.2151 },\n { id: 40401, x: 4823717.1007, y: 8812227.6132 },\n { id: 11708, x: 4803077.4569, y: 8479287.4966 },\n { id: 73193, x: 4603759.3674, y: 8467892.4506 },\n { id: 11712, x: 4800708.6906, y: 8460792.7642 },\n { id: 40406, x: 4820059.9439, y: 8822304.4871 },\n { id: 11714, x: 4799711.7181, y: 8467612.8748 },\n { id: 40408, x: 4818692.5736, y: 8815930.0526 },\n { id: 73200, x: 4598049.1684, y: 8461485.9362 },\n { id: 73201, x: 4597128.6787, y: 8471031.379 },\n { id: 40411, x: 4816936.5151, y: 8808099.8009 },\n { id: 40416, x: 4813922.5295, y: 8821905.0099 },\n { id: 69112, x: 4688494.077, y: 8395164.0239 },\n { id: 40419, x: 4811263.502, y: 8817513.0413 },\n { id: 40421, x: 4810417.4956, y: 8804932.7723 },\n { id: 69115, x: 4688045.3884, y: 8379617.8478 },\n { id: 40425, x: 4808518.3726, y: 8808492.4676 },\n { id: 69119, x: 4684623.3659, y: 8382303.1315 },\n { id: 69122, x: 4679048.3337, y: 8389378.1019 },\n { id: 15839, x: 4751308.6691, y: 8704848.6122 },\n { id: 69127, x: 4674801.5967, y: 8383433.8476 },\n { id: 15844, x: 4748330.3245, y: 8722829.9845 },\n { id: 65047, x: 4726112.0881, y: 8381469.3745 },\n { id: 65048, x: 4724627.2475, y: 8393510.4991 },\n { id: 11766, x: 4797291.7365, y: 8411945.5916 },\n { id: 65054, x: 4719719.7365, y: 8396751.5565 },\n { id: 11767, x: 4796930.4369, y: 8405947.2813 },\n { id: 65055, x: 4719427.71, y: 8379259.7458 },\n { id: 48659, x: 4765217.5245, y: 8735950.6428 },\n { id: 11769, x: 4794874.0422, y: 8417653.0767 },\n { id: 65059, x: 4716914.2003, y: 8386119.8202 },\n { id: 11772, x: 4792796.7274, y: 8408386.1123 },\n { id: 48665, x: 4760561.7345, y: 8732364.9226 },\n { id: 48666, x: 4759042.918, y: 8742735.8554 },\n { id: 48667, x: 4757923.8897, y: 8727436.033 },\n { id: 3578, x: 4779273.9463, y: 8538693.2879 },\n { id: 11777, x: 4786664.7249, y: 8413092.3058 },\n { id: 32273, x: 4856191.9404, y: 8658462.6586 },\n { id: 3580, x: 4776680.612, y: 8529817.3267 },\n { id: 36373, x: 4834046.7353, y: 8632682.4889 },\n { id: 65069, x: 4709149.9719, y: 8392510.4881 },\n { id: 36376, x: 4831174.5878, y: 8622491.7678 },\n { id: 32277, x: 4851593.5945, y: 8653081.5571 },\n { id: 36377, x: 4831601.6252, y: 8641058.2636 },\n { id: 36380, x: 4828911.4502, y: 8635007.9889 },\n { id: 32281, x: 4847236.4422, y: 8655939.3853 },\n { id: 36381, x: 4826830.3387, y: 8639832.6016 },\n { id: 32282, x: 4845752.9815, y: 8647783.1695 },\n { id: 3589, x: 4770395.145, y: 8527991.7494 },\n { id: 3592, x: 4767633.5606, y: 8535406.765 },\n { id: 32286, x: 4842327.7488, y: 8651543.1164 },\n { id: 36386, x: 4823804.7401, y: 8621433.3464 },\n { id: 32287, x: 4840387.9734, y: 8642649.2463 },\n { id: 28188, x: 4652017.1438, y: 8617639.3957 },\n { id: 32288, x: 4840846.6561, y: 8657821.9815 },\n { id: 36388, x: 4822255.895, y: 8631664.5035 },\n { id: 28190, x: 4650184.7079, y: 8607652.2605 },\n { id: 28191, x: 4649525.1499, y: 8612935.8029 },\n { id: 28196, x: 4646977.9429, y: 8617778.4931 },\n { id: 24098, x: 4688735.1382, y: 8633744.3408 },\n { id: 28199, x: 4644974.209, y: 8614629.5321 },\n { id: 24100, x: 4686397.942, y: 8626826.5714 },\n { id: 15903, x: 4751749.7393, y: 8739433.0608 },\n { id: 28201, x: 4641627.3574, y: 8621465.1435 },\n { id: 24102, x: 4684829.4864, y: 8635423.6228 },\n { id: 28202, x: 4641084.174, y: 8607726.881 },\n { id: 24103, x: 4684638.2779, y: 8640054.254 },\n { id: 15905, x: 4750413.6594, y: 8732297.1285 },\n { id: 28203, x: 4641244.1222, y: 8616929.5302 },\n { id: 28204, x: 4638984.3236, y: 8604160.2007 },\n { id: 24107, x: 4679897.6884, y: 8638498.8286 },\n { id: 24108, x: 4679282.4709, y: 8627390.799 },\n { id: 28208, x: 4637369.3469, y: 8615434.3417 },\n { id: 24110, x: 4678489.2831, y: 8642541.8127 },\n { id: 24111, x: 4676805.1217, y: 8634537.9127 },\n { id: 28211, x: 4634366.6961, y: 8620903.568 },\n { id: 24112, x: 4676112.8471, y: 8624142.6068 },\n { id: 24113, x: 4674948.7712, y: 8629620.895 },\n { id: 24115, x: 4674416.9789, y: 8638937.3015 },\n { id: 20024, x: 4710178.6801, y: 8700088.2827 },\n { id: 20027, x: 4709360.4928, y: 8696315.4241 },\n { id: 20028, x: 4708820.4124, y: 8692012.5872 },\n { id: 20031, x: 4705736.0953, y: 8698774.5918 },\n { id: 11835, x: 4776425.0538, y: 8417636.5797 },\n { id: 20034, x: 4703249.2814, y: 8694087.2207 },\n { id: 20035, x: 4702506.2026, y: 8702188.3 },\n { id: 11837, x: 4771929.3044, y: 8412137.4719 },\n { id: 20040, x: 4699860.6045, y: 8704578.8007 },\n { id: 20043, x: 4697489.6704, y: 8697090.2002 },\n { id: 20045, x: 4695564.4261, y: 8704528.551 },\n { id: 20046, x: 4694549.7994, y: 8687866.2338 },\n { id: 61038, x: 4744323.5448, y: 8400676.1526 },\n { id: 56939, x: 4630660.3044, y: 8526662.7568 },\n { id: 48742, x: 4766960.8425, y: 8761878.6955 },\n { id: 61040, x: 4741866.0633, y: 8415670.7553 },\n { id: 56942, x: 4629219.6096, y: 8532377.6678 },\n { id: 7754, x: 4851212.127, y: 8414027.4322 },\n { id: 56943, x: 4626303.9249, y: 8529387.3563 },\n { id: 61043, x: 4740723.7788, y: 8404517.598 },\n { id: 56944, x: 4625991.7911, y: 8524568.6023 },\n { id: 61044, x: 4739508.8428, y: 8411334.5586 },\n { id: 56945, x: 4626201.8411, y: 8539507.3239 },\n { id: 48748, x: 4761619.674, y: 8756402.6596 },\n { id: 7758, x: 4849018.3748, y: 8407542.6506 },\n { id: 48749, x: 4760896.2079, y: 8750446.4125 },\n { id: 61047, x: 4738160.5577, y: 8407712.0368 },\n { id: 48750, x: 4759333.6517, y: 8764935.1113 },\n { id: 56951, x: 4619772.8264, y: 8529476.7827 },\n { id: 56952, x: 4618868.961, y: 8521302.492 },\n { id: 48754, x: 4756744.1576, y: 8758439.0929 },\n { id: 61052, x: 4735329.4782, y: 8416570.7364 },\n { id: 48755, x: 4755704.4552, y: 8747666.6302 },\n { id: 7765, x: 4845384.8592, y: 8400408.7165 },\n { id: 61054, x: 4734817.9288, y: 8402938.3851 },\n { id: 56956, x: 4615549.2921, y: 8536976.254 },\n { id: 7768, x: 4843376.0399, y: 8411700.3626 },\n { id: 61056, x: 4732963.3446, y: 8411240.0312 },\n { id: 61059, x: 4731264.4153, y: 8417161.0815 },\n { id: 7773, x: 4841766.2565, y: 8405692.8031 },\n { id: 61063, x: 4729697.102, y: 8403424.7809 },\n { id: 61065, x: 4727690.237, y: 8412142.3381 },\n { id: 7778, x: 4838038.9865, y: 8418938.593 },\n { id: 7779, x: 4837592.8862, y: 8401393.1813 },\n { id: 61067, x: 4726559.7303, y: 8417807.0847 },\n { id: 61069, x: 4726095.3598, y: 8408042.792 },\n { id: 40611, x: 4820021.7439, y: 8795326.6502 },\n { id: 40616, x: 4817213.65, y: 8787867.7451 },\n { id: 73409, x: 4611587.0072, y: 8488270.1559 },\n { id: 40618, x: 4816252.214, y: 8803406.0848 },\n { id: 73411, x: 4608979.2568, y: 8482107.7195 },\n { id: 73414, x: 4606694.1633, y: 8495418.3411 },\n { id: 40623, x: 4813858.6694, y: 8797260.1928 },\n { id: 40625, x: 4812737.0424, y: 8791226.1534 },\n { id: 73417, x: 4605061.3507, y: 8486333.6665 },\n { id: 48825, x: 4769053.7369, y: 8785191.0902 },\n { id: 48827, x: 4767119.7841, y: 8780368.8473 },\n { id: 73421, x: 4598597.0002, y: 8484500.7147 },\n { id: 48828, x: 4766248.2635, y: 8766248.2224 },\n { id: 48830, x: 4764301.4976, y: 8772195.2729 },\n { id: 48834, x: 4758744.4846, y: 8774545.6647 },\n { id: 48835, x: 4758583.7377, y: 8781217.6725 },\n { id: 52952, x: 4687572.7921, y: 8505325.4764 },\n { id: 16061, x: 4744828.6824, y: 8742611.3333 },\n { id: 16062, x: 4744215.6812, y: 8728789.083 },\n { id: 16067, x: 4738490.705, y: 8736349.5791 },\n { id: 52959, x: 4679694.0945, y: 8516946.243 },\n { id: 52960, x: 4676434.6614, y: 8502634.5998 },\n { id: 16069, x: 4736330.5201, y: 8725463.3815 },\n { id: 52961, x: 4676281.7927, y: 8508517.2404 },\n { id: 52963, x: 4672599.1019, y: 8516320.1755 },\n { id: 16072, x: 4734523.7808, y: 8743179.5437 },\n { id: 16075, x: 4731639.0821, y: 8733823.6133 },\n { id: 73469, x: 4593540.1341, y: 8493327.7612 },\n { id: 73473, x: 4589279.7883, y: 8486675.4802 },\n { id: 73474, x: 4585767.2938, y: 8479826.6443 },\n { id: 57081, x: 4631412.2349, y: 8509838.1414 },\n { id: 36586, x: 4837224.866, y: 8653921.004 },\n { id: 57082, x: 4631374.4318, y: 8518458.2157 },\n { id: 57083, x: 4627888.1343, y: 8501372.2374 },\n { id: 57084, x: 4627255.0172, y: 8512286.2567 },\n { id: 36593, x: 4831928.6473, y: 8651624.1996 },\n { id: 57089, x: 4622390.0199, y: 8506517.4815 },\n { id: 3807, x: 4779900.4579, y: 8504197.8248 },\n { id: 36603, x: 4824112.8048, y: 8648609.7695 },\n { id: 3811, x: 4775969.8485, y: 8514207.0592 },\n { id: 12010, x: 4797804.0929, y: 8435554.8845 },\n { id: 3812, x: 4774518.8459, y: 8504961.4102 },\n { id: 36606, x: 4821477.3999, y: 8653641.4095 },\n { id: 12012, x: 4795569.9534, y: 8430264.8052 },\n { id: 48905, x: 4768260.1536, y: 8797730.1631 },\n { id: 3817, x: 4771054.9502, y: 8511031.1158 },\n { id: 3818, x: 4769993.8993, y: 8520382.0014 },\n { id: 12017, x: 4794060.3406, y: 8421407.0365 },\n { id: 69404, x: 4682841.9663, y: 8413835.9288 },\n { id: 3820, x: 4767538.8773, y: 8514440.1305 },\n { id: 32514, x: 4873959.2936, y: 8675655.5362 },\n { id: 12020, x: 4790446.5349, y: 8427014.6981 },\n { id: 3822, x: 4766276.0608, y: 8504768.3197 },\n { id: 48912, x: 4761894.7976, y: 8791566.7161 },\n { id: 69408, x: 4679371.4453, y: 8400419.3427 },\n { id: 48913, x: 4760345.6946, y: 8787403.7406 },\n { id: 12022, x: 4788740.9872, y: 8435890.0413 },\n { id: 69409, x: 4677361.1047, y: 8407407.3327 },\n { id: 32518, x: 4869715.2247, y: 8668404.9842 },\n { id: 48915, x: 4760047.4692, y: 8798128.7189 },\n { id: 48916, x: 4758367.8144, y: 8804724.1841 },\n { id: 12025, x: 4787551.9197, y: 8421092.6143 },\n { id: 32522, x: 4866488.4891, y: 8678038.166 },\n { id: 12029, x: 4784271.7818, y: 8432511.1901 },\n { id: 69416, x: 4671749.992, y: 8402720.4003 },\n { id: 32526, x: 4862067.8589, y: 8672702.6759 },\n { id: 12031, x: 4783324.8639, y: 8426572.5744 },\n { id: 12032, x: 4782223.0425, y: 8423136.4875 },\n { id: 32529, x: 4860068.3715, y: 8665669.2677 },\n { id: 32530, x: 4860288.9969, y: 8680096.9834 },\n { id: 7955, x: 4854464.5725, y: 8391281.6093 },\n { id: 28453, x: 4632511.1147, y: 8612368.0501 },\n { id: 7958, x: 4851178.5957, y: 8398601.2056 },\n { id: 7959, x: 4851211.6729, y: 8385672.0799 },\n { id: 28455, x: 4629936.3541, y: 8605507.2068 },\n { id: 28458, x: 4628183.8249, y: 8616587.1205 },\n { id: 28459, x: 4628305.0842, y: 8620228.4862 },\n { id: 7964, x: 4847103.0014, y: 8392043.4284 },\n { id: 28460, x: 4626046.0957, y: 8613582.3004 },\n { id: 28462, x: 4625455.1253, y: 8605759.5854 },\n { id: 28465, x: 4623744.4429, y: 8621905.5339 },\n { id: 7971, x: 4844526.0244, y: 8385883.8286 },\n { id: 28468, x: 4620930.2706, y: 8610078.7846 },\n { id: 28469, x: 4620743.4623, y: 8619173.6213 },\n { id: 28470, x: 4618687.8914, y: 8615846.0154 },\n { id: 7975, x: 4841219.7602, y: 8394112.1811 },\n { id: 28472, x: 4617338.0043, y: 8606034.0478 },\n { id: 73561, x: 4594980.678, y: 8478746.2866 },\n { id: 28473, x: 4617236.4401, y: 8611493.9436 },\n { id: 28474, x: 4617232.9811, y: 8621811.7328 },\n { id: 24379, x: 4690481.195, y: 8662970.671 },\n { id: 73567, x: 4589132.9471, y: 8462561.9718 },\n { id: 24382, x: 4686568.1651, y: 8651425.192 },\n { id: 73570, x: 4584768.3466, y: 8470139.4113 },\n { id: 24384, x: 4685660.7137, y: 8657205.6041 },\n { id: 24386, x: 4684803.406, y: 8663175.7179 },\n { id: 73574, x: 4577559.5472, y: 8416758.2468 },\n { id: 24388, x: 4682255.4664, y: 8644857.933 },\n { id: 7992, x: 4855790.1323, y: 8452054.7621 },\n { id: 73576, x: 4576346.3505, y: 8431127.0297 },\n { id: 24389, x: 4682102.4065, y: 8653836.6986 },\n { id: 73577, x: 4576324.0389, y: 8426590.6965 },\n { id: 24390, x: 4681606.1588, y: 8660518.0315 },\n { id: 73578, x: 4576317.169, y: 8426587.2087 },\n { id: 24392, x: 4680290.7749, y: 8664213.1009 },\n { id: 24394, x: 4676503.3959, y: 8659750.0787 },\n { id: 24397, x: 4674599.5572, y: 8652758.0351 },\n { id: 40797, x: 4844744.0455, y: 8833834.2848 },\n { id: 40798, x: 4844718.8576, y: 8841026.0488 },\n { id: 40806, x: 4839611.0905, y: 8835475.368 },\n { id: 40809, x: 4837281.517, y: 8823726.3139 },\n { id: 44910, x: 4802878.8087, y: 8724149.9763 },\n { id: 40811, x: 4835912.0226, y: 8828813.6967 },\n { id: 44913, x: 4799881.6694, y: 8743341.8272 },\n { id: 40814, x: 4834682.379, y: 8836092.3053 },\n { id: 44915, x: 4798673.4848, y: 8734689.1736 },\n { id: 61313, x: 4743918.8636, y: 8379470.4062 },\n { id: 61314, x: 4743435.5421, y: 8389883.4572 },\n { id: 40819, x: 4830500.4924, y: 8829853.8153 },\n { id: 40820, x: 4830087.1214, y: 8823692.3541 },\n { id: 44920, x: 4794278.7978, y: 8736648.2304 },\n { id: 44922, x: 4793111.8152, y: 8729494.4095 },\n { id: 40823, x: 4828848.9803, y: 8837025.9599 },\n { id: 16231, x: 4746901.9039, y: 8714789.2849 },\n { id: 61321, x: 4739457.2455, y: 8383548.2445 },\n { id: 69520, x: 4670298.7069, y: 8413391.6623 },\n { id: 61322, x: 4738517.8315, y: 8396126.3161 },\n { id: 57224, x: 4648604.2372, y: 8545803.6176 },\n { id: 44928, x: 4788386.6414, y: 8743062.9579 },\n { id: 20334, x: 4707299.2162, y: 8664666.1126 },\n { id: 57226, x: 4647629.9674, y: 8553057.2325 },\n { id: 16236, x: 4741902.9186, y: 8719943.4188 },\n { id: 57227, x: 4647061.446, y: 8561294.2496 },\n { id: 20336, x: 4706197.8631, y: 8683722.1987 },\n { id: 20337, x: 4705072.2327, y: 8677979.4901 },\n { id: 69526, x: 4664917.1846, y: 8401764.7265 },\n { id: 61328, x: 4735057.9381, y: 8390321.6047 },\n { id: 57229, x: 4644687.5995, y: 8553858.687 },\n { id: 20338, x: 4704106.1439, y: 8671283.3795 },\n { id: 16239, x: 4739124.137, y: 8707418.0216 },\n { id: 61330, x: 4734476.9098, y: 8377613.8749 },\n { id: 57231, x: 4644058.513, y: 8547820.014 },\n { id: 20340, x: 4702404.0038, y: 8684455.0274 },\n { id: 57232, x: 4643563.2577, y: 8560396.8322 },\n { id: 57233, x: 4640491.7608, y: 8553966.1408 },\n { id: 20342, x: 4700634.8266, y: 8674296.7911 },\n { id: 16244, x: 4735340.3521, y: 8715392.7874 },\n { id: 69532, x: 4660364.9454, y: 8399085.5527 },\n { id: 57235, x: 4639003.3967, y: 8544909.9603 },\n { id: 49037, x: 4768191.8163, y: 8813664.9438 },\n { id: 69533, x: 4656441.342, y: 8407141.8378 },\n { id: 16246, x: 4731933.505, y: 8707217.3878 },\n { id: 69534, x: 4655325.397, y: 8402027.8843 },\n { id: 61336, x: 4731199.1878, y: 8382385.2421 },\n { id: 57237, x: 4638902.6883, y: 8561200.8098 },\n { id: 49039, x: 4766048.7573, y: 8806843.3993 },\n { id: 20346, x: 4697255.7682, y: 8683791.2833 },\n { id: 61337, x: 4729949.5638, y: 8390171.9591 },\n { id: 20347, x: 4696041.4764, y: 8678262.7776 },\n { id: 16248, x: 4731199.8137, y: 8724455.6351 },\n { id: 61338, x: 4729766.2199, y: 8395184.6765 },\n { id: 57239, x: 4636256.6768, y: 8551889.7921 },\n { id: 20349, x: 4694359.474, y: 8669137.9256 },\n { id: 49045, x: 4760759.3696, y: 8812601.3048 },\n { id: 61343, x: 4726446.7769, y: 8386436.4624 },\n { id: 49047, x: 4881587.2805, y: 8699642.5128 },\n { id: 49049, x: 4879915.2357, y: 8689605.2556 },\n { id: 36759, x: 4818863.7275, y: 8644172.3477 },\n { id: 36766, x: 4814265.858, y: 8658483.3341 },\n { id: 36767, x: 4813557.181, y: 8650150.9526 },\n { id: 69567, x: 4670015.7153, y: 8377590.0597 },\n { id: 69568, x: 4669349.4154, y: 8393126.642 },\n { id: 36776, x: 4808550.3979, y: 8644665.4626 },\n { id: 69569, x: 4667285.8207, y: 8386442.9765 },\n { id: 36782, x: 4804425.5989, y: 8653201.4073 },\n { id: 65481, x: 4724422.9506, y: 8413641.54 },\n { id: 65487, x: 4721463.3565, y: 8406125.8213 },\n { id: 65492, x: 4714766.4258, y: 8398818.1209 },\n { id: 65494, x: 4713821.5844, y: 8410140.8159 },\n { id: 16311, x: 4752045.5195, y: 8759185.2983 },\n { id: 16312, x: 4751625.0577, y: 8751153.211 },\n { id: 32733, x: 4873679.9381, y: 8689644.7076 },\n { id: 4040, x: 4798939.1344, y: 8557472.0341 },\n { id: 32734, x: 4871099.785, y: 8682734.8177 },\n { id: 32735, x: 4871622.4821, y: 8698525.8362 },\n { id: 4045, x: 4796018.1379, y: 8542992.1925 },\n { id: 32742, x: 4866945.1021, y: 8689552.1385 },\n { id: 12247, x: 4798150.8365, y: 8454829.4926 },\n { id: 32743, x: 4865825.5832, y: 8685129.1092 },\n { id: 32745, x: 4865185.7616, y: 8696609.4463 },\n { id: 12250, x: 4796668.3017, y: 8447019.7245 },\n { id: 12251, x: 4796498.1316, y: 8442453.2646 },\n { id: 4053, x: 4789235.8033, y: 8554421.035 },\n { id: 32751, x: 4859829.7006, y: 8687081.9622 },\n { id: 12256, x: 4791941.8552, y: 8439614.6038 },\n { id: 4058, x: 4785129.4183, y: 8546492.7777 },\n { id: 12257, x: 4791135.2537, y: 8448825.1264 },\n { id: 12258, x: 4790422.3751, y: 8454168.7017 },\n { id: 16359, x: 4755145.6688, y: 8769149.4626 },\n { id: 12262, x: 4787251.9206, y: 8441684.2865 },\n { id: 16362, x: 4753005.7909, y: 8776248.0305 },\n { id: 16364, x: 4751874.9249, y: 8782814.6807 },\n { id: 16365, x: 4750185.2021, y: 8767339.299 },\n { id: 12266, x: 4783742.5442, y: 8449725.0194 },\n { id: 12267, x: 4782780.1114, y: 8439591.4123 },\n { id: 12270, x: 4781946.1129, y: 8445409.8931 },\n { id: 40973, x: 4845728.6031, y: 8859786.9432 },\n { id: 40977, x: 4842705.7258, y: 8850353.2106 },\n { id: 40978, x: 4842658.8493, y: 8856154.9764 },\n { id: 40984, x: 4838745.9974, y: 8852030.5924 },\n { id: 40985, x: 4838146.5315, y: 8843351.8153 },\n { id: 40989, x: 4836293.1855, y: 8860538.6722 },\n { id: 49188, x: 4887709.7199, y: 8728348.7824 }\n ];\n }", "function updatePoints() {\n var result = $.parseJSON(fetchPoints(limit));\n\n if (!error) {\n offset = offset + 1;\n\n var allPoints = result[\"values\"];\n var isSeated = result[\"result\"];\n\n // === Hack so you can see how the interface works ===\n // var newPoint = Math.floor(Math.random() * 500) + 50;\n // dummyPoints.push(newPoint);\n // allPoints = dummyPoints;\n // === End of hack ===\n\n // allPoints.unshift()\n points = pointsHeader;\n for (var i in allPoints) {\n addPoint(allPoints[i]);\n }\n\n return isSeated\n }\n}", "function getPointsCallback(gistList) {\n // Set Gist list:\n tmpThis.gistList = gistList;\n }", "function getPointsCallback(gistList) {\n // Set Gist list:\n tmpGistList = gistList;\n // Get ID from gistlist:\n var gistID = getGistIDFromGistList(gistList, gistName);\n if (gistID == null) {\n callback(null);\n return null;\n }\n // output result:\n if (gistID != null) {\n // Save current data to cache list:\n var cacheInfo = {\n area: areaName,\n site_positon: locationName,\n gist: gistName,\n gist_id: gistID\n };\n localCacheForGistID.push(cacheInfo);\n callback(gistID);\n return true;\n } else {\n callback(null);\n }\n }", "constructor(pointValue) {\n var resolves = [\n {\n 'rolls': DiceRoll.getRolls([2, 12]),\n 'pay': (26/5)\n },\n {\n 'rolls': DiceRoll.getRolls([3, 11]),\n 'pay': (11/5)\n },\n {\n 'rolls': DiceRoll.getRolls(7),\n // Seven pays 5 for 1, minus 5 return, so it is a push.\n 'pay': 0\n },\n {\n 'rolls': DiceRoll.getRolls([4, 5, 6, 8, 9, 10]),\n 'pay': -1\n }\n ];\n var params = {\n 'name': 'World',\n 'overrideComeOut': true,\n 'isCenter': true,\n 'resolves': resolves\n };\n super(params);\n }", "function addLatLng(event) \n{\n\n var path = poly.getPath();\n // Because path is an MVCArray, we can simply append a new coordinate\n // and it will automatically appear.\n\n path.push(event.latLng);\n\n // Add a new marker at the new plotted point on the polyline.\n var styleMaker1 = new StyledMarker({styleIcon:new StyledIcon(StyledIconTypes.MARKER,{color:document.getElementById(\"area_color\").value,text:\"\"+pointCount}),position:event.latLng,map:map});\n workingAreaPointArray.push(styleMaker1);\n //document.getElementById(\"PointsOfArea\").innerHTML += '<input type=\"radio\" name=\"point' + pointCount + '\">Point '+pointCount+'<br>';\n if(document.getElementById(\"tempMsg\") != null)\n {\n document.getElementById(\"tempMsg\").innerHTML = \"\";\n }\n //add the \"click\" to the current poly array\n currentAreaPoly.push(event.latLng);\n \n pointCount++;\n}", "_addPointBtn() {\n\t this.$points\n\t .find('.addpoint')\n\t .before('<a href=\"#\" class=\"point\" aria-label=\"point\"> </a>');\n\t }", "function usePoint(p) {\n var i = pointToIdx(p);\n grid[i].push(p);\n return p;\n }", "function queryWithWaypoints(event, points) {\n UserPreferences.setPreference('waypoints', points.waypoints);\n showPlaces(false);\n planTrip();\n }", "function PointData(name, recordFields, records, url, properties) {\r\n RamaddaUtil.inherit(this, new BasePointData(name, properties));\r\n RamaddaUtil.defineMembers(this, {\r\n recordFields: recordFields,\r\n records: records,\r\n url: url,\r\n loadingCnt: 0,\r\n equals: function(that) {\r\n return this.url == that.url;\r\n },\r\n getIsLoading: function() {\r\n return this.loadingCnt > 0;\r\n },\r\n handleEventMapClick: function(myDisplay, source, lon, lat) {\r\n this.lon = lon;\r\n this.lat = lat;\r\n if (myDisplay.getDisplayManager().hasGeoMacro(this.url)) {\r\n this.loadData(myDisplay, true);\r\n return true;\r\n }\r\n return false;\r\n },\r\n startLoading: function() {\r\n this.loadingCnt++;\r\n },\r\n stopLoading: function() {\r\n this.loadingCnt--;\r\n },\r\n loadData: function(display, reload) {\r\n if (this.url == null) {\r\n console.log(\"No URL\");\r\n return;\r\n }\r\n var props = {\r\n lat: this.lat,\r\n lon: this.lon,\r\n };\r\n var jsonUrl = display.displayManager.getJsonUrl(this.url, display, props);\r\n this.loadPointJson(jsonUrl, display, reload);\r\n },\r\n loadPointJson: function(url, display, reload) {\r\n var pointData = this;\r\n this.startLoading();\r\n var _this = this;\r\n var obj = pointDataCache[url];\r\n if (obj == null) {\r\n obj = {\r\n pointData: null,\r\n pending: []\r\n };\r\n // console.log(\"created new obj in cache: \" +url);\r\n pointDataCache[url] = obj;\r\n }\r\n if (obj.pointData != null) {\r\n // console.log(\"from cache \" +url);\r\n display.pointDataLoaded(obj.pointData, url, reload);\r\n return;\r\n }\r\n obj.pending.push(display);\r\n if (obj.pending.length > 1) {\r\n // console.log(\"Waiting on callback:\" + obj.pending.length +\" \" + url);\r\n return;\r\n }\r\n var fail = function(jqxhr, textStatus, error) {\r\n var err = textStatus + \": \" + error;\r\n console.log(\"JSON error:\" + err);\r\n display.pointDataLoadFailed(err);\r\n pointData.stopLoading();\r\n }\r\n\r\n var success=function(data) {\r\n if (GuiUtils.isJsonError(data)) {\r\n // console.log(\"fail\");\r\n display.pointDataLoadFailed(data);\r\n return;\r\n }\r\n var newData = makePointData(data, _this.derived, display);\r\n obj.pointData = pointData.initWith(newData);\r\n var tmp = obj.pending;\r\n obj.pending = [];\r\n for (var i = 0; i < tmp.length; i++) {\r\n // console.log(\"Calling: \" + tmp[i]);\r\n tmp[i].pointDataLoaded(pointData, url, reload);\r\n }\r\n pointData.stopLoading();\r\n }\r\n console.log(\"load data:\" + url);\r\n // console.log(\"loading point url:\" + url);\r\n Utils.doFetch(url, success,fail,\"text\");\r\n //var jqxhr = $.getJSON(url, success).fail(fail);\r\n }\r\n\r\n });\r\n}", "function updateAddressWithLatLng(points){\n\n $.ajax({\n url:'php/action.php',\n method:'post',\n data:points,\n success:function(res){\n console.log(res);\n }\n })\n \n }", "function setPointData(data){\n //console.log(data);\n var sData=data.staticData[0];\n var lData=data.langData;\n var eData=data.elementData;\n var mData=data.mediaData;\n\n point.coord.setWGS(sData.latwgs,sData.lngwgs);\n setNewType(point.tSQL[sData.pt]);\n if (map!=null) {setMarker();}\n\n point.mainFoto=sData.mainfoto;\n\n point.setLoadedLangData(point,lData);\n point.setLoadedElementData(point,eData);\n point.setLoadedMediaData(point,mData);\n point.ready=true;\n}", "function startLiveUpdate(){\n \n setInterval(function(){\n \n let dataPoints = []\n fetch('https://canvasjs.com/services/data/datapoints.php')\n .then(response => response.json())\n .then((data) => {\n data.forEach(function(value) {\n dataPoints.push({ x: parseInt(value[0]), y: parseInt(value[1]) });\n });\n console.log(dataPoints)\n graf(dataPoints)\n })\n\n \n\n }, 5000)\n\n}", "function fnewPoint(x,y){\r\n\tthis.points.push(new points(x,y));\r\n}", "addPoints(points, parameter){\n let str = \"\";\n if(parameter == \"xp\" || parameter == \"b\"){\n let oldLvl = this.lvl;\n this.xp+=points;\n //update xp\n this.lvl = LvlSystem.getLvl(this.xp);\n if(this.lvl > oldLvl){\n str += \"*\" + this.nameTag + \"* has reached lvl : *\" + this.lvl + \"*\\n\";\n }\n }\n if(parameter == \"r\" || parameter == \"b\"){\n let oldRank = this.rank;\n let oldRankPoints = this.rankPoints;\n\n this.rankPoints+=points;\n if(this.rankPoints < 0){\n this.rankPoints = 0;\n }\n //update rank\n this.rank = RankSystem.getRankName(this.rankPoints);\n if(this.rank != oldRank){\n if(this.rankPoints > oldRankPoints){\n str += \"*\" + this.nameTag + \"* just reached : *\" + this.rank + \"* rank. Good job! :]\\n\";\n }else if(this.rankPoints < oldRankPoints){\n str += \"*\" + this.nameTag + \"* just dropped to : *\" + this.rank + \"* rank. :[\\n\";\n }\n }\n }\n if(parameter != \"xp\" && parameter != \"r\" && parameter != \"b\"){\n str += \"Invalid parameter \" + parameter + \" in addPoints(points, parameter). Use 'xp' for adding xp or 'r' for adding rank points or use 'b' to add to both.\";\n throw \"Invalid parameter \" + parameter + \" in addPoints(points, parameter). Use 'xp' for adding xp or 'r' for adding rank points or use 'b' to add to both.\";\n }\n\n return str;\n }", "function updatSPL(){\n if (saved_user_markers_data){\n for (let i=0; i<saved_user_markers_data.length; i++){\n\n let pList = saved_user_markers_data;\n console.log(pList);\n let pointIndex = i+1;\n let pointID = pList[i].id;\n console.log(\"PointID =\",pointID)\n console.log(pointIndex);\n let pointName = pList[i].name;\n console.log(pointName);\n let pointTags = pList[i].tag;\n console.log(pointTags);\n let pointSet = `#${pointIndex} Name: ${pointName} Tags: ${pointTags}`;\n\n\n savedPoint = document.createElement(\"div\");\n // savedPoint.id =\n savedPoint.style.display = \"flex\";\n savedPoint.style.justifyContent = \"space-evenly\";\n savedPoint.style.flexDirection = \"row\";\n savedPoint.style.width = \"100%\";\n savedPoint.style.marginTop = \"5px\";\n savedPoint.innerHTML += pointSet;\n\n let saved_point_delete_btn = document.createElement('input');\n saved_point_delete_btn.type = \"button\";\n saved_point_delete_btn.value = \"Delete\";\n saved_point_delete_btn.addEventListener('click', function(){\n deleteSavedPoint(pointID, this.parentElement);\n });\n\n target1 = document.getElementById(\"Saved_Target\");\n target1.appendChild(savedPoint);\n // this puts the div inside the div for easier targeted deleting\n savedPoint.appendChild(saved_point_delete_btn);\n\n }\n }\n}", "function displayPoints(){\n let counter=0;\n let collection=\"\";\n markerLayer.getSource().clear();\n\n for(let i=1;i<=tableLen;i++) {\n const ll=document.getElementById(`LatLong${i}`);\n const point=parseLatLong(ll.value);\n if (point) {\n displayPoint(point);\n collection=`${collection}${counter==0?\"\":\", \"}[${ll.value}]`;\n counter++;\n }\n }\n if (counter > 0)\n {\n let layerExtent = markerLayer.getSource().getExtent();\n if (layerExtent) {\n centreAndZoom(layerExtent)\n }\n\n let collectionPoint = document.getElementById(\"collectionPoint\");\n collectionPoint.innerText=collection;\n }\n}", "function showCoordinates(pt) {\n var coords =\n \"Lat/Lon \" +\n pt.latitude.toFixed(3) +\n \" \" +\n pt.longitude.toFixed(3) +\n \" | Scale 1:\" +\n Math.round(view.scale * 1) / 1 +\n \" | Zoom \" +\n view.zoom;\n coordsWidget.innerHTML = coords;\n this.x = pt.longitude.toFixed(5);\n this.y = pt.latitude.toFixed(5);\n //console.log(this.x, this.y);\n //console.log(infoUser.browserName(),infoUser.latitude(), infoUser.longitude(),infoUser.altitude());\n }" ]
[ "0.7021911", "0.65076137", "0.6428545", "0.64121526", "0.6320536", "0.6286854", "0.61808246", "0.6122103", "0.6103436", "0.6007058", "0.59909797", "0.5986229", "0.59777665", "0.5960849", "0.5957555", "0.5912277", "0.58642143", "0.5859838", "0.5832224", "0.58268404", "0.5814074", "0.57627326", "0.5753266", "0.5748302", "0.57013696", "0.56962675", "0.56929535", "0.5684692", "0.56756353", "0.56692564", "0.56412154", "0.55967575", "0.5596282", "0.5574285", "0.5564313", "0.55532634", "0.5551631", "0.5551409", "0.55467576", "0.55399096", "0.55086476", "0.54873353", "0.54800594", "0.54762423", "0.5472016", "0.54706174", "0.54692394", "0.54659", "0.54652095", "0.5463453", "0.54629695", "0.54610294", "0.54583097", "0.54543567", "0.5448387", "0.5446098", "0.5445041", "0.5442015", "0.5438321", "0.54316294", "0.54313177", "0.5430812", "0.5422733", "0.542233", "0.5412323", "0.54102254", "0.5409638", "0.54003114", "0.54002273", "0.5399802", "0.53970873", "0.5395312", "0.53915894", "0.5384351", "0.5379633", "0.5371306", "0.5371046", "0.5365689", "0.53541195", "0.5347148", "0.53437", "0.53428054", "0.534009", "0.5338712", "0.53363866", "0.53255767", "0.53213024", "0.53164095", "0.5315426", "0.5312362", "0.5311282", "0.53109443", "0.5305984", "0.529665", "0.52948695", "0.52942914", "0.52870494", "0.52828246", "0.5276856", "0.5276431" ]
0.5527698
40
create function to display user name
function displayName(user) { const html = `<br><br> <h1>${user.first_name} ${user.last_name}</h1> `; const display = document.getElementById('display-name') display.innerHTML = html return html }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printName(user){\n console.log(`this user name is ${user.name}`);\n}", "name(userId) {\n if (userId) {\n // find user from user id\n let user = Meteor.users.findOne(userId, {fields: {'username': 1}});\n // return username\n return user ? `@${user.username}`: '';\n }\n }", "function User(name) {\r\n var displayName = function (greeting) {\r\n console.log(greeting + ' ' + name);\r\n }\r\n return displayName;\r\n}", "function getDisplayTextOfUser() {\n if (_userInformation.DisplayName != null) {\n return _userInformation.DisplayName;\n }\n return _userInformation.UserName;\n }", "function userName(firstName,lastName) {\n var result= firstName + \" \" + lastName;\n return result;\n}", "getDisplayName() {\r\n var name = this.auth.currentUser.displayName;\r\n var nameArr = name.split(\" \");\r\n return nameArr[0];\r\n }", "function getUserByName(username) {\n}", "function name() {\n console.info(this.username);\n}", "function formatName(user){\n return user.firstName + ' ' + user.lastName;\n}", "function getName() {\n getUseInput(function(name) {\n userName = name;\n deleteAllLines();\n displayString(\"Hello \" + userName, 'main');\n });\n }", "function addUserName(name) {\n return (sentence) => {\n return `${sentence} ${name}`\n };\n}", "function getUserName() {\n return getAuth().currentUser.displayName;\n}", "function printUsername(fn) {\n return fn(\"biggaji\");\n}", "function name(firstName, lastName) {\n var userName = firstName + \" \" + lastName;\n return userName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;// TODO 5: Return the user's display name.\n}", "function displayEntireNameForUser(user) {\n if (!user) {\n return '';\n }\n\n let displayName = '@' + user.username;\n const fullName = getFullName(user);\n\n if (fullName && user.nickname) {\n displayName = react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", null, '@' + user.username, ' - ', react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", {\n className: \"light\"\n }, fullName + ' (' + user.nickname + ')'));\n } else if (fullName) {\n displayName = react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", null, '@' + user.username, ' - ', react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", {\n className: \"light\"\n }, fullName));\n } else if (user.nickname) {\n displayName = react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", null, '@' + user.username, ' - ', react__WEBPACK_IMPORTED_MODULE_10___default.a.createElement(\"span\", {\n className: \"light\"\n }, '(' + user.nickname + ')'));\n }\n\n return displayName;\n}", "function user_name(){\n\t\tvar name = document.createElement(\"div\");\n\t\tname.textContent = \"NAME\";\n\t\tname.setAttribute(\"class\", \"user_name\");\n\t\tdiv.appendChild(name);\n\t}", "function displayUserName(data) {\n\t$('.welcome_message').html(`Welcome ${data.currentUser.username}, you are now logged into`)\n}", "function onGetUserNameSuccess() {\n $('#message').text('Hello ' + user.get_title());\n }", "function onGetUserNameSuccess() {\n $('#message').text('Hello ' + user.get_title());\n }", "function onGetUserNameSuccess() {\n $('#message').text('Hello ' + user.get_title());\n }", "function onGetUserNameSuccess() {\n $('#message').text('Hello ' + user.get_title());\n }", "get userDisplayName() {\n return this._data.user_name;\n }", "get userDisplayName() {\n return this._data.user_name;\n }", "get userDisplayName() {\n return this._data.user_name;\n }", "get userDisplayName() {\n return this._data.user_name;\n }", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function returnUser(userName) {\n return \"Welcome to Kodiri \" + userName;\n return `Welcome to Kodiri ${userName}`;\n}", "function getUserName() {\r\n return firebase.auth().currentUser.displayName;\r\n}", "function getUserName() {\r\n return firebase.auth().currentUser.displayName;\r\n}", "function printUsername() {\n let usernameDOM = document.getElementById('label-username');\n usernameDOM.innerHTML = user.username;\n}", "function getUserName() {\n\treturn firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n userName = prompt('Identify yourself user.');\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n }", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n}", "function Info(user) {\n return `${user.name} tem ${user.age} anos.`;\n}", "function get_user_name() {\n switch (event_type) {\n case \"user\":\n var nameurl = \"https://api.line.me/v2/bot/profile/\" + user_id;\n break;\n case \"group\":\n var groupid = msg.events[0].source.groupId;\n var nameurl = \"https://api.line.me/v2/bot/group/\" + groupid + \"/member/\" + user_id;\n break;\n }\n\n try {\n // call LINE User Info API, get user name\n var response = UrlFetchApp.fetch(nameurl, {\n \"method\": \"GET\",\n \"headers\": {\n \"Authorization\": \"Bearer \" + CHANNEL_ACCESS_TOKEN,\n \"Content-Type\": \"application/json\"\n },\n });\n var namedata = JSON.parse(response);\n var reserve_name = namedata.displayName;\n }\n catch {\n reserve_name = \"not avaliable\";\n }\n return String(reserve_name)\n }", "function set_user_name(new_name){\n //TODO Validate User String\n current_user_name = new_name\n nameSpace.innerHTML=(\"User: \" + current_user_name)\n \n}", "function getFullName(user) {\n const { firstName, lastName } = user;\n return `${firstName} ${lastName}`;\n }", "function getFullUserName(nick, user, host) {\n return nick + \"!\" + user + \"@\" + host;\n }", "function CreateUserName(divID) {\n var name = Sanitize($(`${divID}`).val());\n name = name.toLowerCase();\n\n if (name.match(/^(https?:\\/\\/)?[a-z0-9]+\\./ig) || name.match(/^@/ig)) {\n name = name.match(/@[a-z0-9-]{3,16}[^\\/]/ig)[0].substring(1);\n }\n\n return name;\n }", "function sayUserName(user) {\n const { name } = user;\n console.log(\"THE USER's NAME IS \" + name);\n}", "function displayNameUser(responseAsJson, div, authToken, apiUrl, content){\n\tconst username = document.createElement(\"h1\");\n\tusername.style.textAlign = \"center\"; //display username\n\tusername.textContent = \"@\" + responseAsJson.username;\n\tusername.className = \"listAll\"; //make username linkable to public profile\n\tusername.onclick = function(){let userPage = createUserPage(div,\n\t\t\t\t\t\t\t\t\t\t responseAsJson.username, authToken, apiUrl);\n\t\t\t\t\t\t\t\t\t\t openEdit(div, userPage)};\n\tcontent.appendChild(username);\n\tconst n = document.createElement(\"h2\"); //display name\n\tn.style.textAlign = \"center\";\n\tn.style.color = \"var(--reddit-blue)\";\n\tn.textContent = responseAsJson.name;\n\tcontent.appendChild(n);\n\treturn content;\n}", "function renderUser(name, data, parameters={}, options={}) {\n\n var html = `<span>${data.username}</span>`;\n\n if (data.first_name && data.last_name) {\n html += ` - <i>${data.first_name} ${data.last_name}</i>`;\n }\n\n return html;\n}", "get username() { // get uinique username. In your api use ${utils.username}\n return new Date().getTime().toString();\n }", "function greetUser(fullName) {\n return `Good day, ${fullName}`\n}", "function playerName(){\n if(loggedIn()){\n return firebase.auth().currentUser.email.split(\"@\")[0].substring(0,20).capitalize();\n }\n return \"\";\n}", "function getName() {\n applicationState.user = userName.value;\n document.getElementById(\n \"userinfo\"\n ).innerHTML = `welcome ${applicationState.user}`;\n applicationState.gameStart = true;\n startTime = Date.now();\n}", "function getUserName() {\n console.log(firebase.auth().currentUser.displayName);\n return firebase.auth().currentUser.displayName;\n}", "function userNameText(userName, userCompany) {\n $(document).ready(function(){\n document.getElementById('user_name_text').innerHTML = `${userName} - ${userCompany}`;\n })\n }", "function onGetUserNameSuccess() {\n $('#message').append('<p>Hello ' + user.get_title() + user.get_email()+'</p>');\n}", "function onGetUserNameSuccess() {\n $('#message').text('Hello ' + user.get_title());\n}", "function getUserName() {\n context.load(user);\n context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);\n }", "function getUserName() {\n context.load(user);\n context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);\n }", "function getUserName() {\n context.load(user);\n context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);\n }", "function getUserName() {\n context.load(user);\n context.executeQueryAsync(onGetUserNameSuccess, onGetUserNameFail);\n }", "function displayName(fname,mname=\"\",lname)\n {\n $('#current_employee_name').text(fname+\" \"+mname+\" \"+lname);\n }", "function showLoginName(){\r\n\r\n\tif(typeof login_name != 'undefined')\r\n\t\t$(\"#loginName\").text(_user+': '+login_name);\r\n\telse\r\n\t\t$(\"#loginName\").text(_user+': '+'admin');\r\n\r\n}", "function showUserName(userName) {\r\n $(\".showUserName\").html(\"Hi \" + userName);\r\n }", "function set_user_name(env, title, first, initial, last) {\n env.auth.user.name = [title, first, initial, last];\n}", "function req_read_user_name(env) {\n var data = http.req_body(env).user;\n set_user_name(\n env,\n data.user_name_title,\n data.user_name_first,\n data.user_name_initial,\n data.user_name_last\n )\n}", "function getUserNameById(id) {\n // codigo\n return \"Regulus\";\n}", "function displayEntireName(userId) {\n return displayEntireNameForUser(Object(mattermost_redux_selectors_entities_users__WEBPACK_IMPORTED_MODULE_18__[\"getUser\"])(stores_redux_store_jsx__WEBPACK_IMPORTED_MODULE_30__[\"default\"].getState(), userId));\n}", "function myFullName() {\n return myFirstName('Srujan');\n }", "getUserName() {\n let loggedInUser = this.loginUserNameLabel.getText();\n console.log(`User is logged in as ${loggedInUser}`);\n return loggedInUser;\n }", "function displayName (err, name){\t\n \tif (name.replace(/\\b\\w/g, l => l.toUpperCase()) === 'Sergi') {\n \t\tconsole.log(\"Your name is: \" + name.replace(/\\b\\w/g, l => l.toUpperCase()))\n \t\tread(options2, displayCity)\n \t}\n \telse {\n \t\tconsole.log(name.replace(/\\b\\w/g, l => l.toUpperCase()) + '? Vaya mierda de nombre!')\n \t\tread(options, displayName)\n \t}\n }", "function getUserName() {\r\n if(isUserSignedIn()){\r\n return auth.currentUser.displayName;\r\n }\r\n}", "function displayUserName() {\n\tshowname = document.getElementById('displayName');\n\tshowname.innerHTML=localStorage.getItem('user'); \n}", "function getFullName(user) {\n return user.firstName + \" \" + user.lastName;\n}", "function displayName(firstName, lastName) {
\n ​var nameStartTag = \"Full Name is \";\n // this inner function has access to the outer function's variables, including the parameter​\n ​function createFullName() {
 \n ​ return nameStartTag + firstName + \" \" + lastName;
 \n }\n ​\n ​ return createFullName();
\n }", "function UserNameReplace() {\n if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;\n $(\"span.insertusername\").text(wgUserName);\n }", "function UserNameReplace() {\n if (typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;\n $(\"span.insertusername\").text(wgUserName);\n}", "function greetUser(firstName) {\n return `Hello ${firstName}`;\n}", "function UserNameReplace() {\n if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;\n $('.insertusername').html(wgUserName); }", "function getName() {\n return \"Hai Aku Sam\";\n}", "function UserNameReplace() {\n if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;\n $(\"span.insertusername\").html(wgUserName);\n }", "function updateUserNameDisplay(fullName) {\n\t$(\"#environmentData .profileName\").text(fullName);\n}", "get userName(){\n\t\treturn this._user.user_name;\n\t}", "function getUserName() {\n\t$.ajax({\n\t\turl : 'rest/user/names',\n\t\ttype : \"GET\",\n\t\tdataType : \"text\"\n\t}).always(function(data) {\n\t\tif (typeof data != 'undefined') {\n\t\t\t$(\".welcome-greeting\").css(\"display\", \"inline\");\n\t\t\t$(\"#user-holder\").text(data);\n\t\t}\n\t});\n}", "function showInfo(user) {\n console.log(`User Info ${user.id} ${user.username} ${user.firstname}`);\n // return 'hola';\n}", "function createUserName ( email ){\n const user = email;\n const iend = user.indexOf(\"@\");\n const userName = user.substring(0 , iend);\n console.log( userName ); \n return userName;\n }", "function getUserName() {\n return _userInformation.UserName;\n }", "function getDisplayNameByUser(user) {\n const state = stores_redux_store_jsx__WEBPACK_IMPORTED_MODULE_30__[\"default\"].getState();\n const teammateNameDisplay = Object(mattermost_redux_selectors_entities_preferences__WEBPACK_IMPORTED_MODULE_17__[\"getTeammateNameDisplaySetting\"])(state);\n\n if (user) {\n return Object(mattermost_redux_utils_user_utils__WEBPACK_IMPORTED_MODULE_20__[\"displayUsername\"])(user, teammateNameDisplay);\n }\n\n return '';\n}", "function get_my_name(name){\n return name + \" Ubanell\";\n}", "function getFullName(user) {\n const firstName = user.firstName;\n const lastName = user.lastName;\n\n return `${firstName} ${lastName}`;\n}", "function renderUsername(value, p, r){\r\n return String.format('<b><font color=\"' + getColor(r.data['username']) + '\">{0}&nbsp;({1}):</b></font>', r.data['username'], r.data['time']);\r\n}", "function getCurrentUserName() {\n return page.evaluate((selector) => {\n let el = document.querySelector(selector);\n\n return el ? el.innerText : '';\n }, selector.user_name);\n }" ]
[ "0.7669555", "0.75255054", "0.7504474", "0.746876", "0.7402384", "0.7401643", "0.7380194", "0.73773277", "0.7375305", "0.7354512", "0.7354015", "0.7319043", "0.7300438", "0.7293123", "0.72905713", "0.72873056", "0.7276611", "0.7259597", "0.72451913", "0.72451913", "0.72451913", "0.72451913", "0.7239288", "0.7239288", "0.7239288", "0.7239288", "0.7235451", "0.7235451", "0.7235451", "0.7220534", "0.71953154", "0.71859115", "0.71438634", "0.71368694", "0.71295947", "0.7122651", "0.7122651", "0.7116093", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.7103395", "0.70887417", "0.7084713", "0.7032062", "0.7027296", "0.7023599", "0.7020956", "0.7012544", "0.7011725", "0.7000937", "0.6958459", "0.6952807", "0.6951708", "0.6950171", "0.6935453", "0.6933222", "0.69237745", "0.6904195", "0.68882746", "0.68882746", "0.68882746", "0.68882746", "0.68832815", "0.6883158", "0.68815136", "0.6879803", "0.68754274", "0.6873552", "0.68724227", "0.68681705", "0.6862225", "0.68610096", "0.68566066", "0.68513274", "0.68413556", "0.6824706", "0.6815953", "0.680945", "0.6808785", "0.6807429", "0.6805657", "0.6785516", "0.67812574", "0.6747768", "0.6742337", "0.6740444", "0.6731953", "0.6726041", "0.67253554", "0.67186445", "0.66952944", "0.66909003", "0.66897726" ]
0.75488657
1
Returns a random number between min (inclusive) and max (exclusive)
function getRandomInteger(min, max) { return Math.floor(Math.random() * (max - min) + min); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomIntEx(min, max) {//max not inclusive\r\n return Math.floor(Math.random() * (max - min)) + min;\r\n}", "function getRandomNumber(min, max) {\n return (Math.random() * (+max - +min) + min);\n }", "function randomInclusive(min, max){\r\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\r\n}", "function rangedRandomVal(min, max) {\n return Math.floor(Math.random() * (max - min) + 1) + min;\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * max) + min;\n}", "function randInt(min, max) { return Math.random() * (max - min) + min; }", "function randInt(min, max) { return Math.random() * (max - min) + min; }", "function getRandomNumber(min,max){\r\n return Math.floor(Math.random()*(max-min)+min);\r\n}", "function getRndInteger(min, max) {\n return Math.floor(Math.random() * (max - min) ) + min;\n } //max is excluded", "function random(min,max){ return Math.floor( Math.random() * (max - min - 1) ) + min; }", "function randomNumber(min, max) {\n return Math.floor(Math.random() * max) + min;\n }", "function rnd(min=0,max=1){return Math.random()*(max-min)+min;}", "function randomNumber(min, max){\n return Math.floor(Math.random()*(max-min+1)+min);\n}", "getRandomNumber(max,min){\n return Math.floor(Math.random()*max+min);\n }", "function RandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}", "function getRandomNumber(min, max) {\n return min + Math.random() * (max - min);\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min) + min)\n}", "function getRandomNumber(min, max) {\r\n return Math.floor(Math.random() * (max - min + 1)) + min;\r\n}", "function getRandomNumber(min, max) {\n var random = Math.floor((Math.random() * max) + min);\n return random;\n}", "function getRandomNumber(min, max) {\n var random = Math.floor((Math.random() * max) + min);\n return random;\n}", "function randomNumber(min, max) { \r\n return Math.floor(Math.random() * (max - min) + min);\r\n}", "function randomNumber(min,max){\n return Math.floor(Math.random()*(max-min+1)+min);\n }", "function getRandomNumber(min, max) {\n // ~~() negative-safe truncate magic\n return ~~(Math.random() * (max - min) + min);\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n}", "range(min, max) {\n\t\tlet r = Math.floor(Math.random() * max);\n\t\twhile(r < min)\n\t\t\tr = Math.floor(Math.random() * max);\n\t\treturn r;\n\t}", "function between(min, max) { \n return Math.floor(\n Math.random() * (max - min) + min\n )\n}", "function numberRandom (min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min );\n}", "function randomNumber(min, max){\n return Math.floor(Math.random() * (1 + max - min) + min);\n}", "function randomNumber(min, max){\n return Math.floor(Math.random() * (1 + max - min) + min);\n}", "function getRandomNumber (min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;\n}", "function randomNumber(min, max){\n return Math.floor(Math.random() * (1 + max - min) + min);\n}", "function randomNumber(min, max){\n return Math.floor(Math.random() * (1 + max - min) + min);\n}", "getRandomIntInclusive(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n let number = Math.floor(Math.random() * (max - min + 1)) + min;\n return number;\n }", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n}", "function randomNumber(min, max) { \n return Math.random() * (max - min) + min;\n}", "function randomNumber(min, max){\n\treturn Math.floor(Math.random() * (1 + max - min) + min);\n}", "function getRandom(min, max) {return Math.random() * (max - min) + min;}", "function getRandomNumber(min, max) {\n return Math.floor( Math.random() * (max - min + 1) ) + min;\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n }", "function getRandomNumber(min, max) {\n return Math.random() * (max - min) + min;\n} // getRandomNumber", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}", "function randomNumber(min, max) {\n\t\treturn Math.floor(Math.random() * (max - min + 1) + min)\t}", "function getRandomNumber(min, max){\n return Math.floor(Math.random() * (max - min + 1) ) + min;\n}", "function getRandomInt(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive\n }", "function randomRange(min_num, max_num){\r\n return Math.floor(Math.random() * (max_num) + min_num);\r\n}", "function randomNumber(min,max)\n{\n return Math.floor(Math.random()*(max-min+1)+min);\n}", "function randomNumber(min,max)\n{\n return Math.floor(Math.random()*(max-min+1)+min);\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;\n }", "function getRandomIntInclusive (min, max) {\r\n return Math.floor(Math.random() * (max - min + 1)) + min;\r\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function getRandomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function getRandom(min,max){return Math.floor(Math.random()*(max+1-min))+min;}////", "function randomNumber(min,max){\n return Math.floor(Math.random() * (max - min + 1)+ min );\n}", "function generateNumber(min, max) {\r\n return Math.floor(Math.random()* (max - min) + min);\r\n}", "function getRandomNumber(min, max) {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n}", "getRandomIntInclusive (min, max) {\n min = Math.ceil(this.min);\n max = Math.floor(this.max);\n return Math.floor(Math.random() * (max-min +1)) +min;\n }", "function getRandomValue(min, max) {\n return Math.floor(Math.random() * (max - min)) + min;\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n}", "function randomNumber(min, max){\n return Math.round( Math.random() * (max - min) + min);\n}", "function getRandomNumber(min, max) {\n\treturn Math.floor(Math.random() * (max - min) + min);\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (1 + max - min) + min);\n}", "function randomNumber(min, max) {\r\n return Math.floor(Math.random() * (max - min + 1)) + min\r\n}", "getRand(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive \n }", "function randomNumber(min,max){\n return parseInt(Math.random()*(max-min)+min);\n}", "function getRandomNumber(min, max) {\n return Math.random() * (max - min) + min;\n }", "function getRandomNumber(min, max) {\n return Math.random() * (max - min) + min;\n }", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) + min);\n }", "function randomNumber(min, max) {\r\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\r\n}", "function getRandomNumber(max, min){\n var num = Math.floor(Math.random() * max) + min;\n return num\n}", "function randomNumber(min, max){\n return Math.round(Math.random() * (max - min + 1) + min);\n}", "function getRandomNumber(min, max){\n return (Math.random() * (max - min)) + min;\n}", "function randomNumberGenerator(min, max) {return Math.floor(Math.random() * (max - min + 1) ) + min;}", "function randomNumber(min, max)\n{\n\treturn Math.random() * (max - min) + min;\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (1 + max - min) + min);\n}", "function getRandomNumber(min, max) {\n\n // farmi spiegare questo!\n return Math.floor(Math.random() * (max - min + 1) + min);\n \n}", "function getRandomNumber(min, max) {\r\n return Math.floor(Math.random() * (max - min + 1) + min);\r\n }", "randomNumber(min, max) { \n return Math.floor(Math.random() * (max - min) + min); \n }", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1) ) + min;\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function randomIntFromInterval(min,max)\n{return Math.floor(Math.random()*(max-min+1)+min);}", "getRandomInt(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive\n }", "function randomNumber(min, max) {\r\n\treturn Math.round(Math.random() * (max - min) + min);\r\n}", "function getRandomNumber(min, max) {\n return Math.round(Math.random() * (max - min) + min);\n}", "function getRandomNumberBetween(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function randomNumber(min, max) {\n\treturn Math.floor(Math.random() * (1 + max - min) + min);\n}", "function randomNumber(min, max) {\n\treturn Math.floor(Math.random() * (1 + max - min) + min);\n}", "function randomNumber(min, max) {\n\treturn Math.floor(Math.random() * (1 + max - min) + min);\n}", "function intRandom(min, max)\n{\n return Math.floor(Math.random() * (max - Math.abs(min) + 1)) + min;\n\n}", "function randomNumber(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "function getRandomIntInclusive(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }", "function getRandomIntInclusive(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }", "function getRandomNum(min, max){\r\n return Math.floor(Math.random()*(max-min+1)+min);\r\n}", "range(max, min){\n let num = Math.round(Math.random()*(min-max)+max);\n return num;\n}", "function getRandomIntInclusive(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}" ]
[ "0.88785905", "0.87791955", "0.87685573", "0.8755253", "0.87487763", "0.8747502", "0.8747502", "0.874279", "0.8741016", "0.8732886", "0.87133825", "0.87099284", "0.8706377", "0.8698992", "0.8696441", "0.86932945", "0.86810774", "0.8680161", "0.8673529", "0.8673529", "0.86730355", "0.8669464", "0.8669143", "0.866856", "0.86648315", "0.866401", "0.8661953", "0.86596924", "0.86596924", "0.86594814", "0.865687", "0.865687", "0.8653453", "0.8652509", "0.86524004", "0.8650545", "0.8650291", "0.8648358", "0.86481076", "0.86481076", "0.86477566", "0.8647746", "0.8647742", "0.86474514", "0.86461735", "0.8645694", "0.8645633", "0.86450624", "0.86450624", "0.86450183", "0.864301", "0.86425066", "0.86425066", "0.86425066", "0.86425066", "0.8641697", "0.864095", "0.864083", "0.86395884", "0.8636185", "0.86358875", "0.863482", "0.8633663", "0.8633459", "0.86333746", "0.8632787", "0.8631982", "0.86309254", "0.8630005", "0.8630005", "0.8629525", "0.8629525", "0.8629494", "0.8629416", "0.86258924", "0.86257005", "0.862508", "0.8620848", "0.8620837", "0.8619755", "0.8617826", "0.86151755", "0.8614994", "0.8614785", "0.86142695", "0.86142695", "0.8613276", "0.86132616", "0.86124367", "0.86118877", "0.86099744", "0.8608407", "0.8608407", "0.8608407", "0.8607851", "0.8606291", "0.8603625", "0.8603625", "0.8602924", "0.86017275", "0.86012036" ]
0.0
-1
================================================================================================ ========================================== WEBSOCKETS ========================================== ================================================================================================ Creates a new websocket connection to the server.
function createWebSocket() { var old = gSocket; if (old !== null && old.readyState === WebSocket.OPEN) return; useWebSocket(new WebSocket("ws://" + window.location.host + "/ws/")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createSocket () {\n this.ws = new WebSocket(this.getEndpoint())\n }", "function createWebSocket() {\n var ws = new WebSocket(channelUrl+\"?token=\"+self.token + queryParam);\n ws.onopen = function() {\n // reset the tries back to 1 since we have a new connection opened.\n attempts = 1;\n\n self._log('Websocket opened: '+ws.url);\n self._fetchResourceOnReady();\n self._emitMessage('connected');\n\n // setup heartbeat onsleep and beat it once to get timer started\n self.heartbeat.onsleep = function() {\n // treat it like the socket closed because when network drops onclose does not get called right away\n self._log(\"Heartbeat timed out. closing socket\");\n ws.onclose();\n };\n self.heartbeat.beat();\n };\n ws.onmessage = function(response) {\n self.heartbeat.beat();\n\n // Receives a message\n if(response.data.trim().length === 0) {\n // heartbeat received\n return;\n }\n var json;\n try {\n json = JSON.parse(response.data);\n } catch (e) {\n self._log(e);\n self._log('This doesn\\'t look like a valid JSON: ' + response.data, response);\n return;\n }\n var type = json.event_type;\n var payload = json.payload;\n self._emitMessage(type, payload);\n };\n ws.onerror = function(response) {\n self._log(\"Websocket had an error\", response);\n };\n ws.onclose = function(response) {\n self._log(\"Websocket closed\");\n var payload = {'message': 'Websocket disconnected due to lost connectivity'};\n self._emitMessage('disconnected', payload);\n var time = generateInterval(attempts);\n\n // clear the heartbeat onsleep callback\n self.heartbeat.onsleep = function() {};\n\n setTimeout(function () {\n // We've tried to reconnect so increment the attempts by 1\n attempts++;\n\n // Connection has closed so try to reconnect every 10 seconds.\n createWebSocket();\n }, time);\n\n };\n }", "connect() {\n this.ws = new WebSocket(this.host);\n this.ws.on('open', this.onConnect.bind(this));\n this.ws.on('close', this.onDisconnect.bind(this));\n this.ws.on('error', this.onError.bind(this));\n }", "function h$createWebSocket(url, protocols) {\n return new WebSocket(url, protocols);\n}", "function h$createWebSocket(url, protocols) {\n return new WebSocket(url, protocols);\n}", "function h$createWebSocket(url, protocols) {\n return new WebSocket(url, protocols);\n}", "function h$createWebSocket(url, protocols) {\n return new WebSocket(url, protocols);\n}", "function h$createWebSocket(url, protocols) {\n return new WebSocket(url, protocols);\n}", "function initWebSocket() {\n\t\t// Create a connection to Server\n\t\tconnect();\n\t}", "function initWebSocket() {\n\t\t// Create a connection to Server\n\t\tconnect();\n\t}", "function connect() {\n // nothing to do if already connected\n if ( socket && socket.readyState === 1) return\n\n try{\n socket = new WebSocket(\n `ws://${host}:${port}/livereload`)\n }\n catch(e) { return void onError(e) }\n\n socket.onmessage = hello\n socket.onerror = onError // consumer provided callback\n socket.onclose = onClose // consumer provided callback\n socket.onopen = async ()=> {\n const fullyOpened = await yesItsReallyOpen()\n if(fullyOpened) socket.send(handshake)\n else socket.close()\n }\n\n return socket\n }", "function connectWS() {\n var host;\n if (!(\"WebSocket\" in window)) {\n alert(\"Your browser doesn't support WebSockets, please \" +\n \"use Google Chrome or Mozilla Firefox\");\n return;\n }\n \n try {\n host = \"ws://127.0.0.1:8000/\";\n socket = new WebSocket(host);\n \n socket.onopen = onOpenHandler; \n socket.onerror = onErrorHandler;\n socket.onclose = onCloseHandler;\n socket.onmessage = onMessageHandler;\n } catch (exception) {\n showAlert(\"Exception in WebSocket connection: \" + exception, \"danger\");\n }\n}", "function wsConnect(url) {\n \n \n websocket = new WebSocket(url); // Connect to WebSocket server\n \n // Assign callbacks\n websocket.onopen = function(evt) { onOpen(evt) };\n websocket.onclose = function(evt) { onClose(evt) };\n websocket.onmessage = function(evt) { onMessage(evt) };\n websocket.onerror = function(evt) { onError(evt) };\n}", "function connect() {\n add_to_output(\"### Trying to open new WebSocket\");\n if (socket_connected) {\n disconnect();\n }\n const socket_path = document.getElementById(\"socketPath\");\n socket = new WebSocket(socket_path.value);\n init_socket(socket);\n}", "connect () {\n /* Connect our websocket */\n this._ws = new WebSocket(this.uri, {\n origin: 'https://www.multiplayerpiano.com',\n agent: this.proxy ? this.proxy.startsWith('socks') ? new SocksProxyAgent(this.proxy) : new HttpsProxyAgent(this.proxy) : undefined\n })\n\n this._constructSocketListeners()\n\n setTimeout(() => {\n if (!this._isConnected) {\n this.emit('error', new Error('Bot failed to connect to websocket in 10 seconds.'))\n this._ws.close()\n }\n }, this._socketTimeoutMS)\n }", "function openWebSocket() {\n if (!gWebSocketOpened) {\n gWebSocket = new WebSocket('ws://localhost:12221/webrtc_write');\n }\n\n gWebSocket.onopen = function () {\n console.log('Opened WebSocket connection');\n gWebSocketOpened = true;\n };\n\n gWebSocket.onerror = function (error) {\n console.log('WebSocket Error ' + error);\n };\n\n gWebSocket.onmessage = function (e) {\n console.log('Server says: ' + e.data);\n };\n}", "connect() {\n log.info('connection constructing.');\n const WebSocketServer = WebSocket.Server;\n const wss = new WebSocketServer({\n port: PORT\n });\n\n wss.on('connection', (ws) => {\n log.info('connection established.');\n this.ws = ws;\n ws.on('message', this.handleMessage);\n });\n\n listener.subscribe('_send', this.send.bind(this));\n }", "function createWS(url) {\n wsConnection = new WebSocket(url);\n if (timeout != undefined && timeout > 0) {\n connectionTimeout = setTimeout(function() {\n if (wsConnection.readyState == 0) {\n logger.warn(LOG_PREFIX, \"WS connection timeout\");\n wsConnection.close();\n }\n }, timeout);\n }\n wsConnection.onerror = function () {\n onSessionStatusChange(SESSION_STATUS.FAILED);\n };\n wsConnection.onclose = function () {\n if (sessionStatus !== SESSION_STATUS.FAILED) {\n onSessionStatusChange(SESSION_STATUS.DISCONNECTED);\n }\n };\n wsConnection.onopen = function () {\n onSessionStatusChange(SESSION_STATUS.CONNECTED);\n clearTimeout(connectionTimeout);\n cConfig = {\n appKey: appKey,\n mediaProviders: Object.keys(MediaProvider),\n keepAlive: keepAlive,\n authToken:authToken,\n clientVersion: \"2.0\",\n clientOSVersion: window.navigator.appVersion,\n clientBrowserVersion: window.navigator.userAgent,\n msePacketizationVersion: 2,\n custom: options.custom\n };\n if (sipConfig) {\n util.copyObjectPropsToAnotherObject(sipConfig, cConfig);\n }\n //connect to REST App\n send(\"connection\", cConfig);\n logger.setConnection(wsConnection);\n // Send ping messages to server to check if connection is still alive #WCS-3410\n wsPingSender.start();\n // Check subsequintel pings received from server to check if connection is still alive #WCS-3410\n wsPingReceiver.start();\n };\n wsConnection.onmessage = function (event) {\n var data = {};\n if (event.data instanceof Blob) {\n data.message = \"binaryData\";\n } else {\n data = JSON.parse(event.data);\n var obj = data.data[0];\n }\n switch (data.message) {\n case 'ping':\n send(\"pong\", null);\n wsPingReceiver.success();\n break;\n case 'getUserData':\n authToken = obj.authToken;\n cConfig = obj;\n onSessionStatusChange(SESSION_STATUS.ESTABLISHED, obj);\n break;\n case 'setRemoteSDP':\n var mediaSessionId = data.data[0];\n var sdp = data.data[1];\n if (streamRefreshHandlers[mediaSessionId]) {\n //pass server's sdp to stream\n streamRefreshHandlers[mediaSessionId](null, sdp);\n } else if (callRefreshHandlers[mediaSessionId]) {\n //pass server's sdp to call\n callRefreshHandlers[mediaSessionId](null, sdp);\n } else {\n remoteSdpCache[mediaSessionId] = sdp;\n logger.info(LOG_PREFIX, \"Media not found, id \" + mediaSessionId);\n }\n break;\n case 'notifyVideoFormat':\n case 'notifyStreamStatusEvent':\n if (streamRefreshHandlers[obj.mediaSessionId]) {\n //update stream status\n streamRefreshHandlers[obj.mediaSessionId](obj);\n }\n break;\n case 'notifyStreamEvent':\n if (streamEventRefreshHandlers[obj.mediaSessionId]) {\n //update stream status\n streamEventRefreshHandlers[obj.mediaSessionId](obj);\n }\n break;\n case 'DataStatusEvent':\n restAppCommunicator.resolveData(obj);\n break;\n case 'OnDataEvent':\n if (callbacks[SESSION_STATUS.APP_DATA]) {\n callbacks[SESSION_STATUS.APP_DATA](obj);\n }\n break;\n case 'fail':\n if (obj.apiMethod && obj.apiMethod == \"StreamStatusEvent\") {\n if (streamRefreshHandlers[obj.id]) {\n //update stream status\n streamRefreshHandlers[obj.id](obj);\n }\n }\n if (callbacks[SESSION_STATUS.WARN]) {\n callbacks[SESSION_STATUS.WARN](obj);\n }\n break;\n case 'registered':\n onSessionStatusChange(SESSION_STATUS.REGISTERED);\n break;\n case 'notifyAudioCodec':\n // This case for Flash only\n var mediaSessionId = data.data[0];\n var codec = data.data[1];\n if (callRefreshHandlers[mediaSessionId]) {\n callRefreshHandlers[mediaSessionId](null, null, codec);\n }\n break;\n case 'notifyTransferEvent':\n callRefreshHandlers[obj.callId](null, null, null, obj);\n break;\n case 'notifyTryingResponse':\n case 'hold':\n case 'ring':\n case 'talk':\n case 'finish':\n if (callRefreshHandlers[obj.callId]) {\n //update call status\n callRefreshHandlers[obj.callId](obj);\n }\n break;\n case 'notifyIncomingCall':\n if (callRefreshHandlers[obj.callId]) {\n logger.error(LOG_PREFIX, \"Call already exists, id \" + obj.callId);\n }\n if (callbacks[SESSION_STATUS.INCOMING_CALL]) {\n callbacks[SESSION_STATUS.INCOMING_CALL](createCall(obj));\n } else {\n //todo hangup call\n }\n break;\n case 'notifySessionDebugEvent':\n logger.info(LOG_PREFIX, \"Session debug status \" + obj.status);\n if (callbacks[SESSION_STATUS.DEBUG]) {\n callbacks[SESSION_STATUS.DEBUG](obj);\n }\n break;\n case 'availableStream':\n var availableStream = {};\n availableStream.mediaSessionId = obj.id;\n availableStream.available = obj.status;\n availableStream.reason = obj.info;\n if (streamRefreshHandlers[availableStream.mediaSessionId]) {\n streamRefreshHandlers[availableStream.mediaSessionId](availableStream);\n }\n break;\n case OUTBOUND_VIDEO_RATE:\n case INBOUND_VIDEO_RATE:\n if (streamRefreshHandlers[obj.mediaSessionId]) {\n obj.status = data.message;\n streamRefreshHandlers[obj.mediaSessionId](obj);\n }\n break;\n default:\n //logger.info(LOG_PREFIX, \"Unknown server message \" + data.message);\n }\n };\n }", "function createWebSocket(listenKey, userStream, OrderAPI, binanceAPI) {\n //console.log(\"createWebSocket\", listenKey, userStream, OrderAPI, binanceAPI);\n const wsstream = new webSocket(`${userStream}${listenKey}`);\n console.log(\"websocket initiated\");\n wsstream.on(\"open\", () => {\n console.log(\"websocket opened\");\n });\n wsstream.on(\"error\", (err) => {\n console.log(err.message);\n });\n keepConnectionAlive(OrderAPI, binanceAPI);\n return wsstream;\n}", "function createWebSocket(opts, _host_) {\n var wsport = (opts && opts.wsport) || null;\n\n webSockOpts = opts; // preserved for future calls\n\n host = _host_ || $loc.host();\n url = ufs.wsUrl('core', wsport, _host_);\n\n $log.debug('Attempting to open websocket to: ' + url);\n ws = wsock.newWebSocket(url);\n if (ws) {\n ws.onopen = handleOpen;\n ws.onmessage = handleMessage;\n ws.onclose = handleClose;\n\n sendEvent('authentication', { token: onosAuth });\n }\n // Note: Wsock logs an error if the new WebSocket call fails\n return url;\n }", "initWS() {\n this.ws = new WebSocket(this.wsUrl, 'game');\n }", "connect() {\n this.ws = new WebSocket(WS_URI, { headers: this.player.headers, rejectUnauthorized: false })\n\n this.ws.on('open', this.handleOpen.bind(this))\n this.ws.on('message', this.handleMessage.bind(this))\n this.ws.on('error', this.handleError.bind(this))\n this.ws.on('close', this.handleClose.bind(this))\n }", "constructor(wss) {\n this.websocketServer = wss;\n }", "function WebSockets() {\n if (!this.instance) {\n logger.info('Initiating the Websockets Server...')\n this.instance = io(server)\n\n // to log every messages being transmitted => https://stackoverflow.com/a/9042249\n var originalEmit = this.instance.sockets.emit\n this.instance.sockets.emit = function() {\n const event = arguments[0]\n const data = arguments[1]\n if (!event.includes('connect')) { // osef des connect et disconnect\n logger.debug(`[WS] >> ${event} :\\n${CircularJSON.stringify(data)}`)\n }\n originalEmit.apply(this, Array.prototype.slice.call(arguments));\n }\n\n // log connect and disconnect\n this.instance.on('connection', function(socket) {\n logger.info(`[WS] ${socket.request.connection.remoteAddress} connected`)\n this.instance.emit('users.count', Object.keys(this.instance.sockets.connected).length)\n socket.on('disconnect', function(reason) {\n logger.info(`[WS] ${socket.request.connection.remoteAddress} disconnected`)\n this.instance.emit('users.count', Object.keys(this.instance.sockets.connected).length)\n }.bind(this))\n }.bind(this))\n }\n return this.instance\n}", "function _connect() {\n log.debug(LOG_PREFIX, `Connecting to ${_wsURL}`);\n _ws = new WebSocket(_wsURL);\n _ws.on('open', _wsOpen);\n _ws.on('close', _wsClose);\n _ws.on('message', _wsMessage);\n _ws.on('error', _wsError);\n _ws.on('ping', _wsPing);\n _ws.on('pong', _wsPong);\n }", "Connect() {\n\t\tif (!(\"WebSocket\" in window)) {\n\t\t\talert(\"WebSockets are not supported by your browser. Please upgrade to connect to the server.\");\n\t\t\tDisplay.LogError(\"WebSockets are not supported by your browser. Please upgrade to connect to the server.\");\n\t\t\treturn;\n\t\t}\n\n\t\tDisplay.LogMessage(\"Connecting to server...\");\n\t\t// HACK(Samuel-Lewis): Hard coded address value is always local\n\t\tServer._socket = new WebSocket(\"ws://\" + Auth.ip + \"/ws\");\n\n\t\tServer._socket.onopen = function (event) {\n\t\t\tServer._OnOpen(event);\n\t\t}\n\t\tServer._socket.onclose = function (event) {\n\t\t\tServer._OnClose(event);\n\t\t}\n\t\tServer._socket.onmessage = function (event) {\n\t\t\tServer._OnMessage(event);\n\t\t}\n\t\tServer._socket.onerror = function (event) {\n\t\t\tServer._OnError(event);\n\t\t}\n\t}", "function connectWebSocket() {\n let protocol = 'wss://';\n // so it also works in 'http' (useful when testing)\n if (location.protocol === 'http:') {\n protocol = 'ws://';\n }\n SOCKET = new WebSocket(protocol + window.location.host + \"/chat\", \"chat\");\n SOCKET.onopen = socketReady;\n SOCKET.onclose = function () {\n console.log('Socket closed');\n addSystemMessage(textElement(\"Disconnected! (will try to reconnect in 5s)\"));\n reconnectWebSocket();\n };\n SOCKET.onerror = function (event) {\n console.log(event);\n addSystemMessage(textElement(\"Disconnected! (will try to reconnect in 5s)\"));\n reconnectWebSocket();\n };\n SOCKET.onmessage = function (event) {\n var type = event.data[0];\n switch (type) {\n case MessageType.getUsername:\n var username = parseUsernameMessage(event.data);\n associateUsername(username);\n break;\n case MessageType.currentUsersCount:\n let connectedCount = parseUsersCount(event.data);\n addToUsersCount(connectedCount);\n break;\n case MessageType.textMessage:\n var message = parseTextMessage(event.data);\n addUserMessage(message);\n break;\n case MessageType.userJoined:\n var username = parseUsernameMessage(event.data);\n userJoined(username);\n break;\n case MessageType.userLeft:\n var username = parseUsernameMessage(event.data);\n userLeft(username);\n break;\n }\n };\n}", "$create() {\n Promise.resolve(\n this.websocket\n ? this.$close()\n : true\n ).then(e => {\n const { host, path, port, secure } = this.options;\n this.$ws = new WebSocket(`${secure ? 'wss' : 'ws'}://${host}${port > 0 ? `:${port}` : ''}${path}`);\n this.$ws.binaryType = 'arraybuffer';\n this.$ws.onopen = this.$onopen;\n this.$ws.onclose = this.$onclose;\n this.$ws.onmessage = this.$onmessage;\n this.$ws.onerror = this.$onerror;\n });\n }", "function createWebSocket () \n {\n ws = new WebSocket('wss://' + site.ws_url + '/ws/core');\n \n // Websocket sent data to us.\n ws.onmessage = function(e) \n { \n var msg = JSON.parse(e.data);\n \n // Some special cases send \"job\" instead of \"type\"\n if(msg.job)\n {\n msg.type = msg.job;\n msg.data = msg.data.Payload;\n }\n \n // Is this a pong to our ping or some other return.\n if(msg.type == 'pong')\n {\n missed_heartbeats--;\n } else\n {\n $scope.$broadcast(msg.type, { data: msg.data, timestamp: msg.timestamp }); \n }\n };\n \n // On Websocket open\n ws.onopen = function(e) \n {\n $scope.ws_reconnecting = false;\n \n // Setup the connection heartbeat\n if(heartbeat === null) \n {\n missed_heartbeats = 0;\n \n heartbeat = setInterval(function() {\n \n try {\n missed_heartbeats++;\n \n if(missed_heartbeats >= 5)\n {\n throw new Error('Too many missed heartbeats.');\n }\n \n ws.send(JSON.stringify({ type: 'ping' }));\n \n } catch(e) \n {\n $scope.ws_reconnecting = true;\n clearInterval(heartbeat);\n heartbeat = null;\n console.warn(\"Closing connection. Reason: \" + e.message);\n ws.close();\n }\n \n }, 5000);\n } else\n {\n clearInterval(heartbeat);\n }\n \n // We need to get WS API key to do anything fun.\n $http.post('/api/v1/me/get_websocket_key', {}).success(function (json) {\n \n // If failed do nothing.\n if(! json.status)\n {\n return false;\n }\n \n // Send websocket key\n ws.send(JSON.stringify({ type: 'ws-key', data: json.data.key })); \n }); \n \n };\n \n/*\n ws.onerror = function(e) {\n \n // clear heartbeat\n clearInterval(heartbeat);\n heartbeat = null;\n \n $scope.ws_reconnecting = true;\n $scope.$apply();\n }\n*/\n \n // On Close\n ws.onclose = function () \n { \n // Kill Ping heartbeat.\n clearInterval(heartbeat);\n heartbeat = null;\n \n // Try to reconnect\n $scope.ws_reconnecting = true;\n setTimeout(function () { createWebSocket(); }, 3 * 1000);\n $scope.$apply();\n }\n \n }", "function initWebSocket() {\n var gateway = `ws://${window.location.hostname}/ws`;\n console.log(gateway)\n websocket = new WebSocket(gateway);\n websocket.onopen = onWebSocketOpen;\n websocket.onclose = onWebSocketClose;\n websocket.onmessage = onWebSocketMessage;\n}", "function openWSConnection(protocol, hostname, port, endpoint) {\n var webSocketURL = null;\n webSocketURL = protocol + \"://\" + hostname + \":\" + port + endpoint;\n console.log(\"openWSConnection::Connecting to: \" + webSocketURL);\n try {\n webSocket = io(webSocketURL);\n console.log('--webSocket--');\n console.dir(webSocket, { depth: null, colors: true });\n\n webSocket.on('new parameters', (parameters) => {\n console.dir(parameters, { depth: null, colors: true });\n let template = document.getElementById('horizontalTemplate').innerHTML;\n if (parameters.orientation !== 0) {\n template = document.getElementById('verticalTemplate').innerHTML;\n }\n else {\n template = document.getElementById('horizontalTemplate').innerHTML;\n }\n renderTemplate(parameters, template);\n });\n\n webSocket.on('connect_failed', (details) => {\n console.log(\"WebSocket CONNECTION FAILED: \" + JSON.stringify(details, null, 4));\n });\n\n webSocket.on('error', (details) => {\n console.log(\"WebSocket ERROR: \" + JSON.stringify(details, null, 4));\n });\n\n webSocket.onopen = function (openEvent) {\n console.log(\"WebSocket OPEN: \" + JSON.stringify(openEvent, null, 4));\n document.getElementById(\"btnSend\").disabled = false;\n document.getElementById(\"btnConnect\").disabled = true;\n document.getElementById(\"btnDisconnect\").disabled = false;\n };\n webSocket.onclose = function (closeEvent) {\n console.log(\"WebSocket CLOSE: \" + JSON.stringify(closeEvent, null, 4));\n document.getElementById(\"btnSend\").disabled = true;\n document.getElementById(\"btnConnect\").disabled = false;\n document.getElementById(\"btnDisconnect\").disabled = true;\n };\n webSocket.onerror = function (errorEvent) {\n console.log(\"WebSocket ERROR: \" + JSON.stringify(errorEvent, null, 4));\n };\n webSocket.onmessage = function (messageEvent) {\n var wsMsg = messageEvent.data;\n console.log(\"WebSocket MESSAGE: \" + wsMsg);\n if (wsMsg.indexOf(\"error\") > 0) {\n document.getElementById(\"incomingMsgOutput\").value += \"error: \" + wsMsg.error + \"\\r\\n\";\n } else {\n document.getElementById(\"incomingMsgOutput\").value += \"message: \" + wsMsg + \"\\r\\n\";\n }\n };\n } catch (exception) {\n console.error(exception);\n webSocket.close();\n }\n}", "function attach_socket() {\n var wsUri = \"ws://\" + window.location.hostname + \"/controller\";\n update_connection_status(\"Connection to \" + wsUri + \" ...\")\n websocket = new WebSocket(wsUri);\n websocket.onopen = function (evt) { onOpen(evt) };\n websocket.onclose = function (evt) { onClose(evt) };\n websocket.onmessage = function (evt) { onMessage(evt) };\n websocket.onerror = function (evt) { onError(evt) };\n}", "connectToWebSocket(url) {\n const client = new WebSocketClient();\n client.connect(url);\n\n client.on('connect', connection =>\n this.handleConnection(connection));\n\n client.on('connectFailed', error =>\n this.handleError(error));\n }", "function websocket_setup() {\n // Get the endpoint address from the current page\n var ws_url = 'ws://' + window.document.location.host + '/endpoint';\n ws = new WebSocket(ws_url);\n ws.onopen = function() {\n msg_connect_success();\n on_connect();\n };\n ws.onclose = function() {\n msg_connect_close();\n }\n ws.onmessage = function(msg) {\n callback(msg);\n }\n}", "function connect() {\n // TODO pass websocket port here\n var socket = new WebSocket('ws://localhost:3132/');\n socket.onclose = function (_event) {\n console.warn('Websocket connection closed or unable to connect; ' + 'loading reconnect timeout');\n\n // Allow the last socket to be cleaned up.\n socket = null;\n\n // Set an interval to continue trying to reconnect\n // periodically until we succeed.\n setTimeout(function () {\n connect();\n }, 5000);\n };\n socket.onmessage = async function (event) {\n const e = JSON.parse(event.data);\n if (e.type === 'update' || e.type === 'remove') {\n await app.loadAll(`/${e.file}`);\n }\n if (e.type === 'thumbs-update') {\n app.model.setThumbs(e.thumbs);\n app.renderThumbs();\n }\n };\n }", "connect ( protocol = \"ws://\", host = \"\", path = \"\" ) {\n if ( \"WebSocket\" in window ) {\n let target = protocol + host + path;\n\n if ( DL.reports( \"connection\" ) ) {\n DL.info( \"Creating WebSocket connection to \" + target );\n }\n\n this.socket = new WebSocket( target );\n\n if ( this.socket instanceof WebSocket) {\n _.assign( this.socket\n , { onopen: this.handleOpen.bind( this )\n , onmessage: this.handleMessage.bind( this )\n , onerror: this.handleError.bind( this )\n , onclose: this.handleClose.bind( this )\n }\n , this\n );\n } else {\n throw new Error( \"Was unable to create a WebSocket instance\" );\n }\n } else {\n // TODO: Visual error for legacy browsers with links to download others\n DL.error( \"This environment doesn't support WebSockets.\" );\n }\n }", "function initWebSocket(server) {\n var webSocket = new WebSocketServer({\n httpServer: server\n });\n\n webSocket.on('request', req => {\n var connection = req.accept(null, req.origin);\n\n logic.onWebsocketUserConnect(connection);\n\n connection.on('message', message => {\n if (message.type !== 'utf8') return;\n logic.onWebsocketMessage(message.utf8Data, connection);\n });\n\n connection.on('close', connection => {\n logic.onWebsocketUserDisconnect(connection);\n });\n });\n\n return webSocket;\n}", "_connect() {\n const options = {\n reconnect: {\n auto: true,\n delay: 1000, // ms\n maxAttempts: 5,\n onTimeout: false\n }\n };\n const providerWeb3 = \n new Web3.providers.WebsocketProvider(constants.INFURA_WS, options);\n return new Web3(providerWeb3);\n }", "createSocket() {\n // Create the socket\n this.socket = new WebSocket('ws://localhost:7777');\n\n extendWebSocket(this.socket);\n\n // Listen for connect events and\n // print them to the terminal\n this.socket.onopen = function() {\n this.top.onConnectionWithServer();\n }.bind(this);\n\n // Listen for a variety of messages\n // and define the callbacks for each\n this.socket.register(\n 'presets', (message) => this.handlePresetsMessage(message));\n this.socket.register(\n 'serialPorts', (message) => this.handleSerialPortsMessage(message));\n this.socket.register(\n 'channelDataString',\n (message) => this.handleChannelDataStringMessage(message));\n this.socket.register(\n 'impedanceDataString',\n (message) => this.handleImpedanceDataStringMessage(message));\n this.socket.register(\n 'recordingStarted',\n (message) => this.handleRecordingStartedMessage(message));\n this.socket.register(\n 'recordingStopped',\n (message) => this.handleRecordingStoppedMessage(message));\n this.socket.register(\n 'presetSaved', (message) => this.handlePresetSavedMessage(message));\n this.socket.register(\n 'unableToConnectToChannelDataSocket',\n (message) =>\n this.handleUnableToConnectToChannelDataSocketMessage(message));\n this.socket.register(\n 'channelDataSocketConnected',\n (message) => this.handleChannelDataSocketConnectedMessage(message));\n this.socket.register(\n 'channelDataSocketClosed',\n (message) => this.handleChannelDataSocketClosedMessage(message));\n this.socket.register(\n 'channelDataSocketError',\n (message) => this.handleChannelDataSocketErrorMessage(message));\n this.socket.register(\n 'version', (message) => this.handleVersionMessage(message));\n this.socket.register(\n 'recordingAlreadyExists',\n (message) => this.handleRecordingAlreadyExistsMessage(message));\n this.socket.register(\n 'recordingError',\n (message) => this.handleRecordingErrorMessage(message));\n this.socket.register(\n 'bioampVersion',\n (message) => this.handleBioampVersionMessage(message));\n this.socket.register(\n 'alwaysOnArtifactUpdate',\n (message) => this.handleAlwaysOnArtifactUpdateMessage(message));\n }", "wsConnect() {\n\n\t\tconst socketUrl = 'ws://localhost:8989/ws';\n\t\t// const socketUrl = 'ws://192.168.1.68:8888/ws';\n\t\t// const socketUrl = 'ws://192.168.1.68:8888/ws';\n\n\t\tthis.SPJS.ws = new WebSocket(socketUrl);\n\n\t\tthis.SPJS.ws.onopen = () => this.onSpjsOpen();\n\t\tthis.SPJS.ws.onmessage = evt => this.onSpjsMessage(evt.data);\n\t\tthis.SPJS.ws.onerror = error => this.onSpjsError(error);\n\t\tthis.SPJS.ws.onclose = () => this.onSpjsClose();\n\n\t}", "function getNewWs () {\n return new WebSocket(`${ (location.protocol === \"https:\" ? \"wss:\" : \"ws:\")\n }//${ location.hostname }:${ location.port ||\n (location.protocol === \"https:\" ? \"443\" : \"80\")\n }/terminalsocket/${ encodeURIComponent(CACHE_CLASS_NAME) }`);\n}", "function getWebSocket() {\n\t\n\trequest('https://slack.com/api/rtm.start?token=' + global.token + '&pretty=1', function(error, response, body) {\n\t\tparser.log(response.url);\n\t\tif (!error && response.statusCode === 200) {\n\t\t url = JSON.parse(body).url;\n\t\t parser.log( \"Creating url:\"+url);\n\t\t createWS(url);\n\t\t}\n\t});\n}", "connect(url) {\n if ( ! url ) {\n url = window.location.href; // http://localhost:8080/console.html\n this.log(\"This href \"+url);\n let start = url.indexOf('/');\n let protocol = url.substring(0,start);\n let webSocketProtocol = 'ws';\n if ( protocol == 'https:' ) {\n webSocketProtocol = 'wss';\n }\n let end = url.indexOf('/', start+2);\n url = webSocketProtocol+':'+url.substring(start,end)+'/vrspace/client'; // ws://localhost:8080/vrspace\n }\n this.log(\"Connecting to \"+url);\n this.ws = new WebSocket(url);\n this.ws.onopen = () => {\n this.connectionListeners.forEach((listener)=>listener(true));\n /*\n this.pingTimerId = setInterval(() => {\n this.sendCommand(\"Ping\");\n }, 20000);\n */\n }\n this.ws.onclose = () => {\n this.connectionListeners.forEach((listener)=>listener(false));\n //clearInterval(this.pingTimerId);\n }\n this.ws.onmessage = (data) => {\n this.receive(data.data);\n this.dataListeners.forEach((listener)=>listener(data.data)); \n }\n this.log(\"Connected!\")\n }", "function connectW(url, onMessage) {\n socket = new WebSocket(url)\n socket.onopen = function() {\n console.log('Соединение установлено.');\n };\n\n socket.onclose = function(event) {\n if (event.wasClean) {\n console.log('Соединение закрыто чисто');\n } else {\n console.log('Обрыв соединения'); // например, 'убит' процесс сервера\n }\n console.log('Код: ' + event.code + ' причина: ' + event.reason);\n };\n\n socket.onmessage = onMessage;\n}", "function setWebsocketConnection() {\n console.log('Opening WS connection to: ' + \"ws://\" + window.location.host + \"/API-ws/\");\n vm.ws = new WebSocket(\"ws://\" + window.location.host + \"/API-ws/\");\n vm.ws.onmessage = function(e) {\n receiveWebsocketMessage(e.data);\n };\n vm.ws.onopen = function() {\n // Request information\n console.log('Opened WS connection to: ' + \"ws://\" + window.location.host + \"/API-ws/\");\n //TODO\n requestGetDetails('content', 'get_details');\n };\n\n // Call onopen directly if socket is already open\n if (vm.ws.readyState == WebSocket.OPEN) {vm.ws.onopen();}\n }", "function wsFactory(url, protocols) {\n return new WebSocket(url, protocols);\n }", "function WebSocketConnection()\n{\nvar self = this;\n\nvar isNodeJs = (typeof window === \"undefined\" ? true : false);\n\nvar lib = null;\nvar SpaceifyError = null;\nvar SpaceifyLogger = null;\n\nif(isNodeJs)\n\t{\n\tlib = \"/var/lib/spaceify/code/\";\n\n\tSpaceifyLogger = require(lib + \"spaceifylogger\");\n\tSpaceifyError = require(lib + \"spaceifyerror\");\n\n\tglobal.fs = require(\"fs\");\n\tglobal.WebSocket = require(\"websocket\").w3cwebsocket;\n\t}\nelse\n\t{\n\tlib = (window.WEBPACK_MAIN_LIBRARY ? window.WEBPACK_MAIN_LIBRARY : window);\n\n\tSpaceifyLogger = lib.SpaceifyLogger;\n\tSpaceifyError = lib.SpaceifyError;\n\t}\n\nvar errorc = new SpaceifyError();\nvar logger = new SpaceifyLogger(\"WebSocketConnection\");\n\nvar url = \"\";\nvar id = null;\nvar port = null;\nvar socket = null;\nvar origin = null;\nvar pipedTo = null;\nvar isOpen = false;\nvar isSecure = false;\nvar remotePort = null;\nvar remoteAddress = null;\nvar eventListener = null;\n\n// For client-side use, in both Node.js and the browser\n\nself.connect = function(opts, callback)\n\t{\n\tid = opts.id || null;\n\tport = opts.port || \"\";\n\tisSecure = opts.isSecure || false;\n\n\tvar caCrt = opts.caCrt || \"\";\n\tvar hostname = opts.hostname || null;\n\tvar protocol = (!isSecure ? \"ws\" : \"wss\");\n\tvar subprotocol = opts.subprotocol || \"json-rpc\";\n\n\ttry\t{\n\t\turl = protocol + \"://\" + hostname + (port ? \":\" + port : \"\") + (id ? \"?id=\" + id : \"\");\n\n\t\tvar cco = (isNodeJs && isSecure ? { tlsOptions: { ca: [fs.readFileSync(caCrt, \"utf8\")] } } : null);\n\n\t\tsocket = new WebSocket(url, \"json-rpc\", null, null, null, cco);\n\n\t\tsocket.binaryType = \"arraybuffer\";\n\n\t\tsocket.onopen = function()\n\t\t\t{\n\t\t\tlogger.log(\"WebSocketConnection::onOpen() \" + url);\n\n\t\t\tisOpen = true;\n\n\t\t\tcallback(null, true);\n\t\t\t};\n\n\t\tsocket.onerror = function(err)\n\t\t\t{\n\t\t\tlogger.error(\"WebSocketConnection::onError() \" + url, true, true, logger.ERROR);\n\n\t\t\tisOpen = false;\n\n\t\t\tcallback(errorc.makeErrorObject(\"wsc\", \"Failed to open WebsocketConnection.\", \"WebSocketConnection::connect\"), null);\n\t\t\t}\n\n\t\tsocket.onclose = function(reasonCode, description)\n\t\t\t{\n\t\t\tonSocketClosed(reasonCode, description, self);\n\t\t\t};\n\n\t\tsocket.onmessage = onMessageEvent;\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tcallback(err, null);\n\t\t}\n\t};\n\n// For server-side Node.js use only\n\nself.setSocket = function(val)\n\t{\n\ttry\t{\n\t\tsocket = val;\n\n\t\tsocket.on(\"message\", onMessage);\n\n\t\tsocket.on(\"close\", function(reasonCode, description)\n\t\t\t{\n\t\t\tonSocketClosed(reasonCode, description, self);\n\t\t\t});\n\n\t\tisOpen = true;\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nself.setId = function(val)\n\t{\n\tid = val;\n\t};\n\nself.setPipedTo = function(targetId)\n\t{\n\tpipedTo = targetId;\n\t};\n\nself.setRemoteAddress = function(val)\n\t{\n\tremoteAddress = val;\n\t};\n\nself.setRemotePort = function(val)\n\t{\n\tremotePort = val;\n\t};\n\nself.setOrigin = function(val)\n\t{\n\torigin = val;\n\t};\n\nself.setIsSecure = function(val)\n\t{\n\tisSecure = val;\n\t}\n\nself.setEventListener = function(listener)\n\t{\n\teventListener = listener;\n\t};\n\nself.getId = function()\n\t{\n\treturn id;\n\t};\n\nself.getRemoteAddress = function()\n\t{\n\treturn remoteAddress;\n\t};\n\nself.getRemotePort = function()\n\t{\n\treturn remotePort;\n\t};\n\nself.getOrigin = function()\n\t{\n\treturn origin;\n\t};\n\nself.getIsSecure = function()\n\t{\n\treturn isSecure;\n\t}\n\nself.getPipedTo = function()\n\t{\n\treturn pipedTo;\n\t}\n\nself.getIsOpen = function()\n\t{\n\treturn isOpen;\n\t}\n\nself.getPort = function()\n\t{\n\treturn port;\n\t}\n\nvar onMessage = function(message)\n\t{\n\ttry\t{\n\t\tif (eventListener)\n\t\t\t{\n\t\t\tif (message.type == \"utf8\")\n\t\t\t\t{\n\t\t\t\t//logger.log(\"WebSocketConnection::onMessage(string): \" + JSON.stringify(message.utf8Data));\n\n\t\t\t\teventListener.onMessage(message.utf8Data, self);\n\t\t\t\t}\n\t\t\tif (message.type == \"binary\")\n\t\t\t\t{\n\t\t\t\t//logger.log(\"WebSocketConnection::onMessage(binary): \" + binaryData.length);\n\n\t\t\t\teventListener.onMessage(message.binaryData, self);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nvar onMessageEvent = function(event)\n\t{\n\t//logger.log(\"WebSocketConnection::onMessageEvent() \" + JSON.stringify(event.data));\n\n\ttry\t{\n\t\tif (eventListener)\n\t\t\teventListener.onMessage(event.data, self);\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nvar onSocketClosed = function(reasonCode, description, obj)\n\t{\n\tlogger.log(\"WebSocketConnection::onSocketClosed() \" + url);\n\n\ttry\t{\n\t\tisOpen = false;\n\n\t\tif (eventListener)\n\t\t\teventListener.onDisconnected(obj.getId());\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nself.send = function(message)\n\t{\n\ttry\t{\n\t\tsocket.send(message);\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\nself.sendBinary = self.send;\n\nself.close = function()\n\t{\n\ttry\t{\n\t\tsocket.close();\n\t\t}\n\tcatch(err)\n\t\t{\n\t\tlogger.error(err, true, true, logger.ERROR);\n\t\t}\n\t};\n\n}", "function connect() {\n // Create a new WebSocket to the SERVER_URL (defined above). The empty\n // array ([]) is for the protocols, which we are not using for this\n // demo.\n ws = new WebSocket(SERVER_URL, []);\n // Set the function to be called when we have connected to the server.\n ws.onopen = handleConnected;\n // Set the function to be called when an error occurs.\n ws.onerror = handleError;\n\n\n ws.onmessage = MsjRecibido;\n // Set the function to be called when we have connected to the server.\n }", "function wsconnect(){\n try {\n console.log(\"opening Websocket\");\n if (\"WebSocket\" in window) {\n console.log(ws_uri);\n var socket = new WebSocket(ws_uri);\n } // end if\n else {\n // Firefox currently prefixes the WebSocket object\n var socket = new MozWebSocket(ws_uri);\n } // end else\n socket.onopen = function() {\n console.log(\"Websocket opened\");\n }\n socket.onmessage = function(e) {\n if (debug === true) {\n console.log(\"Received data: \" + e.data);\n }\n measurement = JSON.parse(e.data);\n console.log(datakey);\n updateData(measurement, datakey);\n } // end function\n socket.onclose = function(){ \n console.log(\"Websocket closed\");\n // automatically reconnect after 1s\n window.setTimeout(wsconnect, 2000);\n }\n } catch(exception) { // end try\n console.log(\"Websocket exception\" + exception); \n } // end catch\n \n } // end function wsconnect", "function setupWebSocket() {\n\tconsole.log('------------------------------------------ Websocket Up ------------------------------------------');\n\twss = new ws.Server({ server: server });\t\t\t\t\t\t// start the websocket now\n\twss.on('connection', function connection(ws) {\n\n\t\t// -- Process all websocket messages -- //\n\t\tws.on('message', function incoming(message) {\n\t\t\tconsole.log(' ');\n\t\t\tconsole.log('-------------------------------- Incoming WS Msg --------------------------------');\n\t\t\tlogger.debug('[ws] received ws msg:', message);\n\t\t\tvar data = null;\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse(message);\t\t\t\t\t\t\t// it better be json\n\t\t\t} catch (e) {\n\t\t\t\tlogger.debug('[ws] message error', message, e.stack);\n\t\t\t}\n\n\t\t\t// --- [5] Process the ws message --- //\n\t\t\tif (data && data.type == 'setup') {\t\t\t\t\t\t// its a setup request, enter the setup code\n\t\t\t\tlogger.debug('[ws] setup message', data);\n\t\t\t\tstartup_lib.setup_ws_steps(data);\t\t\t\t\t// <-- open startup_lib.js to view the rest of the start up code\n\n\t\t\t} else if (data) {\t\t\t\t\t\t\t\t\t\t// its a normal marble request, pass it to the lib for processing\n\t\t\t\tws_server.process_msg(ws, data);\t\t\t\t\t// <-- the interesting \"blockchainy\" code is this way (websocket_server_side.js)\n\t\t\t}\n\t\t});\n\n\t\t// log web socket errors\n\t\tws.on('error', function (e) { logger.debug('[ws] error', e); });\n\n\t\t// log web socket connection disconnects (typically client closed browser)\n\t\tws.on('close', function () { logger.debug('[ws] closed'); });\n\n\t\t// whenever someone connects, tell them our app's state\n\t\tws.send(JSON.stringify(ws_server.build_state_msg()));\t\t\t\t// tell client our app state\n\t});\n\n\t// --- Send a message to all connected clients --- //\n\twss.broadcast = function broadcast(data) {\n\t\tvar i = 0;\n\t\twss.clients.forEach(function each(client) {\t\t\t\t\t\t\t// iter on each connection\n\t\t\ttry {\n\t\t\t\tlogger.debug('[ws] broadcasting to clients. ', (++i), data.msg);\n\t\t\t\tclient.send(JSON.stringify(data));\t\t\t\t\t\t\t// BAM, send the data\n\t\t\t} catch (e) {\n\t\t\t\tlogger.debug('[ws] error broadcast ws', e);\n\t\t\t}\n\t\t});\n\t};\n\n\tws_server.setup(wss, null);\n}", "_connectToWebSocket() {\n return new Promise((fulfill, reject) => {\n // create the WebSocket\n try {\n if (this.secure) {\n this.webSocketUrl = this.webSocketUrl.replace(/^ws:/i, 'wss:');\n }\n this._ws = new WebSocket(this.webSocketUrl);\n } catch (err) {\n // handles bad URLs\n reject(err);\n return;\n }\n // set up event handlers\n this._ws.on('open', () => {\n fulfill();\n });\n this._ws.on('message', (data) => {\n const message = JSON.parse(data);\n this._handleMessage(message);\n });\n this._ws.on('close', (code) => {\n this.emit('disconnect');\n });\n this._ws.on('error', (err) => {\n reject(err);\n });\n });\n }", "function startWebsocketClient() {\n const socketProtocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:')\n const serverSocketUrl = socketProtocol + \"//\" + window.location.hostname + \":\" + window.location.port + window.location.pathname\n const socket = new WebSocket(serverSocketUrl);\n\n socket.onopen = e => {\n console.log(`connection to ${serverSocketUrl} established.`);\n }\n\n socket.onmessage = (e) => {\n runtimeInfo = JSON.parse(e.data);\n\n updateContainerInfo(runtimeInfo);\n };\n}", "function initWebsocket() {\n connection.onopen = () => {\n };\n\n connection.onclose = () => {\n getServerUrl().then(result => {\n connection = new WebSocket(result);\n });\n };\n\n connection.onerror = (error) => {\n throw 'Error'\n };\n\n connection.onmessage = (event) => {\n\n var obj = JSON.parse(event.data);\n\n switch(obj.type) {\n case 'MSG_RECV':\n handleChatMessage(obj);\n break;\n case 'MAP_RECV':\n myMap.handleMarker(obj);\n break;\n case 'MAP_DEL':\n myMap.deleteMarker(obj);\n break;\n default:\n throw 'Type not found';\n }\n };\n}", "function openSocket() {\r\n\t// Ensures only one connection is open at a time\r\n\tif (webSocket !== undefined && webSocket.readyState !== WebSocket.CLOSED) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Create a new instance of the websocket\r\n\twebSocket = new WebSocket(\"ws://\" + socket_url + \":\" + port\r\n\t\t\t+ \"/WebMobileGroupChatServer/chat?name=\" + name);\r\n\r\n\t/**\r\n\t * Binds functions to the listeners for the websocket.\r\n\t */\r\n\twebSocket.onopen = function(event) {\r\n\t\t// $('#message_container').fadeIn();\r\n\r\n\t\tif (event.data === undefined)\r\n\t\t\treturn;\r\n\t};\r\n\r\n\twebSocket.onmessage = function(event) {\r\n\r\n\t\t// parsing the json data\r\n\t\tparseMessage(event.data);\r\n\t};\r\n\r\n\twebSocket.onclose = function(event) {\r\n\r\n\t};\r\n}", "function connect() {\n const socket = new WebSocket('ws://localhost:8090');\n return new Promise(resolve => {\n socket.addEventListener('open', () => {\n resolve(socket);\n });\n });\n}", "function Connect() {\n SetState('?', 'Connecting');\n Socket = new WebSocket(`ws://${window.location.host}/socket`);\n Socket.addEventListener('error', HandleError);\n Socket.addEventListener('open', HandleOpen);\n Socket.addEventListener('close', HandleClose);\n Socket.addEventListener(\n 'message',\n /** @type EventListener */ (HandleMessage),\n );\n}", "start() {\n\n /**\n * Initialize the websocket server object\n * @type {TemplatedApp}\n */\n const app = uWS.App().ws('/*', {\n\n // Websocket server options\n compression: uWS.SHARED_COMPRESSOR,\n maxPayloadLength: 16 * 1024 * 1024,\n idleTimeout: 10,\n maxBackpressure: 1024,\n\n /**\n * Event triggered whenever a client connects to the websocket\n * @param ws {WebSocket} The newly connected client\n */\n open: (ws) => {\n\n // send newly connected client initial timestamp\n this.notify(ws, 0)\n },\n\n /**\n * Event triggered whenever the server receives an incoming message from a client\n * @param ws {WebSocket} The client the incoming message is from\n * @param message The incoming message\n * @param isBinary {boolean} Whether the message was sent in binary mode\n */\n message: (ws, message, isBinary) => {\n\n // decode incoming message into an object\n let data = JSON.parse(new Buffer.from(message).toString());\n\n // notify client with event for message with count \"c\"\n this.notify(ws, data.c);\n }\n\n /**\n * Tells the websocket server to start listening for incoming connections\n * on the given port\n */\n }).listen(port, (token) => {\n if (token) {\n console.log('Listening to port ' + port);\n } else {\n console.log('Failed to listen to port ' + port);\n }\n });\n }", "_webSocketConnect(data) {\n var authUrl = data.wsUrl + '?access_token=' +\n this.settings.wsToken;\n var connection = null;\n // Open a websocket connection for streaming audio\n try {\n // Set up WAMP connection to router\n connection = new autobahn.Connection({\n url: authUrl,\n realm: 'default'\n });\n } catch (e) {\n console.log('WebSocket creation error: ' + e);\n return;\n }\n var self = this;\n connection.onerror = function(e) {\n console.log('WebSocket error: ' + e);\n self.fireEvent('websocketError', [e]);\n };\n connection.onopen = function(session) {\n console.log('WebSocket connection opened');\n self._session = session;\n var _call = self._session.call;\n self._session.call = function(url) {\n console.debug('Calling RPC: ' + url);\n return _call.apply(this, arguments);\n };\n self.fireEvent('websocketOpened');\n };\n connection.onclose = function(e) {\n console.log('WebSocket disconnected');\n self._session = null;\n self.fireEvent('websocketClosed');\n };\n connection.open();\n }", "createWebSocket(endpoint) {\n const ws = new VoiceWebSocket_1.VoiceWebSocket(`wss://${endpoint}?v=4`, Boolean(this.debug));\n ws.on('error', this.onChildError);\n ws.once('open', this.onWsOpen);\n ws.on('packet', this.onWsPacket);\n ws.once('close', this.onWsClose);\n ws.on('debug', this.onWsDebug);\n return ws;\n }", "function W3CWebSocket(uri, protocols) {\n\t\tvar native_instance;\n\t\n\t\tif (protocols) {\n\t\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t\t}\n\t\telse {\n\t\t\tnative_instance = new NativeWebSocket(uri);\n\t\t}\n\t\n\t\t/**\n\t\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t\t * class). Since it is an Object it will be returned as it is when creating an\n\t\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t\t *\n\t\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t\t */\n\t\treturn native_instance;\n\t}", "connect() {\r\n socket = new WebSocket(\"ws://localhost:4567/profesor\");\r\n socket.onopen = this.openWs;\r\n socket.onerror = this.errorWs;\r\n socket.onmessage = this.messageWs;\r\n app.recarga();\r\n }", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new NativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new NativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function connect(url){\n\t\tconsole.log(\"Client socket: Connecting to server\");\n\t\t\n\t\tmWebSocket = new WebSocket(url);\n\t\tmWebSocket.onopen = onOpen;\n\t\tmWebSocket.onclose = onClose;\n\t\tmWebSocket.onmessage = onMessage;\n\t\tmWebSocket.onerror = onError;\n\t}", "setupSocket() {\n var self = this;\n self.sockets = [];\n const nativeWebSocket = window.WebSocket;\n window.WebSocket = function(...args){\n const socket = new nativeWebSocket(...args);\n self.sockets.push(socket);\n return socket;\n };\n let setupThisSocket = setInterval( ()=> {\n if( self.sockets.length != 0 ){\n clearInterval(setupThisSocket);\n self.sockets[0].addEventListener('message', (e) => self.messageHandler(self, e));\n console.log(\"Attached to socket\");\n }\n console.log(\"waiting for socket ...\");\n }, 100);\n }", "function initWebSock() {\n\n\n\t// create websocket connection with specified remote IP address\n\t//console.log(\"PilotHostName:\"+PilotHostName);\n\tconsole.log(\"WsUrl = \"+wsurl);\n\twebsocketMain = new WebSocket(wsurl);\n\n\t// for now, does nothing with version, gets CUID and triggers event notifications; available space, partition list\n\twebsocketMain.onopen = function(evt) {\n\t\tdocument.getElementById(\"WebStatus\").innerHTML = \"&nbsp;Connection succeeds.\";\n\t\t$(\"#WebStatus\").effect(\"pulsate\",{times:3},3000);\n\t\tsendVersionNeg(evt);\n\t};\n\n\t// determine what the websocket server has sent us\n\twebsocketMain.onmessage = function(evt) { parseIncomingMessage(evt); };\n\n\t// determine error code sent by websocket server\n\twebsocketMain.onerror = function(evt) { parseError(evt); };\n\n\t// perform any cleanup on socket close\n\twebsocketMain.onclose = function(evt) { sendClientShutdown(evt); };\n\n}", "function W3CWebSocket(uri, protocols) {\n\t\tvar native_instance;\n\n\t\tif (protocols) {\n\t\t\tnative_instance = new nativeWebSocket(uri, protocols);\n\t\t}\n\t\telse {\n\t\t\tnative_instance = new nativeWebSocket(uri);\n\t\t}\n\n\t\t/**\n\t\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t\t * class). Since it is an Object it will be returned as it is when creating an\n\t\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t\t *\n\t\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t\t */\n\t\treturn native_instance;\n\t}", "function start() {\n\tconst webSocketServer = new WebSocket.Server({ port: 8081 });\n\n\twebSocketServer.on('connection', function connection(ws) {\n\t\tws.on('message', function incoming(message) {\n\t\t\tconsole.log(\"- Received message\", message);\n\n\t\t\tconst clientEvent = JSON.parse(message)\n\n\t\t\thandleClientEvent(ws, clientEvent)\n\t\t});\n\n\t\tws.on('close', function handle() {\n\t\t\tconsole.log(\"CLOSE\")\n\t\t\tdisconnectClient(ws)\n\t\t})\n\t});\n}", "function setupWebSocket() {\n logger.info('------------------------------------------ Websocket Up ------------------------------------------');\n var wss = new ws.Server({ server: server });\t\t\t\t\t\t\t\t//start the websocket now\n wss.on('connection', function connection(ws) {\n logger.debug('[ws] received ws connect');\n ws.on('message', function incoming(message) {\n console.log(' ');\n console.log('-------------------------------- Incoming WS Msg --------------------------------');\n logger.debug('[ws] received ws msg:', message);\n var data = null;\n try {\n data = JSON.parse(message);\n }\n catch (e) {\n logger.debug('[ws] message error', message, e.stack);\n }\n if (data && data.type == 'setup') {\n logger.debug('[ws] setup message', data);\n\n\n }\n else if (data) {\n logger.debug('[ws] message', data);\n }\n wss.broadcast(build_state_msg())\n\n });\n\n ws.on('error', function (e) { logger.debug('[ws] error', e); });\n ws.on('close', function () { logger.debug('[ws] closed'); });\n ws.send(JSON.stringify(build_state_msg()));\t\t\t\t\t\t\t//tell client our app state\n });\n wss.broadcast = function broadcast(data) {\n var i = 0;\n wss.clients.forEach(function each(client) {\n try {\n logger.debug('[ws] broadcasting to clients. ', (++i), data.msg);\n client.send(JSON.stringify(data));\n }\n catch (e) {\n logger.debug('[ws] error broadcast ws', e);\n }\n });\n };\n\n wss.broadcastMsg = function broadcast(msg,state,payload) {\n var data={\n msg:msg,\n state:state,\n payload:payload\n };\n var i = 0;\n wss.clients.forEach(function each(client) {\n try {\n logger.debug('[ws] broadcasting to clients. ', (++i), data.msg);\n client.send(JSON.stringify(data));\n }\n catch (e) {\n logger.debug('[ws] error broadcast ws', e);\n }\n });\n };\n app.wss=wss;\n\n}", "function createNewConnection(wsAddr, sessionId) {\n let connection = new EventEmitter();\n connection.sessionId = '';\n\n serverConnections[wsAddr] = connection;\n\n connection.nextChannelId = 1;\n connection.connected = false;\n\n connection.reconnect =\n connection.connect = function connect() {\n if (connection.ws) {\n try {\n connection.ws.close();\n } catch (err) {\n // Ignore any closing errors. Most likely due to not\n // being connected yet.\n }\n\n connection.ws = null;\n }\n connection.ws = new SockJS(wsAddr);\n connection.ws.onopen = () => {\n let connectStr = sessionId ?\n 'CONTROL SESSION ' + sessionId :\n 'CONTROL START';\n connection.ws.send(`:${controlChannel} ${connectStr}`);\n connection.connected = true;\n connection.emit('open');\n };\n connection.ws.onclose = (err) => {\n connection.connected = false;\n connection.ws = null;\n connection.emit('close', err);\n };\n connection.ws.onmessage = (event) => {\n connection.emit('message', event);\n\n // If the message starts with \":channel \" then extract that channel and emit\n // an event for it.\n if (event.data[0] === ':') {\n let message = event.data;\n let spacePos = message.indexOf(' ');\n\n // If no space, ie. \":1\", this is the server acknowledging this channel\n // is now open and ready to be used.\n if (spacePos === -1) {\n connection.emit('open.' + message.substr(1));\n return;\n }\n\n let channelId = message.substr(1, spacePos - 1);\n event.data = message.substr(spacePos + 1);\n connection.emit('message.' + channelId, event);\n } else {\n // Core messages. Used for session handling and session syncing\n let parts = event.data.split(' ');\n\n if (parts[0] === 'SESSION') {\n connection.sessionId = parts[1];\n }\n }\n };\n };\n\n connection.connect();\n return connection;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new nativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new nativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new nativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new nativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "function W3CWebSocket(uri, protocols) {\n\tvar native_instance;\n\n\tif (protocols) {\n\t\tnative_instance = new nativeWebSocket(uri, protocols);\n\t}\n\telse {\n\t\tnative_instance = new nativeWebSocket(uri);\n\t}\n\n\t/**\n\t * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket\n\t * class). Since it is an Object it will be returned as it is when creating an\n\t * instance of W3CWebSocket via 'new W3CWebSocket()'.\n\t *\n\t * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2\n\t */\n\treturn native_instance;\n}", "Connect() {\r\n this._MistyWebSocket.Connect(function (event) {\r\n //\talert(\"Connected to websockets\");\r\n });\r\n }", "function JstpWebSocketClient(config) {\n events.EventEmitter.call(this);\n\n this.config = config;\n this.wsClient = new WebSocketClient(config);\n this.wsConnection = null;\n this.isConnected = false;\n}", "function connect() {\n $(\".disconnected\").show();\n webSocket = new WebSocket(wsUri + \"/remote\");\n webSocket.onopen = function () { onOpen(); };\n webSocket.onclose = function () { onClose(); };\n webSocket.onmessage = function (evt) { onMessage(evt); };\n webSocket.onerror = function (evt) { onError(evt); };\n}", "function createQueueSocket(){\n hostname = window.location.hostname\n const socket = new WebSocket('wss://'+hostname+'/ws');\n return socket\n}", "function startWebsocket() {\n const address = game.settings.get(moduleName,'address');\n \n const url = address.startsWith('wss://') ? address : ('ws://'+address+'/');\n\n ws = new WebSocket(url);\n\n ws.onmessage = function(msg){\n //console.log(msg);\n analyzeWSmessage(msg.data);\n clearInterval(wsInterval);\n wsInterval = setInterval(resetWS, 5000);\n }\n\n ws.onopen = function() {\n messageCount = 0;\n WSconnected = true;\n ui.notifications.info(\"Material Deck \"+game.i18n.localize(\"MaterialDeck.Notifications.Connected\") +\": \"+address);\n wsOpen = true;\n const msg = {\n target: \"server\",\n module: \"MD\"\n }\n ws.send(JSON.stringify(msg));\n const msg2 = {\n target: \"SD\",\n type: \"init\",\n system: game.system.id\n }\n ws.send(JSON.stringify(msg2));\n clearInterval(wsInterval);\n wsInterval = setInterval(resetWS, 5000);\n }\n \n clearInterval(wsInterval);\n wsInterval = setInterval(resetWS, 10000);\n}", "function Worker() {\n // Get websocket server\n const wss = this.wss;\n // Get http/https server\n const server = this.server;\n\n // Use your library/framework as you usually do\n const app = express();\n app.use(morgan('tiny'));\n app.use(express.static('./public'));\n\n // Connect ClusterWS and your library/framework\n server.on('request', app);\n\n const connectedSockets = [];\n\n // Listen on connections to websocket server\n wss.on('connection', (socket) => {\n connectedSockets.push(socket);\n socket.on('message', (data) => {\n console.log('got message on server', data);\n console.log('sending message...');\n data.created = new Date();\n connectedSockets.forEach(connectedSocket => { \n connectedSocket.send('message', data);\n });\n });\n\n socket.on('disconnect', (code, reason) => {\n const index = connectedSockets.indexOf(socket);\n connectedSockets.splice(index, 1);\n });\n });\n}", "function create_ws() {\n // Create WebSocket connection.\n socket = new WebSocket(server_adress);\n\n socket.onopen = function(event) {\n console.log(\"OPENED\");\n };\n\n\n socket.onmessage = function(event) {\n let length = event.data.size;\n let offset = exports.buffer_ptr();\n // console.log(event.data)\n event.data.arrayBuffer()\n .then(buffer => {\n // console.log(\"received\")\n // if we define bytes earlier in parent scope then everything blows up(don't know (why) Javascript)\n let bytes = new Uint8Array(memory.buffer, offset, length);\n let data = new Uint8Array(buffer, 0, length)\n for (let i = 0; i < length; i++) {\n bytes[i] = data[i];\n }\n exports.receive_msg(length)\n })\n .catch((error) => {\n // console.log(error)\n // console.log(\"you are looser haha\")\n });\n };\n\n\n socket.onclose = function(event) {\n };\n\n socket.onerror = function(error) {\n alert(`[error] ${error.message}`);\n };\n}", "_connect() {\n if (!this._wss) {\n this._wss = this._wssFactory(this._wssPath);\n this._wss.on(\"error\", this._onError.bind(this));\n this._wss.on(\"connecting\", this._onConnecting.bind(this));\n this._wss.on(\"connected\", this._onConnected.bind(this));\n this._wss.on(\"disconnected\", this._onDisconnected.bind(this));\n this._wss.on(\"closing\", this._onClosing.bind(this));\n this._wss.on(\"closed\", this._onClosed.bind(this));\n this._wss.on(\"message\", this._onMessage.bind(this));\n if (this._beforeConnect) this._beforeConnect();\n this._wss.connect();\n }\n }" ]
[ "0.8206566", "0.777753", "0.74776375", "0.7475257", "0.7475257", "0.7475257", "0.7475257", "0.7475257", "0.743022", "0.743022", "0.7280924", "0.72731376", "0.7227185", "0.71977884", "0.7188435", "0.71748084", "0.7173974", "0.71661603", "0.7163815", "0.71573037", "0.7153191", "0.7149889", "0.7143875", "0.71064633", "0.7099257", "0.7098888", "0.70891154", "0.7061654", "0.7046909", "0.7040735", "0.70331067", "0.70288014", "0.7024396", "0.70124215", "0.7008455", "0.70067686", "0.7002106", "0.6985204", "0.6978433", "0.6975905", "0.6950837", "0.69269353", "0.69239", "0.6911817", "0.6886008", "0.68835974", "0.68664336", "0.6866347", "0.6834802", "0.68181694", "0.67765576", "0.6757043", "0.6739394", "0.6734825", "0.6724071", "0.671729", "0.6712315", "0.6712299", "0.6704895", "0.67005897", "0.6680832", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.66765654", "0.6675774", "0.66490555", "0.6639436", "0.66335744", "0.66259074", "0.6620104", "0.66095346", "0.66084474", "0.66084474", "0.66084474", "0.65935045", "0.6574598", "0.65650237", "0.6556402", "0.6553092", "0.6549768", "0.6521657", "0.65166074" ]
0.8253882
0
Closes the websocket connection.
function closeWebSocket() { var socket = gSocket; if (socket === null) return; socket.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function close() {\n\t\tif (mWebSocket) {\n\t\t\tconsole.log('Client socket: Closing');\n\t\t\tmWebSocket.close();\n\t\t}\n\t}", "function _wsClose() {\n _self.connected = false;\n _self.emit('disconnect');\n _clearPingPong();\n if (_retry === true) {\n log.debug(LOG_PREFIX, `Will retry in 3 seconds...`);\n setTimeout(() => {\n _connect();\n }, 3000);\n } else {\n log.log(LOG_PREFIX, 'WebSocket closed.');\n }\n }", "closeConnection() {\n var _self = this;\n if (_self._ws) {\n _self._ws.close();\n }\n }", "terminate() {\n if (this.readyState === WebSocket.CLOSED) return;\n\n if (this._socket) {\n this.readyState = WebSocket.CLOSING;\n this._socket.end();\n // Add a timeout to ensure that the connection is completely cleaned up\n // within 30 seconds, even if the other peer does not send a FIN packet.\n clearTimeout(this._closeTimer);\n this._closeTimer = setTimeout(this._finalize, closeTimeout, true);\n } else if (this.readyState === WebSocket.CONNECTING) {\n this.finalize(true);\n }\n }", "function disconnect () {\n if (ws != null) {\n if (isConnected()) { closeRequested = true }\n ws.close(1000)\n ws = null\n }\n}", "function socketOnEnd() {\n const websocket = this[kWebSocket$1];\n\n websocket._readyState = WebSocket$1.CLOSING;\n websocket._receiver.end();\n this.end();\n}", "function socketOnEnd () {\n const websocket = this[kWebSocket];\n\n websocket.readyState = WebSocket.CLOSING;\n websocket._receiver.end();\n this.end();\n}", "function socketOnEnd () {\n const websocket = this[kWebSocket];\n\n websocket.readyState = WebSocket.CLOSING;\n websocket._receiver.end();\n this.end();\n}", "close() {\n\t\tthis.debug('disconnect');\n\t\tif(!this._socket) return;\n\t\tthis._beforeDisconnect && this._beforeDisconnect();\n\t\tthis._socket.destroy();\n\t\tthis._connected = false;\n\t\t// 'disconnected' event will be emitted by onClose listener\n\t}", "function socketOnEnd() {\n const websocket = this[kWebSocket];\n\n websocket._readyState = WebSocket.CLOSING;\n websocket._receiver.end();\n this.end();\n}", "function socketOnEnd() {\n const websocket = this[kWebSocket];\n\n websocket._readyState = WebSocket.CLOSING;\n websocket._receiver.end();\n this.end();\n}", "terminate() {\n if (this.readyState === WebSocket$1.CLOSED) return;\n if (this.readyState === WebSocket$1.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n return abortHandshake$1(this, this._req, msg);\n }\n\n if (this._socket) {\n this._readyState = WebSocket$1.CLOSING;\n this._socket.destroy();\n }\n }", "terminate () {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n return abortHandshake(this, this._req, msg);\n }\n\n if (this._socket) {\n this.readyState = WebSocket.CLOSING;\n this._socket.destroy();\n }\n }", "terminate () {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n return abortHandshake(this, this._req, msg);\n }\n\n if (this._socket) {\n this.readyState = WebSocket.CLOSING;\n this._socket.destroy();\n }\n }", "function onClose() {\n\t\tconsole.log('Client socket: Connection closed');\n\t\tmWebSocket = null;\n\t\tcastEvent('onClose', event);\n\t}", "terminate() {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n return abortHandshake(this, this._req, msg);\n }\n\n if (this._socket) {\n this._readyState = WebSocket.CLOSING;\n this._socket.destroy();\n }\n }", "terminate() {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n return abortHandshake(this, this._req, msg);\n }\n\n if (this._socket) {\n this._readyState = WebSocket.CLOSING;\n this._socket.destroy();\n }\n }", "disconnect() {\n if (this.ws != null) {\n this.ws.close();\n }\n this.connectionListeners.forEach((listener)=>listener(false));\n this.log(\"Disconnected\");\n }", "function socketOnClose() {\n const websocket = this[kWebSocket$1];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('data', socketOnData);\n this.removeListener('end', socketOnEnd);\n\n websocket._readyState = WebSocket$1.CLOSING;\n\n let chunk;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written and `readable.read()`\n // will return `null`. If instead, the socket is paused, any possible buffered\n // data will be read as a single chunk.\n //\n if (\n !this._readableState.endEmitted &&\n !websocket._closeFrameReceived &&\n !websocket._receiver._writableState.errorEmitted &&\n (chunk = websocket._socket.read()) !== null\n ) {\n websocket._receiver.write(chunk);\n }\n\n websocket._receiver.end();\n\n this[kWebSocket$1] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}", "close() {\n if (this.socket) this.socket.destroy();\n }", "function socketOnClose () {\n const websocket = this[kWebSocket];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('end', socketOnEnd);\n\n websocket.readyState = WebSocket.CLOSING;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written and `readable.read()`\n // will return `null`. If instead, the socket is paused, any possible buffered\n // data will be read as a single chunk and emitted synchronously in a single\n // `'data'` event.\n //\n websocket._socket.read();\n websocket._receiver.end();\n\n this.removeListener('data', socketOnData);\n this[kWebSocket] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}", "function socketOnClose () {\n const websocket = this[kWebSocket];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('end', socketOnEnd);\n\n websocket.readyState = WebSocket.CLOSING;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written and `readable.read()`\n // will return `null`. If instead, the socket is paused, any possible buffered\n // data will be read as a single chunk and emitted synchronously in a single\n // `'data'` event.\n //\n websocket._socket.read();\n websocket._receiver.end();\n\n this.removeListener('data', socketOnData);\n this[kWebSocket] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}", "function socketOnClose() {\n const websocket = this[kWebSocket];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('end', socketOnEnd);\n\n websocket._readyState = WebSocket.CLOSING;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written and `readable.read()`\n // will return `null`. If instead, the socket is paused, any possible buffered\n // data will be read as a single chunk and emitted synchronously in a single\n // `'data'` event.\n //\n websocket._socket.read();\n websocket._receiver.end();\n\n this.removeListener('data', socketOnData);\n this[kWebSocket] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}", "function socketOnClose() {\n const websocket = this[kWebSocket];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('end', socketOnEnd);\n\n websocket._readyState = WebSocket.CLOSING;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written and `readable.read()`\n // will return `null`. If instead, the socket is paused, any possible buffered\n // data will be read as a single chunk and emitted synchronously in a single\n // `'data'` event.\n //\n websocket._socket.read();\n websocket._receiver.end();\n\n this.removeListener('data', socketOnData);\n this[kWebSocket] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}", "async close() {\n // Close all pending connections.\n forEach(this._pendingAuthRequests, ({ socket }) => socket.destroy());\n\n // Shut down server.\n try {\n this._wsServer.close();\n } catch (e) {\n log.warn(`Cannot shutdown WebSocket server cleanly: ${e}`);\n }\n }", "function closeWS(){\n ws.close();\n}", "function HandleClose() {\n console.log('WebSocket closed');\n Socket = null;\n SetState(IconError, 'Disconnected');\n}", "close() {\n debug(\"disconnect\");\n this.skipReconnect = true;\n this.reconnecting = false;\n if (\"opening\" === this.readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this.readyState = \"closed\";\n if (this.engine)\n this.engine.close();\n }", "emitClose() {\n if (!this._socket) {\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[PerMessageDeflate.extensionName]) {\n this._extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n }", "emitClose() {\n if (!this._socket) {\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[PerMessageDeflate.extensionName]) {\n this._extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n }", "function onDisconnectClick() {\n webSocket.close();\n}", "_close() {\n debug(\"disconnect\");\n this.skipReconnect = true;\n this._reconnecting = false;\n\n if (\"opening\" === this._readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n\n this.backoff.reset();\n this._readyState = \"closed\";\n if (this.engine) this.engine.close();\n }", "function closeWebSocketConnection(username) {\n if (websocket != null || websocket != undefined) {\n websocket.close();\n websocket = undefined;\n }\n}", "_close() {\n debug(\"disconnect\");\n this.skipReconnect = true;\n this._reconnecting = false;\n if (\"opening\" === this._readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this._readyState = \"closed\";\n if (this.engine)\n this.engine.close();\n }", "function closeConnection() {\n if (that.connection.isConnected()) {\n // send disconnect signal then close ws connection\n var message = new ChatMessage(ChatMessage.DisconnectMessage);\n\n that.connection.send(message);\n $('onlineUsers').innerHTML = \"<p>Aktive Mitglieder</p> <p style='color:red'>Verbindung geschlossen </p>\";\n that.connection.close();\n\n }\n that.connection = null;\n }", "function closeWs() {\n if (ws && (ws.readyState === ws.OPEN)) {\n ws.close();\n }\n }", "function close() {\n main.innerHTML = 'Closed <a href=/>reload</a>';\n let payload = {\n action: 'disconnected'\n };\n ws.send(JSON.stringify(payload));\n\n}", "emitClose () {\n this.readyState = WebSocket.CLOSED;\n\n if (!this._socket) {\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[PerMessageDeflate.extensionName]) {\n this._extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this.emit('close', this._closeCode, this._closeMessage);\n }", "emitClose () {\n this.readyState = WebSocket.CLOSED;\n\n if (!this._socket) {\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[PerMessageDeflate.extensionName]) {\n this._extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this.emit('close', this._closeCode, this._closeMessage);\n }", "_close() {\n debug(\"disconnect\");\n this.skipReconnect = true;\n this._reconnecting = false;\n if (\"opening\" === this._readyState) {\n // `onclose` will not fire because\n // an open event never happened\n this.cleanup();\n }\n this.backoff.reset();\n this._readyState = \"closed\";\n if (this.engine)\n this.engine.close();\n }", "handleClose() {\n log.info(`[WS] WebSocket connection closed`)\n }", "terminate () {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n this._req.abort();\n this.finalize(\n new Error('WebSocket was closed before the connection was established')\n );\n return;\n }\n\n this.finalize(true);\n }", "emitClose() {\n if (!this._socket) {\n this._readyState = WebSocket$1.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[permessageDeflate.extensionName]) {\n this._extensions[permessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this._readyState = WebSocket$1.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n }", "$close() {\n return new Promise(resolve => {\n this.$ws.onclose = function () {};\n this.$ws.close();\n this.state.connected = false;\n });\n }", "function receiverOnFinish() {\n this[kWebSocket].emitClose();\n}", "function receiverOnFinish() {\n this[kWebSocket].emitClose();\n}", "function receiverOnFinish () {\n this[kWebSocket].emitClose();\n}", "function receiverOnFinish () {\n this[kWebSocket].emitClose();\n}", "emitClose () {\n this.readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode || 1006, this._closeMessage || '');\n\n if (this.extensions[PerMessageDeflate.extensionName]) {\n this.extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this.extensions = null;\n\n this.removeAllListeners();\n this.on('error', constants.NOOP); // Catch all errors after this.\n }", "function receiverOnFinish() {\n this[kWebSocket$1].emitClose();\n}", "closeNow(){\n this.socket.close()\n }", "close () {\n this.socket.close()\n document.removeEventListener('keypress', this.sendMessageEventListener)\n }", "close() {\n this._closedFromClient = true;\n\n this._stopConnectionRetries();\n\n this._areRetriesEnabled = false;\n\n if (this._channel) {\n try {\n this._channel.close();\n } catch (error) {} // eslint-disable-line no-empty\n\n\n this._channel = null;\n }\n }", "emitClose () {\n this.readyState = WebSocket$1.CLOSED;\n\n this.emit('close', this._closeCode, this._closeMessage);\n\n if (this.extensions[PerMessageDeflate_1.extensionName]) {\n this.extensions[PerMessageDeflate_1.extensionName].cleanup();\n }\n\n this.extensions = null;\n\n this.removeAllListeners();\n }", "close () {\n this._rtc.close()\n return this._socket.close()\n }", "function on_close() {\n add_to_output(\"### Closed WebSocket\");\n const socket_connected_log = document.getElementById(\"socketConnect\");\n socket_connected_log.innerHTML = \"No\";\n socket_connected = false;\n}", "close() {\n\n\t\t// Remove the channel from all its connections\n\t\tthis.connections.forEach((connection) => {\n\t\t\tthis.unbind(connection);\n\t\t});\n\n\t\t// Remove the channel from the host\n\t\tthis._host._channels.delete(this._name);\n\n\t\t// Emit close event\n\t\tthis.emit('close');\n\t}", "terminate () {\n if (this.readyState === WebSocket$1.CLOSED) return;\n if (this.readyState === WebSocket$1.CONNECTING) {\n this._req.abort();\n this.finalize(new Error('closed before the connection is established'));\n return;\n }\n\n this.finalize(true);\n }", "requestCloseConnection () {\n if (this.connection &&\n this.connection.readyState !== WebSocket.CLOSING &&\n this.connection.readyState !== WebSocket.CLOSED) {\n log.info('Request close cloud connection without reconnecting');\n // Remove listeners, after this point we do not want to react to connection updates\n this.connection.onclose = () => {};\n this.connection.onerror = () => {};\n this.connection.close();\n }\n this.clear();\n }", "emitClose () {\n\t this.readyState = WebSocket.CLOSED;\n\t this.emit('close', this._closeCode || 1006, this._closeMessage || '');\n\n\t if (this.extensions[PerMessageDeflate.extensionName]) {\n\t this.extensions[PerMessageDeflate.extensionName].cleanup();\n\t }\n\n\t this.extensions = null;\n\n\t this.removeAllListeners();\n\t this.on('error', constants.NOOP); // Catch all errors after this.\n\t }", "emitClose () {\n\t this.readyState = WebSocket.CLOSED;\n\t this.emit('close', this._closeCode || 1006, this._closeMessage || '');\n\n\t if (this.extensions[PerMessageDeflate.extensionName]) {\n\t this.extensions[PerMessageDeflate.extensionName].cleanup();\n\t }\n\n\t this.extensions = null;\n\n\t this.removeAllListeners();\n\t this.on('error', constants.NOOP); // Catch all errors after this.\n\t }", "close() {\n clearTimeout(this._connectionTimeout);\n clearTimeout(this._greetingTimeout);\n this._responseActions = [];\n\n // allow to run this function only once\n if (this._closing) {\n return;\n }\n this._closing = true;\n\n let closeMethod = 'end';\n\n if (this.stage === 'init') {\n // Close the socket immediately when connection timed out\n closeMethod = 'destroy';\n }\n\n this.logger.debug(\n {\n tnx: 'smtp'\n },\n 'Closing connection to the server using \"%s\"',\n closeMethod\n );\n\n let socket = (this._socket && this._socket.socket) || this._socket;\n\n if (socket && !socket.destroyed) {\n try {\n this._socket[closeMethod]();\n } catch (E) {\n // just ignore\n }\n }\n\n this._destroy();\n }", "close() {\n clearTimeout(this._connectionTimeout);\n clearTimeout(this._greetingTimeout);\n this._responseActions = [];\n\n // allow to run this function only once\n if (this._closing) {\n return;\n }\n this._closing = true;\n\n let closeMethod = 'end';\n\n if (this.stage === 'init') {\n // Close the socket immediately when connection timed out\n closeMethod = 'destroy';\n }\n\n this.logger.debug(\n {\n tnx: 'smtp'\n },\n 'Closing connection to the server using \"%s\"',\n closeMethod\n );\n\n let socket = (this._socket && this._socket.socket) || this._socket;\n\n if (socket && !socket.destroyed) {\n try {\n this._socket[closeMethod]();\n } catch (E) {\n // just ignore\n }\n }\n\n this._destroy();\n }", "close() {\n clearTimeout(this._connectionTimeout);\n clearTimeout(this._greetingTimeout);\n this._responseActions = [];\n\n // allow to run this function only once\n if (this._closing) {\n return;\n }\n this._closing = true;\n\n let closeMethod = 'end';\n\n if (this.stage === 'init') {\n // Close the socket immediately when connection timed out\n closeMethod = 'destroy';\n }\n\n this.logger.debug(\n {\n tnx: 'smtp'\n },\n 'Closing connection to the server using \"%s\"',\n closeMethod\n );\n\n let socket = (this._socket && this._socket.socket) || this._socket;\n\n if (socket && !socket.destroyed) {\n try {\n this._socket[closeMethod]();\n } catch (E) {\n // just ignore\n }\n }\n\n this._destroy();\n }", "function onClose(event) {\n console.log('Connection closed');\n setTimeout(initWebSocket, 2000); /**< Two Seconds timeout for reconnecting Websocket*/\n}", "close() {\n console.log(\"disconnecting\");\n this._distributeMessage('remove', '');\n clearInterval(this._swarmUpdater);\n this._server.close();\n Object.keys(this._connections).forEach(function(key) {\n this._connections[key].socket.end();\n }, this);\n }", "close() {\n this._socket.close();\n this._socket = null;\n this._parseObj = null;\n }", "onClose() {\n this._closeSocket(constants_1.ERRORS.SocketClosed);\n }", "terminate () {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n if (this._req && !this._req.aborted) {\n this._req.abort();\n this.emit('error', new Error('closed before the connection is established'));\n this.finalize(true);\n }\n return;\n }\n\n this.finalize(true);\n }", "close() {\n debug(\"session close\");\n this.socket.destroy();\n\n // delegate\n this.app.remove(this);\n this.app.emit(\"close\", this);\n }", "close()\n {\n this.channel.close();\n }", "async close() {\n const socket = this._socket;\n\n this.__waker = null;\n this._socket = null;\n if (!socket) return Promise.resolve();\n\n socket.close();\n return new Promise((resolve, reject) => {\n socket.once('error', (err) => {\n reject(err);\n });\n\n socket.once('disconnected', () => {\n resolve();\n });\n });\n }", "disconnect() {\n let _this = this;\n\n _this._continuousOpen = false;\n if (_this._sock) {\n _this._sendClose();\n }\n }", "function _onBeforeUnloadCallback() {\n ws.close();\n}", "close() {\n this.connection.sendBeacon({type: 'disconnect', session: this.sessionId})\n this.messageSubscription.unsubscribe()\n clearTimeout(this.resendReportTimer)\n clearInterval(this.performPurgeTimer)\n clearTimeout(this.changeReportDebounceTimer)\n }", "socketClose() {\n console.log('sock close');\n\n GlobalVars.reset();\n this.reset();\n\n this.reconnect();\n }", "destroy () {\n this._socket.close()\n this._rtc.close()\n this._removeEventListeners()\n }", "close() {\n\t\tthis.connection.close();\n\t}", "terminate () {\n\t if (this.readyState === WebSocket.CLOSED) return;\n\t if (this.readyState === WebSocket.CONNECTING) {\n\t if (this._req && !this._req.aborted) {\n\t this._req.abort();\n\t this.emit('error', new Error('closed before the connection is established'));\n\t this.finalize(true);\n\t }\n\t return;\n\t }\n\n\t this.finalize(true);\n\t }", "terminate () {\n\t if (this.readyState === WebSocket.CLOSED) return;\n\t if (this.readyState === WebSocket.CONNECTING) {\n\t if (this._req && !this._req.aborted) {\n\t this._req.abort();\n\t this.emit('error', new Error('closed before the connection is established'));\n\t this.finalize(true);\n\t }\n\t return;\n\t }\n\n\t this.finalize(true);\n\t }", "async disconnect () {\n this.connection.end()\n this.socket.end()\n this.server.onDisconnected()\n return this._destroy()\n }", "destroy() {\n var _a;\n try {\n (_a = this.debug) === null || _a === void 0 ? void 0 : _a.call(this, 'destroyed');\n this.setHeartbeatInterval(-1);\n this.ws.close(1000);\n }\n catch (error) {\n this.emit('error', error);\n }\n }", "async function close() {\n await channels.close();\n }", "teardown() {\n\t\tclearInterval(this._heartbeatPing);\n\t\tthis.ws.close();\n\t}", "function closeSession() {\r\n if (wss !== \"undefined\" && wss !== null) {\r\n wss.close();\r\n }\r\n if (ws) {\r\n ws.close();\r\n }\r\n if (appx_session.wss) {\r\n appx_session.wss.close();\r\n }\r\n if (appx_session.ws) {\r\n appx_session.ws.close();\r\n }\r\n}", "function onClose(evt) {\n\n \n console.log(\"Disconnected\"); // Log disconnection state\n\t\n setTimeout(function() { wsConnect(url) }, 2000); // Try to reconnect after a few seconds\n}", "disconnect() { socket_close(this) }", "function close(self) {\n\tvar connect = self._connect;\n\tself._connect = null;\n\tself.connected = false;\n\tif (connect && typeof connect == 'object') {\n\t\tconnect.idle();\n\t}\n}", "disconnectedCallback(){\n console.log(\"this lifecycle happens\");\n ws.close();\n }", "close() {\n\t\tthis._communicator.close();\n\t}", "function closeConnection() {\n connection.end();\n}", "function terminate() {\n console.log('[client disconnected]', clientID);\n //stop sending metadata\n clearInterval(metadataTimer);\n //disconnect websocket if not already\n if (me.readyState === WebSocket.CONNECTING || me.readyState === WebSocket.OPEN) {\n me.terminate();\n }\n //clean up connections to channels\n for (const id of connectedChannels) {\n disconnect(id);\n }\n }", "async function close() {\n this.client.close();\n}", "function closeSocket() {\r\n\twebSocket.close();\r\n\r\n\t$('#message_container').fadeOut(600, function() {\r\n\t\t$('#prompt_name_container').fadeIn();\r\n\t\t// clearing the name and session id\r\n\t\tsessionId = '';\r\n\t\tname = '';\r\n\r\n\t\t// clear the ul li messages\r\n\t\t$('#messages').html('');\r\n\t\t$('p.online_count').hide();\r\n\t});\r\n}", "close() {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = 0;\n }\n if (this.messageTimer) {\n clearTimeout(this.messageTimer);\n this.messageTimer = 0;\n }\n if (this.webrtcIsReady()) {\n this.client.close();\n }\n if (this.peerConnOpen()) {\n this.pc.close();\n }\n if (this.relayIsReady()) {\n this.relay.close();\n }\n this.onCleanup();\n }", "onDisconnect() {\n console.log(\"WS Closed\")\n }", "dispose() {\n if (this.stompClient) {\n this.stompClient.disconnect(function() {\n console.log('disconnected.');\n });\n }\n }", "disconnect() {\n this.emit('closing');\n this.sendVoiceStateUpdate({\n channel_id: null,\n });\n\n this._disconnect();\n }", "_websocketClosed(data) {\n this._pino.warn({\n type: 'coins',\n message: 'Websocket closed unexpectedly',\n data: data\n })\n\n // Wait 20 seconds before reconnecting\n setTimeout(() => {\n // Try to reconnect the first time\n this._websocket.connect()\n\n let count = 1\n // Try to reconnect every 30 seconds if it fails\n const interval = setInterval(() => {\n if (!this._websocket.socket) {\n count++\n\n // Log critical error if it keeps failing every 30/2 = 15 minutes\n if (count % 30 === 0) {\n const time_since = 30 * count\n this._pino.fatal({\n type: 'coins',\n message: `Attempting to reconnect to websocket for the ${count} time. It has been ${time_since} seconds since we lost connection.`\n })\n }\n this._websocket.connect()\n }\n else {\n this._pino.info({\n type: 'coins',\n message: 'Reconnected to websocket'\n })\n clearInterval(interval)\n }\n }, 30000)\n }, 20000)\n }", "stop()\n\t{\n\t\tlogger.debug('stop()');\n\n\t\t// Don't close the given http.Server|https.Server but just unmount the\n\t\t// WebSocket server.\n\t\tthis._wsServer.unmount();\n\t}" ]
[ "0.7789422", "0.75805116", "0.73896027", "0.7157365", "0.7152189", "0.7085369", "0.70610225", "0.70610225", "0.7053792", "0.7053746", "0.7053746", "0.6996932", "0.69938695", "0.69938695", "0.69856805", "0.6980813", "0.6980813", "0.6960279", "0.6940485", "0.6919743", "0.6915847", "0.6915847", "0.69090325", "0.69090325", "0.689027", "0.68246704", "0.6798972", "0.678798", "0.6762104", "0.6762104", "0.67359036", "0.6730863", "0.6721053", "0.6704871", "0.666358", "0.6660969", "0.66491663", "0.66480327", "0.66480327", "0.6645447", "0.65970314", "0.65940994", "0.6585623", "0.65803057", "0.6546894", "0.6546894", "0.6541171", "0.6541171", "0.65396243", "0.65335685", "0.6525112", "0.6517604", "0.6486906", "0.648351", "0.6473131", "0.64527357", "0.64435804", "0.6435596", "0.6435215", "0.643211", "0.643211", "0.64157724", "0.64157724", "0.64157724", "0.6400628", "0.63980347", "0.63915575", "0.6363249", "0.6338643", "0.62984204", "0.62895274", "0.6274039", "0.62671775", "0.62629426", "0.6254913", "0.62396735", "0.62348366", "0.6226482", "0.62174207", "0.62174207", "0.62173325", "0.62091166", "0.6207474", "0.6204355", "0.6194999", "0.61836505", "0.6177631", "0.6163299", "0.61539954", "0.61238825", "0.6120413", "0.61190563", "0.61154336", "0.6112806", "0.61096764", "0.61085725", "0.6097686", "0.6073274", "0.6056935", "0.60386896" ]
0.76935095
1
Method to use the given socket as the WebSocket connection to the server.
function useWebSocket(socket) { socket.onopen = handleSocketOpen; socket.onclose = handleSocketClose; socket.onerror = handleSocketError; gSocket = socket; socket.onmessage = handleSocketMessage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createSocket () {\n this.ws = new WebSocket(this.getEndpoint())\n }", "function setupSocket(socket) {\n\n socket.onopen = function () {\n connectedToWS = true\n }\n\n socket.onmessage = function (msg) {\n connectionSketch.showServerResponse(msg.data)\n }\n\n socket.onclose = function () {\n connectedToWS = false\n }\n}", "function connect() {\n // nothing to do if already connected\n if ( socket && socket.readyState === 1) return\n\n try{\n socket = new WebSocket(\n `ws://${host}:${port}/livereload`)\n }\n catch(e) { return void onError(e) }\n\n socket.onmessage = hello\n socket.onerror = onError // consumer provided callback\n socket.onclose = onClose // consumer provided callback\n socket.onopen = async ()=> {\n const fullyOpened = await yesItsReallyOpen()\n if(fullyOpened) socket.send(handshake)\n else socket.close()\n }\n\n return socket\n }", "function connect() {\n add_to_output(\"### Trying to open new WebSocket\");\n if (socket_connected) {\n disconnect();\n }\n const socket_path = document.getElementById(\"socketPath\");\n socket = new WebSocket(socket_path.value);\n init_socket(socket);\n}", "setSocket(socket) {\n\t\tthis.socket = socket;\n\t}", "function connect() {\n // TODO pass websocket port here\n var socket = new WebSocket('ws://localhost:3132/');\n socket.onclose = function (_event) {\n console.warn('Websocket connection closed or unable to connect; ' + 'loading reconnect timeout');\n\n // Allow the last socket to be cleaned up.\n socket = null;\n\n // Set an interval to continue trying to reconnect\n // periodically until we succeed.\n setTimeout(function () {\n connect();\n }, 5000);\n };\n socket.onmessage = async function (event) {\n const e = JSON.parse(event.data);\n if (e.type === 'update' || e.type === 'remove') {\n await app.loadAll(`/${e.file}`);\n }\n if (e.type === 'thumbs-update') {\n app.model.setThumbs(e.thumbs);\n app.renderThumbs();\n }\n };\n }", "createSocket() {\n // Create the socket\n this.socket = new WebSocket('ws://localhost:7777');\n\n extendWebSocket(this.socket);\n\n // Listen for connect events and\n // print them to the terminal\n this.socket.onopen = function() {\n this.top.onConnectionWithServer();\n }.bind(this);\n\n // Listen for a variety of messages\n // and define the callbacks for each\n this.socket.register(\n 'presets', (message) => this.handlePresetsMessage(message));\n this.socket.register(\n 'serialPorts', (message) => this.handleSerialPortsMessage(message));\n this.socket.register(\n 'channelDataString',\n (message) => this.handleChannelDataStringMessage(message));\n this.socket.register(\n 'impedanceDataString',\n (message) => this.handleImpedanceDataStringMessage(message));\n this.socket.register(\n 'recordingStarted',\n (message) => this.handleRecordingStartedMessage(message));\n this.socket.register(\n 'recordingStopped',\n (message) => this.handleRecordingStoppedMessage(message));\n this.socket.register(\n 'presetSaved', (message) => this.handlePresetSavedMessage(message));\n this.socket.register(\n 'unableToConnectToChannelDataSocket',\n (message) =>\n this.handleUnableToConnectToChannelDataSocketMessage(message));\n this.socket.register(\n 'channelDataSocketConnected',\n (message) => this.handleChannelDataSocketConnectedMessage(message));\n this.socket.register(\n 'channelDataSocketClosed',\n (message) => this.handleChannelDataSocketClosedMessage(message));\n this.socket.register(\n 'channelDataSocketError',\n (message) => this.handleChannelDataSocketErrorMessage(message));\n this.socket.register(\n 'version', (message) => this.handleVersionMessage(message));\n this.socket.register(\n 'recordingAlreadyExists',\n (message) => this.handleRecordingAlreadyExistsMessage(message));\n this.socket.register(\n 'recordingError',\n (message) => this.handleRecordingErrorMessage(message));\n this.socket.register(\n 'bioampVersion',\n (message) => this.handleBioampVersionMessage(message));\n this.socket.register(\n 'alwaysOnArtifactUpdate',\n (message) => this.handleAlwaysOnArtifactUpdateMessage(message));\n }", "connect() {\n this.ws = new WebSocket(this.host);\n this.ws.on('open', this.onConnect.bind(this));\n this.ws.on('close', this.onDisconnect.bind(this));\n this.ws.on('error', this.onError.bind(this));\n }", "setupSocket() {\n var self = this;\n self.sockets = [];\n const nativeWebSocket = window.WebSocket;\n window.WebSocket = function(...args){\n const socket = new nativeWebSocket(...args);\n self.sockets.push(socket);\n return socket;\n };\n let setupThisSocket = setInterval( ()=> {\n if( self.sockets.length != 0 ){\n clearInterval(setupThisSocket);\n self.sockets[0].addEventListener('message', (e) => self.messageHandler(self, e));\n console.log(\"Attached to socket\");\n }\n console.log(\"waiting for socket ...\");\n }, 100);\n }", "function connectWS() {\n var host;\n if (!(\"WebSocket\" in window)) {\n alert(\"Your browser doesn't support WebSockets, please \" +\n \"use Google Chrome or Mozilla Firefox\");\n return;\n }\n \n try {\n host = \"ws://127.0.0.1:8000/\";\n socket = new WebSocket(host);\n \n socket.onopen = onOpenHandler; \n socket.onerror = onErrorHandler;\n socket.onclose = onCloseHandler;\n socket.onmessage = onMessageHandler;\n } catch (exception) {\n showAlert(\"Exception in WebSocket connection: \" + exception, \"danger\");\n }\n}", "function extendWebSocket(socket) {\n // Handle incoming messages.\n socket.onmessage = function(evt) {\n this.shimFnDict = this.shimFnDict || {};\n\n let packet = JSON.parse(evt.data);\n\n var fn = this.shimFnDict[packet['topic']];\n if (!fn) {\n console.log('Unhandled function: ', packet['topic']);\n }\n fn(packet['data']);\n }.bind(socket);\n\n // Acts like socket.io's version of .on()\n var shimOn =\n function(key, fn) {\n this.shimFnDict = this.shimFnDict || {};\n\n let fnDict = this.shimFnDict;\n fnDict[key] = fn;\n }\n\n // Use .register as the function to register handlers for various types.\n socket.register = shimOn.bind(socket);\n\n // Use .emitSend to send messages to other similarly extended sockets.\n socket.emitSend = function(topic, message) {\n this.send(JSON.stringify({\n 'topic': topic,\n 'data': message,\n }));\n }.bind(socket);\n}", "function init_socket(socket) {\n socket.onopen = on_open;\n socket.onclose = on_close;\n socket.onmessage = (raw) => on_message(raw.data);\n}", "function newConnection(socket){\n currentSocket = socket\n\n console.log( Date(Date.now()) + 'new connection: ' + socket.id);\n\n // MAJOR FUNCTIONS TO START OR STOP CONTROL\n socket.on('restartControl', callRestartControl);\n socket.on('launchControl', callLaunchControl);\n socket.on('killControl', callKillControl);\n\n\n // GENERIC FUNCTIONS for DATGui! -mg\n socket.on('sendDatOSC', sendDatOSC); // non-socket specific\n socket.on('sendDatCommand', sendDatCommand); \n socket.on('requestSettings', loadDatPreset);\n socket.on('requestPresets', loadPresetList);\n socket.on('saveSettings', saveDatSettings);\n\n // GENERIC FUNCTIONS FOR Patcher \n socket.on('sendPatchableUpdate', sendPatchableUpdate);\n\n // PAINTBRUSH\n socket.on('paintbrush', sendPaintBrushCoords);\n\n\n // Define Socket Messages and their Corresponding function\n socket.on('muteToggle',muteToggle);\n socket.on('toggleSoundFile',toggleSoundFile);\n // socket.on('turnOffSoundFiles',turnOffSoundFiles);\n socket.on('gestureToggle',gestureToggle);\n socket.on('setVolume',setVolume);\n socket.on('triggerGesture',triggerGesture);\n socket.on('triggerLightGesture', triggerLightGesture)\n socket.on('toggleInterpDisplay',toggleInterpDisplay);\n socket.on('rhToggle',rhToggle);\n socket.on('setRHSpeed',setRHSpeed);\n socket.on('awToggle',awToggle);\n socket.on('setAwVelocity',setAwVelocity);\n socket.on('setAwAmplitude',setAwAmplitude);\n socket.on('setAwPeriod',setAwPeriod);\n socket.on('setAwAngle',setAwAngle);\n socket.on('tlToggle',tlToggle);\n socket.on('setTlState',setTlState);\n socket.on('setTlScaleFactor',setTlScaleFactor);\n socket.on('checkCredentials',checkCredentials);\n socket.on('verifyLogin', verifyLogin);\n socket.on('sleepButton', callSleep);\n socket.on('wakeButton', callWake);\n socket.on('radioLight', radioLight);\n socket.on('behaviourScene', behaviourScene);\n socket.on('load', emitUpdate);\n socket.on('setTimer', setTimerData);\n socket.on('useTimer',settimerActive);\n\n socket.on('setVolumeGeneric',setVolumeGeneric);\n socket.on('setBehaviourIntensity',setBehaviourIntensity);\n \n\n\n /////////////////////////////////////////\n //// Login Functions ////\n /////////////////////////////////////////\n\n function checkCredentials(uPid){\n // log recieved Username, Password, and Connection ID\n console.log( Date(Date.now()) + uPid)\n var uname = uPid[0];\n var psw = uPid[1];\n var id = uPid[2];\n \n // check password\n for (i=0; i<credentials.length; i++){\n credCheck = credentials[i];\n if (credCheck[0] == uname){\n if (credCheck[1] == psw){\n loginId = id;\n boolID = [true,id,credCheck[2]];\n socket.emit('checkedCredentials',boolID);\n console.log( Date(Date.now()) + 'all good')\n return\n }\n else{console.log( Date(Date.now()) + 'incorrect password'); return}\n }\n }\n console.log( Date(Date.now()) + 'username not recognized')\n }\n\n function verifyLogin(inputId){\n console.log(Date(Date.now())+\"input Id: \" +inputId)\n console.log(Date(Date.now())+\"login Id: \" +loginId)\n if (inputId == ('?'+loginId)){\n socket.emit(\"loginVerified\",true)\n }\n else{socket.emit(\"loginVerified\",false)}\n\n }\n\n\n /// load DAT.gui settings from disk for this connection - replaced with a \n // non-connection-specific version above, so I can change programmatically via OSC.\n/*\n function loadDatSettings(data) { // { behaviour: ___, preset: ____ , target: (optional) <- am i using}\n\n console.log( Date(Date.now()) + \" Requesting: \" + data.behaviour + \"_settings_\" + data.preset);\n let raw = fs.readFileSync(behaviourdir + data.behaviour + \"_settings_\" + data.preset + \".json\");\n let s = JSON.parse(raw);\n\n // if(data.target != undefined) { // we are looking for a nested target..\n \n // var t = data.target; // string name of source\n // // for now, hardcode to look in the \"particleSources\" array\n\n // if(s.particleSources[data.target] != undefined) {\n\n // console.log( Date(Date.now()) + \" Sending subset of data called )\n // }\n\n\n \n // }\n\n console.log( Date(Date.now()) + \" Sending data... \");\n socket.emit('updateSettings', { behaviour: data.behaviour, settings: s, presetname: data.preset});\n\n // now sync the rest of my clients to this new preset\n socket.broadcast.emit('syncClients', { beh: data.behaviour, param: 'changeToNewPreset', val: data.preset });\n\n }\n*/\n\n function loadPresetList(beh) {\n console.log( Date(Date.now()) + \" Looking for all \" + beh + \" presets...\");\n // do a directory search for presets that aren't called 'current'.\n\n var presets = [];\n\n var files = glob.sync(behaviourdir+ beh + \"_settings_*.json\");\n for(var filename of files) {\n var p = filename.substring((behaviourdir.length + beh.length+10), filename.lastIndexOf('.json')); // truncate after '_settings_'\n if(p != 'current') {\n presets.push(p); // current is special, don't use it.\n }\n }\n console.log(Date(Date.now()) + \" ... sending: \" + JSON.stringify(presets));\n socket.emit('populatePresets', { behaviour: beh, presetlist: presets });\n\n }\n\n /// save DAT.gui settings to disk (actually, this simply copies the file \"XXXXX_current.json\" to the new filename (hack, but it works!)\n\n function saveDatSettings(data) { // { behaviour: ___, preset: ____ }\n \n console.log( Date(Date.now()) + \" Saving: \" + data.behaviour + \"_settings_\" + data.preset + \".json\");\n fs.copyFile(behaviourdir + data.behaviour + \"_settings_current.json\", behaviourdir + data.behaviour + \"_settings_\" + data.preset + \".json\", (err) => {\n if (err) throw err;\n console.log(\" Success.\");\n });\n\n // sync all my clients' preset lists...\n socket.broadcast.emit('syncClients', { beh: data.behaviour, param: 'reloadPresetList', val: data.preset });\n\n }\n\n //////////\n function callKillControl() {\n killControl();\n }\n\n function callRestartControl() {\n restartControl();\n }\n\n function callLaunchControl() {\n launchControl();\n }\n\n //////////\n\n function sendPaintBrushCoords(coords) {\n paintBrush(coords);\n }\n\n\n //////////\n\n function settimerActive(bool){\n amatriadata.timerActive = JSON.parse(bool)\n rewriteData(amatriadata);\n }\n\n function callSleep(){\n processingSleep()\n }\n\n function callWake(){\n processingWake()\n }\n\n function setTimerData(values){\n \n amatriadata.sleepHour = values[0]\n amatriadata.sleepMin = values[1]\n amatriadata.wakeHour = values[2]\n amatriadata.wakeMin = values[3]\n\n console.log ('Sleep Time: ' + amatriadata.sleepHour + \":\" + amatriadata.sleepMin)\n console.log ('Wake Time: ' + amatriadata.wakeHour + \":\" + amatriadata.wakeMin)\n\n rewriteData(amatriadata);\n createTimerCallback(values);\n }\n\n\n function triggerLightGesture(gesture){\n // OSC message reference: https://support.etcconnect.com/ETC/Consoles/ColorSource/ColorSource_20_and_40_AV/OSC_Commands_for_ColorSource_AV_Console\n killPlaybacks(0,81); // Kills all playbacks\n if (gesture.type == 'playback'){\n console.log( Date(Date.now()) + 'triggering playback: ' + gesture.id + ' at level: ' + gesture.level);\n lightOscClient.send(('/cs/playback/' + gesture.id + '/level'), gesture.level);\n }\n else if (gesture.type == 'cue'){\n console.log( Date(Date.now()) + 'triggering lighting cue: ' + gesture.id);\n lightOscClient.send('/cs/playback/gotocue/' + gesture.id);\n // lightOscClient.send('/cs/playback/go');\n }\n else{\n console.log( Date(Date.now()) + 'unknown light gesture type called');\n }\n }\n\n function killPlaybacks(min,max){\n for(var i = min; i < max; i++){\n lightOscClient.send(('/cs/playback/' + i + '/level'), 0);\n }\n }\n \n // function behaviourScene(scene){\n // console.log( Date(Date.now()) + \" *** SWITCHING TO SCENE: \" + scene + \" [ \" + socket.id + \" ]\");\n // amatriadata.behaviourScene = scene\n // behaviourOscClient.send('/serverMessage/scene', scene);\n // rewriteData(amatriadata);\n // try {\n // loadCues(scene);\n // } catch (err) {\n // console.log(Date(Date.now()) + err);\n // // console.log(Date(Date.now()) + \"No cue_settings file for this scene\");\n // }\n \n // }\n\n function loadCues(scene){\n console.log(Date(Date.now()) + \"clearing existing cues for scene change\");\n for (let i in active_cues){\n clear_timeouts(i);\n }\n console.log(Date(Date.now()) + \"loading cues for scene: \" + scene);\n var cue_settings = fs.readFileSync(behaviourdir + 'cue_settings_' + scene + '.json');\n var cue_settings_json = JSON.parse(cue_settings);\n for (let q in cue_settings_json){\n send_timeout_coummands(q, cue_settings_json[q]);\n }\n }\n\n function send_timeout_coummands(name, cue){\n var timeoutID = setTimeout(console.log, cue.start_time, (Date(Date.now()) + \"starting cue for \" + cue.behaviour + \" , parameter: \" + cue.param)); // console log message for each cue\n if (active_cues[name] == null){\n active_cues[name] = [];\n }\n active_cues[name].push(timeoutID);\n // interpolate the parameter values over the duration of the cue\n var linear_interpolation_delta = cue.end_value - cue.start_value;\n \n for(var step = 0; step <= cue.duration; step += cue_step_interval){\n var interpolation_proportion = step/cue.duration; // should be range 0-1, like a percentage\n var datMessage = {};\n datMessage.behaviour = cue.behaviour;\n datMessage.name = cue.param;\n datMessage.value = cue.start_value + (linear_interpolation_delta * interpolation_proportion);\n if(cue.target != null) { // Target is for specifying a nested behaviour, like gridrunner source\n datMessage.target = cue.target;\n }\n if(cue.behaviour == \"globalSetting\"){\n // can't use sendDatOSC for a global setting\n if(cue.param == \"behaviourIntensity\"){\n timeoutID = setTimeout(setBehaviourIntensity, cue.start_time + step, datMessage.value);\n }\n } else {\n timeoutID = setTimeout(sendDatOSC,cue.start_time + step, datMessage);\n }\n active_cues[name].push(timeoutID);\n }\n }\n\n function clear_timeouts(cue_name){\n for (let i in active_cues[cue_name]) {\n clearTimeout(active_cues[cue_name][i]);\n /// remove [cue name] object from active_cues here.\n }\n }\n\n\n\n function radioLight(value){\n var playback = value[1];\n var destination = value[0];\n var playbackseq = [\"11\",\"12\",\"11\",\"13\",\"14\",\"13\",\"15\",\"16\",\"15\"];\n\n if (destination == 'grotto'){ amatriadata.grottoPlayback = playback;}\n else if (destination == 'river'){amatriadata.riverPlayback = playback;}\n else if (destination == 'cloud'){amatriadata.cloudPlayback = playback;}\n rewriteData(amatriadata);\n killPlaybacks(30,36);\n var idx = playbackseq.indexOf(playback);\n if (idx != -1){\n console.log ('turning on playback: ' + playback + ' turning off playback: ' + playbackseq[idx+1]);\n\n // until we know how to do a fade without colors, we need to just turn them on:\n // fadeplayback(playback,true,2000);\n \n \n // just set the other playback directly to zero\n // if we had a way to get a playbacks current value from the CS40\n // we could lerp this nicely from current value to zero\n // but untill we figure that out this works - KC\n lightOscClient.send(('/cs/playback/' + playback + '/level'), 1); \n lightOscClient.send(('/cs/playback/' + playbackseq[idx+1] + '/level'), 0); \n }\n else{\n console.log ('turning off: ' + destination);\n var p1 = 0;\n var p2 = 0;\n if (destination == 'grotto'){p1=11;p2=12;}\n else if (destination == 'river'){p1=13;p2=14;}\n else if (destination == 'cloud'){p1=15;p2=16;}\n\n // see above re: lerping values to zero\n lightOscClient.send(('/cs/playback/' + p1 + '/level'), 0);\n lightOscClient.send(('/cs/playback/' + p2 + '/level'), 0);\n\n }\n }\n\n\n function muteToggle(data){\n if (!amatriadata.muteState) {\n audioOscClient.send('/masterMute', 0);\n console.log( Date(Date.now()) + 'muting audio');\n amatriadata.muteState = true;\n amatriadata.manualMute = true; \n }\n else{\n audioOscClient.send('/masterMute', 1);\n console.log( Date(Date.now()) + 'unmuting audio');\n amatriadata.muteState = false;\n amatriadata.manualMute = true; // back to manual \n }\n rewriteData(amatriadata);\n socket.broadcast.emit('muteToggle', muteState);\n\n }\n\n function toggleSoundFile(file){\n audioOscClient.send('/toggle' + file);\n console.log(Date(Date.now()) + 'playing sound file: ' + file);\n\n }\n\n // function toggleSoundFile(file){\n // switch (file) {\n // case 'MeanderComp01':\n // if(!amatriadata.playingMeanderComp01) {\n // audioOscClient.send('/toggle' + file);\n // console.log(Date(Date.now()) + 'playing sound file: ' + file);\n // amatriadata.playingMeanderComp01 = true;\n // }\n // else {\n // audioOscClient.send('/toggle' + file);\n // console.log(Date(Date.now()) + 'stopping sound file: ' + file);\n // amatriadata.playingMeanderComp01 = false;\n // }\n // rewriteData(amatriadata);\n // break;\n \n // case 'Track8Min':\n // if(!amatriadata.playingTrack8Min) {\n // if(amatriadata.playingMeanderComp01)\n // audioOscClient.send('/toggleMeanderComp01'); // turn off MeanderComp01\n // audioOscClient.send('/toggle' + file);\n // console.log(Date(Date.now()) + 'playing sound file: ' + file);\n // amatriadata.playingMeanderComp01 = false;\n // amatriadata.playingTrack8Min = true;\n // }\n // else {\n // audioOscClient.send('/toggle' + file);\n // console.log(Date(Date.now()) + 'stopping sound file: ' + file);\n // amatriadata.playingTrack8Min = false;\n // }\n // rewriteData(amatriadata);\n // break;\n // default:\n // console.log(Date(Date.now()) + 'unrecognized sound file requested: ' + file);\n // break;\n // }\n // }\n\n // function turnOffSoundFiles() {\n // console.log(Date(Date.now()) + 'stopping any playing sound files');\n // if(amatriadata.playingTrack8Min) {\n // audioOscClient.send('/toggleTrack8Min');\n // console.log(Date(Date.now()) + 'toggling ------------------------------');\n // amatriadata.playingTrack8Min = false;\n // }\n // rewriteData(amatriadata);\n // }\n\n function gestureToggle(data){\n // Set State Directly\n if (typeof data == 'boolean'){\n if (data){\n behaviourOscClient.send('/sensorGestures/toggle', 1);\n console.log( Date(Date.now()) + 'Directly setting sensor sound gestures on');\n amatriadata.gestureState = data;\n }\n else {\n behaviourOscClient.send('/sensorGestures/toggle', 0);\n console.log( Date(Date.now()) + 'Directly setting sensor sound gestures off');\n amatriadata.gestureState = data;\n }\n }\n \n else{\n // Toggle\n if (!amatriadata.gestureState) {\n behaviourOscClient.send('/sensorGestures/toggle', 1);\n console.log( Date(Date.now()) + 'setting sensor sound gestures on');\n amatriadata.gestureState = true;\n }\n else{\n behaviourOscClient.send('/sensorGestures/toggle', 0);\n console.log( Date(Date.now()) + 'setting sensor sound gestures off');\n amatriadata.gestureState = false;\n }\n }\n rewriteData(amatriadata);\n }\n\n function setVolume(volume){\n audioOscClient.send('/masterVolume', parseFloat(volume));\n console.log( Date(Date.now()) + 'Volume: ' + volume);\n amatriadata.masterVolume = volume;\n rewriteData(amatriadata);\n }\n\n function toggleInterpDisplay(value){\n //toggle message based on current state\n var interpOscClient = null\n var piMonitorState = false\n if (value == 1){\n interpOscClient = interpOscClient1\n piMonitorState = piMonitorState1\n piMonitorState1 = !piMonitorState1\n }\n else if (value == 2){\n interpOscClient = interpOscClient2\n piMonitorState = piMonitorState2\n piMonitorState2 = !piMonitorState2\n }\n else if (value == 3){\n interpOscClient = interpOscClient3\n piMonitorState = piMonitorState3\n piMonitorState3 = !piMonitorState3\n }\n\n var message = 'on';\n if (piMonitorState){\n message = 'off';\n }\n\n // use incoming value to specify pi unit number\n interpOscClient1.send('/pipresents/unit01/core/monitor', message);\n console.log( Date(Date.now()) + 'Toggling Pi ' + value + \"with state: \" + message);\n }\n\n // Triggers Max Gesture based on button ID\n function triggerGesture(gestureNum){\n var soundOrNoise = ((Math.random() < 0.90) ? 1 : 2); // 10 percent chance it is noise.\n audioOscClient.send('/gesture/trigger',gestureNum, soundOrNoise);\n console.log( Date(Date.now()) + 'Gesture ' + gestureNum + ' Triggered ' + ((soundOrNoise == 1) ? \"(Sound)\" : \"(Noise)\"));\n }\n\n // Set Riverhead speed from rhSlider\n function setRHSpeed(rhSpeed){\n behaviourOscClient.send('/riverHead/rhRingSpeed', parseFloat(rhSpeed));\n socket.broadcast.emit('setRHSpeed',rhSpeed)\n console.log( Date(Date.now()) + 'RH Speed: ' + rhSpeed);\n }\n \n // Toggles Riverhead\n function rhToggle(data){\n if (rhState) {\n behaviourOscClient.send('/riverHead/rhDisplayRings', 0);\n console.log( Date(Date.now()) + 'turning Riverhead off');\n rhState = false;\n }\n else{\n behaviourOscClient.send('/riverHead/rhDisplayRings', 1);\n console.log( Date(Date.now()) + 'turning Riverhead on');\n rhState = true;\n }\n }\n\n\n ///// experimental ambient wave adjustmnts ====== mg March 10\n // Toggles AW Arrow\n function awToggle(data){\n if (awState) {\n behaviourOscClient.send('/ambientWaves/display', 0);\n console.log( Date(Date.now()) + 'turning aw arrow off');\n awState = false;\n }\n else{\n behaviourOscClient.send('/ambientWaves/display', 1);\n console.log( Date(Date.now()) + 'turning aw arrow on');\n awState = true;\n }\n\n socket.broadcast.emit('awToggle', awState);\n }\n\n // Set AW Velocity\n function setAwVelocity(awVelocity){\n behaviourOscClient.send('/ambientWaves/velocity', parseFloat(awVelocity));\n socket.broadcast.emit('setAwVelocity', awVelocity)\n console.log( Date(Date.now()) + 'AW Velocity: ' + awVelocity);\n }\n\n // Set AW Period\n function setAwPeriod(awPeriod){\n behaviourOscClient.send('/ambientWaves/period', parseFloat(awPeriod));\n socket.broadcast.emit('setAwPeriod', awPeriod)\n console.log( Date(Date.now()) + 'AW Period: ' + awPeriod);\n }\n\n // Set AW Amplitude\n function setAwAmplitude(awAmplitude){\n behaviourOscClient.send('/ambientWaves/amplitude', parseFloat(awAmplitude));\n socket.broadcast.emit('setAwAmplitude', awAmplitude)\n console.log( Date(Date.now()) + 'AW Amplitude: ' + awAmplitude);\n }\n\n // Set AW Angle\n function setAwAngle(awAngle){\n behaviourOscClient.send('/ambientWaves/angle', parseFloat(awAngle));\n socket.broadcast.emit('setAwAngle', awAngle)\n console.log( Date(Date.now()) + 'AW Angle: ' + awAngle);\n }\n\n ///// Timelapse Scale Factor adjustmnt ====== rg March 26\n // Toggles TL Scale Factor\n function tlToggle(data){ \n if (tlState) {\n behaviourOscClient.send('/timelapse/tlon', 0); \n console.log( Date(Date.now()) + 'turning timelapse scale factor off');\n socket.emit(\"behaviourScene\",'default'); // switch to timelapse scene\n //socket.broadcast.emit('setSceneButtons','default');\n console.log( Date(Date.now()) + 'switching to Default scene');\n tlState = false;\n }\n else{\n behaviourOscClient.send('/timelapse/tlon', 1);\n console.log( Date(Date.now()) + 'turning timelapse scale factor on');\n socket.emit(\"behaviourScene\",'timelapse'); // switch to timelapse scene\n //socket.broadcast.emit('setSceneButtons','timelapse');\n console.log( Date(Date.now()) + 'switching to Timelapse scene');\n tlState = true;\n }\n\n socket.broadcast.emit('tlToggle', tlState);\n }\n\n function setTlState(tlTargetState){ \n if (tlTargetState) {\n behaviourOscClient.send('/timelapse/tlon', 1);\n console.log( Date(Date.now()) + 'turning timelapse scale factor on');\n socket.emit(\"behaviourScene\",'timelapse'); // switch to timelapse scene\n socket.emit('setSceneButtons','timelapse');\n console.log( Date(Date.now()) + 'switching to Timelapse scene');\n tlState = true;\n }\n else{\n behaviourOscClient.send('/timelapse/tlon', 0);\n console.log( Date(Date.now()) + 'turning timelapse scale factor off');\n socket.emit(\"behaviourScene\",'default'); // switch to timelapse scene\n socket.emit('setSceneButtons','default');\n console.log( Date(Date.now()) + 'switching to Default scene');\n tlState = false;\n }\n\n socket.broadcast.emit('tlToggle', tlState);\n }\n\n // Set Timelapse Scale Factor\n function setTlScaleFactor(tlScaleFactor){\n behaviourOscClient.send('/timelapse/scalefactor', parseFloat(tlScaleFactor));\n socket.broadcast.emit('setTlScaleFactor', tlScaleFactor)\n console.log( Date(Date.now()) + 'Timelapse Scale Factor: ' + tlScaleFactor);\n }\n\n}", "onConnect( socket, req ) {\n\t\tconst ip = req.headers['x-forwarded-for'] || req.socket.remoteAddress\n\t\tconsole.log( `WebSocket connection established from ${ ip }...` );\n\n\t\tsocket.on( 'close', this.onClose.bind( this ) );\n\t\tsocket.on( 'message', this.onMessage.bind( this ) );\n\n\t\t// Callback to send the created integer to each connected client.\n\t\tconst sendInteger = ( integer ) => {\n\t\t\tthis.wss.clients.forEach( client => client.send( integer ) );\n\t\t}\n\n\t\t// Start the forge.\n\t\tthis.forge.start( sendInteger );\n\t}", "function attach_socket() {\n var wsUri = \"ws://\" + window.location.hostname + \"/controller\";\n update_connection_status(\"Connection to \" + wsUri + \" ...\")\n websocket = new WebSocket(wsUri);\n websocket.onopen = function (evt) { onOpen(evt) };\n websocket.onclose = function (evt) { onClose(evt) };\n websocket.onmessage = function (evt) { onMessage(evt) };\n websocket.onerror = function (evt) { onError(evt) };\n}", "function newConnection(socket) {\n // Log the socket id\n console.log('New connection: ' + socket.id);\n\n // Emit to all other clients except user.\n socket.on('CONNECT_USER', function (userProfile) {\n // For every user add userProfile to object\n connectedUsers[socket.id] = userProfile;\n socket.broadcast.emit('CONNECT_USER', {\n // Send the user profile and socket id to client\n userProfile: userProfile,\n id: socket.id\n });\n });\n\n // When textArea received from client\n socket.on('textArea', sendTextarea);\n\n // When searchField received from client\n socket.on('searchField', sendSearchfield);\n\n // Send searchfield message to all clients\n function sendSearchfield(field) {\n // Api request to Youtube send it to all clients\n io.emit('NEW_VIDEO',\n // EncodeURI Make sure spaces work\n `${(field)}`);\n }\n\n // Send textarea message to all clients\n function sendTextarea(text) {\n io.sockets.emit('textArea', text);\n }\n\n // Client disconnect\n socket.on('disconnect', function () {\n console.log('User disconnected: ' + socket.id);\n // Broadcast to all other clients. Delete the socket.id from the connecter\n socket.broadcast.emit('DISCONNECT_USER', socket.id);\n // Delete the property\n delete connectedUsers[socket.id];\n });\n\n // When video playing received from client\n socket.on('videoPlay', sendPlaying);\n // Send to all client except self\n function sendPlaying() {\n socket.broadcast.emit('videoPlay', true);\n }\n\n // When video pause received from client\n socket.on('videoPause', sendPause);\n // Send to all client except self\n function sendPause() {\n socket.broadcast.emit('videoPause', true);\n }\n}", "connectSocket(socket)\n {\n this.sockets.push(socket);\n console.log('Socket connected');\n\n this.messageHandler(socket);\n \n this.sendChain(socket);\n }", "function openSocket(websocketlocation) {\r\n socket = new WebSocket(websocketlocation);\r\n socket.onclose = function() {\r\n setTimeout(function(){openSocket(websocketlocation)}, 5000);\r\n };\r\n}", "function openSocket() {\r\n\t// Ensures only one connection is open at a time\r\n\tif (webSocket !== undefined && webSocket.readyState !== WebSocket.CLOSED) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Create a new instance of the websocket\r\n\twebSocket = new WebSocket(\"ws://\" + socket_url + \":\" + port\r\n\t\t\t+ \"/WebMobileGroupChatServer/chat?name=\" + name);\r\n\r\n\t/**\r\n\t * Binds functions to the listeners for the websocket.\r\n\t */\r\n\twebSocket.onopen = function(event) {\r\n\t\t// $('#message_container').fadeIn();\r\n\r\n\t\tif (event.data === undefined)\r\n\t\t\treturn;\r\n\t};\r\n\r\n\twebSocket.onmessage = function(event) {\r\n\r\n\t\t// parsing the json data\r\n\t\tparseMessage(event.data);\r\n\t};\r\n\r\n\twebSocket.onclose = function(event) {\r\n\r\n\t};\r\n}", "function configurar() {\n if (socket) {\n socket.close()\n }\n let host = document.getElementById(\"hostip\").value\n socket = new WebSocket(host)\n setupSocket(socket)\n\n}", "function acceptConnection(socket) {\n}", "connect () {\n /* Connect our websocket */\n this._ws = new WebSocket(this.uri, {\n origin: 'https://www.multiplayerpiano.com',\n agent: this.proxy ? this.proxy.startsWith('socks') ? new SocksProxyAgent(this.proxy) : new HttpsProxyAgent(this.proxy) : undefined\n })\n\n this._constructSocketListeners()\n\n setTimeout(() => {\n if (!this._isConnected) {\n this.emit('error', new Error('Bot failed to connect to websocket in 10 seconds.'))\n this._ws.close()\n }\n }, this._socketTimeoutMS)\n }", "function createWebSocket() {\n var old = gSocket;\n if (old !== null && old.readyState === WebSocket.OPEN) return;\n \n useWebSocket(new WebSocket(\"ws://\" + window.location.host + \"/ws/\"));\n}", "connect() { socket_connect(this) }", "function initWebSocket() {\n\t\t// Create a connection to Server\n\t\tconnect();\n\t}", "function initWebSocket() {\n\t\t// Create a connection to Server\n\t\tconnect();\n\t}", "function apply() {\n var WS = global.WebSocket;\n utils.patchEventTargetMethods(WS.prototype);\n global.WebSocket = function(a, b) {\n var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);\n var proxySocket;\n\n // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance\n var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');\n if (onmessageDesc && onmessageDesc.configurable === false) {\n proxySocket = Object.create(socket);\n ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) {\n proxySocket[propName] = function() {\n return socket[propName].apply(socket, arguments);\n };\n });\n } else {\n // we can patch the real socket\n proxySocket = socket;\n }\n\n utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']);\n\n return proxySocket;\n };\n}", "setSocket(socket) {\n this.socket = socket;\n if (debug) console.log('socket on port ${this.port} established.');\n this.ready = true;\n while(this.queue.length) {\n let entry = this.queue.splice(0,1)[0];\n this[entry.op](entry.eventName, entry.handler || entry.payload, entry.afterwards);\n }\n }", "connect ( protocol = \"ws://\", host = \"\", path = \"\" ) {\n if ( \"WebSocket\" in window ) {\n let target = protocol + host + path;\n\n if ( DL.reports( \"connection\" ) ) {\n DL.info( \"Creating WebSocket connection to \" + target );\n }\n\n this.socket = new WebSocket( target );\n\n if ( this.socket instanceof WebSocket) {\n _.assign( this.socket\n , { onopen: this.handleOpen.bind( this )\n , onmessage: this.handleMessage.bind( this )\n , onerror: this.handleError.bind( this )\n , onclose: this.handleClose.bind( this )\n }\n , this\n );\n } else {\n throw new Error( \"Was unable to create a WebSocket instance\" );\n }\n } else {\n // TODO: Visual error for legacy browsers with links to download others\n DL.error( \"This environment doesn't support WebSockets.\" );\n }\n }", "function updateSocket(socket) {\n\t\tconsole.log(socket.id + \" --- SOCKET UPDATED\");\n\t\tsendToSocket(socket, 'sendChannels', channels);\n\t\tsendToSocket(socket, 'sendCountReceivers', countReceivers);\n\t\tsendToSocket(socket, 'sendDefaultCarst', defaultCarst);\n\t\tsendToSocket(socket, 'sendCarsts', carsts);\n\t\tsendToSocket(socket, 'sendCommands', commands);\n\t\tsendToSocket(socket, 'sendPlaylists', playlists);\n\t\tsendToSocket(socket, 'sendEvents', events);\n\t}", "connect() {\n this.ws = new WebSocket(WS_URI, { headers: this.player.headers, rejectUnauthorized: false })\n\n this.ws.on('open', this.handleOpen.bind(this))\n this.ws.on('message', this.handleMessage.bind(this))\n this.ws.on('error', this.handleError.bind(this))\n this.ws.on('close', this.handleClose.bind(this))\n }", "connectToWebSocket(url) {\n const client = new WebSocketClient();\n client.connect(url);\n\n client.on('connect', connection =>\n this.handleConnection(connection));\n\n client.on('connectFailed', error =>\n this.handleError(error));\n }", "connectSocket(socket)\n\t{\n\t\tthis.sockets.push(socket);\n\t\tconsole.log('Socket connected');\n\n\t\tthis.messageHandler(socket);\n\n\t\tthis.sendChain(socket);\n\t}", "function setWebsocketConnection() {\n console.log('Opening WS connection to: ' + \"ws://\" + window.location.host + \"/API-ws/\");\n vm.ws = new WebSocket(\"ws://\" + window.location.host + \"/API-ws/\");\n vm.ws.onmessage = function(e) {\n receiveWebsocketMessage(e.data);\n };\n vm.ws.onopen = function() {\n // Request information\n console.log('Opened WS connection to: ' + \"ws://\" + window.location.host + \"/API-ws/\");\n //TODO\n requestGetDetails('content', 'get_details');\n };\n\n // Call onopen directly if socket is already open\n if (vm.ws.readyState == WebSocket.OPEN) {vm.ws.onopen();}\n }", "connectSocket(socket) {\n this.sockets.push(socket);\n console.log('Socket Connected');\n\n //Since all sockets run through here, the message handler\n //can be attached here\n this.messageHandler(socket);\n\n //Still have to send the message\n //Have to stringify it since send only accepts strings\n this.sendChain(socket);\n }", "function Socket(socket) {\r\n _super.call(this);\r\n this.socket = socket;\r\n this.eureca = {};\r\n this.request = socket.request;\r\n this.id = socket.id;\r\n //FIXME : with nodejs 0.10.0 remoteAddress of nodejs clients is undefined (this seems to be a engine.io issue) \r\n this.remoteAddress = socket.address;\r\n //this.registerEvents(['open', 'message', 'error', 'close', 'reconnecting']);\r\n this.bindEvents();\r\n }", "function openWSConnection(protocol, hostname, port, endpoint) {\n var webSocketURL = null;\n webSocketURL = protocol + \"://\" + hostname + \":\" + port + endpoint;\n console.log(\"openWSConnection::Connecting to: \" + webSocketURL);\n try {\n webSocket = io(webSocketURL);\n console.log('--webSocket--');\n console.dir(webSocket, { depth: null, colors: true });\n\n webSocket.on('new parameters', (parameters) => {\n console.dir(parameters, { depth: null, colors: true });\n let template = document.getElementById('horizontalTemplate').innerHTML;\n if (parameters.orientation !== 0) {\n template = document.getElementById('verticalTemplate').innerHTML;\n }\n else {\n template = document.getElementById('horizontalTemplate').innerHTML;\n }\n renderTemplate(parameters, template);\n });\n\n webSocket.on('connect_failed', (details) => {\n console.log(\"WebSocket CONNECTION FAILED: \" + JSON.stringify(details, null, 4));\n });\n\n webSocket.on('error', (details) => {\n console.log(\"WebSocket ERROR: \" + JSON.stringify(details, null, 4));\n });\n\n webSocket.onopen = function (openEvent) {\n console.log(\"WebSocket OPEN: \" + JSON.stringify(openEvent, null, 4));\n document.getElementById(\"btnSend\").disabled = false;\n document.getElementById(\"btnConnect\").disabled = true;\n document.getElementById(\"btnDisconnect\").disabled = false;\n };\n webSocket.onclose = function (closeEvent) {\n console.log(\"WebSocket CLOSE: \" + JSON.stringify(closeEvent, null, 4));\n document.getElementById(\"btnSend\").disabled = true;\n document.getElementById(\"btnConnect\").disabled = false;\n document.getElementById(\"btnDisconnect\").disabled = true;\n };\n webSocket.onerror = function (errorEvent) {\n console.log(\"WebSocket ERROR: \" + JSON.stringify(errorEvent, null, 4));\n };\n webSocket.onmessage = function (messageEvent) {\n var wsMsg = messageEvent.data;\n console.log(\"WebSocket MESSAGE: \" + wsMsg);\n if (wsMsg.indexOf(\"error\") > 0) {\n document.getElementById(\"incomingMsgOutput\").value += \"error: \" + wsMsg.error + \"\\r\\n\";\n } else {\n document.getElementById(\"incomingMsgOutput\").value += \"message: \" + wsMsg + \"\\r\\n\";\n }\n };\n } catch (exception) {\n console.error(exception);\n webSocket.close();\n }\n}", "connect() {\r\n socket = new WebSocket(\"ws://localhost:4567/profesor\");\r\n socket.onopen = this.openWs;\r\n socket.onerror = this.errorWs;\r\n socket.onmessage = this.messageWs;\r\n app.recarga();\r\n }", "function proxySocket() {\n\t\tproxyEvents.forEach(function(event){\n\t\t\tsocket.on(event, function(data) {\n\t\t\t\tamplify.publish('socket:'+event, data || null);\n\t\t\t});\n\t\t});\n\t\tsocket.on('connect', function() {\n\t\t\tsocket.emit('subscribe', user.token);\n\t\t\tamplify.publish('socket:connect');\n\t\t});\n\t\n\t}", "function createGameSocket(color){\n stem = window.location.href.split('/')[3]\n host = window.location.hostname\n id = stem.substring(8,17)\n const gamesock = new WebSocket('wss://'+host+'/gamesock?id='+id+'&color='+color)\n return gamesock\n}", "wsConnect() {\n\n\t\tconst socketUrl = 'ws://localhost:8989/ws';\n\t\t// const socketUrl = 'ws://192.168.1.68:8888/ws';\n\t\t// const socketUrl = 'ws://192.168.1.68:8888/ws';\n\n\t\tthis.SPJS.ws = new WebSocket(socketUrl);\n\n\t\tthis.SPJS.ws.onopen = () => this.onSpjsOpen();\n\t\tthis.SPJS.ws.onmessage = evt => this.onSpjsMessage(evt.data);\n\t\tthis.SPJS.ws.onerror = error => this.onSpjsError(error);\n\t\tthis.SPJS.ws.onclose = () => this.onSpjsClose();\n\n\t}", "connect() {\n const protocol = this.config.ssl ? 'wss' : 'ws';\n const url = `${protocol}://${this.config.ip}:${this.config.port}`;\n\n log.debug('Socket - connect()', url);\n\n this.connection = null;\n\n this.connection = io(url, {\n forceNew: true,\n reconnection: false,\n upgrade: false,\n transports: ['websocket'],\n });\n\n // listens for server side errors\n this.connection.on('error', (error) => {\n log.debug('Socket - connect() - error', error);\n });\n\n // listens for websocket connection errors (ie db errors, server down, timeouts)\n this.connection.on('connect_error', (error) => {\n log.debug('Socket - connect() - server connection error', this.config.ip);\n log.error(error);\n\n this.listening = false;\n\n this.game.app.toggleLogin(false);\n this.game.app.sendError(null, 'Could not connect to the game server.');\n });\n\n // listens for socket connection attempts\n this.connection.on('connect', () => {\n log.debug('Socket - connect() - connecting to server', this.config.ip);\n this.listening = true;\n\n this.game.app.updateLoader('Preparing handshake...');\n this.connection.emit('client', {\n gVer: this.config.version,\n cType: 'HTML5',\n });\n });\n\n // listens for server side messages\n this.connection.on('message', (message) => {\n log.debug('Socket - connect() - message', message);\n this.receive(message);\n });\n\n // listens for a disconnect\n this.connection.on('disconnect', () => {\n log.debug('Socket - connect() - disconnecting');\n this.game.handleDisconnection();\n });\n }", "function connectWebSocket() {\n let protocol = 'wss://';\n // so it also works in 'http' (useful when testing)\n if (location.protocol === 'http:') {\n protocol = 'ws://';\n }\n SOCKET = new WebSocket(protocol + window.location.host + \"/chat\", \"chat\");\n SOCKET.onopen = socketReady;\n SOCKET.onclose = function () {\n console.log('Socket closed');\n addSystemMessage(textElement(\"Disconnected! (will try to reconnect in 5s)\"));\n reconnectWebSocket();\n };\n SOCKET.onerror = function (event) {\n console.log(event);\n addSystemMessage(textElement(\"Disconnected! (will try to reconnect in 5s)\"));\n reconnectWebSocket();\n };\n SOCKET.onmessage = function (event) {\n var type = event.data[0];\n switch (type) {\n case MessageType.getUsername:\n var username = parseUsernameMessage(event.data);\n associateUsername(username);\n break;\n case MessageType.currentUsersCount:\n let connectedCount = parseUsersCount(event.data);\n addToUsersCount(connectedCount);\n break;\n case MessageType.textMessage:\n var message = parseTextMessage(event.data);\n addUserMessage(message);\n break;\n case MessageType.userJoined:\n var username = parseUsernameMessage(event.data);\n userJoined(username);\n break;\n case MessageType.userLeft:\n var username = parseUsernameMessage(event.data);\n userLeft(username);\n break;\n }\n };\n}", "function send_on_websocket(what) {\n console.log(what);\n if (!socket_connected) {\n add_to_output(\"### Can't send to closed socket\");\n } else {\n socket.send(what);\n }\n}", "async function addSocket(socket) {\n debug(\"Coupdoeil addSocket id %s\", socket.id)\n return await _webSocketApp.addSocket(socket)\n}", "#upgrade(req, socket) {\n\t\tif(is_banned(req.client.remoteAddress)) {\n\t\t\t// TODO: Log this?\n\t\t\tsocket.destroy(); // Immediately close the connection\n\t\t\treturn;\n\t\t}\n\n\t\tif(req.headers.upgrade.toLowerCase() !== 'websocket' || !ServerAuth.is_authorized(req)) {\n\t\t\tsocket.destroy();\n\t\t\treturn;\n\t\t}\n\n\t\tconst ws_accept = generate_ws_accept(req.headers);\n\n\t\tsocket.write([\n\t\t\t'HTTP/1.1 101 Switching Protocols',\n\t\t\t'Upgrade: WebSocket',\n\t\t\t'Connection: Upgrade',\n\t\t\t`Sec-WebSocket-Accept: ${ws_accept}`\n\t\t].join('\\r\\n') + '\\r\\n\\r\\n');\n\n\t\t// Clean up the connection list\n\t\tlet end_index = this.#connections.length;\n\t\twhile(--end_index >= 0 && this.#connections[end_index] === null) this.#connections.pop();\n\n\t\tlet index = this.#connections.push(socket) - 1;\n\n\t\tsocket.on('data', this.#data.bind(this, index));\n\t\tsocket.on('error', (err) => {\n\t\t\tthis.#emitter.emit(\"error\", {\n\t\t\t\tmessage: err.message,\n\t\t\t\tindex,\n\t\t\t\tsocket\n\t\t\t});\n\t\t});\n\t}", "initWS() {\n this.ws = new WebSocket(this.wsUrl, 'game');\n }", "function connectSocket(user) {\n username = user;\n //console.log(username);\n //console.log(socket);\n if (socket == null) { //check if socket already is connected\n console.log(\"opening socket\");\n try{\n socket = new WebSocket(webSocketUrl);\n }\n catch(err){\n console.log(err);\n }\n \n }\n socket.onopen = function (event) {\n //console.log(socket.readyState)\n send(null);\n };\n socket.onmessage = function (event) {\n //this is for error handling\n //console.log(event.data)\n var msg = JSON.parse(event.data);\n\n if(msg.message == \"0x9\"){//PING\n socket.send('{\"message\": \"0xA\"}');//PONG\n }\n else{\n alert(\"Error: \" + msg.error);\n }\n }\n socket.onerror = function(event){\n if(event.data == undefined){\n alert(\"An error occurred while trying to connect the websocket.\");\n }\n else{ \n alert(\"Error: \" + event.data);\n }\n }\n}", "_runSocketServer() {\n const socketServer = new ws.Server({ port: SOCKET_SERVER_PORT });\n\n socketServer.on('connection', socket => {\n this._connectedSockets = [...this._connectedSockets, socket];\n\n socket.send(JSON.stringify(this._getProjectContent()));\n\n socket.on('close', () => {\n this._connectedSockets = this._connectedSockets.filter(\n _socket => _socket !== socket\n );\n });\n });\n }", "initSocket(socket){\n\t\tsocket.on('connect', (value)=>{\n\t\t\tconsole.log(\"Connected\");\n\t\t})\n\t\tsocket.on('disconnect', this.reconnectUserInfo)\n\t}", "function initWebSocket() {\n var gateway = `ws://${window.location.hostname}/ws`;\n console.log(gateway)\n websocket = new WebSocket(gateway);\n websocket.onopen = onWebSocketOpen;\n websocket.onclose = onWebSocketClose;\n websocket.onmessage = onWebSocketMessage;\n}", "connectSocket(socket) {\n // push this socket to the array of sockets\n this.sockets.push(socket);\n console.log('Socket connected');\n // call the message handler event\n this.messageHandler(socket);\n this.sendChain(socket);\n }", "function wsconnect(){\n try {\n console.log(\"opening Websocket\");\n if (\"WebSocket\" in window) {\n console.log(ws_uri);\n var socket = new WebSocket(ws_uri);\n } // end if\n else {\n // Firefox currently prefixes the WebSocket object\n var socket = new MozWebSocket(ws_uri);\n } // end else\n socket.onopen = function() {\n console.log(\"Websocket opened\");\n }\n socket.onmessage = function(e) {\n if (debug === true) {\n console.log(\"Received data: \" + e.data);\n }\n measurement = JSON.parse(e.data);\n console.log(datakey);\n updateData(measurement, datakey);\n } // end function\n socket.onclose = function(){ \n console.log(\"Websocket closed\");\n // automatically reconnect after 1s\n window.setTimeout(wsconnect, 2000);\n }\n } catch(exception) { // end try\n console.log(\"Websocket exception\" + exception); \n } // end catch\n \n } // end function wsconnect", "connectSocket(socket) {\n this.sockets.push(socket);\n console.log('Socket Connected');\n this.messageHandler(socket);\n this.sendChain(socket);\n\n }", "function useWebsocket(socket, request, protocol) {\n // configure and make server\n const server = makeServer({ schema, roots });\n\n // accept socket to begin\n socket.accept();\n\n // subprotocol pinger because WS level ping/pongs are not be available\n let pinger, pongWait;\n function ping() {\n if (socket.readyState === socket.OPEN) {\n // send the subprotocol level ping message\n socket.send(stringifyMessage({ type: MessageType.Ping }));\n\n // wait for the pong for 6 seconds and then terminate\n pongWait = setTimeout(() => {\n clearInterval(pinger);\n socket.close();\n }, 6000);\n }\n }\n\n // ping the client on an interval every 12 seconds\n pinger = setInterval(() => ping(), 12000);\n\n // use the server\n const closed = server.opened(\n {\n protocol, // will be validated\n send: (data) => socket.send(data),\n close: (code, reason) => socket.close(code, reason),\n onMessage: (cb) =>\n socket.addEventListener('message', async (event) => {\n try {\n // wait for the the operation to complete\n // - if init message, waits for connect\n // - if query/mutation, waits for result\n // - if subscription, waits for complete\n await cb(event.data);\n } catch (err) {\n // all errors that could be thrown during the\n // execution of operations will be caught here\n socket.close(1011, err.message);\n }\n }),\n // pong received, clear termination timeout\n onPong: () => clearTimeout(pongWait),\n },\n // pass values to the `extra` field in the context\n { socket, request },\n );\n\n // notify server that the socket closed and stop the pinger\n socket.addEventListener('close', (code, reason) => {\n clearTimeout(pongWait);\n clearInterval(pinger);\n closed(code, reason);\n });\n}", "function socketConnected( socket ) {\n if( !socket ) {\n Y.log(`xterminal: no socket object passed in. Aborting....`, \"warn\", NAME);\n return socket.callback('NO_SOCKET');\n }\n if( !Y.doccirrus.ipc.isMaster() ) {\n return socket.callback( 'NOT_MASTER' );\n }\n\n\n if( !socket.handshake || !socket.handshake.query || !socket.handshake.query.terminalId ) {\n //Should never come in here\n Y.log(`xterminal: terminalId not present as query param in socket object. Cannot establish a socket connection`, \"warn\", NAME);\n socket.emit('connectionProblem', `NO_TERMINAL_ID`);\n return socket.callback('NO_TERMINAL_ID');\n }\n\n const\n term = terminals[parseInt(socket.handshake.query.terminalId, 10)],\n listenForTerminalExit = socket.handshake.query.listenForTerminalExit;\n\n if( !term ) {\n //Should never come in here\n Y.log(`xterminal: Terminal not found for terminalId: ${socket.handshake.query.terminalId}. Aborting this connection.`, \"warn\", NAME);\n socket.emit('connectionProblem', `TERMINAL_NOT_FOUND`);\n return socket.callback('TERMINAL_NOT_FOUND');\n }\n\n term.on('data', function(data) {\n try {\n socket.emit('message', data);\n } catch (ex) {\n // The WebSocket is not open, ignore\n //Should not come here\n Y.log(`xterminal: Error emitting message from socket for terminalId: ${socket.handshake.query.terminalId}. Error: ${ex}`, \"error\", NAME);\n }\n });\n\n if( listenForTerminalExit ) {\n term.on('exit', function(code, signal) {\n Y.log(`xterminal: Console tab terminal exitted with code: ${code} and signal: ${signal}`, \"info\", NAME);\n socket.emit(\"terminalExited\", \"TERMINAL_EXITED\");\n });\n }\n\n socket.on('message', function(msg) {\n term.write(msg);\n });\n\n socket.on('disconnect', function () {\n // Clean things up\n term.kill();\n delete terminals[term.pid];\n Y.log(`xterminal: Socket disconnected. Killed terminalId: ${term.pid}. ${Object.keys(terminals).length} Terminal(s) are open`, \"info\", NAME);\n });\n }", "function connect(url){\n\t\tconsole.log(\"Client socket: Connecting to server\");\n\t\t\n\t\tmWebSocket = new WebSocket(url);\n\t\tmWebSocket.onopen = onOpen;\n\t\tmWebSocket.onclose = onClose;\n\t\tmWebSocket.onmessage = onMessage;\n\t\tmWebSocket.onerror = onError;\n\t}", "Connect() {\n\t\tif (!(\"WebSocket\" in window)) {\n\t\t\talert(\"WebSockets are not supported by your browser. Please upgrade to connect to the server.\");\n\t\t\tDisplay.LogError(\"WebSockets are not supported by your browser. Please upgrade to connect to the server.\");\n\t\t\treturn;\n\t\t}\n\n\t\tDisplay.LogMessage(\"Connecting to server...\");\n\t\t// HACK(Samuel-Lewis): Hard coded address value is always local\n\t\tServer._socket = new WebSocket(\"ws://\" + Auth.ip + \"/ws\");\n\n\t\tServer._socket.onopen = function (event) {\n\t\t\tServer._OnOpen(event);\n\t\t}\n\t\tServer._socket.onclose = function (event) {\n\t\t\tServer._OnClose(event);\n\t\t}\n\t\tServer._socket.onmessage = function (event) {\n\t\t\tServer._OnMessage(event);\n\t\t}\n\t\tServer._socket.onerror = function (event) {\n\t\t\tServer._OnError(event);\n\t\t}\n\t}", "function apply(_global) {\n var WS = _global.WebSocket;\n // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener\n // On older Chrome, no need since EventTarget was already patched\n if (!_global.EventTarget) {\n patchEventTargetMethods(WS.prototype);\n }\n _global.WebSocket = function (a, b) {\n var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);\n var proxySocket;\n // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance\n var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');\n if (onmessageDesc && onmessageDesc.configurable === false) {\n proxySocket = Object.create(socket);\n ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function (propName) {\n proxySocket[propName] = function () {\n return socket[propName].apply(socket, arguments);\n };\n });\n }\n else {\n // we can patch the real socket\n proxySocket = socket;\n }\n patchOnProperties(proxySocket, ['close', 'error', 'message', 'open']);\n return proxySocket;\n };\n for (var prop in WS) {\n _global.WebSocket[prop] = WS[prop];\n }\n}", "function apply(_global) {\n var WS = _global.WebSocket;\n // On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener\n // On older Chrome, no need since EventTarget was already patched\n if (!_global.EventTarget) {\n patchEventTargetMethods(WS.prototype);\n }\n _global.WebSocket = function (a, b) {\n var socket = arguments.length > 1 ? new WS(a, b) : new WS(a);\n var proxySocket;\n // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance\n var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage');\n if (onmessageDesc && onmessageDesc.configurable === false) {\n proxySocket = Object.create(socket);\n ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function (propName) {\n proxySocket[propName] = function () {\n return socket[propName].apply(socket, arguments);\n };\n });\n }\n else {\n // we can patch the real socket\n proxySocket = socket;\n }\n patchOnProperties(proxySocket, ['close', 'error', 'message', 'open']);\n return proxySocket;\n };\n for (var prop in WS) {\n _global.WebSocket[prop] = WS[prop];\n }\n}", "function onConnection(socket){\n console.log('connected...');\n}", "registerSocketListener() {\n this.ws.onopen = () => { this.onOpen() }\n this.ws.onclose = () => { this.onClose() }\n this.ws.onerror = () => { this.onError() }\n this.ws.onmessage = (e) => { this.onMessage(e) }\n }", "function createQueueSocket(){\n hostname = window.location.hostname\n const socket = new WebSocket('wss://'+hostname+'/ws');\n return socket\n}", "function setupSocket(socket) {\n socket.setTimeout(0);\n socket.setNoDelay(true);\n socket.setKeepAlive(true, 0);\n}", "function onConnect(socket) {\n // When the client emits 'info', this listens and executes\n socket.on('info', data => {\n socket.log(JSON.stringify(data, null, 2));\n });\n\n var id=socket.decoded_token;\n\n //Join own room\n socket.join(id._id);\n\n // Insert sockets below\n require('../api/room/room.socket').register(socket,id);\n require('../api/thing/thing.socket').register(socket);\n\n}", "function connect() {\n var socket;\n var host = $(\"#alarmForm\").data(\"eventservicewebsocketurl\");\n\n try {\n var socket = new WebSocket(host);\n\n socket.onopen = function () {\n //alertify.alert('<p class=\"event\">Socket Status: ' + socket.readyState + ' (open)');\n }\n\n socket.onmessage = function (msg) {\n // alertify.alert(msg.data); \n var data = finaldata($.parseJSON(msg.data));\n window.alarmconfig.uicontext.wsAlarmDatasource(data);\n }\n\n socket.onclose = function () {\n alertify.alert(\"Alarm websocket server connectivity lost.\");\n }\n\n } catch (exception) {\n alertify.alert('<p>Error' + exception);\n }\n\n }", "function initWebSocket(webSocketPort)\r\n{\r\n\t//On recupere l'ip du serveur\r\n\tvar ip = location.host;\r\n\tip = ip.split(\":\");\r\n\tip = ip[0];\r\n\t//alert(ip);\r\n\t//Connexion a la websocket\r\n\tvar webSocketAddress = \"ws://\"+ip+\":\"+webSocketPort+\"/\"\r\n\tdoConnect(webSocketAddress);\r\n}", "function openWebSocket() {\n if (!gWebSocketOpened) {\n gWebSocket = new WebSocket('ws://localhost:12221/webrtc_write');\n }\n\n gWebSocket.onopen = function () {\n console.log('Opened WebSocket connection');\n gWebSocketOpened = true;\n };\n\n gWebSocket.onerror = function (error) {\n console.log('WebSocket Error ' + error);\n };\n\n gWebSocket.onmessage = function (e) {\n console.log('Server says: ' + e.data);\n };\n}", "function OnWebSocket(msg, s, head) {\r\n debug(1, \"Websocket connected\");\r\n s.on('data', function (msg) {\r\n if (this.parent.tunneling == false) {\r\n msg = msg.toString();\r\n if ((msg == 'c') || (msg == 'cr')) {\r\n // Pipe the connection, but don't pipe text websocket frames into the TCP socket.\r\n this.parent.tunneling = true; this.pipe(this.parent.tcp, { dataTypeSkip: 1 }); this.parent.tcp.pipe(this); debug(1, \"Tunnel active\");\r\n } else if ((msg.length > 6) && (msg.substring(0, 6) == 'error:')) {\r\n console.log(msg.substring(6));\r\n disconnectTunnel(this.tcp, this, msg.substring(6));\r\n }\r\n }\r\n });\r\n s.on('error', function () { disconnectTunnel(this.tcp, this, 'Websocket error'); });\r\n s.on('close', function () { disconnectTunnel(this.tcp, this, 'Websocket closed'); });\r\n s.parent = this;\r\n}", "function connect(event) {\n let socket = new SockJS('/gameWs');\n stompClient = Stomp.over(socket);\n stompClient.connect({}, onConnected, onError);\n\n event.preventDefault();\n}", "function initSocket() {\n\tg_socket = io.connect(g_server_address, {secure: true});\n}", "connect() {\n log.info('connection constructing.');\n const WebSocketServer = WebSocket.Server;\n const wss = new WebSocketServer({\n port: PORT\n });\n\n wss.on('connection', (ws) => {\n log.info('connection established.');\n this.ws = ws;\n ws.on('message', this.handleMessage);\n });\n\n listener.subscribe('_send', this.send.bind(this));\n }", "function connect() {\n const socket = new WebSocket('ws://localhost:8090');\n return new Promise(resolve => {\n socket.addEventListener('open', () => {\n resolve(socket);\n });\n });\n}", "function SandboxSocketOpen()\n{\n ws.onmessage = SandboxSocketMessageHandler;\n}", "function createWebSocket(opts, _host_) {\n var wsport = (opts && opts.wsport) || null;\n\n webSockOpts = opts; // preserved for future calls\n\n host = _host_ || $loc.host();\n url = ufs.wsUrl('core', wsport, _host_);\n\n $log.debug('Attempting to open websocket to: ' + url);\n ws = wsock.newWebSocket(url);\n if (ws) {\n ws.onopen = handleOpen;\n ws.onmessage = handleMessage;\n ws.onclose = handleClose;\n\n sendEvent('authentication', { token: onosAuth });\n }\n // Note: Wsock logs an error if the new WebSocket call fails\n return url;\n }", "function openSocket() {\n\tsocket.send(\"Player connecting...\");\n}", "function connectW(url, onMessage) {\n socket = new WebSocket(url)\n socket.onopen = function() {\n console.log('Соединение установлено.');\n };\n\n socket.onclose = function(event) {\n if (event.wasClean) {\n console.log('Соединение закрыто чисто');\n } else {\n console.log('Обрыв соединения'); // например, 'убит' процесс сервера\n }\n console.log('Код: ' + event.code + ' причина: ' + event.reason);\n };\n\n socket.onmessage = onMessage;\n}", "constructor() {\n // Allow only ws protocol\n this.socket = io('http://localhost:4001', {transports: ['websocket']});\n }", "constructor(socket) {\n super(socket);\n }", "function doSocket(self, args, callback)\n{\n if(!args || !args.hashname) return callback(\"no hashname\");\n if(!args.to || !args.listen) return callback(\"need to and listen\");\n self.doLine(args.hashname, function(err){\n if(err) return callback(\"line failed\");\n var server = net.createServer(function(client) {\n console.log('server connected');\n var stream = getStream(self, seen(self, args.hashname));\n var tunnel = wrapStream(self, stream);\n client.pipe(tunnel).pipe(client);\n // send sock open now\n stream.send({sock:args.to});\n });\n server.listen(args.listen, callback);\n });\n}", "function SocketConnection(onResponse) {\n\n\t\tvar socket;\n\t\tvar valid = true;\n\t\tvar closeListener = function(){};\n\t\tvar queue = [];\n\t\tvar timer;\n\n\t\t// attempt to connect using a web socket\n\t\tvar host = 'ws://' + document.location.hostname;\n\t\tif(document.location.port) {\n\t\t\thost = host + ':' + document.location.port\n\t\t}\n\n\t\ttry{\n\t\t\tsocket = new WebSocket(host, 'visaevus-client');\n\t\t\tsocket.onmessage = response;\n\t\t\tsocket.onclose = closed;\n\t\t\tsocket.onerror = logError;\n\t\t}\n\t\tcatch(ex) {\n\t\t\tvalid = false;\n\t\t}\n\n\t\tfunction logError() {\n\t\t\tif(console) {\n\t\t\t\tconsole.log(arguments);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction closed() {\n\t\t\tvalid = false;\n\t\t\tcloseListener();\n\t\t}\n\t\t\n\t\tfunction response(message) {\n\t\t\tonResponse(message.data);\n\t\t}\n\t\t\n\t\tfunction checkOpen() {\n\t\t\tif(socket.readyState === WebSocket.OPEN) {\n\t\t\t\tme.send = send;\n\t\t\t\twhile(queue.length) {\n\t\t\t\t\tsend(queue.shift());\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\ttimer = setTimeout(checkOpen, 50);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction opening(message) {\n\t\t\tqueue.push(message);\n\t\t\tcheckOpen();\n\t\t\t\n\t\t\tif(socket.readyState > WebSocket.OPEN) {\n\t\t\t\tthrow \"failed to init\";\n\t\t\t}\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = setTimeout(checkOpen, 50);\n\t\t}\n\t\t\n\t\tfunction send(message) {\n\t\t\tsocket.send(message);\n\t\t}\n\n\t\tthis.onclose = function(newListener) {\n\t\t\tclearTimeout(timer);\n\t\t\tcloseListener = newListener;\n\t\t}\n\t\t\n\t\t/**\n\t\t * Used to send a messag to the server\n\t\t */\n\t\tthis.send = opening;\n\n\t\tthis.isValid = function() {\n\t\t\treturn valid;\n\t\t}\n\t}", "function newConnection(socket) {\n\tconsole.log('New Connection: ' + socket.id);\n\tconsole.log(io.engine.clientsCount);\n\t//console.log(socket); // A lot of information written to console\n\n\t// Receives Data From Client\n\tsocket.on('ball', ballMessage); \n\t// Log and Emit data\n\tfunction ballMessage(data) {\n\t\tsocket.broadcast.emit('ball', data);\n\t\t//console.log(data);\n\t}\n\t// trigger mouseMessage function from 'mouse'\n\t//function mouseMessage() { console.log(data); }\n\t// socket.broadcast.emit('mouse', data);\n}", "set socket(socket) {\n // No data socket should be open in any case where the control socket is set or upgraded.\n this.dataSocket = undefined;\n // This being a reset, reset any other state apart from the socket.\n this.tlsOptions = {};\n this._partialResponse = \"\";\n if (this._socket) {\n const newSocketUpgradesExisting = socket.localPort === this._socket.localPort;\n if (newSocketUpgradesExisting) {\n this._removeSocketListeners(this.socket);\n }\n else {\n this._closeSocket(this.socket);\n }\n }\n if (socket) {\n // Setting a completely new control socket is in essence something like a reset. That's\n // why we also close any open data connection above. We can go one step further and reset\n // a possible closing error. That means that a closed FTPContext can be \"reopened\" by\n // setting a new control socket.\n this._closingError = undefined;\n // Don't set a timeout yet. Timeout for control sockets is only active during a task, see handle() below.\n socket.setTimeout(0);\n socket.setEncoding(this._encoding);\n socket.setKeepAlive(true);\n socket.on(\"data\", data => this._onControlSocketData(data));\n // Server sending a FIN packet is treated as an error.\n socket.on(\"end\", () => this.closeWithError(new Error(\"Server sent FIN packet unexpectedly, closing connection.\")));\n // Control being closed without error by server is treated as an error.\n socket.on(\"close\", hadError => { if (!hadError)\n this.closeWithError(new Error(\"Server closed connection unexpectedly.\")); });\n this._setupDefaultErrorHandlers(socket, \"control socket\");\n }\n this._socket = socket;\n }", "connectSocket(socket) {\n this.sockets.push(socket);\n console.log('Socket connected');\n\n this.messageHandler(socket);\n // when the new socket connect, we print them the chain\n this.sendChain(socket);\n }", "constructor() {\n // call the socket init with the url of my test environment aka local host (WS server)\n socket.init('ws://localhost:3001'); \n //sending and echoing a message\n socket.registerOpenHandler(() => {\n let message = new ChatMessage({ message: 'pow!' });\n socket.sendMessage(message.serialize());\n });\n socket.registerMessageHandler((data) => {\n console.log(data);\n });\n }", "setupSocket() {\n this.socket = io('/gameroom');\n this.socket.on('connect', () => {\n this.socket.emit('setup_client')\n });\n this.socket.on('packet', this.handleSocketMessages)\n }", "function connect(callback) {\n //TODO: Disabled for right now since we have bigger problems to worry about\n \n // var thisSocket = io('//' + location.host);\n // websocket = thisSocket;\n // thisSocket.on('connect', function(socket) {\n // if (typeof(callback) == 'function') {\n // callback(socket);\n // }\n // });\n }", "function _connect() {\n log.debug(LOG_PREFIX, `Connecting to ${_wsURL}`);\n _ws = new WebSocket(_wsURL);\n _ws.on('open', _wsOpen);\n _ws.on('close', _wsClose);\n _ws.on('message', _wsMessage);\n _ws.on('error', _wsError);\n _ws.on('ping', _wsPing);\n _ws.on('pong', _wsPong);\n }", "websocketConnect() {\n const that = this;\n // schaut ob es schon einen socket gibt\n if (!that.state.socket) {\n // Create WebSocket connection.\n console.log(\"connecting to websocket\")\n that.state.socket = io(\"http://192.168.178.52:8080\");\n\n // Connection opened\n that.state.socket.on('connect', function () {\n console.log(\"Joining Game\");\n // Dem Spiel beitreten\n that.joinGame();\n // Die Ui wird initialisiert\n that.setState({ isInitialized: true });\n // Wenn eine neue Frage geladen wird, wird sie im state gespeichert.\n that.state.socket.on(\"loadQuestion\", function (message) {\n that.setState({ currentQuestion: message, questionVisible: message.questionVisible, answers: message.answers })\n });\n\n // on tick für den Countdown\n that.state.socket.on('tick', function (message) {\n that.setState({ timer: message.tick})\n if (message.tick < 10) {\n navigator.vibrate(200);\n }\n })\n\n // resettet den Timer\n that.state.socket.on('resetTick', function () {\n that.setState({timer: 30})\n });\n\n // on Admin ui für admin stuff\n that.state.socket.on('loadAdminUI', function () {\n that.setState({ isAdmin: true })\n });\n\n that.state.socket.on('disconnect', function () {\n console.log('Disconnected')\n });\n\n that.state.socket.on('teamInUse', function (){\n that.state.socket.disconnect();\n that.setState({\n isInitialized: false,\n teamName: \"\",\n error: \"Team ist bereits ingame\",\n currentQuestion: {},\n questionVisible: false,\n isAdmin: false,\n socket: undefined,\n answers: [],\n showData: []\n });\n });\n\n that.state.socket.on('adminNewAnswer',function (message) {\n that.setState({answers: message.answers})\n console.log('setting Answers' + message.answers)\n });\n\n that.state.socket.on('showAuswertung', function (message) {\n that.setState({\n showData: message.auswertung\n })\n });\n\n });\n // wenn schon eine Connection besteht\n }else if (that.state.socket.connected) {\n that.state.socket.emit('joinGame', { name: that.state.teamName });\n that.setState({ isInitialized: true });\n }\n }", "function Connect() {\n SetState('?', 'Connecting');\n Socket = new WebSocket(`ws://${window.location.host}/socket`);\n Socket.addEventListener('error', HandleError);\n Socket.addEventListener('open', HandleOpen);\n Socket.addEventListener('close', HandleClose);\n Socket.addEventListener(\n 'message',\n /** @type EventListener */ (HandleMessage),\n );\n}", "setSocket (socket) {\n this.socket = socket\n this.lastSeen = new Date()\n }", "constructor(serverClass) {\n\t\tthis.ws = new WebSocket(\"ws://{{host}}/mySocket\")\n\t\tthis.ws.socket = this\n\t\tthis.serverClass = serverClass\n\t\tthis.ws.onmessage = function(event) {\n\t\t\tlet inData = JSON.parse(event.data)\n\t\t\tthis.socket.serverClass.receiveData(inData)\n\t\t}\n\t\t// Once the socket is successfully open, try to login\n\t\tthis.ws.onopen = function(event) {\n\t\t\tthis.socket.serverClass.onopen(this.socket)\n\t\t}\n\t}", "function Socket(url) {\n var _this = this;\n this.ask = function(question) {\n return Socket.prototype.ask.apply(_this, arguments);\n };\n this.send = function(obj) {\n return Socket.prototype.send.apply(_this, arguments);\n };\n this.getVideoChannel = function(name, room) {\n return Socket.prototype.getVideoChannel.apply(_this, arguments);\n };\n this.getSpecialChannel = function(name, factory) {\n return Socket.prototype.getSpecialChannel.apply(_this, arguments);\n };\n this.getChannel = function(name) {\n return Socket.prototype.getChannel.apply(_this, arguments);\n };\n this.withUrl = function(url) {\n return Socket.prototype.withUrl.apply(_this, arguments);\n };\n this.getWebSocket = function(url) {\n return Socket.prototype.getWebSocket.apply(_this, arguments);\n };\n this.setWebsocket = function(websocket) {\n return Socket.prototype.setWebsocket.apply(_this, arguments);\n };\n this.createWebSocket = function(url) {\n return Socket.prototype.createWebSocket.apply(_this, arguments);\n };\n this.isMock = function() {\n return Socket.prototype.isMock.apply(_this, arguments);\n };\n /*\n creates a socket object\n */\n\n this.router = new Batman.SimpleRouter();\n this.websocket = this.getWebSocket(url);\n Batman.Socket.instance = this;\n }", "connect(url) {\n if ( ! url ) {\n url = window.location.href; // http://localhost:8080/console.html\n this.log(\"This href \"+url);\n let start = url.indexOf('/');\n let protocol = url.substring(0,start);\n let webSocketProtocol = 'ws';\n if ( protocol == 'https:' ) {\n webSocketProtocol = 'wss';\n }\n let end = url.indexOf('/', start+2);\n url = webSocketProtocol+':'+url.substring(start,end)+'/vrspace/client'; // ws://localhost:8080/vrspace\n }\n this.log(\"Connecting to \"+url);\n this.ws = new WebSocket(url);\n this.ws.onopen = () => {\n this.connectionListeners.forEach((listener)=>listener(true));\n /*\n this.pingTimerId = setInterval(() => {\n this.sendCommand(\"Ping\");\n }, 20000);\n */\n }\n this.ws.onclose = () => {\n this.connectionListeners.forEach((listener)=>listener(false));\n //clearInterval(this.pingTimerId);\n }\n this.ws.onmessage = (data) => {\n this.receive(data.data);\n this.dataListeners.forEach((listener)=>listener(data.data)); \n }\n this.log(\"Connected!\")\n }", "function newConnection(socket){\n\tconsole.log('New connection: ' + socket.id);\n\t//socket.on('clickEvent', mouseMsg);\n\t//function mouseMsg(data){\n\t\t//socket.broadcast.emit('clickEvent', data);\n\t\t//following line refers to sending data to all\n\t\tio.sockets.emit('buttonEvent', buttonPress);\n\t//\tconsole.log(data);\n\t//}\n}", "function makeConnection(socket: any, port: ?number, host: string) {\n socket.connect(port || DEFAULT_PORT, host)\n}", "function openRefreshSocket() {\n refreshNotesSocket = new WebSocket( 'ws://' + window.location.host + '/ws/refresh/notes/');\n console.log(\"Opening socket!!\");\n refreshNotesSocket.onmessage = function (e) {\n refresh_notes()\n };\n\n refreshNotesSocket.onclose = function (e) {\n console.log(e);\n };\n}", "function init(gameId) {\n var loc = window.location, new_uri;\n if (loc.protocol === \"https:\") {\n new_uri = \"wss:\";\n } else {\n new_uri = \"ws:\";\n }\n new_uri += \"//\" + loc.host;\n new_uri += loc.pathname + gameId;\n ws = new WebSocket(new_uri);\n //ws = new WebSocket(\"ws://echo.websocket.org\");\n ws.addEventListener(\"open\", function () {\n console.log(\"socket opended\");\n pingId = setInterval(ping, pingInterval);\n });\n\n ws.addEventListener(\"message\", handleMessage);\n\n ws.addEventListener(\"close\", function () {\n console.log(\"socket closed\");\n clearInterval(pingId);\n view.init();\n });\n\n ws.addEventListener(\"error\", function () {\n console.err(\"socket error\")\n });\n\n\n }", "function WSLobbyConnect(){\n\tconnection = new WebSocket('ws://192.168.10.105:8888','echo');\n\tconnection.onopen = myWSOnOpen;\n\tconnection.onmessage = myWSOnMessage;\n\tconnection.onerror = myWSOnError;\n\n\t//window.setInterval(updateNameListWidget,2000);\n\tdocument.onmousemove=updateMouseEvent;\n}", "function wsConnect(url) {\n \n \n websocket = new WebSocket(url); // Connect to WebSocket server\n \n // Assign callbacks\n websocket.onopen = function(evt) { onOpen(evt) };\n websocket.onclose = function(evt) { onClose(evt) };\n websocket.onmessage = function(evt) { onMessage(evt) };\n websocket.onerror = function(evt) { onError(evt) };\n}" ]
[ "0.7205808", "0.71387035", "0.6904389", "0.6766441", "0.67275095", "0.66992855", "0.66890585", "0.6675163", "0.66636205", "0.66358757", "0.6586775", "0.65610963", "0.65578604", "0.65536785", "0.6551787", "0.65481424", "0.6541749", "0.6508997", "0.64851314", "0.64622676", "0.6455205", "0.64519715", "0.6434557", "0.6433245", "0.64269644", "0.64269644", "0.6424789", "0.64244825", "0.6422224", "0.6373438", "0.6373278", "0.6353132", "0.6349278", "0.6342796", "0.63419247", "0.63415295", "0.63408834", "0.63349545", "0.633175", "0.63066715", "0.6288566", "0.6284361", "0.627823", "0.62734985", "0.6269823", "0.62620324", "0.62608474", "0.6256388", "0.62491244", "0.622508", "0.6219858", "0.621937", "0.62188673", "0.62012243", "0.61923593", "0.618833", "0.6180555", "0.6179587", "0.6177788", "0.6177788", "0.6170285", "0.616963", "0.61694634", "0.61606246", "0.6156895", "0.61523145", "0.6141685", "0.6136492", "0.6132478", "0.61301756", "0.6108675", "0.6106215", "0.6105517", "0.60884446", "0.6084848", "0.6080974", "0.60708", "0.60671884", "0.6066593", "0.6059515", "0.6055751", "0.6054713", "0.60511875", "0.6049726", "0.6045477", "0.60413694", "0.6036627", "0.60287094", "0.6023443", "0.6020959", "0.60129505", "0.6008892", "0.6005267", "0.60039616", "0.6001142", "0.5998934", "0.59869707", "0.5986716", "0.5977334", "0.5974892" ]
0.83537537
0
Checks if the websocket is usable.
function isSocketOpen() { var socket = gSocket; return socket !== null && socket.readyState === WebSocket.OPEN; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function websocket_check() {\n return window.WebSocket;\n}", "function isWebSocketSupported() {\n if(typeof isWebSocketSupported.value === 'undefined' || isWebSocketSupported.value === null) {\n isWebSocketSupported.value = ('WebSocket' in window || 'MozWebSocket' in window);\n }\n return isWebSocketSupported.value;\n}", "isAvailable () {\n const lessThanOneHourAgo = (date) => {\n const HOUR = 1000 * 60 * 60;\n const anHourAgo = Date.now() - HOUR;\n\n return date > anHourAgo;\n }\n\n return this.socket !== null || (this.lastSeen !== null && lessThanOneHourAgo(this.lastSeen))\n }", "function doesSupportWebsockets() {\n return !((bowser.msie && bowser.version < 10) ||\n (bowser.firefox && bowser.version < 11) ||\n (bowser.chrome && bowser.version < 16) ||\n (bowser.safari && bowser.version < 7) ||\n (bowser.opera && bowser.version < 12.1));\n}", "function isConnectionAvailable() {\n // Here we return true to make it convient for testing using web, and\n // also it will not impcat the function.\n var connection = navigator.connection;\n return !(connection && connection.type === Connection.NONE);\n }", "socketsEmpty() {\n return this.playerMap.getActivePlayerCount() < 1;\n }", "function hasWebSocket() {\n var m = /Android ([0-9]+)\\.([0-9]+)/i.exec(navigator.userAgent);\n var hasConstructor = typeof WebSocket === \"function\";\n\n if (!m) { return hasConstructor; }\n\n var x = parseInt(m[1], 10);\n var y = parseInt(m[2], 10);\n\n return hasConstructor && (x > 4 || (x === 4 && y >= 4));\n}", "function checkConnectionStatus() {\n if (!client.isConnected()) {\n connect();\n }\n}", "function tryOpeningWebSocket() {\n if (!gWebSocketOpened) {\n console.log('Once again trying to open web socket');\n openWebSocket();\n setTimeout(function() { tryOpeningWebSocket(); }, 1000);\n }\n}", "function checkstatus()\n\t{\n\t\tif(disconnectwarned || !AjaxLife.Network.Connected) return;\n\t\tvar now = new Date();\n\t\tif(!now.getTime() - lastmessage.getTime() > 60000)\n\t\t{\n\t\t\tdisconnectwarned = true;\n\t\t\talert(\"No data has been received for over a minute. You may have been disconnected.\");\n\t\t}\n\t}", "function checkIsConnected() {\r\n if (_connectionState != Labs.ConnectionState.Connected) {\r\n throw \"API not initialized\";\r\n }\r\n }", "function hasConnectionError() {\n\t\t\treturn settings.connectionError;\n\t\t}", "function check () {\n if (ws.open() && !(read || meta)) {\n if (queue.length > 0) {\n file = queue[0].file\n meta = JSON.stringify({\n name: file.name,\n size: file.size,\n type: file.type\n })\n ws.send(meta)\n } else {\n ws.close()\n }\n }\n }", "function MonitorWebSocket()\n{\n if (ws.readyState != 1)\n {\n document.getElementById(\"WebSocketData\").style.display=\"none\";\n document.getElementById(\"AltWebSocketData\").style.display=\"block\";\n }\n else\n {\n document.getElementById(\"WebSocketData\").style.display=\"block\";\n document.getElementById(\"AltWebSocketData\").style.display=\"none\";\n }\n}", "function checkAdminConnection(){\n\n\tvar isAdminConnected = new WebSocket('ws://127.0.0.1:1337?check_admin_conn='+location.origin);\n\n\tisAdminConnected.onmessage = function(msg){\n\n\t\t\tvar theMessage = JSON.parse(msg.data);\n\t\t\t\n\t\t\tif(theMessage.adminConnection){\n\t\t\t\tconsole.log(\"admin connected\");\n\t\t\t\tinitAdminConnectedChat();\n\t\t\t}\n\n\t\t\tif(theMessage.otherChatUsers){\n\t\t\t\tconsole.log(theMessage.otherChatUsers);\n\t\t\t\tinitAdminNotConnectedChat();\n\t\t\t}\n\t}\n}", "function hasGoodConnection() {\n\n var is_good = true;\n\n switch (navigator.connection.type) {\n\n case Connection.NONE:\n console.log('no internet connection');\n is_good = false;\n break;\n\n case Connection.UNKNOWN:\n console.log('unknown internet connection');\n is_good = false;\n break;\n\n //this would be great but Cell network info are not available on iOS\n //case Connection.CELL_2G:\n // console.log('2G connection too weak');\n // is_good = false;\n // break;\n //\n //case Connection.CELL:\n // console.log('Connection too weak');\n // is_good = false;\n // break;\n }\n //I assume the connection is good enough to load the map tiles\n return is_good;\n }", "checkConnectionStatus() {\n const connected = Meteor.status().connected;\n if (!connected) sAlert.error('Ingen tilkobling til server. Er du koblet til internett?');\n return connected;\n }", "function check_conn_timeout() {\n if (fatal_error || last_msg_recv_ts === null) {\n return;\n }\n\n if (Date.now() - last_msg_recv_ts > CONN_TIMEOUT) {\n set_fatal_error('Your connection has been closed after a timeout. ' +\n 'Please reload the page.');\n report_error(init_id, 'connection timed out');\n ws.close();\n }\n }", "function isConnect() {\n return !needWait;\n }", "function checkIfLive() {\n var wasLive = false;\n var chat = document.querySelector(\"ytd-live-chat-frame\");\n if (chat) {\n wasLive = true;\n }\n return wasLive;\n}", "arePeersReady() {\n return this._readyState === true && this._remoteIsReady === true;\n }", "function pnAvailable() {\r\n var bAvailable = false;\r\n if (window.isSecureContext) {\r\n\t\t// running in secure context - check for available Push-API\r\n bAvailable = (('serviceWorker' in navigator) && \r\n\t\t ('PushManager' in window) && \r\n\t\t\t\t\t ('Notification' in window)); \r\n } else {\r\n console.log('site have to run in secure context!');\r\n }\r\n return bAvailable;\r\n}", "function hasInternetConnection () {\n try {\n var connectionProfile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();\n if (connectionProfile) {\n if (connectionProfile.getNetworkConnectivityLevel() === 3)\n return true;\n }\n }\n catch (e) {}\n\n return false;\n }", "function checkConnection() {\n\t if (!window.tronWeb) {\n\t $('#connection-status').html('Not Connected to Tron');\n\t return false;\n\t }\n\t if (!window.tronWeb.defaultAddress.base58) {\n\t $('#connection-status').html('Not Connected to Tron');\n\t return false;\n\t }\n\t $('#connection-status').html('Connected to Tron');\n\t return true;\n\t}", "function checkIfReady (peer) {\n if (peer && peer.isWritable) {\n peer.sendUnsubscriptions(topics)\n } else {\n setImmediate(checkIfReady.bind(peer))\n }\n }", "function checkIfReady (peer) {\n if (peer && peer.isWritable) {\n peer.sendUnsubscriptions(topics)\n } else {\n setImmediate(checkIfReady.bind(peer))\n }\n }", "function checkConnection(){\n viewModel.notOnline(!navigator.onLine);\n // requests next check in 500 ms\n setTimeout(checkConnection, 500);\n}", "function isNetworkAvailable(){\n var networkState = navigator.connection.type;\n alert(networkState);\n if(networkState == Connection.NONE){\n return false;\n }\n return true;\n}", "function isConnected() {\n if (client === undefined) {\n return false;\n }\n return client.isConnected();\n }", "async function isConnected() {\n return web3utils.isConnected();\n}", "async function CheckInternetConnection() {\n result = await getRequest(\"http://pegelonline.wsv.de\");\n if (result == false) {\n drawError(translation.noInternetConnection);\n return false;\n }\n return true;\n}", "function handleOpen() {\n $log.info('Web socket open - ', url);\n vs && vs.hide();\n\n if (fs.debugOn('txrx')) {\n $log.debug('Sending ' + pendingEvents.length + ' pending event(s)...');\n }\n pendingEvents.forEach(function (ev) {\n _send(ev);\n });\n pendingEvents = [];\n\n connectRetries = 0;\n wsUp = true;\n informListeners(host, url);\n }", "function checkReadyState() {\n\n if ( data.sync !== JSON.stringify(SYNC) || checkCaches() || !ROOM._start ) {\n\n return setTimeout( checkReadyState, DELAY );\n }\n\n // invoke loop\n if ( data.loop ) return startLoop();\n\n // initialize game\n ROOM._start();\n }", "function thereAreConnections() {\n if (Object.keys(connections).length === 0) return false;\n return true;\n}", "function thereAreConnections() {\n if (Object.keys(connections).length === 0) return false;\n return true;\n}", "function isConnected() {\n return user != null;\n }", "function connected() {\n\t// return true;\n return navigator.connection.type != Connection.NONE;\n}", "function reconnectTimer () {\n if (!ws || ws.readyState == WebSocket.CLOSED) {\n reallyConnect();\n }\n }", "function isBusy() {\n return audioElementsToPlay.length > 0;\n }", "function isStreamUsable(stream) {\n return stream && stream.isAvailable && stream.inRange && !stream.hasFailed;\n}", "function checkReady() {\n if (document.getElementsByTagName('body')[0] !== undefined) {\n window.clearInterval(intervalID);\n callback.call(this);\n }\n }", "function checkStatus() {\n flushMonitoringOperations(self.queue);\n\n if (self.queue.length === 0) {\n // Get all the known connections\n var connections = self.availableConnections\n .concat(self.inUseConnections)\n .concat(self.nonAuthenticatedConnections)\n .concat(self.connectingConnections);\n\n // Check if we have any in flight operations\n for (var i = 0; i < connections.length; i++) {\n // There is an operation still in flight, reschedule a\n // check waiting for it to drain\n if (connections[i].workItems.length > 0) {\n return setTimeout(checkStatus, 1);\n }\n }\n\n destroy(self, connections);\n // } else if (self.queue.length > 0 && !this.reconnectId) {\n } else {\n // Ensure we empty the queue\n _execute(self)();\n // Set timeout\n setTimeout(checkStatus, 1);\n }\n }", "function checkStatus() {\n flushMonitoringOperations(self.queue);\n\n if(self.queue.length == 0) {\n // Get all the known connections\n var connections = self.availableConnections\n .concat(self.inUseConnections)\n .concat(self.nonAuthenticatedConnections)\n .concat(self.connectingConnections);\n\n // Check if we have any in flight operations\n for(var i = 0; i < connections.length; i++) {\n // There is an operation still in flight, reschedule a\n // check waiting for it to drain\n if(connections[i].workItems.length > 0) {\n return setTimeout(checkStatus, 1);\n }\n }\n\n destroy(self, connections);\n // } else if (self.queue.length > 0 && !this.reconnectId) {\n\n } else {\n // Ensure we empty the queue\n _execute(self)();\n // Set timeout\n setTimeout(checkStatus, 1);\n }\n }", "_isReady() {\n for (const role of this._roles.values()) {\n if (!role.isConnected()) {\n return false;\n }\n }\n return true;\n }", "checkConnection() {\n var client = navigator;\n var container = this.component;\n\n if (!client.online) {\n\n container.show();\n\n container.html('<p>You are currently on any internet connection find a connection and try again</p>');\n\n } else{\n container.hide();\n }\n }", "function checkStatus() {\n checkWin();\n checkLose();\n }", "function checkNetConnection() {\n\tvar status = window.navigator.onLine;\n\tif (status) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "isConnected () {\n // TODO(ikajaste): It's possible this acutally returns true, make sure later\n return this.connection && this.connection.connected;\n }", "function isOnline() {\n var xhr = new ( window.ActiveXObject || XMLHttpRequest )( \"Microsoft.XMLHTTP\" );\n var status;\n xhr.open( \"GET\", window.location.origin + window.location.pathname + \"/ping\",false);\n try {\n xhr.send();\n return ( xhr.status >= 200 && (xhr.status < 300 || xhr.status === 304) );\n } catch (error) {\n return false;\n }\n }", "function checkConnection(quiet) {\r\n\tif (!quiet) {\r\n\t\tquiet = false;\r\n\t}\r\n\r\n\tif (!isConnectionAvailable()) {\r\n\t\tif (quiet == false) {\r\n\t\t\twarn(\"Vous n'êtes pas connecté à Internet.\\nConnectez-vous et Essayez à nouveau.\");\r\n\t\t\tnavigator.notification.vibrate(1000);\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized')\n setTimeout(checkState,50);\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle)\n clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function opToggleConn()\n{\n if(websocket != undefined && websocket.readyState == websocket.OPEN){\n disconnect();\n } else {\n connect();\n };\n}", "function canUse() {\n return fsevents && Object.keys(FSEventsWatchers).length < 128;\n}", "refresh() {\n if (this.ws) {\n this.ws.close();\n return true;\n }\n return false;\n }", "function openWebSocket() {\n websocket = new WebSocket(host);\n\n websocket.onopen = function(evt) {\n //writeToScreen(\"Websocket Connected\");\n websocket.send(\"cam-start\");\n //refreshStream();\n\n };\n\n websocket.onmessage = function(evt) {\n\n\n\n\n var message = JSON.parse(evt.data);\n var data = ab2str(message.data);\n\n console.log(data);\n if (data === \"255\") {\n writeToScreen('<span style = \"color: red;\">Error Incoming Collision Detected!</span>', true);\n } else {\n //writeToScreen('<span style = \"color: blue;\">RECEIVE: ' + data + '</span>');\n }\n\n };\n\n websocket.onerror = function(evt) {\n writeToScreen('<span style=\"color: red;\">ERROR:</span> ' + evt.data);\n };\n\n websocket.onclose = function (p1) {\n websocket.send('cam-stop');\n }\n}", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState,50);\n }\n }\n catch(e) {\n log('Server abort: ' , e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function isConnected() {\n var networkState = navigator.network.connection.type;\n\n //console.log(\"isConnected network state: \" + networkState);\n return (networkState !== Connection.NONE) && (networkState !== Connection.UNKNOWN);\n}", "function webSocket_onopen()\n\t{\n\t\tstatusChange();\n\t\tconsole.log(\"[ASNeG_Client] WebSocket Verbindung geoeffnet\");\n\t\treadValueList();\n\t}", "function webSocket_onopen()\n\t{\n\t\tlogger_.log(\"webSocket_onopen\", \"WebSocket Verbindung geoeffnet\");\n\t\treadValueList();\n\t\tstatusChange();\n\t}", "function initWebSock() {\n\n\n\t// create websocket connection with specified remote IP address\n\t//console.log(\"PilotHostName:\"+PilotHostName);\n\tconsole.log(\"WsUrl = \"+wsurl);\n\twebsocketMain = new WebSocket(wsurl);\n\n\t// for now, does nothing with version, gets CUID and triggers event notifications; available space, partition list\n\twebsocketMain.onopen = function(evt) {\n\t\tdocument.getElementById(\"WebStatus\").innerHTML = \"&nbsp;Connection succeeds.\";\n\t\t$(\"#WebStatus\").effect(\"pulsate\",{times:3},3000);\n\t\tsendVersionNeg(evt);\n\t};\n\n\t// determine what the websocket server has sent us\n\twebsocketMain.onmessage = function(evt) { parseIncomingMessage(evt); };\n\n\t// determine error code sent by websocket server\n\twebsocketMain.onerror = function(evt) { parseError(evt); };\n\n\t// perform any cleanup on socket close\n\twebsocketMain.onclose = function(evt) { sendClientShutdown(evt); };\n\n}", "function checkState() {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tvar state = getDoc(io).readyState;\r\n\r\n\t\t\t\t\t\tlog('state = ' + state);\r\n\t\t\t\t\t\tif (state && state.toLowerCase() === 'uninitialized') {\r\n\t\t\t\t\t\t\tsetTimeout(checkState, 50);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\tlog('Server abort: ', e, ' (', e.name, ')');\r\n\t\t\t\t\t\tcb(SERVER_ABORT);\t\t\t\t// eslint-disable-line callback-return\r\n\t\t\t\t\t\tif (timeoutHandle) {\r\n\t\t\t\t\t\t\tclearTimeout(timeoutHandle);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttimeoutHandle = undefined;\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "function onErrorHandler() {\n if (!socket_ok) {\n $(\".ws_status\").children().empty();\n $(\".ws_status\").find(\"span\").attr(\"id\", \"ws_offline\");\n $(\".ws_status\").children().append(\"OFFLINE\");\n } else {\n socket_ok = false;\n /* Disable the update timer */\n if (update_timer != null)\n clearTimeout(update_timer);\n /* If the user is visiting a page which depends on the WebSocket,\n * bring it back to the index page. */\n createIndexPage();\n }\n}", "validateConnection () {\n return !getReadOnly()\n }", "function check() {\n return supportPushState() ;\n } // function: check", "function checkWeb3(){\n // Set the connect status on the app\n if (web3 && web3.isConnected()) {\n console.info('Connected');\n $('#no_status').text(\"Conectado\");\n // Set version\n setWeb3Version();\n checkNodeStatus();\n } else {\n console.info('Not Connected');\n $('#no_status').text(\"Desconectado\");\n }\n}", "isConnected() {\n return !this._connection._closed;\n }", "isConnected() {\n return !this._connection._closed;\n }", "isConnected() {\n return !this._connection._closed;\n }", "function checkState() {\n\t\t\t\ttry {\n\t\t\t\t\tvar state = getDoc(io).readyState;\n\t\t\t\t\tlog('state = ' + state);\n\t\t\t\t\tif (state.toLowerCase() == 'uninitialized')\n\t\t\t\t\t\tsetTimeout(checkState,50);\n\t\t\t\t}\n\t\t\t\tcatch(e) {\n\t\t\t\t\tlog('Server abort: ' , e, ' (', e.name, ')');\n\t\t\t\t\tcb(SERVER_ABORT);\n\t\t\t\t\ttimeoutHandle && clearTimeout(timeoutHandle);\n\t\t\t\t\ttimeoutHandle = undefined;\n\t\t\t\t}\n\t\t\t}", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state && state.toLowerCase() == 'uninitialized') {\n setTimeout(checkState, 50);\n }\n } catch (e) {\n log('Server abort: ', e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle);\n }\n timeoutHandle = undefined;\n }\n }", "function checkConnection() {\n return __awaiter(this, void 0, void 0, function () {\n var e_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n // audio/volume has only a little data,\n // so we use that path to check the connection\n return [4 /*yield*/, GET(\"audio/volume\")];\n case 1:\n // audio/volume has only a little data,\n // so we use that path to check the connection\n _a.sent();\n return [2 /*return*/, true];\n case 2:\n e_2 = _a.sent();\n return [2 /*return*/, false];\n case 3: return [2 /*return*/];\n }\n });\n });\n}", "function initWebsockets() {\n device.classList.add('hasInited');\n window.addEventListener(\"deviceorientation\", debounceDeviceOrientationEvent);\n }", "function checkState() {\n try {\n var state = getDoc(io).readyState;\n log('state = ' + state);\n if (state.toLowerCase() == 'uninitialized')\n setTimeout(checkState, 50);\n }\n catch (e) {\n log('Server abort: ', e, ' (', e.name, ')');\n cb(SERVER_ABORT);\n timeoutHandle && clearTimeout(timeoutHandle);\n timeoutHandle = undefined;\n }\n }", "function tellReady() {\n if (!isLocalStreamStarted()) {\n alert(\n \"Local stream not running yet. Please [Start Video] or [Start Screen].\"\n );\n return;\n }\n if (!socketReady) {\n alert(\"Socket is not connected to server. Please reload and try again.\");\n return;\n }\n\n // call others, in same room\n console.log(\"tell ready to others in same room, before offer\");\n socket.emit(\"message\", { type: \"talk_ready\" });\n}", "function on_close() {\n add_to_output(\"### Closed WebSocket\");\n const socket_connected_log = document.getElementById(\"socketConnect\");\n socket_connected_log.innerHTML = \"No\";\n socket_connected = false;\n}", "isConnected() {\n return this.connection && this.connection.isConnected;\n }", "function isConnected() {\n\treturn serialPort && serialPort.isOpen();\n}", "function socketAlive() {\n setTimeout(function() {\n socket.emit('socket_alive');\n socketAlive();\n }, 3200);\n }", "checkReady() {\n if (!this.ready) {\n throw new Error('Database is not ready yet. Please connect and wait.');\n }\n }", "function check() {\n const url = \"ws://\"+broker.value\n // test connection\n var client = mqtt.connect(url, {keepalive:0, reconnectPeriod:0 });\n\n client.on('connect', function () {\n connectstatus.className=\"connected\";\n connectstatus.textContent=\"connected\";\n })\n \n client.on('error', function () {\n connectstatus.className=\"notconnected\";\n connectstatus.textContent=\"not connected\";\n })\n}", "function wsConnect() {\n //console.log(\"connect\",wsUri);\n ws = new WebSocket(wsUri);\n //var line = \"\"; // either uncomment this for a building list of messages\n ws.onmessage = function(msg) {\n //console.log(msg);\n let json;\n try {\n json = JSON.parse(msg.data);\n console.log(json);\n if (jQuery.isEmptyObject(json)){\n json = false;\n $('#message-alert').html(\"Tarjeta no válida\");\n\n timer = new Timer(function() { // init timer with 5 seconds\n $.when($('#message-alert').fadeOut(500)).done(function() {\n resetMsgCard();\n $('#message-alert').fadeIn(500);\n });\n }, 3000);\n }\n } catch (error) {\n switch (msg.data) {\n case \"wait\":\n $('#message-alert').html(\"por favor espere...\");\n break;\n case \"ok\":\n document.getElementById('status').innerHTML = '<span class=\"badge badge-success\"><h6>Conectado</h6></span>';\n break;\n case \"disconnected\":\n document.getElementById('status').innerHTML = '<span class=\"badge badge-danger\"><h3>Fallo en la red. Sin conexión con base de datos</h3></span>';\n break;\n }\n }\n if (json){\n addClient(json);\n addHistory(json);\n }\n }\n ws.onopen = function() {\n // update the status div with the connection status\n //document.getElementById('status').innerHTML = '<span class=\"badge badge-success\"><h6>Conectado</h6></span>';\n //ws.send(\"Open for data\");\n //console.log(\"connected\");\n }\n ws.onclose = function() {\n // update the status div with the connection status\n \n // in case of lost connection tries to reconnect every 3 secs\n setTimeout(wsConnect,3000);\n }\n ws.onerror = function(error) {\n console.log(error);\n // if isn't production, try to connect to development\n wsUri = \"ws://192.168.1.169:1880/ws/simple\";\n }\n}", "async function existsRooms(){\n\tvar exists = false;\n\tawait Promise.resolve(axios.get(host)\n\t.then(async function(response){\n\t\tif(response.data>0){\n\t\t\texists = true;\n\t\t}\n\t}));\n\treturn exists;\n}", "async sendPresenceAvailable() {\n return await this.pupPage.evaluate(() => {\n return window.Store.PresenceUtils.sendPresenceAvailable();\n });\n }" ]
[ "0.6906933", "0.66632", "0.6447671", "0.64471036", "0.6361029", "0.62265", "0.61406237", "0.61277264", "0.6111207", "0.60787797", "0.602117", "0.6011114", "0.59578496", "0.59545577", "0.5885194", "0.58571494", "0.58475554", "0.5830798", "0.5813095", "0.57853484", "0.5770008", "0.5746392", "0.57186747", "0.57184523", "0.56972384", "0.56972384", "0.56705165", "0.5655837", "0.5653764", "0.56184024", "0.5585071", "0.5560704", "0.5551953", "0.55497414", "0.55497414", "0.55389535", "0.55363387", "0.55106056", "0.54994184", "0.5499293", "0.5466591", "0.54572886", "0.54469866", "0.5442105", "0.5424873", "0.5419291", "0.5417703", "0.54148185", "0.54121757", "0.5403688", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.54020286", "0.5400934", "0.54002494", "0.53909355", "0.5385637", "0.5383078", "0.5383078", "0.5383078", "0.5383078", "0.5383078", "0.5383078", "0.5383078", "0.5383078", "0.5383078", "0.537957", "0.5376648", "0.53688407", "0.53682375", "0.5354433", "0.535003", "0.5338176", "0.5334045", "0.53339714", "0.53318524", "0.53318524", "0.53318524", "0.53282815", "0.5328244", "0.5326872", "0.532597", "0.53164583", "0.53156716", "0.53134483", "0.5312975", "0.52823687", "0.52797794", "0.527605", "0.5269623", "0.5267567", "0.5265797", "0.52651775" ]
0.6845541
1
let classes = useStyles();
render() { return ( <Card className="w-50 p-3" > <CardActionArea> <CardMedia className="h-50" image="./images/pelusa.jpg" title="Contemplative Reptile" /> <CardContent> <Typography gutterBottom variant="h5" component="h2"> Lizard </Typography> <Typography variant="body2" color="textSecondary" component="p"> Lizards are a widespread group of squamate reptiles, with over 6,000 species, ranging across all continents except Antarctica </Typography> </CardContent> </CardActionArea> <CardActions> <Button size="small" color="primary"> Share </Button> <Button size="small" color="primary"> Learn More </Button> </CardActions> </Card> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getClasses() {\n return {\n ...(makeStyles(theme => ({\n sliderContainer: {\n position: \"relative\",\n width: \"100%\",\n height: 12,\n //borderWidth: 1,\n borderWidth: 0,\n borderRadius: 5,\n borderStyle: \"solid\",\n borderColor: \"#c5cae9\", //indigo[100]\n backgroundColor: \"transparent\" //indigo[50]\n //backgroundColor: \"#e8eaf6\" //indigo[50]\n },\n slider: {\n position: \"relative\",\n width: 0,\n height: 10,\n borderRadius: 5,\n backgroundColor: \"#7986cb\" //indigo[300]\n }\n })))()\n }\n}", "function getClasses() {\n return {\n ...commonListStyles(),\n ...commonViewStyles(),\n ...(makeStyles(theme => ({\n readMoreLink: {\n textAlign: \"right\"\n },\n readMoreContainer: {\n textAlign: \"left\",\n display: \"flex\",\n paddingRight: theme.spacing(3),\n [theme.breakpoints.down(\"xs\")]: {\n marginBottom: theme.spacing(2),\n paddingLeft: theme.spacing(3),\n display: \"block\",\n \"&:first-child\": {\n marginTop: theme.spacing(0)\n },\n \"&:last-child\": {\n marginBottom: theme.spacing(0)\n }\n },\n \"&:last-child\": {\n marginBottom: theme.spacing(2),\n marginBottom: 0,\n }\n },\n gutter: {\n width: 80,\n textAlign: \"center\",\n [theme.breakpoints.down(\"xs\")]: {\n width: \"100%\",\n position: \"relative\",\n height: \"auto\",\n display: \"block\"\n },\n flexShrink: 0,\n },\n gutterIcon: {\n marginTop: 3,\n fontSize: \"42px!important\",\n color: theme.palette.primary.light,\n },\n content: {\n flexGrow: 1\n },\n endOfPublicResume: {\n ...theme.typography.subtitle1,\n color: theme.palette.primary.light,\n margin: theme.spacing(0, 0, 3),\n },\n privateProfile: {\n \"& i\": {\n color: theme.palette.primary.light,\n verticalAlign: \"middle\"\n },\n \"& span\": {\n ...theme.typography.subtitle1,\n color: theme.palette.primary.light,\n verticalAlign: \"middle\"\n },\n margin: theme.spacing(0, 0, 6),\n },\n subheading: {\n ...theme.typography.body1,\n ...{\n color: theme.palette.primary.light,\n marginTop: 0,\n marginBottom: 0,\n fontWeight: 500\n },\n },\n subheading2: {\n ...theme.typography.body1,\n ...{\n color: theme.palette.secondary.light,\n marginTop: 0,\n marginBottom: 0,\n fontWeight: 500\n },\n },\n })))()\n }\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n}", "function ɵɵclassMap(classes) {\n checkStylingMap(keyValueArraySet, classStringParser, classes, true);\n }", "get mainClasses() {\n return classNames(\n 'carbon-tab',\n this.props.className\n );\n }", "getStyles() {\n return ['font-awesome.css', 'page-indicators.css'];\n }", "makeStyles(requireFunc, components) {\n var styles = {};\n styles.__requireFunc = requireFunc;\n\n components.forEach(key => {\n styles[key] = true;\n });\n\n return styles;\n }", "function AppLoading() {\n\n const classes = useStyles();\n\n return <>\n <Container maxWidth=\"xs\">\n <div className={classes.loadingBox}>\n <Typography\n variant=\"h6\"\n component=\"h2\"\n className={classes.title}\n >\n Aplikasi Penjualan\n </Typography>\n <LinearProgress/>\n </div>\n </Container>\n </>\n}", "function PageContainer() {\n return <StyledPageContainer />;\n}", "useCurrentStyle() {\n return me.currentStyle;\n }", "function useCompatTheme() {\n return (0,_fluentui_utilities__WEBPACK_IMPORTED_MODULE_1__.useCustomizationSettings)(['theme']).theme;\n}", "function useCompatTheme() {\n return (0,_fluentui_utilities__WEBPACK_IMPORTED_MODULE_1__.useCustomizationSettings)(['theme']).theme;\n}", "addClass(...classes) {\n this._props.className = classNames(this._props.className, classes);\n }", "function useStyleApplicator(ref) {\n /* must pass in React.useRef object */\n const setStyles = (style) => {\n Object.keys(style).forEach((key) => {\n if (ref.current) ref.current.style[key] = style[key]\n })\n }\n return setStyles\n}", "static getStyles(){return this.styles;}", "getSliderClasses() {\n return mergeStyles({\n height: this.props.vertical ? this.props.verticalHeight : 'auto',\n marginBottom: 4,\n });\n }", "render() {\n return (\n <Container style={styles.container}>\n </Container>\n );\n }", "function classMap(classes) {\n _stylingMap(classes, true);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0,_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__.default)(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0,_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__.default)(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0,_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__.default)(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0,_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__.default)(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return Object(_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__[\"createStyles\"])(styles);\n}", "render() {\n const {classes} = this.props;\n return (\n <ThemeProvider theme={theme}>\n <Grid container justify='space-around'\n className={classes.cards}>\n <this.Cards />\n </Grid>\n </ThemeProvider>);\n }", "getHeaderStyles() {\n return {\n backgroundColor: \"#FCEF50\"\n };\n }", "function buildClassMap(styles) {\n var classes = {};\n var _loop_1 = function (styleName) {\n if (styles.hasOwnProperty(styleName)) {\n var className_1;\n Object.defineProperty(classes, styleName, {\n get: function () {\n if (className_1 === undefined) {\n // tslint:disable-next-line:no-any\n className_1 = Object(__WEBPACK_IMPORTED_MODULE_0__MergeStyles__[\"g\" /* mergeStyles */])(styles[styleName]).toString();\n }\n return className_1;\n },\n enumerable: true,\n configurable: true\n });\n }\n };\n for (var styleName in styles) {\n _loop_1(styleName);\n }\n return classes;\n}", "resolveStyles(props = {}) {\n const styles = {\n animationDuration: props.duration,\n borderColor: props.secondaryColor,\n borderTopColor: props.color,\n borderWidth: props.borderWidth,\n height: props.size,\n width: props.size,\n }\n const overrides = props.style || {}\n\n return {...styles, ...overrides}\n }", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function buildClassMap(styles) {\n var classes = {};\n var _loop_1 = function (styleName) {\n if (styles.hasOwnProperty(styleName)) {\n var className_1;\n Object.defineProperty(classes, styleName, {\n get: function () {\n if (className_1 === undefined) {\n // tslint:disable-next-line:no-any\n className_1 = Object(_MergeStyles__WEBPACK_IMPORTED_MODULE_0__[\"mergeStyles\"])(styles[styleName]).toString();\n }\n return className_1;\n },\n enumerable: true,\n configurable: true\n });\n }\n };\n for (var styleName in styles) {\n _loop_1(styleName);\n }\n return classes;\n}", "function handleStyles(styles, props, theme, context) {\n let current\n const mappedArgs = []\n const nonGlamorClassNames = []\n for (let i = 0; i < styles.length; i++) {\n current = styles[i]\n if (typeof current === 'function') {\n const result = current(props, theme, context)\n if (typeof result === 'string') {\n processStringClass(result, mappedArgs, nonGlamorClassNames)\n } else {\n mappedArgs.push(result)\n }\n } else if (typeof current === 'string') {\n processStringClass(current, mappedArgs, nonGlamorClassNames)\n } else if (Array.isArray(current)) {\n const recursed = handleStyles(current, props, theme, context)\n mappedArgs.push(...recursed.mappedArgs)\n nonGlamorClassNames.push(...recursed.nonGlamorClassNames)\n } else {\n mappedArgs.push(current)\n }\n }\n return {mappedArgs, nonGlamorClassNames}\n}", "function createThemeClassesLookup(classes) {\n return classes.reduce((currentClassNames, baseClass) => {\n Object.keys(baseClass).forEach((key) => {\n currentClassNames[baseClass[key]] = key;\n });\n return currentClassNames;\n }, {});\n}", "static get defaultProps() {\n return {\n className: ''\n };\n }", "function useThemeContext(){return Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useContext\"])(_theme_ThemeContext__WEBPACK_IMPORTED_MODULE_1__[/* default */ \"a\"]);}", "static get styles() {\n return [style];\n }", "function classNamesFunction() {\n // TODO: memoize.\n return function (getStyles, styleProps) {\n return Object(__WEBPACK_IMPORTED_MODULE_0__uifabric_merge_styles__[\"f\" /* mergeStyleSets */])(getStyles && (typeof getStyles === 'function' ? getStyles(styleProps) : getStyles));\n };\n}", "function useTransitionStyles() {\n const [transitionStyles, setTransitionStyles] = React.useState({});\n const timerId = React.useRef();\n\n // On mount\n React.useEffect(() => {\n timerId.current = setTimeout(() => {\n setTransitionStyles({\n transitionProperty: \"background, border-color, box-shadow, color, fill\",\n transitionDuration: \"150ms\",\n });\n }, 0);\n\n // On unmount: clear timer so state won't be set when component is unmounted\n return () => {\n if (timerId.current) clearTimeout(timerId.current);\n };\n }, []);\n\n return transitionStyles;\n}", "styles() { }", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0,_material_ui_styles__WEBPACK_IMPORTED_MODULE_0__.createStyles)(styles);\n}", "constructor() {\n const {\n defaultStyle,\n globalStyle,\n fontStyle,\n formStyle,\n buttonStyle\n } = { ...getInitialStyles };\n\n this.initialStyles = {\n ...defaultStyle,\n ...globalStyle,\n ...fontStyle,\n ...formStyle,\n ...buttonStyle\n };\n }", "function buildClassMap(styles) {\n var classes = {};\n var _loop_1 = function (styleName) {\n if (styles.hasOwnProperty(styleName)) {\n var className_1;\n Object.defineProperty(classes, styleName, {\n get: function () {\n if (className_1 === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n className_1 = (0,_MergeStyles__WEBPACK_IMPORTED_MODULE_0__.mergeStyles)(styles[styleName]).toString();\n }\n return className_1;\n },\n enumerable: true,\n configurable: true,\n });\n }\n };\n for (var styleName in styles) {\n _loop_1(styleName);\n }\n return classes;\n}", "function buildClassMap(styles) {\n var classes = {};\n var _loop_1 = function (styleName) {\n if (styles.hasOwnProperty(styleName)) {\n var className_1;\n Object.defineProperty(classes, styleName, {\n get: function () {\n if (className_1 === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n className_1 = (0,_MergeStyles__WEBPACK_IMPORTED_MODULE_0__.mergeStyles)(styles[styleName]).toString();\n }\n return className_1;\n },\n enumerable: true,\n configurable: true,\n });\n }\n };\n for (var styleName in styles) {\n _loop_1(styleName);\n }\n return classes;\n}", "static get styles() {\n return styles;\n }", "function ɵɵclassProp(className, value) {\n checkStylingProperty(className, value, null, true);\n return ɵɵclassProp;\n}", "function defaultStyles(){\n return {\n classes: {\n 'with-3d-shadow': true,\n 'with-transitions': true,\n 'gallery': false\n },\n css: {}\n };\n }", "function defaultStyles(){\n return {\n classes: {\n 'with-3d-shadow': true,\n 'with-transitions': true,\n 'gallery': false\n },\n css: {}\n };\n }", "function Styles() {\n var defaultTraits = {\n 'no-fill': {\n fill: 'none'\n },\n 'no-border': {\n strokeOpacity: 0.0\n },\n 'no-events': {\n pointerEvents: 'none'\n }\n };\n var self = this;\n /**\n * Builds a style definition from a className, a list of traits and an object of additional attributes.\n *\n * @param {String} className\n * @param {Array<String>} traits\n * @param {Object} additionalAttrs\n *\n * @return {Object} the style defintion\n */\n this.cls = function (className, traits, additionalAttrs) {\n var attrs = this.style(traits, additionalAttrs);\n return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])(attrs, { 'class': className });\n };\n /**\n * Builds a style definition from a list of traits and an object of additional attributes.\n *\n * @param {Array<String>} traits\n * @param {Object} additionalAttrs\n *\n * @return {Object} the style defintion\n */\n this.style = function (traits, additionalAttrs) {\n if (!Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"isArray\"])(traits) && !additionalAttrs) {\n additionalAttrs = traits;\n traits = [];\n }\n var attrs = Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"reduce\"])(traits, function (attrs, t) {\n return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])(attrs, defaultTraits[t] || {});\n }, {});\n return additionalAttrs ? Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])(attrs, additionalAttrs) : attrs;\n };\n this.computeStyle = function (custom, traits, defaultStyles) {\n if (!Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"isArray\"])(traits)) {\n defaultStyles = traits;\n traits = [];\n }\n return self.style(traits || [], Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])({}, defaultStyles, custom || {}));\n };\n}", "function Styles() {\n var defaultTraits = {\n 'no-fill': {\n fill: 'none'\n },\n 'no-border': {\n strokeOpacity: 0.0\n },\n 'no-events': {\n pointerEvents: 'none'\n }\n };\n var self = this;\n /**\n * Builds a style definition from a className, a list of traits and an object of additional attributes.\n *\n * @param {String} className\n * @param {Array<String>} traits\n * @param {Object} additionalAttrs\n *\n * @return {Object} the style defintion\n */\n this.cls = function (className, traits, additionalAttrs) {\n var attrs = this.style(traits, additionalAttrs);\n return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])(attrs, { 'class': className });\n };\n /**\n * Builds a style definition from a list of traits and an object of additional attributes.\n *\n * @param {Array<String>} traits\n * @param {Object} additionalAttrs\n *\n * @return {Object} the style defintion\n */\n this.style = function (traits, additionalAttrs) {\n if (!Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"isArray\"])(traits) && !additionalAttrs) {\n additionalAttrs = traits;\n traits = [];\n }\n var attrs = Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"reduce\"])(traits, function (attrs, t) {\n return Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])(attrs, defaultTraits[t] || {});\n }, {});\n return additionalAttrs ? Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])(attrs, additionalAttrs) : attrs;\n };\n this.computeStyle = function (custom, traits, defaultStyles) {\n if (!Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"isArray\"])(traits)) {\n defaultStyles = traits;\n traits = [];\n }\n return self.style(traits || [], Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"assign\"])({}, defaultStyles, custom || {}));\n };\n}", "function functionalThemeClasses(context) {\n const vm = { ...context.props,\n ...context.injections\n };\n const isDark = Themeable.options.computed.isDark.call(vm);\n return Themeable.options.computed.themeClasses.call({\n isDark\n });\n}", "function functionalThemeClasses(context) {\n const vm = { ...context.props,\n ...context.injections\n };\n const isDark = Themeable.options.computed.isDark.call(vm);\n return Themeable.options.computed.themeClasses.call({\n isDark\n });\n}", "function functionalThemeClasses(context) {\n const vm = { ...context.props,\n ...context.injections\n };\n const isDark = Themeable.options.computed.isDark.call(vm);\n return Themeable.options.computed.themeClasses.call({\n isDark\n });\n}", "get themeClasses() {\n return baseThemeID + \" \" +\n (this.state.facet(darkTheme) ? baseDarkID : baseLightID) + \" \" +\n this.state.facet(theme);\n }", "static get styles() {\n return [...this.baseStyles, ...super.stickyStyles];\n }", "function App(props) {\n\n let [className, setClassName] = useState(\"App gradient\");\n\n useEffect(() => {console.log('Classname: ', className)}, [className]); \n\n const changeGradient = (props) => {\n setClassName(\"App gradient \" + props);\n }\n\n const resetGradient = () => {\n setClassName(\"App gradient\");\n }\n\n return (\n <div className={className}>\n <h1>Meme Aesthetics</h1>\n <ImageContainer onGuess={changeGradient} onGenerate={resetGradient}/>\n </div>\n );\n}", "static get styles() { return []; }", "get classes() {\n const result = {};\n const element = this.nativeElement;\n // SVG elements return an `SVGAnimatedString` instead of a plain string for the `className`.\n const className = element.className;\n const classes = typeof className !== 'string' ? className.baseVal.split(' ') : className.split(' ');\n classes.forEach((value) => result[value] = true);\n return result;\n }", "static getStyles() {\n return this.styles;\n }", "static getStyles() {\n return this.styles;\n }", "function App() {\n const classes = useStyles();\n return (\n <Section col className={classes.app}>\n <Header />\n <Counter />\n </Section>\n );\n}", "getRenderClasses() {\n return {\n 'md3-button--icon-leading': this.hasIcon,\n };\n }", "getClasses() {\n let classes = ['indicator-pip'];\n\n if (this.props.final) {\n classes.push('final');\n }\n\n if (this.props.taken) {\n classes.push('taken');\n }\n\n return classes.join(' ');\n }", "function Wrapper() {\n\tconst { Dark } = useContext(DataContext);\n\tconst [ dark ] = Dark;\n\tconst isDark = () => {\n\t\tif(dark) {\n\t\t\treturn(\"dark-mode\");\n }\n\t\telse {\n\t\t\treturn(\"\");\n\t\t\t}\n };\n \n return (\n <div className={isDark()}>\n <Home />\n </div>\n );\n }", "function withStyles() {\n return function wrapWithStyles(ComposedComponent) {\n return class WithStyles extends React.Component {\n render() {\n return <ComposedComponent {...this.props} />\n }\n }\n };\n}", "function theme(theme) {\n return Object(_decorators_handleDecorator__WEBPACK_IMPORTED_MODULE_2__[\"handleDecorator\"])((target) => {\n target.addDecorator('baseThemeClasses', theme);\n });\n}", "getStyles () {\n return Object.assign({},\n styles.base,\n this.state.isValid ? styles.valid : styles.error,\n this.props.submitted && (this.props.wrapper.required && !this.state.isCompleted) ? styles.error : styles.valid,\n this.state.focused ? styles.focused : {},\n { backgroundColor: this.props.theme.inputBackground }\n )\n }", "function useContainerClassName() {\n const {isBlogPostPage} = useBlogPost();\n return !isBlogPostPage ? 'margin-bottom--xl' : undefined;\n}", "static get styles() {\n return [css`\n .clicked{\n background-color:red;\n }\n`];\n }", "function defaultStyles(){\n\t return {\n\t classes: {\n\t 'with-3d-shadow': true,\n\t 'with-transitions': true,\n\t 'gallery': false\n\t },\n\t css: {}\n\t };\n\t }", "function ɵɵclassMap(classes) {\n var index = getSelectedIndex();\n var lView = getLView();\n var stylingContext = getStylingContext(index, lView);\n var directiveStylingIndex = getActiveDirectiveStylingIndex$1();\n if (directiveStylingIndex) {\n var args = [stylingContext, classes, directiveStylingIndex];\n enqueueHostInstruction(stylingContext, directiveStylingIndex, updateClassMap, args);\n }\n else {\n var tNode = getTNode(index, lView);\n // inputs are only evaluated from a template binding into a directive, therefore,\n // there should not be a situation where a directive host bindings function\n // evaluates the inputs (this should only happen in the template function)\n if (hasClassInput(tNode) && classes !== NO_CHANGE) {\n var initialClasses = getInitialClassNameValue(stylingContext);\n var classInputVal = (initialClasses.length ? (initialClasses + ' ') : '') + forceClassesAsString(classes);\n setInputsForProperty(lView, tNode.inputs['class'], classInputVal);\n classes = NO_CHANGE;\n }\n updateClassMap(stylingContext, classes);\n }\n if (runtimeIsNewStylingInUse()) {\n classMap(classes);\n }\n}", "function getTreeCheckboxEmotionStyles(clsPrefix, theme) {\n var _styles;\n\n var classRoot = \".\".concat(clsPrefix);\n var classInner = \".\".concat(clsPrefix, \"-inner\");\n var classIndeterminate = \".\".concat(clsPrefix, \"-indeterminate\");\n var classChecked = \".\".concat(clsPrefix, \"-checked\");\n var styles = (_styles = {}, (0, _defineProperty2.default)(_styles, \"\".concat(classRoot, \" > \").concat(classInner), {\n backgroundColor: theme.colors.actionDefaultBackgroundDefault,\n borderColor: theme.colors.actionPrimaryBackgroundDefault\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classRoot, \":hover > \").concat(classInner), {\n backgroundColor: theme.colors.actionDefaultBackgroundHover,\n borderColor: theme.colors.actionPrimaryBackgroundHover\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classRoot, \":active > \").concat(classInner), {\n backgroundColor: theme.colors.actionDefaultBackgroundPress,\n borderColor: theme.colors.actionPrimaryBackgroundPress\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classChecked, \" > \").concat(classInner), {\n backgroundColor: theme.colors.actionPrimaryBackgroundDefault,\n borderColor: 'transparent'\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classChecked, \":hover > \").concat(classInner), {\n backgroundColor: theme.colors.actionPrimaryBackgroundHover,\n borderColor: 'transparent'\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classChecked, \":active > \").concat(classInner), {\n backgroundColor: theme.colors.actionPrimaryBackgroundPress,\n borderColor: 'transparent'\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classIndeterminate, \" > \").concat(classInner), {\n backgroundColor: theme.colors.primary,\n borderColor: theme.colors.primary,\n // The after pseudo-element is used for the check image itself\n '&:after': {\n backgroundColor: theme.colors.white,\n height: '3px',\n width: '8px',\n borderRadius: '4px'\n }\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classIndeterminate, \":hover > \").concat(classInner), {\n backgroundColor: theme.colors.actionPrimaryBackgroundHover,\n borderColor: 'transparent'\n }), (0, _defineProperty2.default)(_styles, \"\".concat(classIndeterminate, \":active > \").concat(classInner), {\n backgroundColor: theme.colors.actionPrimaryBackgroundPress\n }), _styles);\n return styles;\n}", "focusableClasses () {\n return {\n focused: this.isFocused\n }\n }", "appBarStyle () {\n return 'light'\n }", "function AppThemeProvider({ children }) {\n const [theme, setTheme] = useState(LightTheme)\n\n return <ThemeProvider theme={theme}>{children}</ThemeProvider>\n}", "function styles(theme) {\n return ({\n background: {\n backgroundImage: `url(${backgroundImage})`,\n backgroundColor: '#7fc7d9',\n backgroundPosition: 'center',\n },\n button: {\n minWidth: 200,\n },\n h5: {\n marginBottom: theme.spacing(4),\n marginTop: theme.spacing(4),\n [theme.breakpoints.up('sm')]: {\n marginTop: theme.spacing(10),\n },\n },\n more: {\n marginTop: theme.spacing(2),\n },\n });\n}", "function App() {\n return (\n <div className=\"App\">\n {/*<ThemeContext.Provider value={themes}>*/}\n <ExampleUseEffect2 />\n {/*</ThemeContext.Provider>*/}\n </div>\n );\n}", "get styles() {\n return this._styles;\n }", "function ButtonStyled() {\n const classes = useStyles();\n return <Button className={classes.root}>Test Styled Button</Button>\n}", "function createStyles(styles) {\n // warning(\n // warnOnce,\n // [\n // 'Material-UI: createStyles from @material-ui/core/styles is deprecated.',\n // 'Please use @material-ui/styles/createStyles',\n // ].join('\\n'),\n // );\n // warnOnce = true;\n return (0, _styles.createStyles)(styles);\n}", "static get miniStyles() {\n return [\n css`\n :host {\n position: relative;\n height: 0;\n margin: 0 auto;\n padding: 0;\n border: none;\n background-color: none;\n }\n #container {\n display: flex;\n position: absolute;\n bottom: 0;\n margin: 0 auto;\n padding: 0;\n border: var(--rich-text-editor-border-width, 1px) solid\n var(--rich-text-editor-border-color, #ddd);\n background-color: var(\n --rich-text-editor-bg,\n var(--rich-text-editor-bg, #ffffff)\n );\n }\n `,\n ];\n }", "function useApplyClassToBody(state, classesToApply) {\n var _a;\n var applyTo = state.applyTo;\n var applyToBody = applyTo === 'body';\n var body = (_a = (0,_fluentui_react_window_provider__WEBPACK_IMPORTED_MODULE_2__.useDocument)()) === null || _a === void 0 ? void 0 : _a.body;\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {\n if (!applyToBody || !body) {\n return;\n }\n for (var _i = 0, classesToApply_1 = classesToApply; _i < classesToApply_1.length; _i++) {\n var classToApply = classesToApply_1[_i];\n if (classToApply) {\n body.classList.add(classToApply);\n }\n }\n return function () {\n if (!applyToBody || !body) {\n return;\n }\n for (var _i = 0, classesToApply_2 = classesToApply; _i < classesToApply_2.length; _i++) {\n var classToApply = classesToApply_2[_i];\n if (classToApply) {\n body.classList.remove(classToApply);\n }\n }\n };\n }, [applyToBody, body, classesToApply]);\n}", "function useApplyClassToBody(state, classesToApply) {\n var _a;\n var applyTo = state.applyTo;\n var applyToBody = applyTo === 'body';\n var body = (_a = (0,_fluentui_react_window_provider__WEBPACK_IMPORTED_MODULE_2__.useDocument)()) === null || _a === void 0 ? void 0 : _a.body;\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {\n if (!applyToBody || !body) {\n return;\n }\n for (var _i = 0, classesToApply_1 = classesToApply; _i < classesToApply_1.length; _i++) {\n var classToApply = classesToApply_1[_i];\n if (classToApply) {\n body.classList.add(classToApply);\n }\n }\n return function () {\n if (!applyToBody || !body) {\n return;\n }\n for (var _i = 0, classesToApply_2 = classesToApply; _i < classesToApply_2.length; _i++) {\n var classToApply = classesToApply_2[_i];\n if (classToApply) {\n body.classList.remove(classToApply);\n }\n }\n };\n }, [applyToBody, body, classesToApply]);\n}", "function App() {\n return <div className=\"counter\" />;\n}" ]
[ "0.776499", "0.7060539", "0.638782", "0.637961", "0.637961", "0.637961", "0.637961", "0.637961", "0.637961", "0.6220399", "0.5937952", "0.5921431", "0.58936673", "0.5828119", "0.5810863", "0.58007765", "0.57845753", "0.57845753", "0.5783547", "0.5781817", "0.57692534", "0.5755133", "0.5719983", "0.5717819", "0.5713024", "0.5713024", "0.5713024", "0.5713024", "0.571035", "0.571035", "0.571035", "0.571035", "0.571035", "0.571035", "0.571035", "0.571035", "0.571035", "0.571035", "0.5705142", "0.5701112", "0.5700174", "0.568158", "0.5662994", "0.5662994", "0.5662994", "0.5662994", "0.5662994", "0.5662994", "0.56514734", "0.5645276", "0.56309235", "0.5622906", "0.56174594", "0.56169164", "0.56096417", "0.5609109", "0.5602987", "0.55831975", "0.5580342", "0.55797434", "0.55797434", "0.55794114", "0.5577725", "0.5571074", "0.5571074", "0.5567272", "0.5567272", "0.5563882", "0.5563882", "0.5563882", "0.5544555", "0.55319613", "0.5530142", "0.5507969", "0.5496788", "0.5495547", "0.5495547", "0.5495173", "0.54904246", "0.54794025", "0.5475126", "0.54680306", "0.5464088", "0.5463262", "0.5453552", "0.5444242", "0.5442804", "0.5433709", "0.54312474", "0.5419728", "0.5408512", "0.5407821", "0.54052734", "0.5402521", "0.5400825", "0.5382368", "0.5381834", "0.5379373", "0.5377706", "0.5377706", "0.53730285" ]
0.0
-1
CONSTRUCTOR TO ORGANIZE DATA
function Match(win, length, champion, runes, items, kda, totalCreep, creepPerMin) { this.win = win this.length = length this.champion = champion this.runes = runes this.itmes = items this.kda = kda this.totalCreep = totalCreep this.creepPerMin = creepPerMin }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this.data = new Data();\n }", "function Data() {\n this.columns = null;\n this.items = null;\n this.projection = null;\n this.num_rows = 0;\n this.num_cols = 0;\n}", "constructor(data) {\n const dataKeys = Object.keys(data);\n for (let i = 0; i < dataKeys.length; i++) {\n this[dataKeys[i]] = data[dataKeys[i]];\n }\n }", "constructor(data) { }", "constructor() {\n this.data = this._loadData();\n }", "constructor(data) {\n this.data = data;\n }", "constructor(data = {}) {\n Object.assign(this, data)\n }", "constructor(data = {}) {\n super(data);\n \n this.init(data);\n }", "constructor(data) {\n \n }", "constructor() {\n this.data = {};\n }", "constructor() {\n this.data = {};\n }", "function Data()\n{\n //parameters\n this.total = 0;\n this.domestic = 0;\n this.transborder = 0;\n this.other = 0;\n}", "init(){\n var self = this;\n self.generateData();\n self.insertInfo();\n self.copyData();\n }", "constructor() {\n super() // required after extends\n this.data = []\n }", "constructor(data) {\n this.data = data;\n }", "constructor(dataInput) {\n this.data = dataInput;\n this.length = Object.keys(dataInput).length;\n this.names = this.dataNames(); \n this.counts = this.dataCounts();\n this.data360 = this.dataMap360();\n this.percent100 = this.dataPercents();\n console.log(this);\n }", "constructor () {\n this.data = {}\n }", "constructor (data) {\n\t\tthis.rows = data;\n\t}", "constructor(_data = {}) {\n this._data = _data;\n }", "init (data = {}) {\n for(let key in data){\n this[key] = data[key];\n }\n }", "init (data = {}) {\n for(let key in data){\n this[key] = data[key];\n }\n }", "constructor(options, ...args){\n super(options, ...args);\n this.data = options ? options.data : undefined;\n }", "constructor(data) {\n super(data);\n }", "constructor(data = {}) {\n //super(data);\n for (const prop in data) {\n this[prop] = data[prop];\n }\n }", "constructor(data = {}) {\r\n //super(data);\r\n for (const prop in data) {\r\n this[prop] = data[prop];\r\n }\r\n }", "constructor(){\n this.data = [] //armazenamento\n }", "constructor(data) {\n this._id = data._id\n this.imgUrl = data.imgUrl\n this.price = data.price\n this.year = data.year\n this.levels = data.levels\n this.bedrooms = data.bedrooms\n this.bathrooms = data.bathrooms\n this.description = data.description\n }", "function Data() { }", "initialize(data) {\n this.$exists = false;\n this.$changed = {};\n this.$attributes = {};\n this.fill(data);\n this.$initialized = true;\n\n return this;\n }", "constructor(data){ \n this.data = data;\n }", "constructor(data) {\n this.data = data || {},\n this.trainDataUrl = { //! object for holding/organizing random query string parts\n baseUrl: 'http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx',\n apiKey: '3106a8d27f8b4f8fb99b7c8d895163dd',\n mapId: '',\n stpId: '',\n outputType: 'JSON',\n }\n }", "constructor (data) {\n\n // the data array\n this.data = [];\n\n // should we parse the todos data?\n if (data && data.todos) data.todos.map(function (item) {\n return new Todo(item);\n }).forEach((item) => { this.data.push(item); });\n }", "constructor(data) {\n this.id = data.id\n this.nombre = data.nombre.toUpperCase();\n this.precio = parseFloat(data.precio);\n this.vendido = false;\n }", "constructor(){\r\n\t\tthis.data = [];//initializing the array as blank...\r\n\t\tthis.data.push(new employee(123, \"Phaniraj\", \"Bangalore\"));\r\n\t\tthis.data.push(new employee(124, \"Mahesh\", \"Bangalore\"));\r\n\t\tthis.data.push(new employee(125, \"Gopal\", \"Mysore\"));\r\n\t\tthis.data.push(new employee(126, \"Venkatesh\", \"Chennai\"));\r\n\t}", "constructur() {}", "constructor(formatobjeto){ //Definimos el constructor\n this.data=formatobjeto\n \n }", "constructor(data) {\n this.comments = data.comments;\n this.points = data.points;\n this.author = data.author;\n this.title = data.title;\n this.uri = data.uri;\n this.rank = data.rank;\n }", "constructor () {\n this.#data = {} // Objeto vazio\n this.#tail = -1 // Pilha vazia\n }", "constructor(data){\n // super para acceder el constructor del padre\n super(data.name, data.sellIn, data.quality)\n \n }", "function Dataset() {\n this.data = [];\n this.max = 0;\n this.min = 0;\n this.range = 0;\n this.size = 0;\n Object.defineProperty(\n this,\n 'length',\n { get: function() { return this.data.length; } }\n );\n if( ( arguments.length > 0 ) && ( arguments[ 0 ] instanceof Array ) ) {\n this.load( arguments[ 0 ] );\n }\n }", "constructor(_data, _target) {\n // Define fields\n this.data = _data;\n this.target = _target;\n\n // Call init\n this.init();\n }", "constructor(){\r\n\t\tthis.data=[]\r\n\t}", "constructor() {\n this.data = [];\n }", "constructor( data ){\n this._emitter = new EventTarget();\n this._converters = new Map();\n this._dynamicProperties = false;\n this._data = data;\n }", "constructor(allData, selectionData) {\n\t\tthis.allData = allData;\n\t\tthis.selectionData = selectionData;\n\t\tthis.selectedData = [];\n\t\tthis.category = \"meteors\";\n\t\tthis.year = 1988;\n\t\t\n\t\tthis.width = 599;\n\t\tthis.height = 390;\n\t\tthis.xOffset = 60;\n\t\tthis.yOffset = 20;\n\t\t\n\t\tthis.xScale;\n\t\tthis.yScale;\n }", "initDataRaw(X) {\n\t\t\tconst N = X.length;\n\t\t\tconst D = X[0].length;\n\t\t\tassert(N > 0, ' X is empty? You must have some data!');\n\t\t\tassert(D > 0, ' X[0] is empty? Where is the data?');\n\t\t\tconst pairwiseDistancesOfInput = pairwiseDistances(X); // convert X to distances using gaussian kernel\n\t\t\tthis.P = d2p(pairwiseDistancesOfInput, this.perplexity, 1e-4); // attach to object\n\t\t\tthis.N = N; // back up the size of the dataset\n\t\t\tthis.initSolution(); // refresh this\n\t\t}", "constructor() {\n // initialize properties as undefined here for clarity, could be done in a public field once these are more widely implemented\n this.x = undefined;\n this.y = undefined;\n this.representation = undefined;\n }", "constructor(data) {\n // data: Object\n let defaultData = {\n sid: null,\n author: '',\n bookname: '',\n category_sid: 0,\n book_id: '',\n publish_date: '1970-01-01',\n pages: 0,\n price: 0,\n isbn: '',\n on_sale: 1,\n introduction: '',\n images: '[]'\n };\n this.data = {...defaultData, ...data};\n }", "constructor() {\r\n this.datas = new Array(16);\r\n this.identity();\r\n }", "constructor(data) {\n this.data = data;\n this.rebuild_population();\n this.list_of_infoBoxData = [];\n }", "constructor(data) {\n // data: Object\n let defaultData = {\n sid: null,\n author: \"\",\n bookname: \"\",\n category_sid: 0,\n book_id: \"\",\n publish_date: \"1970-01-01\",\n pages: 0,\n price: 0,\n isbn: \"\",\n on_sale: 1,\n introduction: \"\",\n };\n this.data = { ...defaultData, ...data };\n }", "constructor(data) {\n super(data);\n this._bucketWidth = freedmanDiaconis(data);\n }", "init (data = {}) {\n for(let _key in data){\n this[_key] = data[_key];\n }\n }", "constructor() {\n\n /**\n * @type {Array.<{type: string, label: string, url: string}>}\n * @private\n */\n this._data = []\n }", "function Data() {\n this.mariopower = 1;\n this.scorelevs = [100, 200, 400, 500, 800, 1000, 2000, 4000, 5000, 8000];\n this.score = new dataObject(0, 6, \"SCORE\");\n this.time = new dataObject(350, 3, \"TIME\");\n this.world = new dataObject(0, 0, \"WORLD\");\n this.coins = new dataObject(0, 0, \"COINS\");\n this.lives = new dataObject(3, 1, \"LIVES\");\n}", "constructor(view, data) {\n this.view = view\n this.data = data\n this.oeeArray = []\n }", "constructor() {\n\n _data.set( this, new Map() );\n _validity.set( this, new Map() );\n\n // Immutable object.\n Object.freeze( this );\n }", "init(data) {\r\n this.object = data.object;\r\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8317c0c3;\n this.SUBCLASS_OF_ID = 0x9f89304e;\n\n this.data = args.data;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x7d748d04;\n this.SUBCLASS_OF_ID = 0xad0352e8;\n\n this.data = args.data;\n }", "initData(data) {\n if (!data || !data.sys) {\n return;\n }\n this.data = this.data || {};\n let dict = data.sys.dict;\n let protos = data.sys.protos;\n\n //Init compress dict\n if (dict) {\n this.data.dict = dict;\n this.data.abbrs = {};\n\n for (let route in dict) {\n this.data.abbrs[dict[route]] = route;\n }\n }\n\n //Init protobuf protos\n if (protos) {\n this.data.protos = {\n server: protos.server || {},\n client: protos.client || {}\n };\n if (!tools.isNull(this.protobuf)) {\n this.protobuf.init({\n encoderProtos: protos.client,\n decoderProtos: protos.server\n });\n }\n }\n }", "constructor (data) {\n this.location = data.geometry.location\n this.id = data.id;\n this.name = data.name;\n //opening_hours = { \"open_now\" : false, \"weekday_text\" : [] }\n this.opening_hours = data.opening_hours;\n this.vicinity = data.vicinity;\n this.rating = data.rating;\n this.d2a = 0;\n this.d2b = 0;\n }", "function Data(dia, mes, ano) {\n this.dia = dia;\n this.mes = mes;\n this.ano = ano;\n // this.dia = dia;\n // this.mes = mes;\n // this.ano = ano;\n }", "function Data(dia, mes, ano) {\n if (ano === void 0) { ano = 1970; }\n this.dia = dia;\n this.mes = mes;\n this.ano = ano;\n // this.dia = dia;\n // this.mes = mes;\n // this.ano = ano;\n }", "constructor(parentElement, data) {\n\n this.parentElement = parentElement;\n this.rawData = data;\n this.preProcessedData = [];\n this.filteredData = [];\n this.displayData = [];\n this.initVis()\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x4218a164;\n this.SUBCLASS_OF_ID = 0xf1163490;\n\n this.data = args.data;\n }", "constructor(data, quantidade, valor){\n\t\tthis._data = new Date( data.getTime() );\n\t\tthis._quantidade = quantidade;\n\t\tthis._valor = valor;\n\n\t\t// Congelando objetos para não ser alterado\n\t\tObject.freeze(this);\n\t\n\t}", "init () {\n const data = this.dataRaw\n data.forEach(point => {\n const typeCode = point.pop()\n this.data.push(new Point(point, typeCode))\n })\n }", "constructor(data) {\n this.type = data.type;\n this.byDevice = data.byDevice;\n this.byMonth = data.byMonth;\n this.symbol = data.symbol;\n }", "makeData (callback) {\n\t\tthis.init(callback);\n\t}", "makeData (callback) {\n\t\tthis.init(callback);\n\t}", "makeData (callback) {\n\t\tthis.init(callback);\n\t}", "makeData (callback) {\n\t\tthis.init(callback);\n\t}", "constructor(data)\n {\n super(data.width, data.height);\n\n this._width = data.width;\n this._height = data.height;\n this._key = data.key;\n\n this.once(\"added\", () => this.onAdded());\n }", "constructor(data) {\n\n //TODO - your code goes here -\n\n }", "constructor(data) {\n this.title = data.title\n this.chore = data.chore || []\n }", "constructor(data) {\n if (data !== undefined) {\n this._matrix = ExtMath.matrix(data);\n }\n }", "constructor(id, data = ''){\n\t\tthis.id = id;\n this.data = data;\t\t\n\t}", "constructor(orgData, data, selectedUoa, selectedUni, type) {\n this.originalData = orgData;\n this.data = data;\n this.selectedUoa = selectedUoa;\n this.selectedUni = selectedUni;\n this.type = type;\n }", "function initializeData(data) {\n // TODO: Convert the properties \"income\", \"lifeExpectancy\" and \"population\" to the \"number\" type for each entry.\n data.forEach(row => {\n row.income = parseFloat(row.income);\n row.lifeExpectancy = parseFloat(row.lifeExpectancy);\n row.population = parseInt(row.population);\n });\n}", "constructor(data){\n if(_.isNil(data) ||\n _.isNil(data.fileName) ||\n _.isNil(data.numberOfBulkRecords)){\n throw new Error('Missing the required data.');\n }\n\n this.fileName = data.fileName; // CSV file name\n this.numberOfBulkRecords = data.numberOfBulkRecords; // size of the chunk of data\n this.numberOfEmails = 4; // number of emails that will be scheduled\n this.specialSeparator = '|'; // specify special separator\n }", "constructor(data, vizCoord) {\n this.data = data.geoData;\n this.bios = data.museumBios;\n this.plotData = null; // this is the data that will actually be plotted, based on the selection of if we are looking at year created or acuqired\n this.vizCoord = vizCoord;\n\n this.height = 600;\n this.width = 1000;\n this.margins = {\n 'left': 35,\n 'right': 35,\n 'top': 25,\n 'bottom': 5\n };\n\n this.xScale = null;\n this.yScale = null;\n this.colorScale = null;\n this.museumNames = [];\n }", "function CompressedDataset(data){\n this.raw = data;\n this.ranges = {\n x: [0, 1],\n y: [0, 1],\n z: [0, 1]\n };\n return this;\n }", "function init(x, y, width, height, data) {\n return COG.extend({\n x: x,\n y: y,\n width: width,\n height: height\n }, data);\n }", "function or(){this.__data__=new Ut}", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xdb21d0a7;\n this.SUBCLASS_OF_ID = 0xb49da1fc;\n\n this.type = args.type;\n this.data = args.data || null;\n this.frontSide = args.frontSide || null;\n this.reverseSide = args.reverseSide || null;\n this.selfie = args.selfie || null;\n this.translation = args.translation || null;\n this.files = args.files || null;\n this.plainData = args.plainData || null;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x3417d728;\n this.SUBCLASS_OF_ID = 0x2899a53d;\n\n this.save = args.save || null;\n this.data = args.data;\n }", "function DataObject() {\n\tthis.string = 'string';\n\tthis.number = 1234;\n\tthis.bool = false;\n\tthis.undef = undefined;\n\tthis.nul = null;\n\tthis.nan = NaN;\n\tthis.array = [1, 2, 3, 4];\n\tthis.func = function() {};\n\tthis.obj = {};\n}", "constructor(){\n this.data = {} //armazenamento\n this.count = 0\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x187fa0ca;\n this.SUBCLASS_OF_ID = 0x51138ae;\n\n this.type = args.type;\n this.data = args.data || null;\n this.frontSide = args.frontSide || null;\n this.reverseSide = args.reverseSide || null;\n this.selfie = args.selfie || null;\n this.translation = args.translation || null;\n this.files = args.files || null;\n this.plainData = args.plainData || null;\n this.hash = args.hash;\n }", "constructor() {\n this.data = []; //inicia variavel\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x7c3c2609;\n this.SUBCLASS_OF_ID = 0x476cbe32;\n\n this.geo = args.geo;\n this.period = args.period;\n }", "function Dataobject(ServerData) {\n this.Head = ServerData.Head;\n this.Data = ServerData.Data;\n this.Config = ServerData.Config; //toNo-Arr indexes\n this.Grid = ServerData.Grid;\n\n //------------------------------------------------------------------------------------------------------------------\n //--------------------Object converters------------------------------------------------------------------------------\n //----------------------------------------------------------------------------------------------------------------\n}", "function HistoriaClinica() { //-------------------------------------------Class HistoriaClinica()\n\n this.a = [];\n\n HistoriaClinica.prototype.cargarData = function (data) {\n this.a = data;\n this.a.Adjuntos = [];\n // // this.a.II;\n // this.a.II_BD = 0;//estado inicial, se puede ir al servidor a buscar la informacion.\n }\n\n} //-------------------------------------------Class HistoriaClinica()", "function LC() {\n this.data = {};\n}", "constructor(list, data) {\n this._list = list;\n this._data = data;\n }", "function VersionData() {\r\n this.allUnits = {};\r\n this.playerUnits = {};\r\n this.computerUnits = {};\r\n this.camps = {};\r\n this.generals = {};\r\n this.functions = {};\r\n}", "initData(data) {\n this.status = data.status;\n this.id = data.id;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x8aeabec3;\n this.SUBCLASS_OF_ID = 0x7cd41eb4;\n\n this.data = args.data;\n this.dataHash = args.dataHash;\n this.secret = args.secret;\n }", "constructor(data, width) {\n super();\n this.data = data;\n this.width = width;\n this.blocks = [];\n }", "init(dataset, xHeader, yHeaders, sorted=false){\n \n this.xHeader = xHeader;\n this.yHeaders = yHeaders;\n this.sorted = sorted;\n this.loadJson(dataset);\n if(sorted){\n this.sortJsonById(xHeader);\n }\n this.extractXYArray(this.xHeader, this.yHeaders);\n \n}" ]
[ "0.71304065", "0.70943147", "0.70683146", "0.6936727", "0.69228387", "0.6920877", "0.69096595", "0.6859795", "0.679646", "0.6792512", "0.6792512", "0.6786045", "0.678404", "0.67796296", "0.67639303", "0.67569506", "0.6746378", "0.66687274", "0.6657119", "0.6634306", "0.6634306", "0.6614626", "0.6612564", "0.6595678", "0.65824354", "0.652828", "0.6522385", "0.6515708", "0.6507598", "0.64856845", "0.6462003", "0.64559346", "0.6447963", "0.64450955", "0.6428311", "0.64258355", "0.64201325", "0.64108056", "0.64026654", "0.6381974", "0.63813263", "0.6373494", "0.6351988", "0.6350537", "0.6348397", "0.6347935", "0.633456", "0.6332194", "0.6326689", "0.63154393", "0.6315201", "0.6283121", "0.6265597", "0.62626755", "0.62544984", "0.624533", "0.62348115", "0.6215085", "0.620773", "0.6202806", "0.6199223", "0.6197798", "0.6192449", "0.61921036", "0.61567044", "0.61555374", "0.615257", "0.6152288", "0.6150877", "0.61392474", "0.61392474", "0.61392474", "0.61392474", "0.6136743", "0.6115875", "0.610668", "0.609702", "0.60965335", "0.60944295", "0.6080162", "0.6076316", "0.6070128", "0.606797", "0.60669535", "0.6058117", "0.6057237", "0.6048595", "0.60476416", "0.60384387", "0.60230494", "0.60109216", "0.6005827", "0.5998736", "0.5994894", "0.5985667", "0.59749025", "0.59726506", "0.5963206", "0.59524274", "0.594342", "0.5939539" ]
0.0
-1
returns null or an error if unsuccessful
async function getStatus(config, target) { let cacheKey = target.trim().toUpperCase(); // find cache key let status = null; let uuid, username; if(cache[cacheKey]) { uuid = cache[cacheKey]['uuid']; username = cache[cacheKey]['name']; } if(uuid === undefined || username === undefined) { let data = await requests.fetchData(target); if(data == null && config['follow']) { // don't retry if follow mode return null; } // while rate limit exceeded while(data == null) { // wait 10 seconds await new Promise(resolve => setTimeout(resolve, 10000)); data = await requests.fetchData(target); } uuid = data['id']; username = data['name']; // cache uuid if(config['cache']) { cache[cacheKey] = { 'name': username, 'uuid': uuid }; } } // get hypixel status information status = await requests.fetchStatus(uuid, config['apikey']); if(uuid == null && config['follow']) { return null; } // rate limit exceeded while(status == null) { await new Promise(resolve => setTimeout(resolve, 10000)); // 10 seconds status = await requests.fetchStatus(uuid, config['apikey']); } return { 'session': status['session'], 'name': username }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Failure() {\n return null;\n}", "function nullForFailure(ctx, failure) {\r\n\tctx.failed = true;\r\n\tctx.failures.push(failure);\r\n\treturn null;\r\n}", "if (this.state.error) {\n return null;\n }", "function validate() {\n //always valid\n return null;\n }", "function Success() {\n return null;\n}", "_getResult() {\n\t\treturn null;\n\t}", "remoteFileExists(communityUuid,documentUuid,callback){\n this._execute(\"/files/basic/api/communitylibrary/\"+communityUuid+\"/document/\"+documentUuid+\"/entry\",\n function(err, httpResponse, body){\n if(err){\n callback(err); \n }\n else{\n var checkErrorCode = body.match(\"<td:errorCode>(.*?)</td:errorCode>\")\n if(checkErrorCode !== null){\n\n if(checkErrorCode.includes(\"ItemNotFound\")){\n callback(\"Item Not Found\")\n }else{\n console.log(checkErrorCode);\n callback(checkErrorCode);\n }\n }\n else{\n callback(null);\n }\n }\n })\n }", "function loadNothing() {\n return null;\n }", "function getErrorObj(){\n\t\t try{ throw Error(\"\")}catch(err){ return err }\n\t }", "get None() {}", "get None() {}", "get None() {}", "get None() {}", "validate() {\n return null;\n }", "_get () {\n throw new Error('_get not implemented')\n }", "handleError(returnCode) {\n if (returnCode === SQLite.OK) {\n return null;\n } else {\n const errmsg = sqlite3_errmsg(this.db);\n throw new Error(errmsg);\n }\n }", "function getErrorObject(){\n try { throw Error('') } catch(err) { return err; }\n}", "getErrorFromState(state) {\n return this._getSubState(state).error || null;\n }", "function getBlogFailure(error){}", "returnIfExists(obj, objName){\n if(obj === undefined) throw new ResourceNotFoundError;\n else return obj;\n }", "function checkNullObject(callback) {\n\n return function (err, object) {\n if (err)\n callback('Database error: ' + err, null);\n else if (!object || object.length === 0)\n callback('No record found', '');\n else\n callback(null, object);\n }\n }", "static get ERROR () { return 0 }", "lookupAddressId(address: ?Address): null|number {\n return lookupAddressId(this.props.addresses, address);\n }", "__init12() {this.error = null}", "if (returnType instanceof GraphQLNonNull) {\n return completeValueWithLocatedError(\n exeContext,\n returnType,\n fieldNodes,\n info,\n path,\n result,\n parentDirectiveTree,\n execDetails\n );\n }", "function getError() {\n return _error;\n }", "function getError() {\n return _error;\n }", "function getError() {\n return _error;\n }", "function getError() {\n return _error;\n }", "function returnUndefined() {}", "function checkNullObject(callback) {\n return function (err, object) {\n\n if (err)\n callback('Database error: ' + err, null);\n else if (!object)\n callback('No record found', '');\n else\n callback(null, object);\n }\n }", "function dwscripts_getNullToken()\n{\n var retVal = null;\n var serverObj = dwscripts.getServerImplObject();\n\n if (serverObj != null && serverObj.getNullToken != null)\n {\n retVal = serverObj.getNullToken();\n }\n\n return retVal;\n}", "analyze(){ return null }", "function checkNullObject(callback) {\n return function (err, object) {\n if (err)\n callback('Database error: ' + err, null);\n else if (!object || object.length === 0)\n callback('No record found', '');\n else\n callback(null, object);\n }\n }", "retrieveItem(key) {\n let item = null\n // Try to get the item first\n if (this.hasItem(key)) {\n item = this.getItem(key) || null // getItem returns undefined\n }\n\n if (item === null) {\n // Throw an error?\n }\n\n return item\n }", "try() {\n if (this.isOk()) {\n return this.value\n }\n throw this.error\n }", "getStatus(){\n const resourceData = this.props.resources[this.props.match.params.name]\n if (resourceData != undefined){\n return resourceData.Status\n }\n return null\n \n }", "async getCodeError () {\n\t\tconst { objectId, objectType } = this.request.query;\n\t\tif (!objectId) {\n\t\t\tthrow this.errorHandler.error('parameterRequired', { info: 'objectId' });\n\t\t}\n\t\tif (!objectType) {\n\t\t\tthrow this.errorHandler.error('parameterRequired', { info: 'objectType' });\n\t\t}\n\n\t\tthis.codeError = await this.data.codeErrors.getOneByQuery(\n\t\t\t{\n\t\t\t\tobjectId,\n\t\t\t\tobjectType \n\t\t\t},\n\t\t\t{\n\t\t\t\thint: CodeErrorIndexes.byObjectId\n\t\t\t}\n\t\t);\n\t\tif (!this.codeError) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'codeError' });\n\t\t}\n\t\tif (this.headerAccountId !== this.codeError.get('accountId')) {\n\t\t\tthrow this.errorHandler.error('readAuth', { reason: 'accountId given in the header does not match the object' });\n\t\t}\n\t}", "getResponseError(resp) {\r\n if (resp.error && Array.isArray(resp.error) && resp.error[0]) {\r\n return resp.error[0].message ? Error(resp.error[0].message) : resp;\r\n }\r\n return null;\r\n }", "function getLocError(err) {\n\n $$.ajax({\n url: 'http://ip-api.com/json/',\n type: 'POST',\n dataType: 'jsonp',\n success: function(loc) {\n var geoip = JSON.parse(loc);\n console.log(\"geoip location=>\", geoip);\n location = {\n latitude: geoip.lat,\n longitude: geoip.lon,\n accuracy: 500\n }\n data.location = location;\n submit();\n },\n error: function(err) {\n console.log(\"get html5 LocError!\");\n\n var lon = getCookie(\"lon\");\n var lat = getCookie(\"lat\");\n location = {\n latitude: lat,\n longitude: lon\n }\n data.location = location;\n $$(\"#finishStep\").removeAttr('disabled');\n submit();\n // if get geoip's data failed then give a default loaciotn from user setting.\n }\n }); // end ajax\n\n } // end error", "firstError (fieldId) {\n if (!(fieldId in this.fields)) {\n return null;\n }\n\n return this.fields[fieldId].errors.first\n }", "getResult() {}", "process(){\n return null;\n }", "get(key: K): ?V {\n var val = this.tree.find([key, null]);\n return val ? val[1] : null;\n }", "checkExistingQuery () {\n\t\treturn null;\n\t}", "getBlob(name) {\n const blob = this.blobs.filter(function(blob) {\n return blob.name === name\n })\n if (blob.length === 0) {\n return null\n }\n else {\n return blob[0]\n }\n }", "static get ERROR() { return 3 }", "snoopReadMiss(tag) {\r\n console.log('DEBUG ' + this.name + '.snoopReadMiss(tag=' + tag + ')')\r\n let lineNum = this.lineInCache(tag)\r\n if(lineNum == null) {\r\n console.log('DEBUG ' + this.name + ': not in this cache')\r\n return null\r\n } else {\r\n console.log('DEBUG ' + this.name + ': found in this cache')\r\n return this.getValues(lineNum)\r\n }\r\n }", "GetWsdlUrl () {\n return new Promise((resolve, reject) => {\n this.camera.core.getWsdlUrl()\n .then(results => {\n console.log('GetWsdlUrl successful')\n resolve(results)\n })\n .catch(error => {\n this.apiErrors.push('GetWsdlUrl')\n console.error('GetWsdlUrl failed')\n console.error(error.message)\n if ('fault' in error) {\n console.error(error.fault)\n }\n resolve(error)\n })\n })\n }", "getLastError () {\n\t\tlet lastAttempt = this.attempts[this.attempts.length - 1];\n\n\t\treturn lastAttempt.error;\n\t}", "function _dbFailure(error) {\n\treturn {\n\t\tsuccess: false,\n\t\terror: error,\n\t\tdata: undefined,\n\t};\n}", "match(input){ return null }", "function transactionError(err) {\n return commandName === 'commitTransaction' ? err : null;\n }", "function transactionError(err) {\n return commandName === 'commitTransaction' ? err : null;\n }", "function JPSpan_Util_ErrorReader() {}", "get() {\n return null;\n }", "get(input){\n var t = this.match(input)\n if(t.isError()) {\n input.setError(t)\n throw JSON.stringify(input.error.json())\n }\n return t.value \n }", "function getline () //int\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n {\n return webphone_api.plhandler.GetLine();\n }\n return -1;\n}", "function getErrorObject() {\n try { throw Error('') } catch(err) { return err; }\n}", "function ignore() {\n return null\n }", "init () {\n\t\treturn null;\n\t}", "function getFrame(objFrames,strFrameName) \n{\n\ttry \n\t{\n\t\tvar i = 0;\n\t\tfor (i=0; i<objFrames.length; i++) \n\t\t\tif (objFrames(i).name.toUpperCase() == strFrameName.toUpperCase())\n\t\t\t\treturn objFrames(i);\n\t}\n\tcatch (e)\n\t{\n\t\treturn null;\n\t}\n\treturn null;\n}", "function getError(err) {\n return db.getData(\"/clientError/\" + err + \"/clientid/\")\n}", "findFileInfoInSource(source, filenameToMatch) {\n if (\n source[filenameToMatch] !== undefined &&\n source[filenameToMatch] !== null\n ) {\n return source[filenameToMatch];\n }\n return null;\n }", "argumentError() {\n if (\"error\" in this.argument) {\n return this.argument.error;\n }\n return \"NO ERROR!!!\";\n }", "argumentError() {\n if (\"error\" in this.argument) {\n return this.argument.error;\n }\n return \"NO ERROR!!!\";\n }", "get error() {\r\n return this._error;\r\n }", "function findErrHandler(error, result) {\n\tif (error) {\n\t\tlog(\"cannot find data\")\n\t\tthrow error\n\t} else {\n\t\tlog(result) \n\t}\n}", "if (\n !deviceA.status ||\n !deviceB.status ||\n !deviceA.status.meta ||\n !deviceB.status.meta\n ) {\n return null;\n }", "_getPageMetadata() {\n return undefined;\n }", "checkDoc(doc) {\n if(doc) {\n if(doc!=null) {\n return {\n check: true,\n };\n } else {\n return {\n check: false,\n res: error.error\n };\n }\n } else {\n return {\n check: false,\n res: error.error\n };\n }\n }", "get(input){\n var t = this.match(input)\n if(t.isError()) {\n input.setError(t)\n throw JSON.stringify(input.error.json())\n }\n return t \n }", "function LookupError(key, defaultError) {\n var msg = '';\n var xml = '';\n try {\n if (typeof MOPROErrorMessages != 'undefined') {\n if (typeof MOPROErrorMessages.responseText != 'undefined') {\n xml = MOPROErrorMessages.responseText;\n }\n }\n // 1. need to escape tcm:component using \"\\\\\" escape character\n // 2. use CSS selector syntax, \"animal > dog > beagle to drill down to the key values\n // 3. find the sckey for the given key and extract the value in scValue from the siblings collection\n /*find('//tcm\\\\:component/tcm\\\\:data/tcm\\\\:content').*/\n msg = $(xml).find('systemcomponent > systemcomponentkeyvalues > sckey:contains(\"' + key + '\")').siblings().text();\n if (msg == '') msg = defaultError; // set default error message if not found in xml file\n }\n catch (m) {\n msg = defaultError;\n }\n return msg;\n}", "getOwner() {\n if (this.result && this.result.answer) {\n return this.result.answer.records[0].data.toString().split('=')[1]\n } else {\n return null\n }\n }", "function isSuccess(request) {\n if (request.kind === \"success\") {\n return request.result;\n }\n return null;\n}", "function isReferenceError(bResult)\r\n{\r\nreturn bResult? ERR_REF_YES : ERR_REF_NO;\r\n}", "isErr() {\n return false;\n }", "function cbGetCurPosFail(error) {\n switch(error.code) {\n case error.PERMISSION_DENIED:\n alert(\"User denied the request for Geolocation.\");\n break;\n case error.POSITION_UNAVAILABLE:\n alert(\"Location information is unavailable.\");\n break;\n case error.TIMEOUT:\n alert(\"The request to get user location timed out.\");\n break;\n case error.UNKNOWN_ERROR:\n alert(\"An unknown error occurred.\")\n break;\n }\n }", "unsafelyUnwrapErr() {\n return this.error;\n }", "function getAgentModelCallbackFailure(err) {\n log(\"(error) getAgentModelCallbackFailure: \" + err);\n }", "getStatus(pid) {\n\t\tconst status = this.statusCache[pid];\n\t\tif(status === undefined) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\treturn status;\n\t\t}\n\t}", "async firstOrFail() {\r\n const result = this.first();\r\n if (!result) {\r\n throw new NotFoundException('Resource');\r\n }\r\n return result;\r\n }", "findInvalidLine() {\r\n for(let lineNum = 0; lineNum < this.numberOfCacheLines; lineNum++) {\r\n let line = this.cacheLines[lineNum];\r\n if(line.state == States.INVALID) {\r\n return lineNum\r\n }\r\n }\r\n return null\r\n }", "function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; }", "function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; }", "function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; }", "function parse_PtgErr(blob) { blob.l++; return BErr[blob.read_shift(1)]; }", "get error() {\n return this._error;\n }", "GetData() {\n if (!this.sourceProfileName || !this.sourceProfileLocation) {\n try {\n this.sourceProfileName = this.migrator.sourceProfiles[0];\n this.sourceProfileLocation = this.migrator.sourceProfileLocations[0];\n } catch (e) {\n return null;\n }\n }\n\n return this.sourceProfileLocation;\n }", "function _getVersionInfo(version){\n for(var i=0; i<versions.length; i++){\n if(versions[i].version === version){\n return versions[i];\n }\n }\n return null;\n }", "function skip() {\n return null;\n }", "function error(e) {\n if (e.TAG === /* Ok */0) {\n return ;\n } else {\n return some(e._0);\n }\n }", "isDocumentExisted(documentName) {\n var checkExistedProcess = this.dbConnect.then((connection) => {\n return new Promise ((resolve, reject) => {\n connection.query('SELECT id FROM ' + dbDocumentInfo + ' WHERE documentName = ?', documentName, (err, results, fields) => {\n if (!err) {\n var docName = results\n var quantity = docName.length\n if(quantity === 1) {\n //connection.release()\n resolve(true)\n } else if (quantity === 0){\n // console.log('Inside dbDoc : ' + docName[0].id)\n //connection.release()\n resolve(false)\n } else {\n //connection.release()\n reject({err: {msg: 'There are two of them in Database - System ERR'}})\n }\n } else {\n reject(err)\n }\n })\n })\n }).catch((err) =>{\n return Promise.reject(err)\n })\n return checkExistedProcess\n }", "getElementAt(index) {\n // check if index passed in a valid position\n if(index >= 0 && index <= this.count) { \n let node = this.head;\n for(let i = 0; i < index && node != null; i++) {\n node = node.next;\n }\n return node;\n }\n return undefined;\n }", "function Null() {\n return null;\n}", "getError() {\n return this.error;\n }", "getDataFromEntry(entry){\n let _item = this.getFromEntry(entry); \n if(this._isNullItem(_item)) return null;\n ON_LOG && console.log('getDataFromEntry' , entry, _item);\n return _item.data;\n }", "function findUserById(id) {\n try {\n // add appropiate code here\n var user = _.find(users, function(o) { return o.id === id});\n if (user === undefined) \n throw \"Cannot read property 'id'\";\n var iFindUser = user.id + \" - \" + user.firstName + \" \" + user.lastName + \" is \" + user.age + \", \" + user.gender;\n return iFindUser;\n\n } catch (error) {\n return error;// Change this line\n console.log(error); // Change this line\n }\n}", "peekFirst() {\n return null;\n }", "zeroLookUp() {\n throw Error('No look up function is set, cant resolve dependencies!')\n }", "contactListFirst (query) {\n return this\n .contactList(query)\n .then(contacts => contacts[0] ? contacts[0] : null)\n ;\n }" ]
[ "0.5765271", "0.56466234", "0.563159", "0.55624133", "0.5494315", "0.5424768", "0.5417981", "0.5347017", "0.53146285", "0.53098774", "0.53098774", "0.53098774", "0.53098774", "0.5232575", "0.5213619", "0.51600593", "0.51181406", "0.51121545", "0.5107502", "0.51022875", "0.50987005", "0.50878155", "0.5064504", "0.50463235", "0.5043471", "0.5039734", "0.5039734", "0.5039734", "0.5039734", "0.50371", "0.5014815", "0.49976805", "0.4991594", "0.49872762", "0.49303684", "0.4930223", "0.49286172", "0.49255636", "0.49015307", "0.4883788", "0.48782405", "0.48764327", "0.48667267", "0.48387706", "0.48351687", "0.48290774", "0.48261923", "0.4818199", "0.4808753", "0.4806804", "0.47989583", "0.47868654", "0.4785911", "0.4785911", "0.4784187", "0.47774956", "0.47714177", "0.4768661", "0.47607496", "0.47596985", "0.47509864", "0.47481394", "0.47439903", "0.47405463", "0.47389987", "0.47389987", "0.4736724", "0.47357956", "0.47234404", "0.47123632", "0.47010428", "0.47000086", "0.46966523", "0.4691799", "0.46768862", "0.46734434", "0.46723807", "0.4669189", "0.46662235", "0.46650916", "0.46645424", "0.46621093", "0.4656937", "0.4656834", "0.4656834", "0.4656834", "0.4656834", "0.46551156", "0.46547964", "0.46545663", "0.46497673", "0.4645344", "0.4643459", "0.46422467", "0.46329898", "0.46259838", "0.46207783", "0.46162152", "0.46148768", "0.4609773", "0.46097293" ]
0.0
-1
Add user to DB
static async store(data) { try { const dob = moment(data.dob).toISOString(); const userData = { first_name: data.first_name, last_name: data.last_name, dob: dob, status: 1, }; const result = await UserModel.create(userData); return { status: 200, data: { message: 'User has been created successfully!', data: result } }; } catch (error) { return ErrorHandler.handleError(error); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addUser() {\n var user = {\n primaryEmail: '[email protected]',\n name: {\n givenName: 'Elizabeth',\n familyName: 'Smith'\n },\n // Generate a random password string.\n password: Math.random().toString(36)\n };\n user = AdminDirectory.Users.insert(user);\n Logger.log('User %s created with ID %s.', user.primaryEmail, user.id);\n}", "function registerUser() {\n addUser()\n }", "static add(user) {\n //wywołuje polecenie sql i zwraca promesę (Promise)\n return db.execute(\n 'insert into users (firstName, lastName) values (?, ?)',\n [user.firstName, user.lastName]\n );\n }", "async addUser(name){\n return user.create(name)\n }", "function addUser() {\n }", "async addUser(ctx) {\n try {\n var body = ctx.request.body;\n var user = new User();\n user.name = body.name;\n user.email = body.email;\n user.save();\n ctx.body = { status: 200, message: \"data save \", user: user }\n }\n catch (error) {\n ctx.throw(error)\n }\n }", "function addUserToDB(id , name) {\n url = serverURL + \"/sendUserInfo\";\n sendPostRequest(url, {'id': id,'name': name});\n}", "function addUser({id, username, email, password}, callback = (x, y) => y || x) {\n let users = getModel('users')\n return users.insert({\n id, username, email,\n password: hashString(password)\n }, (err, result) => {\n return users.findOne({id}, callback)\n })\n}", "function createUser(req, res, next) {\n const sql = sqlString.format(`INSERT INTO users SET ?`, req.body)\n\n db.execute(sql, (err, result) => {\n if (err) return next(err)\n res.send('New user added successfully')\n })\n}", "function addNewUser() {\n}", "function createUser() {\n var newUser = {\n username: $usernameFld.val(),\n password: $passwordFld.val(),\n firstName: $firstNameFld.val(),\n lastName: $lastNameFld.val(),\n role: $roleFld.val()\n };\n try {\n userService\n .createUser(newUser)\n .then(function (userServerInfo) {\n users.push(userServerInfo);\n renderUsers(users);\n resetInputFields();\n clearSelected();\n });\n }\n catch (err) {\n console.log(err.name + \": \" + err.message);\n }\n }", "function addUserToDB(uname){\n\tvar a = db.users.find({name: uname})[0];\n\tif (typeof a != 'object' || !'name' in a){\n\t\tvar user = new User(uname, 0, 0);\n\t\tdb.users.update({name: uname}, user, {multi: false, upsert: true});\n\t}\n}", "function add(newUser) {\n return db('users').insert(newUser);\n}", "function addUser({name, password}) {\n const a = findUser(name);\n const ic = generateInternalCode(name);\n if(a.i === ic) {\n return;\n } \n postUser(name, password);\n}", "function addUser (user) {\n return knex('users').insert(user)\n}", "function addUserToDb(args, onSuccess, onError){\n const user = new User(args)\n user.save((err, success) => {\n if (err) {\n console.log(err)\n onError(err)\n }\n else {\n console.log(\"Created a user\")\n onSuccess(success)\n }\n })\n}", "newUser(req, res, next) {\n // EXTRACT FORM DATA\n const { username, email, password } = req.body;\n\n // INSERT USER DATA INTO AN OBJECT\n let newUser = { username, email, password };\n\n // USE MODEL TO REGISTER A NEW USER\n User.addUser(newUser)\n .then(user => {\n res.status(201).json({\n success: true,\n message: 'User registered',\n user: {\n id: user.id,\n username: user.username,\n email: user.email\n }\n });\n })\n .catch(err => console.error(err));\n }", "function addUser(userName, firstName, password) {\n MongoClient.connect(database, function (err, db) {\n if (err) throw err;\n var dbo = db.db(\"TEAM_TASKS\");\n var newUser = {\n type: \"testing\",\n name: userName,\n firstName: firstName,\n pwd: password,\n projects: null,\n };\n dbo.collection(\"profiles\").insertOne(newUser, function (error, res) {\n if (error) throw error;\n console.log(\"1 document inserted\");\n db.close();\n });\n });\n}", "function add(user) {\n return db(\"users\")\n .insert(user, \"id\")\n .then(([id]) => findInfoBy({ id }));\n}", "function addUser(u){\n users.push(new userModel.User(u.username, u.firstName, u.lastName, u.email, u.password));\n console.log('Added user ' + u.username);\n}", "function insertNewUser({ username, firstname, lastname, email, password, admin }) {\n}", "function addUser(username, password, email)\n{\n var sqlQuery = `INSERT INTO users (username, password, email, data) VALUES (?, ?, ?, ?)`;\n dbCon.query(sqlQuery, [ username, password, email, null ], (err, res) => \n {\n if (err) throw err;\n console.log(\"User [\" + username + \"] successfully created\");\n });\n}", "function addUser(object, done, next){\r\n User.create(object).then((user) => {\r\n return done(user);\r\n }).catch(next);\r\n}", "addUser(user) {\n return db(\"users\")\n .insert(user, \"id\")\n .then(([id]) => db(\"users\").where({ id }));\n }", "function addUser() {\r\n user_name = document.getElementById(\"user_name\").value;\r\n firebase.database().ref(\"/\").child(user_name).child(user_name).update({\r\n purpose: \"adding user\"\r\n })\r\n }", "function addUser(user, callback){\n var newUser = new User(userToJson(user));\n newUser.save(callback);\n}", "async function addUser(req, res, next) {\n const user = new userModel_1.default(req.body);\n try {\n await user.save();\n return res.status(200).json({\n status: \"okay\",\n message: \"User successfully signed up\",\n });\n }\n catch (err) {\n res.status(400).json({\n error: dbErrorHandler_1.default.getErrorMessage(err),\n });\n }\n}", "function createUser() {}", "function addNewUser(firstName, lastName, phone, email, password, callback) {\n\tdb.query(`INSERT INTO users (firstname, lastname, phone, email, pword) VALUES('${firstName}', '${lastName}', '${phone}', '${email}', '${password}')`,\n\t(err) => {\n if(err) {\n console.log(err.stack);\n callback(true);\n } else {\n callback(null);\n }\n });\n}", "function addUser(username, password, callback) {\n\tvar instance = new MyUser();\n \tinstance.username = username;\n \tinstance.password = password;\n \tinstance.save(function (err) {\n\t if (err) {\n\t\t\tcallback(err);\n\t }\n\t else {\n\t \t callback(null, instance);\n\t }\n \t});\n}", "function insertUser(data) {\n\treturn db(\"team_members\").insert(data);\n}", "function register() {\n User.register(self.user, handleLogin);\n }", "addUser(user) {\n return Api.post(\"/admin/add-user\", user).then((r) => sendActionResult(r));\n }", "addNewUser({name, email, location}) {\n return mPool.collection(\"users\").\n insertOne({\n \"name\": name, \n \"email\": email,\n \"location\": location\n });\n }", "function addNewUser(user, db, callback){\n var twitter = db.db(\"twitter\");\n twitter.collection(\"users\").insertOne(user, function(err, res) {\n if (err) throw err;\n console.log(\"New user added to database: \", user);\n callback(err, user.email);\n });\n}", "addUser(user, callback) {\r\n\r\n let passwordMd5 = crypto.createHash('md5').update(user.password).digest('hex');\r\n\r\n let insert = {username: user.username, password: passwordMd5};\r\n this._connection.query('INSERT INTO users SET ?', insert, function (err, rows, fields) {\r\n if (err) {\r\n return callback(err);\r\n }\r\n\r\n callback(null, rows);\r\n }\r\n );\r\n\r\n this._connection.end();\r\n }", "function register(user) {\n return db('users').insert(user, ['id'])\n}", "function registerUserInDB(username, password){\n let newUser = new User({username: username, password: password});\n return newUser.save();\n}", "addUser(user,callback){\n baseRef.createUser({\n email:user.email,\n password:user.password\n },function(error,userData){\n baseRef.post(userData.uid,{\n data:{name:user.name}\n })\n callback(error,userData);\n })\n }", "function registerUser() {\n let email = $(\"#txtEmail\").val();\n let pass= $(\"#txtPassword\").val();\n let first= $('#txtFirst').val();\n let last = $('#txtLast').val();\n let age = $('#txtAge').val();\n let address = $('#txtAddress').val();\n let phone = $('#txtPhone').val();\n let payment = $('#txtPayment').val();\n let color = $('#txtColor').val();\n\n let user = new User(email, pass, first, last, age, address, phone, payment, color);\n console.log(user);\n\n saveUser(user); // This function is on the storeManager\n clearUser();\n\n}", "function registerUser(){\r\n let email=$(\"#txtEmail\").val();\r\n let pass=$(\"#txtPassword\").val();\r\n let firstName=$(\"#txtFirst\").val();\r\n let lastName=$(\"#txtLast\").val();\r\n let age=$(\"#txtAge\").val();\r\n let address=$(\"#txtAddress\").val();\r\n let phone=$(\"#txtPhone\").val();\r\n let payment=$(\"#selPayment\").val();\r\n let color=$(\"#txtColor\").val();\r\n let user = new User(email,pass,firstName,lastName,age,address,phone,payment,color);\r\n console.log(user);\r\n saveUser(user);// this function is on the storeManager\r\n clearForm();\r\n setNavInfo()\r\n\r\n}", "static add(name, username, password) {\n \n const salt = bcrypt.genSaltSync(saltRounds);\n \n const hash = bcrypt.hashSync(password, salt);\n return db.one(`insert into users (name, username, pwhash) values($1, $2, $3) returning id`, [name, username, hash])\n .then(data => {\n const u = new User(data.id, name, username);\n return u;\n })\n }", "function addUser(user) {\n users.push(user);\n }", "function addUser(user) {\n return db('username_password')\n .insert(user, 'id')\n .then(ids => {\n console.log(ids);\n return getUserByID(ids[0]);\n });\n}", "function addUser(newCompanyName, newUsername, newPassword, newPhoneNumber) {\n // Make a new user object\n let userData = {\n company: newCompanyName,\n username: newUsername,\n password: newPassword,\n phoneNumber: newPhoneNumber,\n permission: \"customer\"\n };\n\n // Add it to the users branch in firebase\n addToBranch(\"users\", userData)\n}", "function saveNewUser(user) {\n // gets userId from last user\n const allUsers = getAllUsers();\n user[0] = ++(allUsers.length);\n \n newUser.userId = user[0];\n newUser.firstName = user[1];\n newUser.lastName = user[2];\n newUser.email = user[3];\n newUser.password = user[4];\n \n if (allUsers[(allUsers.length-1)] == null) {\n allUsers[(allUsers.length-1)] = newUser;\n } else { allUsers.push(newUser); }\n \n setCurrentUser(user);\n setAllUsers(allUsers);\n }", "function addNewUser(name){\n var user={\n id:name,\n //new user always starts in this sector\n sector:\"000:000\",\n highscore:0,\n //user has random position\n x: randomInt(MIN_POS,MAX_POS),\n y:randomInt(MIN_POS,MAX_POS),\n };\n firebase.database().ref(\"users/\"+name).set(user);\n }", "async function addNewUser() {\n const randomTokenVerifying = genRandomToken(32);\n const encryptedToken = await bcrypt.hash(randomTokenVerifying, 8);\n\n // 2] generate url for verification\n const url = `${frontend_link}/verifyEmail/${randomTokenVerifying}`;\n\n await new Email({ firstName, email }, url).verifyEmail();\n const user = await User.create({\n firstName,\n lastName,\n email,\n password,\n passwordConfirm,\n phone,\n photo,\n });\n\n // 4-a] save random token to database after hashing it && change expiry date\n\n //====================\n\n user.randomTokenVerifying = encryptedToken;\n await user.save({ validateBeforeSave: false });\n res.status(200).json({\n status: 'success',\n data: user,\n });\n }", "function addUser(data) {\n var stmt = db.prepare(\"INSERT INTO User (UserName, UserProfile) VALUES (?, ?)\", function (err) {\n if (err) {\n console.log(err);\n return false;\n }\n else {\n var jsonStr = JSON.parse(data);\n stmt.run(jsonStr[0].UserName, jsonStr[0].UserProfile);\n stmt.finalize();\n }\n });\n return true;\n}", "function registerUser(){\n Cloud.Users.create({\n username: \"push123x\",\n password: \"push123x\",\n password_confirmation: \"push123x\",\n first_name: \"Firstname\",\n last_name: \"Lastname\"\n }, function (e) {\n if (e.success) {\n \talert(\"User Created\");\n \tloginUser();\n } else {\n \talert(\"Error :\"+e.message);\n }\n });\n}", "function addUser(username, password, callback) {\n var instance = new MyUser();\n\n instance.username = username;\n instance.password = password;\n instance.save(function (error) {\n if (error) {\n callback(error);\n } else {\n callback(null, instance);\n }\n });\n}", "addUser(callback) {\n var self = this;\n \n // Check if given username is available.\n self.isUsernameAvailable(function(err, available) {\n if (err) callback(err);\n if(available) {\n var sql = \"INSERT INTO user (username, password) VALUES (?,?)\";\n pool.getConnection(function(con_err, con) {\n if(con_err) {\n console.log(\"Error - \" + Date() + \"\\nUnable to connect to database.\");\n callback(con_err);\n return;\n }\n \n con.query(sql, [self.username, md5(self.password)], function (err, result) {\n if (err) {\n console.log('Error encountered on ' + Date());\n console.log(err);\n callback(null, false);\n con.release();\n return;\n } \n \n // Assign a planet of difficulty 1 to the new user\n var planet_user = new PlanetUser(result.insertId);\n \n planet_user.addNewPlanet(1, function(err_planet, result_planet) {\n if (err_planet) {\n console.log('Error encountered on ' + Date());\n console.log(err_planet);\n callback(null, false);\n con.release();\n return;\n }\n callback(null,true);\n con.release();\n });\n });\n });\n }\n else {\n callback(null, false);\n }\n });\n \n }", "function write_user(options, completed, failed) {\n db.users.erase_db(function(removed_data){\n db.users.add(options, function(added_data){\n // console.log(added_data);\n completed(added_data);\n });\n });\n}", "function registerUser(newUserObj, done) {\n logger.info(\"Inside service method - register user\");\n newUserObj.userId = uuidv4();\n usersDao.addUser(newUserObj, done);\n}", "function registerNewUser() {\n USER_NAME = buildNewName();\n USER_PWD = buildNewPassword();\n register(USER_NAME, USER_PWD);\n}", "async addUser(name, email){\n let res = await db.query('INSERT INTO users (id, name, email) VALUES (0, ?, ?)', [name, email]);\n\n return res;\n }", "create(user) {\n const { firstName, lastName, email, password, role, refreshToken } = user;\n const stmt = this.db.prepare(\n \"INSERT INTO users (firstName, lastName, email, password, role, refreshToken) VALUES (?, ?, ?, ?, ?, ?)\"\n );\n return stmt.run(firstName, lastName, email, password, role, refreshToken);\n }", "async function addUser(name, email, pwd, bio, profile_pic) {\n\tconst user = await findUser(name);\n if (user.length !== 0) {\n return false;\n }\n\tconst encrypted = mc.hash(pwd);\n\tconst salt = encrypted[0];\n\tconst hash = encrypted[1];\n\tawait db.signup(name, email, salt, hash, bio, profile_pic);\n return true;\n}", "function addUserToDatabase(data, cb) {\n usersFb = fb.child('users/' + fb.getAuth().uid);\n var uuid = usersFb.set(data);\n cb(uuid);\n }", "function createUser(req, res) {\n let user = req.body;\n // db Save\n // console.log(user);\n // if a new entry is created on server\n // memory -> ram\n userDB.push(user);\n fs.writeFileSync(path.join(__dirname,\n \"user.json\"),\n JSON.stringify(userDB));\n // res status code server send \n res.status(201).json({\n success: \"successfull\",\n user: user\n })\n}", "function submitNewUser() {\n var json = `{\"username\": \"${username}\", \"email\": \"${email}\", \n \"password\": \"${password}\", \"role\":\"${role}\"}`;\n\n fetch('http://localhost:9090/users/add', {\n method: 'POST',\n body: json,\n headers: {\n 'Authorization': `bearer ${localStorage.getItem('access_token')}`,\n 'Content-Type': 'application/json'\n }})\n .then(res => res.json())\n .then(alert('New user added to system!'))\n .catch(console.error());\n }", "static createUser(userid, userEmail, lastname){\n admin.database().ref('user/' + userid).set({\n name: lastname,\n email: userEmail\n }).catch((err) => console.log(err));\n }", "function addUser() {\n return new Promise(function(resolve, reject) {\n var model = require('./api/user/model');\n\n var user = new model({\n username: 'sam',\n password: bcrypt.hashSync(md5('crow'), 10),\n displayName: 'Sam Crow',\n role: 9, //Admin role\n created: Date.now()\n });\n\n //check to see if user is already in db\n model.findOne({'username': user.username }, '_id', function(err, id) {\n if (err) {\n return reject(console.log(err));\n }\n if (id) {\n return reject(console.log('user is already in the db'));\n }\n\n user.save(function (err) {\n if (err) {\n return reject(console.log(err));\n } else {\n return resolve(console.log('user added to db'));\n }\n });\n });\n });\n}", "async addUser(ctx, next) {\n console.log('Controller HIT: UserController::addUser');\n return new Promise((resolve, reject) => {\n const usr = ctx.request.body;\n chpConnection.query({\n sql: `INSERT INTO User\n (\n fname,\n lname,\n email,\n payment\n ) VALUES (?, ?, ?, ?);`,\n values: [usr.fname,\n usr.lname,\n usr.email,\n usr.payment\n ]\n }, (err, res) => {\n if(err) {\n reject(err);\n }\n ctx.body = res;\n ctx.status = 200;\n resolve();\n });\n \n })\n .then(await next)\n .catch(err => {\n ctx.status = 500;\n ctx.body = {\n error: `Internal Server Error: ${err}`,\n status: 500\n };\n });\n }", "add(userObject, response) {\n //password encryption\n userObject.password = encryptOperations.encryptPassword(\n userObject.password\n );\n UserModel.create(userObject, (err) => {\n if (err) {\n console.log(\"Error in Record Add\");\n response.status(appCodes.SERVER_ERROR).json({\n status: appCodes.ERROR,\n message: \"Record Not Added Due to Error\"\n });\n } else {\n console.log(\"Record Added..\");\n sendMail(userObject.userid, \"register\");\n\n response\n .status(appCodes.OK)\n .json({ status: appCodes.SUCCESS, message: \"Record Added\" });\n }\n });\n }", "async addUser(username) {\n // Check if user already exists is in database\n const exists = await this.loadUser(username);\n\n // If user already exists, do not add User to Database\n if (exists) return false;\n\n return this.client.query(QUERIES.ADD_USER(username))\n .then(() => true)\n .catch((err) => {\n error(err);\n this.client.end();\n return false;\n });\n }", "function createUser() {\n var username = $('#usernameFld').val();\n var password = $('#passwordFld').val();\n var firstName = $('#firstNameFld').val();\n var lastName = $('#lastNameFld').val();\n var role = $('#roleFld').val();\n\n var user = new User(username,password,firstName,lastName,role,null,null,null);\n\n userService\n .createUser(user)\n .then(findAllUsers)\n .then(emptyUserForm);\n }", "function addTestUser() {\n let userId = dateFormat(new Date(), \"mmddHHMM\");\n // Generate Password\n let sha1sum = crypto.createHash(\"sha1\");\n sha1sum.update(\"12345\");\n let password = sha1sum.digest(\"hex\");\n\n return new Promise((resolve, reject) => {\n db.Profile.create({\n userId: userId,\n userPassword: password,\n avatar: \"\",\n name: `Test_${userId}`,\n mail: \"[email protected]\",\n website: \"https://csie.nuk.edu.tw\",\n lab: \"2066\",\n roll: \"member\",\n groups: [],\n collections: [],\n notifications: [],\n })\n .then(() => {\n resolve(userId);\n })\n .catch((err) => {\n reject(err);\n });\n });\n}", "function createUser(){\n let username = getUsername();\n let password = getPassword();\n\n if (username.length != 0){\n if (allUsers.has(username)){\n throw new Error(\"User with us\");\n }\n allUsers.set(username, password);\n console.log(\"User added: \" + username + \" \" + password);\n } else{\n throw new Error(\"Username is empty\");\n }\n}", "createUser (user) {\n\t\treturn User.create(user).exec();\n\t}", "save() {\n return db.execute('INSERT INTO users (user_name, user_password, user_email) VALUES (?, ?, ?)',\n [this.username, this.password, this.email]);\n }", "function upsertUser(userData) {\n $.post(\"/api/user/create\", userData)\n .then(function(){\n localStorage.setItem(\"currentUser\", JSON.stringify(userData));\n localStorage.setItem(\"loggedIn\", true);\n window.location = \"/\"\n });\n }", "function addUser(user) {\n\tdata.push(user);\n\tupdateDOM();\n}", "static async add(user) {\n // user.id = nextId++;\n // userExtent.push(user);\n // return user;\n if (!User.list().some(u => u.email.toLowerCase() === user.email.toLowerCase())) {\n user.id = nextId++;\n let hashedPass = await bcrypt.hash(user.passwordHash, 10)\n user.passwordHash = hashedPass\n userExtent.push(user);\n return true;\n }\n return false;\n }", "async function addNew(){\n try {\n const users = await createUser(req.body.id,req.body.name,\n req.body.surname,req.body.email,req.body.age);\n res.send(req.body);\n } catch (error) {\n res.status(400).send(`HTTP 400 -- Bad Request ~Missing Parameters`);\n }\n \n }", "function createUser(newUser){\n\n UserService\n .createUser(newUser)\n .then(\n function (doc) {\n vm.user = null;\n init();\n });\n }", "function putUser(req, res) {\n\tvar user = req.body.username;\n\tvar pass = req.body.password;\n\tvar date = new Date().toISOString().slice(0, 10);\n\tvar last = req.session.uid;\n\tif (req.body.usertype == 'Admin') {\n\t\tvar userType = 1;\n\t} else if (req.body.usertype == 'User') {\n\t\tvar userType = 2;\n\t}\n\n\tbcrypt.hash(pass, saltRounds, function(err, hash) {\n\t\tvar query = {\n\t\t\ttext: 'INSERT INTO users(username, password, user_type, date_entered, last_update) VALUES ($1, $2, $3, $4, $5)',\n\t\t\tvalues: [user, hash, userType, date, last]\n\t\t}\n\n\t\tmodel.pullData(query, (rows) => {\n\t\t\tconsole.log(rows);\n\t\t});\n\t});\n}", "function register(req, res) {\n \n const credentials = req.body;\n\n const hash = bcrypt.hashSync(credentials.password, 10);\n credentials.password = hash;\n\n db('users')\n .insert(credentials)\n .then(ids => {\n const id = ids[0];\n res.status(201).json({ newUserId: id });\n })\n .catch(err => {\n res.status(500).json(err);\n });\n}", "addUserToDB(username, userData, success=()=>{}, error=()=>{}) {\n const ref = this.firebase.database().ref('users');\n\n ref.update({\n [username]: {\n ...userData\n }\n })\n .then(() => {\n // console.log(`DB ${username} successfully added to database`);\n success();\n })\n .catch(e => {\n console.error(`DB error adding ${username} to database`);\n error(e);\n });\n }", "static async addUser(req, res) {\n try {\n let { error } = await validateUser(req.body);\n if (error) return res.status(200).json({ msg: error.details[0].message, error: true });\n\n let user = await User.findOne({ email: req.body.email });\n if (user) return res.status(200).json({ msg: 'You have already registered your account.', error: true });\n user = new User({\n name: req.body.name,\n email: req.body.email,\n password: req.body.password,\n employee_id: req.body.employee_id,\n slot_booked: false,\n vaccine_center: '',\n date: '',\n time_slot: '',\n vaccine_name: '',\n });\n const salt = await bcrypt.genSalt(10);\n user.password = await bcrypt.hash(user.password, salt);\n await user.save();\n delete user._doc.password;\n const token = user.getToken();\n res.json({ token, user, error: false });\n } catch (error) {\n res.json({ error: true, msg: error.message });\n }\n }", "addUser(first_name, last_name, email, passwordHash) {\t\n\t\tvar _this = this;\n\t\t//see notes\n\t\t\n\t\treturn _this.getUserByEmail(email)\n\t\t\t.then(rows => {\n\t\t\t\tif (rows) {\n\t\t\t\t\tvar err = new Error('User already exists');\n\t\t\t\t\terr.status = 409;\n\t\t\t\t\treturn err;\n\t\t\t\t} else {\n\t\t\t\t\treturn _this._connection\n\t\t\t\t\t\t.queryAsync(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'INSERT INTO USERS (first_name, last_name, email, passwordHash) ' + \n\t\t\t\t\t\t\t\t'VALUES (:first_name, :last_name, :email, :passwordHash)'\n\t\t\t\t\t\t\t), \n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfirst_name: first_name,\n\t\t\t\t\t\t\t\tlast_name: last_name,\n\t\t\t\t\t\t\t\temail: email,\n\t\t\t\t\t\t\t\tpasswordHash: passwordHash\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\treturn _this.getUserById(_this._connection.lastInsertId())\n\t\t\t\t\t\t\t\t.then(rows => {\t\t\n\t\t\t\t\t\t\t\t\treturn rows ? rows : new Error('AHHHHHHH!');\n\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}\n\t\t\t});\n\t}", "function addUser(userId, userTypeValue, generatedPassword, userParams, success, fail) {\n userParams[userKeys[0]] = userId;/** set user id */\n userParams[userKeys[4]] = \"MD5('\"+paramQ+generatedPassword+\"')\";/** Password : encoding */\n userParams[userKeys[5]] = 1; /** Active : 1 => yes */\n userParams[userKeys[7]] = 1; /** Generated password : 1 => yes */\n\n var query=\"INSERT INTO T_User \";\n var attributes=\"(\";\n var values=\"(\";\n var cpt=0; //Will represent the number of field in parameters.\n for(var i=0; i<userKeys.length;i++){\n if (userParams.hasOwnProperty(userKeys[i])) {\n if (cpt == 0) {\n attributes = attributes+ userKeys[i];\n values= values+\"'\"+ userParams[userKeys[i]]+\"'\";\n }\n else {\n if(i!=4){\n values= values+\", \"+\"'\"+userParams[userKeys[i]]+\"'\";\n }\n else{\n values= values+\", \"+userParams[userKeys[i]];\n }\n attributes = attributes+\", \"+ userKeys[i];\n }\n cpt++;\n }\n }\n attributes=attributes+\")\";\n values=values+\")\";\n query= query + attributes+\" VALUES \"+values;\n console.log(\"query for adding user: \"+query);\n\n connectionVariable.query( query, function (err, data) {\n if (err) throw err;\n else {\n success(data);\n updateUserIdInDB(userId, userTypeValue);\n }\n });\n}", "function addUserToTable(username, userType, userId) {\n users.set(userId, {username: username, userType: userType})\n refreshUserTable();\n}", "function addUser(user, callback) {\n\n var encrypted = encrypt(user.password, salt);\n\n var instance = new User();\n instance.username = user.username;\n instance.email = user.email;\n instance.password = encrypted;\n instance.access = user.access;\n\n instance.save(function (err) {\n if (err) {\n callback(err);\n }\n else {\n callback(null, instance);\n }\n\n });\n\n}", "createNewUser(cred){\n\t\treturn db.one(`INSERT INTO user_id(uname, password) VALUES ($[uname], $[password]) RETURNING *`, cred);\n\t}", "function addUser(userName, userEmail, userPW){\n\tvar firebaseRef = firebase.database().ref();\n\tfirebase.auth().createUserWithEmailAndPassword(userEmail,userPW).catch(function(error){\n\t// Handle Errors\n\talert(\"User was not added!!!\");\n\t\talert(error.message);\n\t});\n\tsetTimeout(function() {\t\n\t\tfirebase.auth().currentUser.updateProfile({\n\t\t\tdisplayName:userName,\n\t\t}).then(function() {\n\t\t // Update successful.\n\t\t alert(\"should have worked\");\n\t\t}).catch(function(error) {\n\t\t // An error happened.\n\t\t alert(\"did not set user name\");\n\t\t \t\t alert(error.message);\n\t\t});\n\t\tsetTimeout(function() {window.location=\"../Login/Login.html\";}, 500);\n\t},750);\n}", "function createUser(req, res, next) {\r\n\treq.body.age = parseInt(req.body.age);\r\n\r\n\tvar auth = _hashPassword(req.params.password);\r\n\r\n\tdb.none(`insert into users(first_name, last_name, email, password)` +\r\n\t `values(${first_name}, ${last_name}, ${email}, ${password})`,\r\n\t req.body)\r\n\t.then(function () {\r\n\t\tres.status(200)\r\n\t\t.json({\r\n\t\t\tstatus: 'success',\r\n\t\t\tmessage: 'Inserted one user'\r\n\t\t});\r\n\t})\r\n\t.catch(function (err) {\r\n\t\treturn next(err);\r\n\t});\r\n}", "function createUser (req, res, next) {\n console.log(req.body);\n db.none(`INSERT INTO \"user\" (user_name, email, profile_pic, password) VALUES ($1, $2, $3, $4)`, [req.body.user_name, req.body.email, req.body.profile_pic, req.body.password])\n .then(next())\n .catch(err => next(err));\n}", "_registerUser(id){\n\t\tthis.idUser = id;\n\t}", "static async addUser(req, res) {\n try {\n let { error } = await validateUser(req.body);\n if (error) return res.status(400).send(error.details[0].message);\n\n let user = await User.findOne({ email: req.body.email });\n if (user) return res.status(400).send(\"User already registered.\");\n user = new User({\n name: req.body.name,\n email: req.body.email,\n password: req.body.password,\n });\n const salt = await bcrypt.genSalt(10);\n user.password = await bcrypt.hash(user.password, salt);\n await user.save();\n\n const token = user.getToken();\n res.send(token);\n } catch (error) {\n res.send(error.message);\n }\n }", "function addUser (username, email, password, isAdmin) {\n const User = require('../lib/models/user');\n const roles = ['user'];\n\n if (isAdmin && isAdmin === true) {\n roles.push('admin');\n }\n\n User.findByEmailorUsername(username, email)\n .then((user) => {\n console.log('A user with this username/email already exists.', user.id);\n process.exit(1);\n })\n .error((err) => {\n // user does not exist already, proceed\n // encrypt password\n return User.encryptPassword(password);\n })\n .then((hash) => {\n console.info('Trying to save encrypted password:', username, hash);\n // create a new user with default role\n const newUser = new User({\n username: username,\n email: email,\n password: hash,\n roles: roles,\n isActive: true,\n verification: {\n token: undefined,\n isCompleted: true\n }\n });\n return newUser.save();\n })\n .then((user) => {\n console.log('Saved User: ', user.username, user.id);\n })\n .error((err) => {\n console.log(err);\n })\n .finally(() => {\n process.exit();\n });\n}", "async function addUser(name, clan) {\n isCon = await init_connection();\n if(!isCon) return null;\n\n var user_id = await getIdUser(name);\n var sql = `INSERT INTO \\`user\\`(\\`name\\`, \\`clan\\`) VALUES ('${name}','${clan}')`;\n const result = await query_db(sql);\n close_connection();\n return result;\n}", "async function add(user) {\n\t// sends info, gets id back\n\t// id is destructured from an array?\n\n\tclg(14, user)\n\tif (user.username && user.password && user.email) {\n\t\tconst [id] = await db('users').insert(user);\n\t\tclg(17, id)\n\n\t\treturn getById(id);\n\t} else {\n\t\treturn ({ err: \"Incomplete registration info. Check that all fields are sent.\" })\n\t}\n}", "function storeUserCallback (err) {\n if (err) {console.log(\"account already in database, moving on\");}\n else {console.log(\"inserted user into db\");}\n //I set googleid as primary key so uniqueness is forced.\n }", "add(user) {\n let mongo = new Mongo();\n return mongo.getNextSeq('user_id')\n .then(ret => {\n user.id = ret.seq;\n return mongo.insert(COLLECTION, user);\n });\n }", "function userCreate(cb) {\n\n var user = new User({\n _projectId: projects[0],\n username: 'DinushaDJ',\n email: '[email protected]',\n password: 'dinusha123',\n userType: 'Member'\n });\n\n user.save(function (err) {\n if (err) {\n cb('user', null);\n return\n }\n console.log('New User ' + user);\n users.push(user);\n cb(null, user)\n } );\n}", "function insertUser (userInfo) {\n var userId = (++dbCfg.lastId);\n var user = {\n \"name\": ('name' in userInfo) ? userInfo.name : \"No name\",\n \"age\": ('age' in userInfo) ? userInfo.age : \"0\",\n \"picture\": ('picture' in userInfo) ? userInfo.picture : \"http://placehold.it/32x32\",\n \"email\": ('email' in userInfo) ? userInfo.email : \"[email protected]\"\n };\n \n database[\"User\"+userId] = user;\n \n // Save data to file JSON\n fs.writeFile(cfgFile, JSON.stringify(dbCfg, null, 4), function(err) {\n if(err) {\n console.log(err);\n } \n });\n\n // Save data to file JSON\n fs.writeFile(outputFilename, JSON.stringify(database, null, 4), function(err) {\n if(err) {\n console.log(err);\n } \n });\n \n return '201 Created'; \n}", "function addAdminUser(uname, password, canSudo, fname, lname) {\n\n\tif ('undefined' === typeof uname || 'string' !== typeof uname || !uname || '' === uname) {\n\t\n\t\treturn console.log('Cannot add user; username is invalid.');\n\t\n\t}\n\t\n\tif ('-h' === uname || '--help' === uname || 'help' === uname) {\n\t\n\t\tactionHelp('adminUser add', 'Add an admin user.', '[username] [password] [canSudo] [first name] [last name]');\n\t\treturn process.exit();\n\t\n\t}\n\t\n\tif ('undefined' === typeof fname || 'string' !== typeof fname || !fname || '' === fname) {\n\t\n\t\tfname = null;\n\t\n\t}\n\t\n\tif ('undefined' === typeof lname || 'string' !== typeof lname || !lname || '' === lname) {\n\t\n\t\tlname = null;\n\t\n\t}\n\t\n\tif ('undefined' === typeof password || 'string' !== typeof password || !password || '' === password) {\n\t\n\t\tconsole.log('Cannot add user; password is invalid.');\n\t\treturn process.exit();\n\t\n\t}\n\tif ('undefined' === typeof canSudo || 'string' !== typeof canSudo || !canSudo || '' === canSudo) {\n\t\n\t\tcanSudo = false;\n\t\n\t}\n\tvar rules = require('password-rules');\n\tvar pwInvalid = rules(password, {maximumLength: 255});\n\tif (pwInvalid) {\n\t\n\t\tconsole.log(pwInvalid.sentence);\n\t\treturn process.exit();\n\t\n\t}\n// \tvar users = new UserModel();\n\tvar now = new Date();\n\tvar newUserObj = {\n\t\t'fName': fname,\n\t\t'lName': lname,\n\t\t'uName': uname,\n\t\t'createdAt': now,\n\t\t'updatedAt': now,\n\t\tpassword,\n\t\t'sudoer': ('string' === typeof canSudo && 'true' === canSudo.toLowerCase()) ? true : false\n\t};\n\tglobal.Uwot.Users.createNew(newUserObj, function(error, user) {\n\t\n\t\tif (error) {\n\t\t\n\t\t\tconsole.log(error.message);\n\t\t\treturn process.exit();\n\t\t\n\t\t}\n\t\tconsole.log('User \"' + uname + '\" has been created (id ' + user._id + ').');\n\t\treturn process.exit();\n\t\n\t});\n\n}", "function postUser(req, res) {\n User.create({\n name: req.body.name,\n email: req.body.email,\n password: req.body.password\n },\n function (err, user) {\n if (err) return res.status(500).send(\"There was a problem adding the information to the database.\");\n res.status(200).send(user);\n });\n}", "function addAnotherUser() {\n // Need a unique id, will monotomically increase\n var id = getNextUserId();\n\n // Create and add the user to DOM\n createNewUser(id);\n\n // Make sure message about no users is hidden\n document.getElementById('no-added-users').style.display = 'none';\n\n // Always return false to disable the default action\n return false;\n}", "function addRoomUser(info) {\n\tvar dude = new PalaceUser(info);\n\tif (theRoom.lastUserLogOnID == dude.id && ticks()-theRoom.lastUserLogOnTime < 900) { // if under 15 seconds\n\t\ttheRoom.lastUserLogOnID = 0;\n\t\ttheRoom.lastUserLogOnTime = 0;\n\t\tif (!getGeneralPref('disableSounds')) systemAudio.signon.play();\n\t}\n\tif (theUserID == dude.id) {\n\t\ttheUser = dude;\n\t\tfullyLoggedOn();\n\t}\n\n\ttheRoom.users.push(dude);\n\tloadProps(dude.props);\n\tdude.animator();\n\tdude.grow(10);\n\tPalaceUser.setUserCount();\n}" ]
[ "0.80739707", "0.79174674", "0.77811867", "0.7635574", "0.75894004", "0.752532", "0.7488236", "0.74286664", "0.7428632", "0.7394747", "0.73926145", "0.7377662", "0.73639", "0.733781", "0.72928256", "0.72744596", "0.7272744", "0.7270755", "0.7226336", "0.7215022", "0.72028154", "0.71852535", "0.71820986", "0.71807325", "0.7118066", "0.711729", "0.71111465", "0.7104575", "0.7076962", "0.70696557", "0.7065581", "0.704817", "0.70198053", "0.7008913", "0.70075953", "0.6990284", "0.6980591", "0.6962849", "0.69574213", "0.6955182", "0.69380873", "0.6933641", "0.69321513", "0.69246024", "0.69230133", "0.6920526", "0.69089985", "0.6908305", "0.6906613", "0.6904802", "0.68960035", "0.6881634", "0.6880666", "0.6872521", "0.6866953", "0.6849504", "0.68369424", "0.68311834", "0.6830733", "0.6822192", "0.6821704", "0.68199694", "0.68134004", "0.68105185", "0.68025565", "0.6801876", "0.679965", "0.6792551", "0.67816806", "0.6769815", "0.67548996", "0.67343426", "0.67289454", "0.67282766", "0.6713096", "0.6703507", "0.6702498", "0.66978073", "0.66973186", "0.6694341", "0.66927314", "0.66910434", "0.6689657", "0.6688236", "0.66866857", "0.66798943", "0.66766614", "0.66638017", "0.6661077", "0.66593343", "0.66567516", "0.6656515", "0.6653067", "0.665268", "0.664805", "0.6647906", "0.6643715", "0.6641465", "0.66393393", "0.6634581", "0.6632492" ]
0.0
-1
Get list of users
static async index() { try { let users = await UserModel.find(); return { status: 200, data: { data: users, message: "Users list found successfully!" } }; } catch (error) { return ErrorHandler.handleError(error); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "users() {\r\n\t\treturn API.get(\"pm\", \"/list-users\");\r\n\t}", "async getUsers() {\n let userResult = await this.request(\"users\");\n return userResult.users;\n }", "async function listUsers() {\r\n let res = await request\r\n .get(reqURL(config.routes.user.list))\r\n .withCredentials()\r\n .set(\"Content-Type\", \"application/json\")\r\n .set(\"Accept\", \"application/json\")\r\n .auth(\"team\", \"DHKHJ98N-UHG9-K09J-7YHD-8Q7LK98DHGS7\");\r\n log(`listUsers:${util.inspect(res.body)}`);\r\n return res.body\r\n}", "function getUsers(){\n\t\t\tgetUsersService.getUserList().then(function(data){\n\t\t\t\tlc.listOfUser = data;\n\t\t\t})\n\t\t\t.catch(function(message){\n\t\t\t\texception.catcher('getUserList Service cannot succeed')(message);\n\t\t\t});\n\t\t}", "function findAllUsers() {\n return fetch('https://wbdv-generic-server.herokuapp.com/api/alkhalifas/users')\n .then(response => response.json())\n }", "function getUsers() {\n\treturn fetch(userURL).then((resp) => resp.json())\n}", "static async getUsers() {\n return await this.request('users/', 'get');\n }", "getAllUsers() {\n return Api.get(\"/admin/user-list\");\n }", "function findAllUsers() {\n return fetch(self.url).then(response => response.json())\n }", "function get_users(){\n\tconst q = datastore.createQuery(USER);\n\treturn datastore.runQuery(q).then( (entities) => {\n\t\t\treturn entities[0].map(ds.fromDatastore);\n\t\t});\n}", "function getUserList() {\n \n return userList;\n }", "function listUsers (req, res) {\n promiseResponse(userStore.find({}), res);\n}", "static getUsers() {\n return API.fetcher(\"/user\");\n }", "function getUsers(request, response) {\n User.find({}, function(err, users) {\n if(err) {\n response.status(500).json({message: \"No users were found.\"});\n }\n if(!users) {\n response.status(404).json({message: \"No users were found.\"});\n }\n var userList = [];\n users.forEach(function(element) {\n userList.push({name: element.fullName, userId: element.userId});\n })\n\n response.status(200).send(userList);\n })\n}", "async list() {\n\t\treturn this.store.User.findAll()\n\t}", "function get_users(){\n var q = datastore.createQuery(USERS);\n\n return datastore.runQuery(q).then( (entities) => {\n return entities;\n });\n}", "function getUsers() {\r\n apiService.getEntity('users')\r\n .then(function (response) {\r\n vm.users = response.data;\r\n notifyService.success('Users loaded.');\r\n }, function (error) {\r\n vm.message = 'Unable to load data: ' + error.message;\r\n });\r\n }", "function listUsers() {\n gapi.client.directory.users.list({\n 'customer': 'my_customer',\n 'maxResults': 100,\n 'orderBy': 'email',\n 'viewType': \"domain_public\"\n }).then(function(response) {\n var users = response.result.users;\n var menu = document.getElementById('menu-main');\n menu.className += \" show-toggle\";\n //appendPre('Directory Loaded, you may now Show Directory <a href=\"link\"> test </a>');\n if (users && users.length > 0) {\n for (i = 0; i < users.length; i++) {\n //console.log(user);\n var user = users[i];\n userlist.push(user)\n /*appendPre('-' + user.primaryEmail + ' (' + user.name.fullName + ')');\n if (user.organizations){\n appendPre(user.organizations[0].title);\n };\n if (user.thumbnailPhotoUrl){\n appendPre(user.thumbnailPhotoUrl)\n }*/\n }\n } else {\n appendPre('No users found.');\n }\n });\n }", "function getUsers() {\n fetch(userUrl)\n .then((res) => res.json())\n .then((users) => {\n sortUsers(users);\n displayLeaderBoard();\n })\n .catch((error) => console.error(\"ERROR:\", error));\n }", "function getUsers() {\n User.query(function(data){\n return self.all = data.users;\n });\n }", "async function getUserList() {\n\n // Connection properties\n var options = {\n method: 'GET',\n uri: conf.API_PATH + `5808862710000087232b75ac`,\n json: true\n };\n\n return (await request(options)).clients;\n}", "function getUserList() {\n userService.getUsers()\n .then(function (users) {\n var result = users.filter(function (u) {\n return u.Id !== vm.current.details.ownerId;\n });\n vm.ownerForm.users = result;\n });\n }", "async getUsers() {\n let res = await fetch('/users', {credentials: 'include', headers: {'Content-Type': 'application/json'}})\n let v = await res.json()\n return v\n }", "function getUsers() {\n return getItem('users');\n}", "function getUsers() {\n return db(\"users\").select(\"users.*\");\n}", "function userList() {\n let jsonFileRead = fs.readFileSync(path.join(__dirname, '../data/users.json'), 'utf-8')\n return JSON.parse(jsonFileRead)\n}", "function getUsers(users) {\n\tconst userList = JSON.parse(users);\n\tgetRepos(userList);\n\tdisplayUser(userList)\n}", "function getAllUsers(){\n return UserService.getAllUsers();\n }", "function findAllUsers(callback) {\n \treturn fetch(this.url)\n .then(function(response) {\n return response.json();\n });\n }", "function listUsers() {\n $listUsers.empty();\n\n if (event) event.preventDefault();\n\n var token = localStorage.getItem('token');\n $.ajax({\n url: '/users',\n method: 'GET',\n beforeSend: function beforeSend(jqXHR) {\n if (token) return jqXHR.setRequestHeader('Authorization', 'Bearer ' + token);\n }\n }).done(function (users) {\n showUsers(users, 0, 10);\n });\n }", "function getUsernameList() {\r\n\tvar userlist = getUsernames();\r\n\treturn userlist;\r\n}", "function listUsers(api, query) {\n return api_1.GET(api, '/users', { query })\n}", "function getUsers() {\n return userService.getUsers().then(function (data) {\n vm.users = data;\n return vm.users;\n })\n }", "function getallusers() {\n\n\t}", "function getAllUsers(callback) {\n requester.get('user', '', 'kinvey')\n .then(callback)\n}", "function getUsers() {\n subscribeService.getUsersContent()\n .then(function(data) {\n vm.data = data.slice(0, vm.data.length + 3);\n });\n }", "function getUsers() {\n return db('users')\n .select('id', 'username')\n}", "function listOfUsers() {\n request.get('https://slack.com/api/users.list?token='+\n process.env.Apptoken+'&pretty=1',function (err,requ,response)\n {\n var data= JSON.parse(response);\n usersLists=data.members;\n });//end of get users.list function\n}", "function getUsers(){\n return users;\n}", "function findAllUsers() {\n userService\n .findAllUsers()\n .then(renderUsers);\n }", "function _getUsers() {\n // var usersList = JSON.parse(localStorage.getItem('lsUsersList'));\n // if (usersList == null) {\n // usersList = users; //Lista de jugadores quemados\n // }\n // return usersList;\n return $http.get('http://localhost:3000/api/get_all_users');\n }", "async function getUsers() {\n const response = await api.get(`/users/?_sort=id&_order=desc`);\n\n if (response.data) {\n setCompletedListUsers(response.data);\n setListUsers(response.data);\n refreshCountPages(response.data);\n }\n }", "async function getUsers() {\n const allUsers = await User.findAll();\n return allUsers.map((user) => user.get({ plain: true }));\n}", "static getAllUsers() {\n return fetch('https://dev-selfiegram.consumertrack.com/users').then(response => {\n return response.json();\n }).catch(error => {\n return error;\n });\n }", "list(req, res) {\n\n return User\n .findAll({})\n .then(users => res.status(200).send(users))\n .catch(error => res.status(400).send(error));\n }", "static async getAllUsers() {\n try {\n logger.info('[user]: listing all users');\n const userList = await UserService.findAllUsers();\n\n return userList;\n } catch (e) {\n throw new InternalServerException();\n }\n }", "async getAllUsers(){\n data = {\n URI: `${ACCOUNTS}`,\n method: 'GET'\n }\n return await this.sendRequest(data)\n }", "function getUsers(req, res) {\n User.find({}, function (err, users) {\n if (err) return res.status(500).send(\"There was a problem finding the users.\");\n res.status(200).send(users);\n });\n}", "function getUsers() {\n\n intakeTaskAgeDatalayer.getUsersInFirm()\n .then(function (response) {\n self.allUser = response.data;\n }, function (error) {\n notificationService.error('Users not loaded');\n });\n }", "function getUsers() {\n return userService.getUsers().then(function(data) {\n vm.users = data;\n vm.loading = false;\n return vm.users;\n });\n }", "function getUsers(data){\n users = JSON.parse(data).results;\n renderUsers();\n}", "static async getUsers (token) {\n const query = `*[_type == 'user'] {\n name,\n _id\n }\n `\n client.config({ token })\n return client.fetch(query)\n }", "allUsers() {\r\n this.log(`Getting list of users...`);\r\n return this.context\r\n .retrieve(`\r\n SELECT emailAddress, password\r\n FROM Users\r\n `\r\n )\r\n }", "static async list(req, res) {\n try {\n const users = await UserService.list();\n res.status(200).send({ success: true, data: users });\n } catch (err) {\n res.status(500).send(errorResponse);\n }\n }", "function get_users(){\n var q = datastore.createQuery(USER);\n return datastore.runQuery(q).then( (entities) => {\n return entities[0];\n });\n}", "static getUsers() {\n const req = new Request('/api/users/', {\n method : 'GET',\n headers : this.requestHeaders()\n });\n return fetch(req).then(res => this.parseResponse(res))\n .catch(err => {\n throw err;\n });\n }", "function getUserList(){\r\n var userListforGet = [];\r\n for(var i=0;i<chatAppUsers.length;i++){\r\n userListforGet.push(chatAppUsers[i].currentUser);\r\n }\r\n return userListforGet;\r\n}", "getUsers() {\n return axios.get(USERS_REST_API_URL);\n }", "function listUsers() {\n const optionalArgs = {\n customer: 'my_customer',\n maxResults: 10,\n orderBy: 'email'\n };\n try {\n const response = AdminDirectory.Users.list(optionalArgs);\n const users = response.users;\n if (!users || users.length === 0) {\n console.log('No users found.');\n return;\n }\n // Print the list of user's full name and email\n console.log('Users:');\n for (const user of users) {\n console.log('%s (%s)', user.primaryEmail, user.name.fullName);\n }\n } catch (err) {\n // TODO (developer)- Handle exception from the Directory API\n console.log('Failed with error %s', err.message);\n }\n}", "static async getAll() {\n\t\tconst usersRes = await db.query(`SELECT * FROM users ORDER BY username`);\n\t\treturn usersRes.rows;\n\t}", "function getUsers(req, res) {\r\n User.getUsers((err, users) => {\r\n if (err) {\r\n res.status(500).send({ message: 'Error al obtener los usuarios' });\r\n } else {\r\n res.status(200).send({ users });\r\n }\r\n });\r\n}", "function getUsers() {\n return new Promise((resolve, reject) => {\n axios.get(`${BASE_URL}/users`)\n .then(res => {\n let users = res.data\n resolve(users)\n })\n })\n}", "function getUsers(cb) {\n const users = app.get('users');\n\n // Return a copy of the data\n const foundUsers = users.map(function(user) {\n return Object.assign({}, user);\n });\n\n debug(`#getUsers: found users: ${JSON.stringify(foundUsers, 0, 2)}`);\n return cb(null, foundUsers);\n}", "function getUsers(req, res) {\n var identity_user_id = req.user.sub;\n var page = 1;\n\n if (req.params.page) {\n page = req.params.page;\n }\n var itemsPerPage = 5;\n\n User.find().sort('_id').paginate(page, itemsPerPage, (err, users, total) => {\n if (err) {\n return res.status(500).send({\n message: 'Error en la petición'\n });\n }\n if (!users) {\n return res.status(404).send({\n message: 'No hay usuarios disponibles'\n });\n }\n followUserIds(identity_user_id).then((value) => {\n return res.status(200).send({\n users,\n users_following: value.following,\n user_follow_me: value.followed,\n total,\n pages: Math.ceil(total / itemsPerPage)\n });\n });\n });\n}", "get usersList() {\n return this.model.users.toArray();\n }", "function getAllUsers() {\n return User.find({}).select({username: \"test\", email: \"[email protected]\", whitelisted: true});\n}", "function getUsers(req, res) {\n var identify_user_id = req.user.sub;\n var page = 1;\n if (req.params.page) {\n page = req.params.page;\n }\n var itemsPerPage = 5;\n User.find().sort('_id').paginate(page, itemsPerPage, (err, users, total) => {\n if (err) return res.status(500).send({message: 'Error en la peticion'});\n if (!users) return res.status(400).send({message: 'No hay usuarios disponibles.'});\n followUserIds(identify_user_id).then((value) => {\n return res.status(200).send({\n users,\n users_following: value.following,\n users_follow_me: value.follow,\n total,\n pages: Math.ceil(total / itemsPerPage)\n });\n });\n });\n}", "retrieveUsers() {\n\n this.__updateToken__()\n return fetch(`${this.url}/users`, {\n\n headers: {\n authorization: `Bearer ${this.__userToken__}`\n }\n })\n .then(response => response.json())\n .then(response => {\n if (response.error) throw Error(response.error)\n\n return response\n })\n }", "listUsers(aud) {\n return this.user._request('/admin/users', {\n method: 'GET',\n audience: aud,\n });\n }", "function getUsers(req, res) {\n console.log('GET de todos los usuarios'.blue);\n UserSchema.find({}, (err, users) => {\n if (err) return res.status(500).send(err);\n if (!users) return res.status(404).send('No hay usuarios registrados');\n\n return res.status(200).send({ users });\n });\n}", "function getUsers (db = connection) {\n return db('users').select()\n}", "function getUsers(){ \n\treturn axios.get(users);\n}", "function getUsers(req, res) {\n var identity_user_id = req.user.sub;\n var pages = req.params.pages;\n var page = 1;\n if (req.params.page) {\n page = req.params.page;\n }\n var itemsPerPage = 5;\n\n User.find().sort('_id').paginate(page, itemsPerPage, (err, usuariosEncontrados, totalUsuarios) => {\n if (err) return res.status(500).send({ message: \"Error en la petición\" });\n if (!usuariosEncontrados) return res.status(404).send({ message: \"No hya usuarios disponibles\" });\n followUserIds(identity_user_id).then((value) => {\n var folllosObj = {\n follows: value.following,\n followsMe: value.followed\n }\n return res.status(200).send({\n usuariosEncontrados,\n totalUsuarios,\n pages: Math.ceil(totalUsuarios / itemsPerPage),\n follows: value.following,\n followsMe: value.followed\n });\n });\n\n });\n\n}", "function getUsers() {\n axios\n .get(process.env.REACT_APP_API_URL + \"/users\")\n .then((res) => {\n setUsers(res.data);\n // console.log(res.data);\n })\n .catch((err) => {\n console.log(\"Error listing the users\");\n });\n }", "function getUsers() {\n\t\t\t\tusers.getUser().then(function(result) {\n\t\t\t\t\tvm.subscribers = result;\n\t\t\t\t\tconsole.log(vm.subscribers);\n\t\t\t\t}, function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t}", "get users() {\n\t\treturn Joi\n\t\t\t.array()\n\t\t\t.items(this.user)\n\t\t\t.label('list_of_users');\n\t}", "async listUsers(req, res, next) {\n try {\n const users = await UsersService.listUsers();\n res.status(HTTPStatus.OK);\n res.json(users);\n } catch (error) {\n next(extendError(error, { task: 'Controller/listUsers' }));\n }\n }", "function getUsers(req, res){\n var identity_user_id = req.user.sub;\n\n // Por defecto se carga la pagina 1 sino obtener la pagina de la peticion\n var page = 1;\n if(req.params.page)\n page = req.params.page;\n\n var itemsPerPage = 5;\n\n // Obtenemos los usuarios de la BD y los ordenamos por ID una vez obtenidos se paginan con Mongoose Pagination\n User.find().sort('_id').paginate(page,itemsPerPage, (err,users,total) =>{\n\n if(err)\n return res.status(500).send({message: 'Error al Obtener los Usuarios'})\n\n if(!users)\n return res.status(404).send({message: 'No hay usuario disponibles'})\n\n followuserIds(identity_user_id).then((value) =>{\n return res.status(200).send({\n users,\n users_following : value.following,\n users_follow_me : value.followed,\n total,\n pages: Math.ceil(total/itemsPerPage)\n })\n })\n\n\n })\n}", "function getUserList(){\r\n var ret = [];\r\n for(var i=0;i<clients.length;i++){\r\n ret.push(clients[i].username);\r\n }\r\n return ret;\r\n}", "function getUsers() {\r\n var message = \"type=allUser\";\r\n sendFriendData(message, 'showUser');\r\n return 0;\r\n}", "function getUsers() {\n if(localStorage.getItem(\"users\") == null) {\n users = [];\n return users;\n } else {\n users = JSON.parse(localStorage.getItem(\"users\"));\n return users;\n }\n }", "function getUsers() {\n\n DashboardFactory.getUsers().then(\n\n function(response) {\n\n vm.users = response;\n console.log(response);\n \n // Get all the chats that the user is subscribed to\n getChatsForAUser();\n },\n\n function(error) {\n\n console.log(error);\n });\n }", "function GetUsers() {\n UserApi.getUser().then(function (response) {\n $scope.user = response.data;\n }), function () {\n aler(\"Unable to load users info\");\n }\n }", "async function listUsers() {\n try {\n const users = await UserModel.find();\n console.log(users);\n } catch (error) {\n console.log(error);\n }\n }", "async function getUsers() {\n let serverResponse = await userService.getUsers();\n if (serverResponse.status === 200) {\n setUsers(serverResponse.data);\n };\n }", "async getUserIds() {\n console.log('GET /users')\n return this.server.getUserIds()\n }", "async findAll() {\n const users = await fetch(\n \"https://run.mocky.io/v3/f7f2db83-197c-4941-be3e-fffd2ad31d26\"\n )\n .then((r) => r.json())\n .then((data) => {\n const list = [];\n data.map((row) => {\n let user = new User();\n user.id = row.id;\n user.fullName = row.name;\n user.email = row.email;\n user.avatar = row.avatar;\n list.push(user);\n });\n\n return list;\n });\n\n return users;\n }", "function listUsers(req, res, next) {\n const privateData = ['password'];\n const offset = parseInt(req.query.offset, 10) || 0;\n const limit = parseInt(req.query.limit, 10) || defaultLimit;\n User.find()\n .skip(offset)\n .limit(limit)\n .omit(privateData)\n .then(users => {\n if (!users.length) {\n return res.status(HTTPStatus.NO_CONTENT).end();\n }\n return res.status(HTTPStatus.OK).send(users);\n })\n .catch(err => next(err));\n}", "static async findAllUsers() {\n const userList = await User.find({});\n return userList;\n }", "getAllUsers() {\r\n return this.users;\r\n }", "function GetUserList() {\r\n\t\treturn $.ajax({\r\n\t\t\turl: '/api/usuarios/listar',\r\n\t\t\ttype: 'get',\r\n\t\t\tdataType: \"script\",\r\n\t\t\tdata: { authorization: localStorage.token },\r\n\t\t\tsuccess: function(response) {\r\n\t\t\t\tconst usuarios = JSON.parse(response);\r\n\t\t\t\t//console.log(usuarios); //<-aqui hago un console para ver lo que devuelve\r\n\t\t\t\tusuarios.forEach(user => {\r\n\t\t\t\t\ttablaUsuarios.row.add({\r\n\t\t\t\t\t\t\"cedulaUsuario\": user.cedulaUsuario,\r\n\t\t\t\t\t\t\"nombreCUsuario\": user.nombreCUsuario,\r\n\t\t\t\t\t\t\"emailUsuario\": user.emailUsuario,\r\n\t\t\t\t\t\t\"nickUsuario\": user.nickUsuario,\r\n\t\t\t\t\t}).draw();\r\n\t\t\t\t});\r\n\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function getList(){\n\t\t// call ajax\n\t\tlet url = 'https://final-project-sekyunoh.herokuapp.com/get-user';\n\t\tfetch(url)\n\t\t.then(checkStatus)\n\t\t.then(function(responseText) {\n\t\t\tlet res = JSON.parse(responseText);\n\t\t\tlet people = res['people'];\n\t\t\tdisplayList(people);\n\t\t})\n\t\t.catch(function(error) {\n\t\t\t// show error\n\t\t\tdisplayError(error + ' while getting list');\n\t\t});\n\t}", "function listUsers(callback) { \r\n this.users.find({}).toArray(function(err, arrayOfUsers) {\r\n var i;\r\n var nameArray = [];\r\n if (!err) {\r\n for (i = 0; i < arrayOfUsers.length; i++) {\r\n nameArray.push(arrayOfUsers[i].username);\r\n }\r\n }\r\n callback(err, nameArray);\r\n });\r\n}", "async function list(req, res, next) {\n try {\n const users = await User.find({/*activated: true*/}, 'username email')\n .sort({'username': 'asc'}).limit(50).exec();\n res.render('users/list', { title: 'Users', users: users }); \n } catch (err) {\n next(err);\n }\n}", "function fetchAllUsers() {\n return fetch(`${SERVER_URL}/users`, {\n headers: {\n Authorization: `Bearer ${userToken}`,\n },\n })\n .then(response => response.json())\n .then(data => setAllUsers(data))\n }", "async getAllUsers() {\n return User.findAll();\n }", "function getAllUsers() {\n let todoUsersDB = storage.getItem('P1_todoUsersDB');\n\n if (todoUsersDB) { return JSON.parse(todoUsersDB); }\n else { return []; }\n }", "function getUsers(request, response) {\n\n\tfunction respondOk(response, users) {\n\t\tresponse.json(users)\n\t}\n\n\tfunction respondError(response, error) {\n\t\tresponse.send(error)\n\t}\n\t// Consulta la base de datos, si no hay errores los devuelve los usuarios al cliente\n\tUser.find({})\n\t\t.then(users => respondOk(response, users))\n\t\t.catch(error => respondError(response, error))\n}", "function getAllUsers(){\n $.get(\"/getAllUsers\", function(users){\n let output =\n \"<table class='table table-striped table-bordered'>\" +\n \"<tr>\" +\n \"<th>Username</th>\" +\n \"</tr>\";\n\n for (const user of users){\n output +=\n \"<tr>\" +\n \"<td>\" + user.username + \"</td>\" +\n \"</tr>\";\n }\n output += \"</table>\";\n $(\"#allUsers\").empty().html(output);\n });\n }", "function getUsers() {\n\tvar apiurl = ENTRYPOINT;\n\treturn $.ajax({\n\t\turl: apiurl,\n\t\tdataType:DEFAULT_DATATYPE\n\t}).always(function(){\n\t\t//Remove old list of users, clear the form data hide the content information(no selected)\n\t\t$(\"#user_list\").empty();\n\t\t$(\"#mainContent\").hide();\n\n\t}).done(function (data, textStatus, jqXHR){\n\t\tif (DEBUG) {\n\t\t\tconsole.log (\"RECEIVED RESPONSE: data:\",data,\"; textStatus:\",textStatus)\n\t\t}\n\t\t//Extract the users\n \tvar users = data.collection.items;\n\t\tfor (var i=0; i < users.length; i++){\n\t\t\tvar user = users[i];\n\t\t\t//Extract the nickname by getting the data values. Once obtained\n\t\t\t// the nickname use the method appendUserToList to show the user\n\t\t\t// information in the UI.\n\t\t\t//Data format example:\n\t\t\t// [ { \"name\" : \"nickname\", \"value\" : \"Mystery\" },\n\t\t\t// { \"name\" : \"registrationdate\", \"value\" : \"2014-10-12\" } ]\n\t\t\tvar user_data = user.data;\n\t\t\tfor (var j=0; j<user_data.length;j++){\n\t\t\t\tif (user_data[j].name==\"nickname\"){\n\t\t\t\t\tappendUserToList(user.href, user_data[j].value);\n\t\t\t\t}\t\t\t\n\t\t\t} \n\t\t}\n\t\t//Set the href of #addUser for creating a new user\n\t\tsetNewUserUrl(data.collection.href)\n\t}).fail(function (jqXHR, textStatus, errorThrown){\n\t\tif (DEBUG) {\n\t\t\tconsole.log (\"RECEIVED ERROR: textStatus:\",textStatus, \";error:\",errorThrown)\n\t\t}\n\t\t//Inform user about the error using an alert message.\n\t\talert (\"Could not fetch the list of users. Please, try again\");\n\t});\n}", "function getUsers() {\n\tif (ite <= 40) {\n\t\tsetTimeout(() => {\n\t\t\tite += 1;\n\t\t\tinit().then(() => {\n\t\t\t\tgetUsers();\n\t\t\t});\n\t\t}, 600000);\n\t}\n\n\tconst options = {\n\t\t'method': 'GET',\n\t\t'hostname': 'api.intra.42.fr',\n\t\t'path': '/v2/cursus/21/users/?access_token=' + accessToken.token.access_token + '&per_page=100&filter[primary_campus_id]=1&page=' + ite + '&filter[staff?]=false&sort=-pool_year&range[pool_year]=0,3000'\n\t};\n\tconst req = https.request(options, (res) => {\n\t\tlet data;\n\t\tres.on(\"data\", d => {\n\t\t\tdata += d;\n\t\t});\n\t\tres.on(\"end\", () => {\n\t\t\tconst json = JSON.parse(data.substring(9));\n\t\t\tjson.map((j) => {\n\t\t\t\tuserIds.push(j.id);\n\t\t\t});\n\t\t\tconsole.log('\\x1b[32mFetched ' + userIds.length + ' students ids\\x1b[0m');\n\t\t\tgetUsersInfo();\n\t\t});\n\t});\n\treq.end();\n}" ]
[ "0.8353867", "0.83229417", "0.8300206", "0.8258981", "0.8253628", "0.8244871", "0.8203518", "0.8172488", "0.816256", "0.80803764", "0.8051225", "0.8040585", "0.80348986", "0.8028877", "0.8005243", "0.793545", "0.7906824", "0.7905672", "0.7902794", "0.784607", "0.78238183", "0.7815899", "0.78117734", "0.7781629", "0.77681625", "0.7764633", "0.77578974", "0.7751702", "0.7739862", "0.7737004", "0.7733298", "0.77314925", "0.77259386", "0.77136153", "0.7711568", "0.7699967", "0.76986706", "0.7692674", "0.7684312", "0.7677534", "0.76774067", "0.7673515", "0.76715475", "0.76677924", "0.7666137", "0.76652515", "0.7661951", "0.7651258", "0.7644598", "0.7634046", "0.76339835", "0.7630846", "0.7628565", "0.76217663", "0.76118153", "0.7601734", "0.7595864", "0.7589687", "0.75894684", "0.75733906", "0.7571333", "0.7565048", "0.75642085", "0.7546541", "0.7533765", "0.7527445", "0.7511506", "0.75111043", "0.7496792", "0.7486083", "0.7477156", "0.74584526", "0.7453131", "0.7452985", "0.7448896", "0.744889", "0.74482393", "0.74476624", "0.7446127", "0.7420868", "0.7416938", "0.7405423", "0.74003327", "0.7398765", "0.73960316", "0.73857504", "0.7384362", "0.7382913", "0.7378685", "0.737488", "0.7373461", "0.73652303", "0.7362655", "0.73478884", "0.73417306", "0.73323214", "0.7322544", "0.73217213", "0.7320399", "0.731803", "0.7305485" ]
0.0
-1
Toggle children on click.
function click(d) { if(d.name == "GO:0003700"){ r_click(r_root); n_click(d); }else if(d.name == "Groups"){ toggleGroups(); if(expanded == false){ root.children.forEach(collapse); r_click(r_root); } else{ root.children.forEach(expand); r_click(r_root); } update(root); }else { n_click(d); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_container.hasClass(\"hidden\"))\n child_container.removeClass(\"hidden\");\n else\n child_container.addClass(\"hidden\");\n });\n\n}", "_toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n }", "function toggleChildren(d) {\n var children = (d.children) ? d.children : null;\n var _children = (d._children) ? d._children : null;\n d._children = children;\n d.children = _children;\n return d;\n }", "function toggle(d) \n\t\t{\n\t\t\tif (d.children) \n\t\t\t{\n\t\t\t\td._children = d.children;\n\t\t\t\td.children = null;\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\td.children = d._children;\n\t\t\t\td._children = null;\n\t\t\t}\n\t\t\tupdate(d);\n\t\t}", "function toggle(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n}", "toggleSelected(value = null) {\n const toToggle = this;\n if (value == null) {\n if (toToggle.selected === true) {\n toToggle.selected = false;\n } else {\n toToggle.selected = true;\n }\n } else {\n toToggle.selected = value;\n }\n\n if (toToggle.children) {\n toToggle.children.forEach((child) => {\n child.toggleSelected(toToggle.selected);\n });\n }\n }", "function click(d) {\r\n\ttoggleChildren(d);\r\n\tupdate(d);\r\n}", "click(e) {\n $(ReactDOM.findDOMNode(e.currentTarget)).siblings('.collapsible-body').toggle();\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else if (d._children) {\n d.children = d._children;\n d._children = null;\n }\n }", "function getChilds(){ \n var current = $(this);\n var cat_id = current.attr('data-key');\n if($(\"#product-cat-child-\"+cat_id).length > 0){\n replaceChildHtml(cat_id);\n\n $(\"#product-cat-child-\"+cat_id).slideToggle('slow');\n $(this).toggleClass('carat-up');\n $(this).closest('.parent-checkbox-wrapper').toggleClass('parent-dropdown-open');\n }\n }", "function treeClick(id) {\n var tlr = document.getElementById(id);\n tlr.querySelector(\".nested\").classList.toggle(\"activeToggle\");\n tlr.classList.toggle(\"caret-down\");\n}", "function toggleAll(node) {\n if (node[childrenIdentifier]) {\n node[childrenIdentifier].forEach(toggleAll);\n toggle(node);\n }\n }", "function click(d) {\n d = toggleChildren(d);\n update(d);\n }", "function toggleAll(d) {\n\t\t\tif (d && d.children) {\n\t\t\t\td.children.forEach(toggleAll);\n\t\t\t\ttoggle(d);\n\t\t\t}\n\t\t}", "function showMobileChildren(event){\n\n $(event).parent().find('>ul').slideToggle(200, function(){\n\n $(event).parent().toggleClass('mobile-active');\n\n $(event).parent().hasClass('mobile-active') ? \n $(event).parent().find('.mobile-active').trigger('click') : '';\n\n });\n $(event).find('.fa').toggle();\n return false; \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d.children.forEach(expand); //Expand all at once\n d._children = null;\n }\n update(d);\n}", "function toggle(node) {\n if (node[childrenIdentifier]) {\n node._children = node[childrenIdentifier];\n node[childrenIdentifier] = null;\n } else {\n node[childrenIdentifier] = node._children;\n node._children = null;\n }\n }", "function _toggle() {\n\tconst parent = this.parentElement.parentElement;\n\tparent.classList.toggle('hidden')\n}", "function click(d) {\n\t\t\t\t\t\t//root.children.forEach(collapse);\n\t\t\t\t\t\tif (d.children) {\n\t\t\t\t\t\t\td._children = d.children;\n\t\t\t\t\t\t\td.children = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\td.children = d._children;\n\t\t\t\t\t\t\td._children = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tupdate(d);\n\t\t\t\t\t}", "toggle() {\n this.expanded = !this.expanded;\n }", "function toggleArtists(d) {\n\tif (d.children) {\n\t\td._children = d.children; //TEMPORARILY STORE CHILDREN IN ._CHILDREN TO HIDE\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children; //MOVE CHILDREN BACK INTO .CHILDREN TO SHOW\n\t\td._children = null;\n\t}\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d,viewOptions); \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //If the node has children, collapse unfolded sibling nodes\n if(d.parent)\n {\n d.parent.children.forEach(function(element){\n \n if(d !== element){\n collapse(element);\n \n }\n });\n }\n update(d);\n}", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n Erase(root);\n update(d);\n $(\"#search_bar\").select2(\"val\", \"\");\n}", "function clicked(d){\n if(d.children){\n d._children = d.children;\n d.children = null;\n }else{\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n console.log(d);\n }", "function treeToggle(el, force) {\n el = this;\n \n while(el != null && (!el.tagName || el.tagName.toLowerCase() != \"li\")) el = el.parentNode;\n \n // Get UL within the LI\n var childSet = findChildWithTag(el, 'ul');\n var topSpan = findChildWithTag(el, 'span');\n\n if( force != null ){\n \n if( force == \"open\"){\n treeOpen( topSpan, el )\n }\n else if( force == \"close\" ){\n treeClose( topSpan, el )\n }\n \n }\n \n else if( childSet != null) {\n // Is open, close it\n if(!el.className.match(/(^| )closed($| )/)) { \n treeClose( topSpan, el )\n // Is closed, open it\n } else { \n treeOpen( topSpan, el )\n }\n }\n}", "toggleDescendants(dataNode) {\n this.expansionModel.isSelected(dataNode)\n ? this.collapseDescendants(dataNode)\n : this.expandDescendants(dataNode);\n }", "function showChildren(number) {\n\t$(\"#p\" + number).toggle();\n\tif($(\"#p\" + number).is(':visible')) {\n\t\tthis.innerHtml = \"Collapse\";\n\t} else {\n\t\tthis.innerHtml = \"Expand\";\n\t}\n}", "function checkChildren() {\n\n\n $(\"#filter-accordion ul.dynatree-container li\").click(function () {\n $('.linkAll').removeClass('active-link');\n });\n}", "function toggleAllChildrenClass(item, from, to) {\n for (var i = 0; i < item.children.length; ++i) {\n var child = item.children[i];\n child.className = child.className.replace(from, to);\n if (child.children.length > 0) {\n toggleIcon(child); // Toggle all icon under it, too..\n }\n }\n}", "function click(d) {\r\n\t if (d.children) {\r\n\t d._children = d.children;\r\n\t self.foldGroup(d.name, d.children);\r\n\t d.children = null;\r\n\r\n\t } else {\r\n\t d.children = d._children;\r\n self.unfoldGroup(d.name, d.children);\r\n\t d._children = null;\r\n\t }\r\n\t update(d);\r\n\t getShowData('update');\r\n\t}", "function click(d) {\n\t\t if (d.children) {\n\t\t\td.hiddenChildren = d.children;\n\t\t\td.children = null;\n\t\t } else {\n\t\t\td.children = d.hiddenChildren;\n\t\t\td.hiddenChildren = null;\n\t\t }\n\t\t update(d);\n\t\t}", "function toggleTOCSections () {\r\n $(\".toc-parent\").each (function () {\r\n var parent = $(this);\r\n $(this).find('button').click (function (){\r\n if (parent.next().is (\":hidden\")){\r\n // show subtree\r\n parent.next().show('slow');\r\n $(this).text(\"-\");\r\n } else {\r\n // hide subtree \r\n parent.next().hide('slow');\r\n $(this).text(\"+\");\r\n }\r\n });\r\n });\r\n}", "toggleNodes() {\n\t\tif (this.toggleVisibility) {\n\t\t\tthis.hideNodes();\n\t\t\tthis.toggleVisibility = false;\n\t\t} else {\n\t\t\tthis.showNodes();\n\t\t\tthis.toggleVisibility = true;\n\t\t}\n\t}", "function toggle(d) {\n // Toggle collapsed status of node.\n if (d.children) collapse(d);\n else expand(d);\n drawScenegraph(d);\n} // end toggle", "onClick_() {\n this.fire('toggle-expanded');\n }", "function toggleChildren(containerID, numTasks) { \n \n let childElements = document.getElementById(containerID.id).childNodes;\n childElements = Array.from(childElements);\n childElements = childElements.filter((node) => {\n return (node.nodeType == Node.ELEMENT_NODE);\n });\n\n console.log(\"length of childNodes: \" + childElements.length);\n\n if (numTasks == 0) { 1// test if empty\n console.log(\"%cNo elements found to drop down\",\"color: orange;\");\n }\n else if (childElements[1].style.display == \"grid\") { // if displaying\n console.log(\"Hiding elements\");\n for (var i = 1; i < childElements.length; i++) { // hide child elements \n console.log(\" hiding element with id: \" + childElements[i].id);\n childElements[i].style.display = \"none\";\n \n }\n } \n else { // if hidden \n console.log(\"Revealing elements\");\n for (var i = 1; i < childElements.length; i++) { // reveal child elements\n console.log(\" revealing element with id: \" + childElements[i].id);\n childElements[i].style.display = \"grid\";\n }\n } \n}", "function childClick ($event) {\n $event.stopPropagation();\n }", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function toggleSubfields(e) {\n e.stopPropagation();\n $ul = getUl(this, 1);\n $ul.toggleClass('visible');\n}", "function click(d) {\n if (d.children) {\n \td._children = d.children;\n \td.children = null;\n } else {\n \td.children = d._children;\n \td._children = null;\n }\n update(d);\n }", "expand () {\n this.root.toggle(true, true);\n }", "function toggle(id, recursive)\n {\n var node;\n if (node = indexbyid[id]) {\n collapse(id, recursive, !node.collapsed);\n }\n }", "function onTargetChildrenClick() {\n console.log(\"Clicked onTargetChildrenClick\");\n // update the UI\n w3.toggleClass('#targetChildren', 'w3-red');\n w3.removeClass('#targetLGTBIQ', 'w3-red');\n w3.removeClass('#targetWomen', 'w3-red');\n w3.removeClass('#targetOrigin', 'w3-red');\n // toggle this filter and disable the others\n targetChildren = !targetChildren;\n targetLGTBIQ = false;\n targetWomen = false;\n targetOrigin = false;\n // trigger the find operation\n findLocationsInDatabase(\"FILTER\", -1);\n}", "function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }", "function click(d) {\n\t\n\t\n\t\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n build_tree(d);\n }", "collapse () {\n this.root.toggle(true, false);\n }", "toggle (recursive, state, depth) {\n depth= depth === undefined ? 999 : depth;\n this.open= (state === undefined ? !this.open : state);\n this.update();\n this.onExpand(this.open);\n this.control.onExpand(this, this.open);\n if (recursive && depth > 0 ) this.nodes.forEach( function(node) {\n node.toggle(true, this.open, depth-1);\n }, this);\n }", "function toggleAll(e) {\n allClosed = !allClosed;\n let carrots = document.getElementsByClassName('carrot');\n for(let i = 0; i < carrots.length; i++) {\n let target = carrots[i].parentElement.getElementsByTagName('div')[0];\n if(allClosed) {\n if(target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Hide All\";\n } else {\n if(!target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Expand All\";\n }\n }\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //update();\n }", "function showUp(parent) {\n parent.children[1].children[0].classList.toggle('active')\n}", "function click(d) {\n console.log(d);\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n\t\t\t if (d.children) {\n\t\t\t d._children = d.children;\n\t\t\t d.children = null;\n\t\t\t } else {\n\t\t\t d.children = d._children;\n\t\t\t d._children = null;\n\t\t\t }\n\t\t\t update();\n\t\t\t}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n \n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n var updateFlag;\n if (d.children) {\n updateFlag = d.children.length > 0;\n d._children = d.children;\n d.children = null;\n } else {\n updateFlag = d._children.length > 0;\n d.children = d._children;\n d._children = null;\n }\n\n //Avoid updating if node has no children\n if(updateFlag){\n update(d);\n }\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update();\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggle() {\n this._setState({\n expanded: !this.state.expanded,\n });\n }", "function subMenusMobile() {\r\n $(\".sub-active\").each(function() {\r\n $(this).click(function(event) {\r\n event.preventDefault();\r\n // Abrindo o submenu mobile\r\n $(this).children(\".sub-menu-mobile\").slideToggle(\"slow\");\r\n // Abrindo o submenu desktop\r\n $(this).children(\".sub-menu-desk\").slideToggle(\"slow\");\r\n\r\n })\r\n });\r\n}", "function click(d)\n {\n toggleChildren(d);\n printNodeInfo(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function toggle_button_click(e) {\n var $button = $(e.currentTarget);\n var $menu = $button.parent().parent().children('ul');\n var was_closed = $button.hasClass('menu-closed');\n\n if (was_closed) {\n expand($menu, $button);\n }\n else {\n collapse($menu, $button);\n }\n }", "function dd_click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n dd_update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n _this.update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function StructureToggle(ele) {\n ele.nextElementSibling.classList.toggle(\"show\")\n ele.children[0].classList.toggle(\"fa-rotate-180\");\n}", "function subNav_slideToggle() {\n $(this).toggleClass('nav__item--show-sub');\n }", "function collapse(d, x) {\n if (x && d === x) {\n return;\n }\n d.clicked = null;\n if(d.children) {\n d._children = d.children\n d.children = null\n d._children.forEach(collapse);\n }\n }", "function click(d) {\n /*if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);*/ \n }", "function click(d) {\n if (d.classe_id || d.root) {\n if (d.children) {\n //console.log(\"->1\")\n d._children = d.children;\n d.children = null;\n } else {\n if (d._children != null) {\n d.children = d._children;\n d._children = null;\n //console.log(\"anes\")\n //console.log(d.node_id)\n d.children.forEach(function (children) {\n expand(children);\n });\n }\n }\n update(d);\n } else {\n //código para mostrar os gráficos\n tooltip_tablle(d);\n }\n}", "function click(d) {\r\n if (d.children) {\r\n d._children = d.children;\r\n d.children = null;\r\n } else {\r\n d.children = d._children;\r\n d._children = null;\r\n }\r\n update(d);\r\n}", "function click(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate();\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "function click(d) {\n// use the following to superficially change the text of the node.\n// this.getElementsByTagName('text')[0].textContent = \"clicked all over\"\n\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n\n update(d);\n}", "toggle() {\n this.collapsed = !this.collapsed\n }", "toggle() {\n this.collapsed = !this.collapsed\n }" ]
[ "0.7110301", "0.6869267", "0.6655963", "0.6654497", "0.665069", "0.66472757", "0.66196424", "0.6617967", "0.6611529", "0.6591686", "0.654975", "0.6496521", "0.6458841", "0.64187694", "0.6404308", "0.63751197", "0.6367944", "0.6303494", "0.6300836", "0.6289716", "0.6254156", "0.62449163", "0.62185836", "0.6213884", "0.61919767", "0.61637324", "0.6153328", "0.6130195", "0.6120592", "0.610906", "0.61043257", "0.60996974", "0.609024", "0.6076921", "0.6074763", "0.606112", "0.6048441", "0.6042722", "0.60290366", "0.6028285", "0.60163766", "0.60163766", "0.6012505", "0.6011154", "0.5976089", "0.5975523", "0.59659415", "0.5965648", "0.5964318", "0.5962736", "0.5950743", "0.5935524", "0.5923737", "0.5915684", "0.590874", "0.5897785", "0.58961093", "0.5891918", "0.5891459", "0.5888909", "0.5887152", "0.58722585", "0.5865026", "0.5865026", "0.5865026", "0.5865026", "0.58564204", "0.5848972", "0.5847518", "0.5840483", "0.58384705", "0.5837155", "0.5837155", "0.5837155", "0.5837155", "0.5832259", "0.5824659", "0.5822542", "0.5822542", "0.5822381", "0.5820514", "0.58084506", "0.58084506", "0.58084506", "0.58084506", "0.5808143", "0.5806044", "0.58021504", "0.58007866", "0.5800026", "0.5793984", "0.5791451", "0.5790509", "0.5785115", "0.5785115", "0.57843536", "0.57843536", "0.5772498", "0.5769301", "0.57669365", "0.57669365" ]
0.0
-1
Toggle children on click.
function mouseout(d) { d3.select(this).select("text.hover").remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_container.hasClass(\"hidden\"))\n child_container.removeClass(\"hidden\");\n else\n child_container.addClass(\"hidden\");\n });\n\n}", "_toggleAllTreeItems() {\n this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n }", "function toggleChildren(d) {\n var children = (d.children) ? d.children : null;\n var _children = (d._children) ? d._children : null;\n d._children = children;\n d.children = _children;\n return d;\n }", "function toggle(d) \n\t\t{\n\t\t\tif (d.children) \n\t\t\t{\n\t\t\t\td._children = d.children;\n\t\t\t\td.children = null;\n\t\t\t} \n\t\t\telse \n\t\t\t{\n\t\t\t\td.children = d._children;\n\t\t\t\td._children = null;\n\t\t\t}\n\t\t\tupdate(d);\n\t\t}", "function toggle(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n}", "toggleSelected(value = null) {\n const toToggle = this;\n if (value == null) {\n if (toToggle.selected === true) {\n toToggle.selected = false;\n } else {\n toToggle.selected = true;\n }\n } else {\n toToggle.selected = value;\n }\n\n if (toToggle.children) {\n toToggle.children.forEach((child) => {\n child.toggleSelected(toToggle.selected);\n });\n }\n }", "function click(d) {\r\n\ttoggleChildren(d);\r\n\tupdate(d);\r\n}", "click(e) {\n $(ReactDOM.findDOMNode(e.currentTarget)).siblings('.collapsible-body').toggle();\n }", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else if (d._children) {\n d.children = d._children;\n d._children = null;\n }\n }", "function getChilds(){ \n var current = $(this);\n var cat_id = current.attr('data-key');\n if($(\"#product-cat-child-\"+cat_id).length > 0){\n replaceChildHtml(cat_id);\n\n $(\"#product-cat-child-\"+cat_id).slideToggle('slow');\n $(this).toggleClass('carat-up');\n $(this).closest('.parent-checkbox-wrapper').toggleClass('parent-dropdown-open');\n }\n }", "function treeClick(id) {\n var tlr = document.getElementById(id);\n tlr.querySelector(\".nested\").classList.toggle(\"activeToggle\");\n tlr.classList.toggle(\"caret-down\");\n}", "function toggleAll(node) {\n if (node[childrenIdentifier]) {\n node[childrenIdentifier].forEach(toggleAll);\n toggle(node);\n }\n }", "function click(d) {\n d = toggleChildren(d);\n update(d);\n }", "function toggleAll(d) {\n\t\t\tif (d && d.children) {\n\t\t\t\td.children.forEach(toggleAll);\n\t\t\t\ttoggle(d);\n\t\t\t}\n\t\t}", "function showMobileChildren(event){\n\n $(event).parent().find('>ul').slideToggle(200, function(){\n\n $(event).parent().toggleClass('mobile-active');\n\n $(event).parent().hasClass('mobile-active') ? \n $(event).parent().find('.mobile-active').trigger('click') : '';\n\n });\n $(event).find('.fa').toggle();\n return false; \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d.children.forEach(expand); //Expand all at once\n d._children = null;\n }\n update(d);\n}", "function toggle(node) {\n if (node[childrenIdentifier]) {\n node._children = node[childrenIdentifier];\n node[childrenIdentifier] = null;\n } else {\n node[childrenIdentifier] = node._children;\n node._children = null;\n }\n }", "function _toggle() {\n\tconst parent = this.parentElement.parentElement;\n\tparent.classList.toggle('hidden')\n}", "function click(d) {\n\t\t\t\t\t\t//root.children.forEach(collapse);\n\t\t\t\t\t\tif (d.children) {\n\t\t\t\t\t\t\td._children = d.children;\n\t\t\t\t\t\t\td.children = null;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\td.children = d._children;\n\t\t\t\t\t\t\td._children = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tupdate(d);\n\t\t\t\t\t}", "toggle() {\n this.expanded = !this.expanded;\n }", "function toggleArtists(d) {\n\tif (d.children) {\n\t\td._children = d.children; //TEMPORARILY STORE CHILDREN IN ._CHILDREN TO HIDE\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children; //MOVE CHILDREN BACK INTO .CHILDREN TO SHOW\n\t\td._children = null;\n\t}\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d,viewOptions); \n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //If the node has children, collapse unfolded sibling nodes\n if(d.parent)\n {\n d.parent.children.forEach(function(element){\n \n if(d !== element){\n collapse(element);\n \n }\n });\n }\n update(d);\n}", "function toggle(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n Erase(root);\n update(d);\n $(\"#search_bar\").select2(\"val\", \"\");\n}", "function clicked(d){\n if(d.children){\n d._children = d.children;\n d.children = null;\n }else{\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n console.log(d);\n }", "function treeToggle(el, force) {\n el = this;\n \n while(el != null && (!el.tagName || el.tagName.toLowerCase() != \"li\")) el = el.parentNode;\n \n // Get UL within the LI\n var childSet = findChildWithTag(el, 'ul');\n var topSpan = findChildWithTag(el, 'span');\n\n if( force != null ){\n \n if( force == \"open\"){\n treeOpen( topSpan, el )\n }\n else if( force == \"close\" ){\n treeClose( topSpan, el )\n }\n \n }\n \n else if( childSet != null) {\n // Is open, close it\n if(!el.className.match(/(^| )closed($| )/)) { \n treeClose( topSpan, el )\n // Is closed, open it\n } else { \n treeOpen( topSpan, el )\n }\n }\n}", "toggleDescendants(dataNode) {\n this.expansionModel.isSelected(dataNode)\n ? this.collapseDescendants(dataNode)\n : this.expandDescendants(dataNode);\n }", "function showChildren(number) {\n\t$(\"#p\" + number).toggle();\n\tif($(\"#p\" + number).is(':visible')) {\n\t\tthis.innerHtml = \"Collapse\";\n\t} else {\n\t\tthis.innerHtml = \"Expand\";\n\t}\n}", "function checkChildren() {\n\n\n $(\"#filter-accordion ul.dynatree-container li\").click(function () {\n $('.linkAll').removeClass('active-link');\n });\n}", "function toggleAllChildrenClass(item, from, to) {\n for (var i = 0; i < item.children.length; ++i) {\n var child = item.children[i];\n child.className = child.className.replace(from, to);\n if (child.children.length > 0) {\n toggleIcon(child); // Toggle all icon under it, too..\n }\n }\n}", "function click(d) {\r\n\t if (d.children) {\r\n\t d._children = d.children;\r\n\t self.foldGroup(d.name, d.children);\r\n\t d.children = null;\r\n\r\n\t } else {\r\n\t d.children = d._children;\r\n self.unfoldGroup(d.name, d.children);\r\n\t d._children = null;\r\n\t }\r\n\t update(d);\r\n\t getShowData('update');\r\n\t}", "function click(d) {\n\t\t if (d.children) {\n\t\t\td.hiddenChildren = d.children;\n\t\t\td.children = null;\n\t\t } else {\n\t\t\td.children = d.hiddenChildren;\n\t\t\td.hiddenChildren = null;\n\t\t }\n\t\t update(d);\n\t\t}", "function toggleTOCSections () {\r\n $(\".toc-parent\").each (function () {\r\n var parent = $(this);\r\n $(this).find('button').click (function (){\r\n if (parent.next().is (\":hidden\")){\r\n // show subtree\r\n parent.next().show('slow');\r\n $(this).text(\"-\");\r\n } else {\r\n // hide subtree \r\n parent.next().hide('slow');\r\n $(this).text(\"+\");\r\n }\r\n });\r\n });\r\n}", "toggleNodes() {\n\t\tif (this.toggleVisibility) {\n\t\t\tthis.hideNodes();\n\t\t\tthis.toggleVisibility = false;\n\t\t} else {\n\t\t\tthis.showNodes();\n\t\t\tthis.toggleVisibility = true;\n\t\t}\n\t}", "function toggle(d) {\n // Toggle collapsed status of node.\n if (d.children) collapse(d);\n else expand(d);\n drawScenegraph(d);\n} // end toggle", "onClick_() {\n this.fire('toggle-expanded');\n }", "function toggleChildren(containerID, numTasks) { \n \n let childElements = document.getElementById(containerID.id).childNodes;\n childElements = Array.from(childElements);\n childElements = childElements.filter((node) => {\n return (node.nodeType == Node.ELEMENT_NODE);\n });\n\n console.log(\"length of childNodes: \" + childElements.length);\n\n if (numTasks == 0) { 1// test if empty\n console.log(\"%cNo elements found to drop down\",\"color: orange;\");\n }\n else if (childElements[1].style.display == \"grid\") { // if displaying\n console.log(\"Hiding elements\");\n for (var i = 1; i < childElements.length; i++) { // hide child elements \n console.log(\" hiding element with id: \" + childElements[i].id);\n childElements[i].style.display = \"none\";\n \n }\n } \n else { // if hidden \n console.log(\"Revealing elements\");\n for (var i = 1; i < childElements.length; i++) { // reveal child elements\n console.log(\" revealing element with id: \" + childElements[i].id);\n childElements[i].style.display = \"grid\";\n }\n } \n}", "function childClick ($event) {\n $event.stopPropagation();\n }", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function toggleSubfields(e) {\n e.stopPropagation();\n $ul = getUl(this, 1);\n $ul.toggleClass('visible');\n}", "function click(d) {\n if (d.children) {\n \td._children = d.children;\n \td.children = null;\n } else {\n \td.children = d._children;\n \td._children = null;\n }\n update(d);\n }", "expand () {\n this.root.toggle(true, true);\n }", "function toggle(id, recursive)\n {\n var node;\n if (node = indexbyid[id]) {\n collapse(id, recursive, !node.collapsed);\n }\n }", "function onTargetChildrenClick() {\n console.log(\"Clicked onTargetChildrenClick\");\n // update the UI\n w3.toggleClass('#targetChildren', 'w3-red');\n w3.removeClass('#targetLGTBIQ', 'w3-red');\n w3.removeClass('#targetWomen', 'w3-red');\n w3.removeClass('#targetOrigin', 'w3-red');\n // toggle this filter and disable the others\n targetChildren = !targetChildren;\n targetLGTBIQ = false;\n targetWomen = false;\n targetOrigin = false;\n // trigger the find operation\n findLocationsInDatabase(\"FILTER\", -1);\n}", "function toggle() {\n setOpened(!opened);\n expandedCallback(!opened);\n }", "function click(d) {\n\t\n\t\n\t\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n build_tree(d);\n }", "collapse () {\n this.root.toggle(true, false);\n }", "toggle (recursive, state, depth) {\n depth= depth === undefined ? 999 : depth;\n this.open= (state === undefined ? !this.open : state);\n this.update();\n this.onExpand(this.open);\n this.control.onExpand(this, this.open);\n if (recursive && depth > 0 ) this.nodes.forEach( function(node) {\n node.toggle(true, this.open, depth-1);\n }, this);\n }", "function toggleAll(e) {\n allClosed = !allClosed;\n let carrots = document.getElementsByClassName('carrot');\n for(let i = 0; i < carrots.length; i++) {\n let target = carrots[i].parentElement.getElementsByTagName('div')[0];\n if(allClosed) {\n if(target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Hide All\";\n } else {\n if(!target.classList.contains('d-none')){\n carrots[i].dispatchEvent(new Event('click'));\n }\n e.innerHTML = \"Expand All\";\n }\n }\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n //update();\n }", "function showUp(parent) {\n parent.children[1].children[0].classList.toggle('active')\n}", "function click(d) {\n console.log(d);\n if (d.children) {\n\td._children = d.children;\n\td.children = null;\n } else {\n\td.children = d._children;\n\td._children = null;\n }\n update(d);\n}", "function click(d) {\n\t\t\t if (d.children) {\n\t\t\t d._children = d.children;\n\t\t\t d.children = null;\n\t\t\t } else {\n\t\t\t d.children = d._children;\n\t\t\t d._children = null;\n\t\t\t }\n\t\t\t update();\n\t\t\t}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n \n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n var updateFlag;\n if (d.children) {\n updateFlag = d.children.length > 0;\n d._children = d.children;\n d.children = null;\n } else {\n updateFlag = d._children.length > 0;\n d.children = d._children;\n d._children = null;\n }\n\n //Avoid updating if node has no children\n if(updateFlag){\n update(d);\n }\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update();\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggle() {\n this._setState({\n expanded: !this.state.expanded,\n });\n }", "function subMenusMobile() {\r\n $(\".sub-active\").each(function() {\r\n $(this).click(function(event) {\r\n event.preventDefault();\r\n // Abrindo o submenu mobile\r\n $(this).children(\".sub-menu-mobile\").slideToggle(\"slow\");\r\n // Abrindo o submenu desktop\r\n $(this).children(\".sub-menu-desk\").slideToggle(\"slow\");\r\n\r\n })\r\n });\r\n}", "function click(d)\n {\n toggleChildren(d);\n printNodeInfo(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n updateTree(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function toggle_button_click(e) {\n var $button = $(e.currentTarget);\n var $menu = $button.parent().parent().children('ul');\n var was_closed = $button.hasClass('menu-closed');\n\n if (was_closed) {\n expand($menu, $button);\n }\n else {\n collapse($menu, $button);\n }\n }", "function dd_click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n dd_update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n _this.update(d);\n }", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function StructureToggle(ele) {\n ele.nextElementSibling.classList.toggle(\"show\")\n ele.children[0].classList.toggle(\"fa-rotate-180\");\n}", "function subNav_slideToggle() {\n $(this).toggleClass('nav__item--show-sub');\n }", "function collapse(d, x) {\n if (x && d === x) {\n return;\n }\n d.clicked = null;\n if(d.children) {\n d._children = d.children\n d.children = null\n d._children.forEach(collapse);\n }\n }", "function click(d) {\n /*if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);*/ \n }", "function click(d) {\n if (d.classe_id || d.root) {\n if (d.children) {\n //console.log(\"->1\")\n d._children = d.children;\n d.children = null;\n } else {\n if (d._children != null) {\n d.children = d._children;\n d._children = null;\n //console.log(\"anes\")\n //console.log(d.node_id)\n d.children.forEach(function (children) {\n expand(children);\n });\n }\n }\n update(d);\n } else {\n //código para mostrar os gráficos\n tooltip_tablle(d);\n }\n}", "function click(d) {\r\n if (d.children) {\r\n d._children = d.children;\r\n d.children = null;\r\n } else {\r\n d.children = d._children;\r\n d._children = null;\r\n }\r\n update(d);\r\n}", "function click(d) {\n\tif (d.children) {\n\t\td._children = d.children;\n\t\td.children = null;\n\t} else {\n\t\td.children = d._children;\n\t\td._children = null;\n\t}\n\tupdate();\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "toggleExpand() {\n if (currentExpanded !== undefined) {\n currentExpanded.justToggleExpand();\n currentExpanded = undefined;\n }\n if (!this.state.expand && currentExpanded === undefined)\n currentExpanded = this;\n\n this.justToggleExpand();\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "handler( children ) {\n const { classes } = this.props\n const { state } = this\nreturn children.map( ( subOption ) => {\n if ( !subOption.children ) {\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n key={ subOption.name }>\n <Link \n to={ subOption.url }\n className={ classes.links }>\n <ListItemText \n inset \n primary={ subOption.name } \n />\n </Link>\n </ListItem>\n </div>\n )\n }\n return (\n <div key={ subOption.name }>\n <ListItem \n button \n onClick={ () => this.handleClick( subOption.name ) }>\n <ListItemText \n inset \n primary={ subOption.name } />\n { state[ subOption.name ] ? \n <ExpandLess /> :\n <ExpandMore />\n }\n </ListItem>\n <Collapse \n in={ state[ subOption.name ] } \n timeout=\"auto\" \n unmountOnExit\n >\n { this.handler( subOption.children ) }\n </Collapse>\n </div>\n )\n } )\n }", "function click(d) {\n// use the following to superficially change the text of the node.\n// this.getElementsByTagName('text')[0].textContent = \"clicked all over\"\n\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n update(d);\n}", "function click(d) {\n if (d.children) {\n d._children = d.children;\n d.children = null;\n } else {\n d.children = d._children;\n d._children = null;\n }\n\n update(d);\n}", "toggle() {\n this.collapsed = !this.collapsed\n }", "toggle() {\n this.collapsed = !this.collapsed\n }" ]
[ "0.7110301", "0.6869267", "0.6655963", "0.6654497", "0.665069", "0.66472757", "0.66196424", "0.6617967", "0.6611529", "0.6591686", "0.654975", "0.6496521", "0.6458841", "0.64187694", "0.6404308", "0.63751197", "0.6367944", "0.6303494", "0.6300836", "0.6289716", "0.6254156", "0.62449163", "0.62185836", "0.6213884", "0.61919767", "0.61637324", "0.6153328", "0.6130195", "0.6120592", "0.610906", "0.61043257", "0.60996974", "0.609024", "0.6076921", "0.6074763", "0.606112", "0.6048441", "0.6042722", "0.60290366", "0.6028285", "0.60163766", "0.60163766", "0.6012505", "0.6011154", "0.5976089", "0.5975523", "0.59659415", "0.5965648", "0.5964318", "0.5962736", "0.5950743", "0.5935524", "0.5923737", "0.5915684", "0.590874", "0.5897785", "0.58961093", "0.5891918", "0.5891459", "0.5888909", "0.5887152", "0.58722585", "0.5865026", "0.5865026", "0.5865026", "0.5865026", "0.58564204", "0.5848972", "0.5847518", "0.5840483", "0.58384705", "0.5837155", "0.5837155", "0.5837155", "0.5837155", "0.5832259", "0.5824659", "0.5822542", "0.5822542", "0.5822381", "0.5820514", "0.58084506", "0.58084506", "0.58084506", "0.58084506", "0.5808143", "0.5806044", "0.58021504", "0.58007866", "0.5800026", "0.5793984", "0.5791451", "0.5790509", "0.5785115", "0.5785115", "0.57843536", "0.57843536", "0.5772498", "0.5769301", "0.57669365", "0.57669365" ]
0.0
-1
Add string to end of the queue
enqueue(value) { this.storage[value] = value; this.count += 1; return this.storage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function push(str) { // Push a string onto the buffer.\n bufferText += str;\n update();\n }", "function enqueue(newElement){\n queue.push(newElement);\n }", "enQueue(element){\n return this.items.push(element); //item added to the queue array\n }", "enqueue(item) {\n\t\tthis.storage.add_to_tail(item);\n\t\tthis.length++;\n\t}", "add(item) {\n\t\tthis.queue.set(item, item);\n\t}", "enqueue(item) {\n this.queue.push(item);\n this.size += 1;\n }", "enQueue(value) {\n this._dataStore.push(value);\n this._length++;\n }", "function add () {\n if(queue.length)\n append(content, render(queue.shift()), top, sticky)\n }", "function add () {\n if(queue.length)\n append(content, render(queue.shift()), top, sticky)\n }", "enqueue(item) {\n queue.unshift(item);\n }", "enqueue(item) {\n queue.unshift(item);\n }", "enqueue(element) {\n // adding element to the queue\n this.items.push(element);\n }", "enqueue(element) {\n // adding element to the queue \n this.items.push(element);\n }", "enqueue(element) {\n // adding element to the queue \n this.items.push(element);\n }", "enqueue(element) {\n // adding element to the queue \n this.items.push(element);\n }", "enqueue(val) {\n this._queue.push(val);\n }", "push(string) {\n var nextKey = this.size();\n this.storage[nextKey] = string;\n return this.size();\n }", "enqueue(value) {\n if (!this.queueIsFull()) {\n this.queue.push(value)\n }\n }", "enqueue(data) {\n if (this.hasRoom()) {\n this.queue.addTail(data);\n this.size++;\n console.log(\n `'${data}' was added to the queue! The queue is now ${this.size}`\n );\n } else throw new Error(`The Queue has no more room to add new data!`)\n }", "add(element) { \n // adding element to the queue \n this.items.push(element); \n }", "function addToQueue(addMsg){\n\t\tfor (var i = 0; i < msgQueue.length; i++){\n\t\t\tvar msg = msgQueue[i];\n\t\t\tif (addMsg.timetag < msg.timetag){\n\t\t\t\tmsgQueue.splice(i, 0, addMsg);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t//otherwise add it to the end\n\t\tmsgQueue.push(addMsg);\n\t}", "enqueue(newItem) {\n this.q.push(newItem)\n }", "push(element) {\n const oldBack = this._back;\n let newBack = oldBack;\n if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {\n newBack = {\n _elements: [],\n _next: undefined\n };\n }\n // push() is the mutation most likely to throw an exception, so it\n // goes first.\n oldBack._elements.push(element);\n if (newBack !== oldBack) {\n this._back = newBack;\n oldBack._next = newBack;\n }\n ++this._size;\n }", "push(element) {\n const oldBack = this._back;\n let newBack = oldBack;\n if (oldBack._elements.length === QUEUE_MAX_ARRAY_SIZE - 1) {\n newBack = {\n _elements: [],\n _next: undefined\n };\n }\n // push() is the mutation most likely to throw an exception, so it\n // goes first.\n oldBack._elements.push(element);\n if (newBack !== oldBack) {\n this._back = newBack;\n oldBack._next = newBack;\n }\n ++this._size;\n }", "enqueue(item) {\n this.items.push(item); // adds an item to the queue\n }", "enqueue(data) {\n this.append(data)\n }", "function addTweetToQueue(e) {\n if (isReply(e)) {\n // eslint-disable-next-line no-console\n console.log('====================')\n // eslint-disable-next-line no-console\n console.log(`=IS REPLY RETURNING=`)\n // eslint-disable-next-line no-console\n console.log('====================')\n return\n }\n tweets.push({\n tweet: e.text,\n tweetId: e.id_str,\n user: e.user.screen_name,\n timeIn: new Date(newTimeIn()),\n timeOut: new Date(newTimeOut()),\n event: e // EVERYTHING!!!\n })\n // eslint-disable-next-line no-console\n console.log(`Item added to queue, current length=${tweets.length}`)\n}", "shiftEmpty() {\n for (i = this.maxLen-1; i > -1; i--) {\n if (this.queueControl[i] == '') {\n this.queueControl.unshift(this.queueControl.splice(i, 1).join())\n break\n }\n }\n }", "add(value){\n\n this.qLength++;\n\n //as Queue is collection of nodes, create a new node\n //also it's implementation is in FIFO so the new node is to be added at last node\n\n const newNode = {\n before:this.last,\n after:null,\n value:value,\n }\n\n //check if the Queue is empty and then set the new node as first node\n\n if(this.last ===null){\n this.first = newNode;\n } else{ /* if the Queue is not empty then set the after pointer of the last node\n to the new node */\n this.last.after = newNode;\n }\n // set the last pointer to the new node\n this.last = newNode;\n\n }", "async function addToNext(uri){\n \tconst newTrack = {\n \turi: uri[0],\n \tprovider: \"queue\",\n metadata: {\n is_queued: true, \n }\n }\n const currentQueue = Spicetify.Queue?.next_tracks\n currentQueue.unshift(newTrack)\n await Spicetify.CosmosAsync.put(\"sp://player/v2/main/queue\", {\n revision: Spicetify.Queue?.revision,\n next_tracks: currentQueue,\n prev_tracks: Spicetify.Queue?.prev_tracks\n }).catch( (err) => {\n \tconsole.error(\"Failed to add to queue\",err);\n \t Spicetify.showNotification(\"Unable to Add\");\n \t})\n \tSpicetify.showNotification(\"Added to Play Next\");\n }", "moveQueue() {\n if (this.localQueue.length > 0) {\n \n const currentEntry = this.localQueue[0];\n\n switch (currentEntry[0]) {\n case \"add\":\n addTrie(currentEntry[1]);\n break;\n case \"remove\":\n removeTrie(currentEntry[1]);\n break;\n }\n\n this.localQueue.shift();\n this.moveQueue();\n } else {\n this.queueProcessing = false;\n }\n }", "enqueue(element) {\n this.items[this.count] = element;\n this.count++;\n }", "function add(){\n var str = base64.encode(new Date().valueOf());\n queueSvc.createMessage(\"zhf-bash-1-queue\", str, function(error, results, response){\n if(!error){\n console.log(\"Success - createMessage\");\n } else {\n console.error(\"Error - createMessage\", error);\n }\n });\n}", "dequeue() {\n this._queue.shift();\n }", "function flush() {\n if (queue) {\n result.push(queue);\n if (handleText) {\n handleText.call(textContext, queue, {\n start: prev,\n end: now()\n });\n }\n queue = '';\n }\n }", "function addToMessageQueue(element)\n{\n messageQueue[messageQueue.length] = element;\n if(messageQueue.length == 1) functionNexMessage();\n}", "add(val) {\n this.buffer.push(val);\n this.buffer = this.buffer.slice(-this.size);\n }", "function flush() {\n if (queue) {\n result.push(queue);\n\n if (handleText) {\n handleText.call(textContext, queue, {\n start: prev,\n end: now()\n });\n }\n\n queue = EMPTY;\n }\n }", "function flush() {\n if (queue) {\n result.push(queue);\n\n if (handleText) {\n handleText.call(textContext, queue, {\n start: prev,\n end: now()\n });\n }\n\n queue = EMPTY;\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "function flush() {\n if (queue) {\n result.push(queue)\n\n if (handleText) {\n handleText.call(textContext, queue, {start: prev, end: now()})\n }\n\n queue = ''\n }\n }", "add(string, object) {\n this.array.push(object)\n this.string += string\n this.modified = true\n }", "enqueue(value) {\n const lastIndex = this._length + this._headIndex;\n this._storage[lastIndex] = value;\n this._length++;\n }", "addToQueue(f, pushFront = false) {\n if (pushFront) {\n this.commandQueue.unshift(f);\n }\n else {\n this.commandQueue.push(f);\n }\n }", "enqueue(element) {\n if (this.maxSize){\n if(this.rear+1 == this.maxSize){\n throw Error ('The queue is overflowing.');\n }\n }\n this.rear +=1;\n this.queue[this.rear] =element;\n }", "function enqueue(x) {\r\n\tqueue.push(x);\r\n}", "function write(str) {\n if (timer === null) {\n timer = setTimeout(flush, interval);\n }\n\n buf.push(str);\n }", "enqueue(element) {\n return this.items.push(element);\n }", "queueMessage(type='empty', message='', duration=1500) {\n if (type !== 'empty' && this.queue.length + 1 <= this.queueLimit) {\n this.queue.push({ type, message, duration, active: false, done: false });\n }\n\n let current = this.queue[0]; \n if (current && !current.active && !current.done) {\n this.queue[0].active = true;\n this.show(current.type, current.message, current.duration, function() {\n this.queue[0].done = true;\n this.queue.shift();\n this.queueMessage();\n });\n }\n\n }", "function enqueue(msg)\n\t {\n\t queue.push(msg);\n\t if (!tickUpcoming) {\n\t setImmediate(tick);\n\t }\n\t }", "function enqueue(msg)\n\t {\n\t queue.push(msg);\n\t if (!tickUpcoming) {\n\t setImmediate(tick);\n\t }\n\t }", "dequeue(){\n if(this.isEmpty()){\n return \"Empty Queue\"\n }\n return this.items.shift();\n }", "[types.ADDMESSAGEQUEUE](state, queue) {\n state.messageQueue.push(queue)\n }", "enqueue(element) {\n this.items.push(element);\n }", "denqueue() {\n debug(`\\nLOG: remove the queue`);\n this.queue.shift();\n }", "AddToQueue(song, msg) {\n if(this.queue.length < 1) {\n this.queue.push(song);\n this.Play(msg);\n }\n else {\n msg.channel.send(\"`\" + song.name + \"` **added to queue.**\");\n this.queue.push(song);\n }\n }", "enqueue(element) {\n this.collection.push(element);\n }", "enqueue(val) {\n // Declare our new item\n const node = new _Node(val);\n\n // If we don't have a first item, make this node first\n if ( this.first === null ) {\n this.first = node;\n };\n\n // If we have a last item, point it to this node\n if ( this.last ) {\n this.last.next = node;\n };\n\n // Make the new node the last item on the queue\n this.last = node;\n }", "add(item) {\n\t\t// limit items added to queue\n\t\tif (this.items.length === this.itemLimit) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.items.push(item);\n\t}", "function queue(){\n alert(\"You have been added to the queue.\")\n}", "function sendQueueEntry() {\n if (this._is_connected && this._queue.length) {\n this._uniqueSocket.write(this._queue[0][0], this._encoding, () => {\n\n // Get rid of sent message only if write was successful.\n let shifted_entry = this._queue.shift();\n\n // Second element of queue entry can be resolve function of promise,\n // if entry was pushed to queue as a result of IpcClient#whenEmitted call.\n if (shifted_entry[1] !== null && typeof shifted_entry[1] === \"function\") {\n shifted_entry[1](); // Resolve promise.\n }\n\n if (!this._queue.length) {\n this._emptying_queue = false;\n }\n else {\n sendQueueEntry.call(this);\n }\n });\n }\n else {\n this._emptying_queue = false;\n }\n}", "dequeue() {\n\n }", "function flush() {\n if (queue) {\n result.push(queue);\n\n if (options.text) {\n options.text.call(options.textContext, queue, {\n start: previous,\n end: now()\n });\n }\n\n queue = '';\n }\n }", "function Queue() {\n this.length = 0;\n}", "__sayNext (queue) {\n \treturn this.__sayThis(queue.shift()).then(() => {\n \t\treturn (queue.length > 0) ? this.__sayNext(queue) : null\n \t})\n \t}", "dequeue() {\n this.queue.shift()\n}", "queueGo() {\n let commands = [wcCommands.go()];\n\n this.queue.push(...commands);\n\n debug('Queueing Go Command');\n }", "enque(ele) {\n if (this.rear == this.capacity - 1) {\n console.log(\"Queue is full\");\n return;\n }\n if (this.front == -1) {\n this.front++;\n\n\n\n }\n this.items[++this.rear] = ele;\n this.Size++;\n }", "enqueue(elem) {\n this.items.push(elem)\n }", "enqueue(value) {\n const node = new NodeDeque(value);\n // only happens under null condition\n if (this.first === null) {\n this.first = node;\n }\n // Add to the end of the queue, because last equals something\n if (this.last) {\n this.last.next = node;\n this.last.prev = this.last;\n }\n //make the new node the last item on the queue\n this.last = node;\n }", "enqueue(value) {\r\n return this.data.addToBack(value);\r\n }", "enqueue(data) {\n const node = new _Node(data);\n\n if (this.first === null) {\n this.first = node;\n }\n\n if (this.last) {\n this.last.next = node;\n }\n //make the new node the last item on the queue\n this.last = node;\n }", "stringState(char) {\n if (char === MARK_OBJ.doubleQue) {\n this.state = this.stringMayEndState;\n } else {\n this.buffer += char;\n }\n }", "function nextInQueue() {\n if (!processing) {\n processing = true;\n rsmq.popMessage({ qname: name }, function (err, message) {\n if ( err ){\n console.log(err);\n processing = false;\n return\n }\n // Queue finished\n if (!message.id) {\n processing = false;\n return\n }\n // List how many remaining\n rsmq.getQueueAttributes({ qname: name }, function (err, resp) {\n if ( err ) {\n return;\n }\n\n console.log('Queue msgs remaining: ' + resp.msgs);\n });\n // Post it\n postToElastic(message);\n });\n }\n}", "enqueue(data) {\n const node = new _Node(data);\n \n if(this.first === null) {\n this.first = node;\n }\n\n if(this.last) {\n this.last.next = node;\n }\n //make the new node the last item on the queue\n this.last = node;\n }", "function pushToQueue( object, callback ) { \n callback();\n}", "function add_to_queue(video, message) {\r\n\r\n\tif(aliases.hasOwnProperty(video.toLowerCase())) {\r\n\t\tvideo = aliases[video.toLowerCase()];\r\n\t}\r\n\r\n\tvar video_id = get_video_id(video);\r\n\r\n\tytdl.getInfo(\"https://www.youtube.com/watch?v=\" + video_id, (error, info) => {\r\n\t\tif(error) {\r\n\t\t\tmessage.reply(\"La vidéo n'a pas été trouvé\");\r\n\t\t} else {\r\n\t\t\tqueue.push({title: info[\"title\"], id: video_id, user: message.author.username});\r\n\t\t\tmessage.reply('\"' + info[\"title\"] + '\" a été ajouté à la liste');\r\n\t\t\tif(!stopped && !is_bot_playing() && queue.length === 1) {\r\n\t\t\t\tplay_next_song();\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}", "add(job) {\n this.queue.push(job);\n }", "enqueue(element) {\n _(this).collection.push(element);\n return this;\n }", "enqueue(value){\n return this.linkedList.append(value);\n }", "enqueue (value) {\n if (this.checkOverflow()) return\n if (this.checkEmpty()) {\n this.front += 1\n this.rear += 1\n } else {\n if (this.rear === this.maxLength) {\n this.rear = 1\n } else this.rear += 1\n }\n this.queue[this.rear] = value\n }", "function addFileToQueue (f) {\n\tfor (var i = 0; i < stats.fileQueue.length; i++) { //see if it's already on the queue\n\t\tif (stats.fileQueue [i].f == f) {\n\t\t\treturn;\n\t\t\t}\n\t\t}\n\tstats.fileQueue [stats.fileQueue.length] = {\n\t\tf: f\n\t\t}\n\t}", "enqueue(value) {\n // Create a new node to store the value\n let node = new _Node(value);\n\n // If the node is the first to be added\n if (this.first === null) {\n this.first = node;\n this.size++;\n }\n\n // Shift existing node in last to the next position in queue\n if (this.last) {\n this.last.next = node;\n }\n\n // Make the new node last\n this.last = node;\n this.size++;\n }", "enqueue(item) {\n\t\tthis.stack1.add(item);\n\t}", "enqueue(data){\n if(!this.isFull()){\n this.data[this.rear] = data;\n if(this.rear === this.data.length-1){\n this.rear = 0;\n }else{\n this.rear ++;\n }\n }\n }", "function addToQueue(fn) {\n if (working) {\n queue.push(fn);\n } else {\n fn();\n }\n}", "enqueue(data){\n const node = new _Node(data);\n\n //makes new node first if null\n if(this.first === null){\n this.first = node;\n }\n\n //moves last node up in the queue\n if(this.last){\n this.last.next = node;\n }\n\n //make new node the last item\n this.last = node;\n }", "function new_queue() {\n let items = [...get_queue(), ...truncated];\n run(items);\n }", "enqueue(value) {\n this.storage.push(value);\n }", "dequeue () {\n while (!this.deflating && this.queue.length) {\n const params = this.queue.shift();\n\n this.bufferedBytes -= params[1].length;\n params[0].apply(this, params.slice(1));\n }\n }", "fillQueueWithBag() {\n while (this.queue.length < this.queueLength) {\n if (this.isBagEmpty()) {\n this.createNewBag()\n }\n\n let bagTetromino = this.bag.shift()\n\n this.queue.push(bagTetromino)\n }\n }", "enqueue(element, priority) { \n // creating object from queue element \n var qElement = new QElement(element, priority); \n var contain = false; \n \n // iterating through the entire \n // item array to add element at the \n // correct location of the Queue \n for (var i = 0; i < this.items.length; i++) { \n if (this.items[i].priority > qElement.priority) { \n // Once the correct location is found it is \n // enqueued \n this.items.splice(i, 0, qElement); \n contain = true; \n break; \n } \n } \n \n // if the element have the highest priority \n // it is added at the end of the queue \n if (!contain) { \n this.items.push(qElement); \n } \n }", "enqueue(value) {\n this.#queue = [value].concat(this.#queue);\n return this.#queue;\n }", "function next(queue) {\n var n = queue.current.length;\n for (var i = n; i < queue.max; i++) {\n var qi = queue.items.shift();\n if (!qi) {\n return;\n }\n queue.current.push(qi.resolve(queue));\n }\n }", "addQueue (fbID, reqUser) {\n redis.getHash(reqUser)\n .then(list => {\n list.userQueue += `,${fbID}`;\n redis.setHash(reqUser , list);\n });\n }" ]
[ "0.68312925", "0.6784135", "0.6606522", "0.653536", "0.6521834", "0.649985", "0.64960444", "0.64949244", "0.64949244", "0.64558774", "0.64558774", "0.6450762", "0.6432036", "0.6432036", "0.6432036", "0.6393708", "0.63744676", "0.6339522", "0.6333109", "0.62464434", "0.62313825", "0.62222093", "0.6207759", "0.6207759", "0.61773854", "0.6137538", "0.6121383", "0.60971445", "0.60868156", "0.6070164", "0.60626805", "0.6056209", "0.60402715", "0.6024426", "0.60239094", "0.6020012", "0.6010528", "0.6002453", "0.6002453", "0.59963864", "0.59963864", "0.59963864", "0.59963864", "0.59963864", "0.59963864", "0.59963864", "0.59963864", "0.59912366", "0.59910464", "0.59323686", "0.59259975", "0.59231246", "0.5907363", "0.5905904", "0.5893673", "0.5840183", "0.5840183", "0.58390594", "0.58246106", "0.5816572", "0.58040875", "0.57977957", "0.5779415", "0.5778218", "0.57744545", "0.5771406", "0.575905", "0.5755492", "0.5745034", "0.5737902", "0.5734144", "0.5733371", "0.5728214", "0.5714764", "0.57009125", "0.56877065", "0.5682898", "0.5672443", "0.56721693", "0.56704277", "0.56585634", "0.56521314", "0.5647689", "0.56466365", "0.56445384", "0.5639636", "0.56378883", "0.563394", "0.5629263", "0.56247646", "0.56205964", "0.5619004", "0.56186754", "0.56009084", "0.5587561", "0.5575969", "0.55585986", "0.55578905", "0.55561554", "0.5555428", "0.5545903" ]
0.0
-1
Remove string from beginning of queue
dequeue() { if (this.count === 0) { return 0; } var firstIdx = Object.keys(this.storage)[0]; var itemToRemove = this.storage[firstIdx]; delete this.storage[firstIdx]; this.count -= 1; return itemToRemove; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shiftEmpty() {\n for (i = this.maxLen-1; i > -1; i--) {\n if (this.queueControl[i] == '') {\n this.queueControl.unshift(this.queueControl.splice(i, 1).join())\n break\n }\n }\n }", "function fx_remove_from_queue(fx) {\n var currents = fx.cr;\n if (currents) {\n currents.splice(currents.indexOf(fx), 1);\n }\n}", "denqueue() {\n debug(`\\nLOG: remove the queue`);\n this.queue.shift();\n }", "remove() {\n if (!this.isEmpty()) {\n let firstElement = this.queue[0];\n this.queue.shift();\n this.length -= 1;\n return firstElement;\n } else {\n return null;\n }\n }", "dequeue() {\n this._queue.shift();\n }", "moveQueue() {\n if (this.localQueue.length > 0) {\n \n const currentEntry = this.localQueue[0];\n\n switch (currentEntry[0]) {\n case \"add\":\n addTrie(currentEntry[1]);\n break;\n case \"remove\":\n removeTrie(currentEntry[1]);\n break;\n }\n\n this.localQueue.shift();\n this.moveQueue();\n } else {\n this.queueProcessing = false;\n }\n }", "function dequeue(queue){\n //immediately return error if queue empty\n if(queue.length < 1){\n console.log(\"ERROR: The specified queue is empty and cannot be dequeued.\")\n return JSON.stringify({})\n }\n\n var nextMessage = queue[queue.length-1]\n\n //logic to handle case when next item is in sequence\n if(nextMessage.hasOwnProperty(\"_sequence\")){\n var partList = sequenceMap.get(nextMessage[\"_sequence\"]).partList\n //case when next item in queue is appropriate message in sequence to remove\n if(nextMessage.hasOwnProperty(\"_part\") && nextMessage[\"_part\"] == partList[0]){\n var currentVal = sequenceMap.get(nextMessage[\"_sequence\"])\n currentVal.partList.shift()\n if(currentVal.partList.length == 0){\n sequenceMap.delete(nextMessage[\"_sequence\"])\n }\n else{\n sequenceMap.set(nextMessage[\"_sequence\"],currentVal)\n }\n return JSON.stringify(queue.pop())\n }\n //case when not the appropriate sequence message to remove (lower part # exists in queue)\n else{\n for(var i=queue.length-1;i>=0;i--){\n var currentMessage = queue[i]\n if(currentMessage.hasOwnProperty(\"_part\") && currentMessage[\"_part\"] == partList[0]){\n var currentVal = sequenceMap.get(currentMessage[\"_sequence\"])\n currentVal.partList.shift()\n if(currentVal.partList.length == 0){\n sequenceMap.delete(currentMessage[\"_sequence\"])\n }\n else{\n sequenceMap.set(currentMessage[\"_sequence\"],currentVal)\n }\n var removedMessage = queue.splice(i,1)\n return JSON.stringify(removedMessage[0])\n }\n }\n }\n }\n\n return JSON.stringify(queue.pop())\n}", "dequeue() {\n this.queue.shift()\n}", "function dequeue(){\n return queue.shift();\n }", "dequeue(){\n if(this.isEmpty()){\n return \"Empty Queue\"\n }\n return this.items.shift();\n }", "dequeue() {\n this.list.remove(this.peekFront)\n }", "remove(){\n /*as it's FIFO so just need to remove the first node and \n adjust the next node in the Queue to be the first node after \n the removal of the first node.*/\n\n const firstNode = this.first;\n\n //check if Queue is empty then return undefined\n\n if (firstNode === null){\n return undefined;\n }\n\n //make this.first point to next node\n this.first = firstNode.after;\n\n //check if the Queue only had one node\n if(this.first === null){\n this.last = null;\n }\n\n this.qLength--;\n\n return firstNode.value;\n }", "dequeue(){\n if(!this.isEmpty()){\n this.data.splice(this.head, 1, undefined);\n if(this.head === this.data.length-1){\n this.head = 0;\n }else{\n this.head ++;\n }\n }\n }", "dequeue() {\n\t\t// the first item in the queue\n\t\tconst item = this.storage.remove_from_head();\n\t\tif (this.isEmpty() !== true) {\n\t\t\t// only do this if the item is not null\n\t\t\tthis.length--;\n\t\t}\n\n\t\treturn item;\n\t}", "dequeue () {\n this.head.shift()\n }", "remove(index) {\n if (index > 0) throw new Error(\"Can't remove from the middle of a queue\");\n return super.remove(index);\n }", "dequeue() {\n if (0 != this.q.length) {\n let c = this.q[0];\n this.q.splice(0, 1);\n return c\n }\n }", "deQueue() {\n if (!this.head) {\n return \"No item\";\n } else {\n let itemToPop = this.head;\n this.head = this.head.next;\n return itemToPop;\n }\n }", "dequeue() {\n const element = this.queue.binaryTree.shift();\n this.queue.binaryTree.unshift(this.queue.binaryTree.pop());\n this.queue.siftDown(0);\n return element;\n }", "dequeue() {\n // return the dequeued element \n // and remove it. \n // if the queue is empty \n // returns Underflow \n if (this.isEmpty())\n return \"Underflow\";\n return this.items.shift();\n }", "dequeue() {\n if(!this.isEmpty()) {\n return this.collection.shift();\n } else {\n console.log(\"Queue is already empty\");\n }\n }", "shift() { // must not be called on an empty queue\n const oldFront = this._front;\n let newFront = oldFront;\n const oldCursor = this._cursor;\n let newCursor = oldCursor + 1;\n const elements = oldFront._elements;\n const element = elements[oldCursor];\n if (newCursor === QUEUE_MAX_ARRAY_SIZE) {\n newFront = oldFront._next;\n newCursor = 0;\n }\n // No mutations before this point.\n --this._size;\n this._cursor = newCursor;\n if (oldFront !== newFront) {\n this._front = newFront;\n }\n // Permit shifted element to be garbage collected.\n elements[oldCursor] = undefined;\n return element;\n }", "shift() { // must not be called on an empty queue\n const oldFront = this._front;\n let newFront = oldFront;\n const oldCursor = this._cursor;\n let newCursor = oldCursor + 1;\n const elements = oldFront._elements;\n const element = elements[oldCursor];\n if (newCursor === QUEUE_MAX_ARRAY_SIZE) {\n newFront = oldFront._next;\n newCursor = 0;\n }\n // No mutations before this point.\n --this._size;\n this._cursor = newCursor;\n if (oldFront !== newFront) {\n this._front = newFront;\n }\n // Permit shifted element to be garbage collected.\n elements[oldCursor] = undefined;\n return element;\n }", "function clearQueue() {\n // get item at front of queue and call fn\n var fn = queue.shift();\n if (fn) fn();\n\n // run again on next tick\n clearQueueLater();\n}", "dequeue(){\n //if queue is empty, nothing to remove\n if(this.first === null){\n return;\n }\n\n //set pointer to first item\n const node = this.first\n\n //move pointer to next in the queue and make it first\n this.first = this.first.next;\n\n //if this is the last item in the queue\n if(node === this.last){\n this.last = null;\n }\n return node.value;\n }", "dequeue() {\n if (!this.first) throw new Error(\"Cannot dequeue! Queue is empty\");\n let removed = this.first;\n // only one item in queue: remove it and set last to be null\n if (this.first === this.last) {\n this.last = null;\n }\n // set first to be what came after first, which will be null if queue has only one item\n this.first = this.first.next;\n this.size -= 1;\n return removed.val;\n }", "dequeue() {\n return this.queue.shift()\n }", "next () {\n const element = this.queue.shift()\n this.keys.delete(element.key)\n\n return element\n }", "dequeue () {\n if (this.length <= 1) {\n this.first = null\n this.last = null\n this.length = 0\n } else {\n const secondNode = this.first.next\n secondNode.prev = null\n\n this.first = secondNode\n\n this.length--\n }\n this.printQueue()\n }", "dequeue() {\n if (this.isEmpty) { throw new Error(\"Can't remove from empty queue\") };\n return this.#queue.pop();\n }", "dequeue() {\n if(! this.isEmpty()) return this.items.shift()\n else return undefined\n }", "dequeue(){\n if(this.isEmpty()){\n throw Error ('The Queue is Empty, Unable to dequeue()');\n }else{\n const removingElement = this.queue[this.front];\n this.front +=1;\n return removingElement;\n }\n }", "dequeue() {\n return this.collection.shift()[0]\n }", "clear_queue() {\n this.queued.length = 0;\n }", "shift() {\n if (!this.first) return undefined; // edge case for empty queue\n if (this.first === this.last) { // edge case for size = 1\n this.last = null;\n }\n let removed = this.first; // store first node in a variable \n this.first = this.first.next; // set first to be the next node\n removed.next = null; // erase link from removed node\n this.size--; // decrement size\n return removed; // return removed node\n }", "dequeue() {\n if (this.count == 0) {\n return undefined;\n }\n let deletedItem = this.items[0];\n this.items.splice(0, 1);\n this.count--;\n return deletedItem;\n }", "dequeue() {\n return this.items.shift();\n }", "dequeue() {\n this.size -= 1;\n return this.queue.shift();\n }", "dequeue(){\n if(this.length === 0){\n return null;\n }\n if(this.length === 1){\n this.last = null;\n this.first = null;\n return this;\n }\n\n const deleteFirst = this.first.next;\n this.first = deleteFirst;\n\n this.length--;\n return this;\n }", "dequeue() {\n return this._queue.shift();\n }", "removeFirst(element) {\n const idx = this.indexOf(element);\n if (idx !== -1) {\n this.splice(idx, 1);\n }\n return;\n }", "dequeue() { \n let removed = this.front\n this.front = this.front.next\n return removed\n }", "dequeue() {\n // save item to return\n const item = this.first.item;\n\n // delete first node\n this.first = this.first.next;\n\n if (this.isEmpty()) {\n this.last = null;\n }\n \n // return saved item\n return item;\n }", "dequeue() {\n if (!this.length) return null;\n\n const removedNode = this.first;\n if (this.length === 1) {\n this.first = null;\n this.last = null;\n }\n\n this.first = removedNode.next;\n this.length -= 1;\n removedNode.next = null;\n return removedNode.value;\n }", "dequeue() {\n return queue.pop()\n }", "dequeue () {\n while (!this.deflating && this.queue.length) {\n const params = this.queue.shift();\n\n this.bufferedBytes -= params[1].length;\n params[0].apply(this, params.slice(1));\n }\n }", "dequeue() {\n return this.collection.shift();\n }", "dequeue() {\r\n this.Array.shift();\r\n}", "dequeue() {\n if (this.arr[this.head] != undefined) {\n this.arr[this.head] = undefined;\n }\n else if (!this.isEmpty()) {\n this.head = (this.head + 1) % this.capacty;\n this.arr[this.head] = undefined;\n }\n }", "dequeue() {\n const value = _(this).collection.shift();\n return value[0];\n }", "dequeue () {\n\t while (!this.deflating && this.queue.length) {\n\t const params = this.queue.shift();\n\n\t this.bufferedBytes -= params[1].length;\n\t params[0].apply(this, params.slice(1));\n\t }\n\t }", "removeFront () {\n\t\tthis.remove(0);\n\t}", "dequeue() {\n\n }", "function removeQueueItem(msg, args) {\n if(isNaN(args)) {\n throw \"Invalid position.\"\n }\n let pos = Number(args);\n if(pos % 1 != 0)\n throw \"Invalid position\";\n let queue = globals.connections[msg.guild.id].queue;\n if(pos < 2 || pos > queue.length)\n throw \"Invalid position.\";\n msg.channel.send(\"**Song** `\" + queue[pos - 1].name + \"` **removed from queue.**\");\n queue.splice(pos - 1, 1)\n}", "remove(job) {\n this.queue = this.queue.filter(function(item) {\n return item !== job;\n });\n }", "function trimStart (chr, string) {\n let output = string\n while (output[0] === chr) {\n output = output.splice(0, 1)\n }\n return output\n}", "function remove(task) {\n\t return buffer.splice(buffer.indexOf(task), 1)[0];\n\t }", "function updateQueue() {\r\n $('#currentProtocol div')[0].remove();\r\n}", "dequeue() {\n return _(this).collection.shift();\n }", "deQueue() {\n this._dataStore.shift();\n this._length--;\n }", "dequeue(){\n if (!this.first) {\n return null;\n }else if (this.size === 1) {\n this.first = null;\n this.last = null;\n }else{\n let oldStart = this.first.next;\n this.first.next = null;\n this.first = oldStart;\n }\n this.size--;\n return this;\n }", "dequeue() {\n if(this.items.length > 0) {\n return this.items.shift();\n }\n }", "function remove(a,s) {\n while (true) {\n var i = s.indexOf(a);\n if (i < 0) break;\n s.splice(i,1);\n }\n return s;\n }", "dequeue () {\n\t while (!this._deflating && this._queue.length) {\n\t const params = this._queue.shift();\n\n\t this._bufferedBytes -= params[1].length;\n\t params[0].apply(this, params.slice(1));\n\t }\n\t }", "dequeue () {\n while (!this._deflating && this._queue.length) {\n const params = this._queue.shift();\n\n this._bufferedBytes -= params[1].length;\n params[0].apply(this, params.slice(1));\n }\n }", "dequeue () {\n while (!this._deflating && this._queue.length) {\n const params = this._queue.shift();\n\n this._bufferedBytes -= params[1].length;\n params[0].apply(this, params.slice(1));\n }\n }", "dequeue () {\n while (!this._deflating && this._queue.length) {\n const params = this._queue.shift();\n\n this._bufferedBytes -= params[1].length;\n params[0].apply(this, params.slice(1));\n }\n }", "dequeue () {\n while (!this._deflating && this._queue.length) {\n const params = this._queue.shift();\n\n this._bufferedBytes -= params[1].length;\n params[0].apply(this, params.slice(1));\n }\n }", "function remove(task) {\n return buffer.splice(buffer.indexOf(task), 1)[0];\n }", "remove(url) {\n\t\tfor (var i = 0; i < this.queue.length; i++) {\n\t\t\tvar currentItem = this.queue[i];\n\t\t\tif (currentItem.url == url) {\n\t\t\t\tthis.queue.splice(i, 1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "[types.DELMESSAGEQUEUE](state) {\n state.messageQueue.shift()\n }", "function deQueue () {\n var message = queue.shift();\n if (!message) {\n running = false;\n return;\n }\n // Lock the status variable before sending the message.\n // (because window.location is synchronous in IE and finishes\n // before this function finishes.)\n running = true;\n send(message);\n }", "dequeue() {\n\t\tif (this.stack2.length === 0) {\n\t\t\t// store length of second stack in variable\n\t\t\tconst length = this.stack1.length;\n\t\t\t// iterate length amount of times until\n\t\t\t// stack 1 is empty.\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tthis.stack2.add(this.stack1.remove());\n\t\t\t}\n\t\t}\n\t\t// return the first item in the queue (first person in line)\n\t\treturn this.stack2.remove();\n\t}", "dequeue() {\n return this.collection.shift();\n }", "function unflagged() {\n result._.push(nextString());\n }", "dequeue() {\n\t\treturn this.items.removeHead();\n\t}", "removeMin() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}", "dequeue() {\n return this.processes.shift();\n // console.log('dequeu',this.processes[0]);\n }", "function remove(task) {\n return buffer.splice(buffer.indexOf(task), 1)[0];\n }", "function resolveQueue(index, queue, resolution, prefixLength, suffixLength){\n \n queue[index].token.id = resolution.result; //update value in the queue\n queue[index].token.type = resolution.type; // update type\n queue[index].priority = -1; //after any operation it should not be replaced with another operation\n \n if(index + suffixLength < queue.length) //don' slice off what isn't there\n queue.splice(index + 1, suffixLength); //go to next token & slice off the related tokens to the operation\n \n if(index - prefixLength > -1) //don't slice off what isn't there\n queue.splice(index - prefixLength, prefixLength); //slice off preceding tokens related to the operation\n \n}", "dequeue(){\n if(this.size === 0) return undefined;\n const node = this.first;\n\n this.first = this.first.next;\n\n this.size--;\n\n if(this.size === 0) this.last = undefined;\n\n node.next = undefined;\n return node;\n }", "dequeue() {\n\t\tif ( this.size() >= 1 ) {\n\t\t\tlet nextUp = this._storage[this._start];\n\t\t\tdelete this._storage[this._start];\n\n\t\t\tif ( this._start == this._end ) {\n\t\t\t\tthis._start = this._end = -1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis._start++;\n\t\t\t}\n\t\t\treturn nextUp;\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Queue is Empty!\");\n\t\t\treturn false;\n\t\t}\n\t}", "dequeue() {\n if (this.first === null) {\n return;\n }\n // we need to save this first node before replacing it so that we can check\n // if it is the only item on the list\n const node = this.first;\n this.first = this.first.next;\n if (node === this.last) {\n this.last = null;\n }\n // need this to be returned so you can use its value later\n this.size--;\n return node.value;\n }", "dequeue() {\n this._treatNoValues();\n return this.storage.shift();\n }", "dequeue(){\n if(!this.first){\n return null;\n }\n if(this.first === this.last){\n this.last = null;\n }\n this.first = this.first.next\n this.length --; \n return this;\n }", "dequeue() {\n\t\treturn this.items.shift();\n\t}", "remove() {\n if (this.isEmpty()) throw new Error('Queue is empty!');\n const value = this.first.value;\n this.first = this.first.next;\n this.size--;\n return value;\n }", "shift() {\n if (this.length === 0) throw new Error(\"No more items in queue\");\n\n const oldHead = this.head;\n\n if (this.length === 1) {\n this.head = null;\n this.tail = null;\n } else {\n this.head = oldHead.next;\n oldHead.next = null;\n }\n\n this.length--;\n\n return oldHead.val;\n }", "dequeue() {\n if (this.isEmpty()) \n throw \"Queue is Empty\"; \n return this.queue.shift(); \n }", "dequeue() {\n return queue.pop();\n }", "dequeue() {\n return queue.pop();\n }", "next() {\n return queue.shift();\n }", "dequeue() {\n if (!this.first) {\n return null;\n }\n if (this.first === this.last) {\n this.last = null;\n }\n this.first = this.first.next;\n this.length--;\n\n return this;\n }", "dequeue() { // removes the item from the queue FIFO\n return this.processes.shift(); // use array shift\n }", "function remove (){\n match_list.pop();\n match_list.pop();\n }", "enqueue(item) {\n queue.unshift(item);\n }", "enqueue(item) {\n queue.unshift(item);\n }", "dequeue() {\n if (this.length === 0) throw new Error(\"No more items in queue\");\n\n const oldHead = this.head;\n\n if (this.length === 1) {\n this.head = null;\n this.tail = null;\n } else {\n this.head = oldHead.next;\n oldHead.next = null;\n }\n\n this.length--;\n\n return oldHead.val;\n }", "remove(input) {}", "pop() {\n // If head is null, there's nothing on the list\n if (this.head == null) {\n return null;\n } else {\n // Get the item that will be popped from the queue\n const extractedItem = this.head;\n\n // Set the next item in the queue as the new head\n this.head = this.head.next;\n\n // Returned the previous head\n return extractedItem;\n }\n}" ]
[ "0.69845027", "0.6750571", "0.66456306", "0.6536793", "0.64369506", "0.6401552", "0.6386654", "0.62966985", "0.61806023", "0.6177262", "0.6162999", "0.61600024", "0.60904914", "0.6063176", "0.6052558", "0.6034269", "0.60322464", "0.6016975", "0.60016143", "0.5976564", "0.59707725", "0.5970489", "0.5970489", "0.5962989", "0.5962215", "0.593213", "0.5917527", "0.5901317", "0.5896268", "0.5875598", "0.5874087", "0.58670205", "0.585993", "0.58553445", "0.5854149", "0.5853799", "0.58497256", "0.58439296", "0.58245444", "0.58131874", "0.5801465", "0.57931244", "0.57906836", "0.5784666", "0.5778814", "0.57744074", "0.57737386", "0.57698745", "0.5763547", "0.57511616", "0.5750547", "0.5743392", "0.5742959", "0.5728576", "0.57218724", "0.5719903", "0.5719388", "0.5717794", "0.5705252", "0.5705004", "0.57007694", "0.5693453", "0.569243", "0.5691001", "0.56857944", "0.56857944", "0.56857944", "0.56857944", "0.56856424", "0.5682235", "0.56781834", "0.56694347", "0.5659283", "0.565742", "0.5649761", "0.56495553", "0.5643555", "0.56394035", "0.5639339", "0.56118244", "0.55984145", "0.5593756", "0.5588412", "0.55819815", "0.5579336", "0.5561379", "0.5556402", "0.55560136", "0.55553794", "0.5552473", "0.5552473", "0.5550195", "0.55498445", "0.55484265", "0.55483127", "0.55355924", "0.55355924", "0.5529728", "0.55263126", "0.55231005" ]
0.56947553
61
Gets and sends the notifications belonging to a user.
function getNotificationsByUserId(req, res, next){ var userid = req.params.userid; User .findOne({ where:{'google.id':userid} }) .then(function(member){ console.log(userid); Notification .findAll({ where: {memberId: member.id}, order: ['createdAt'] }) .then(function(notifications){ res.send({ notifications: notifications }); }, function(){ next(); }); }, function(){ next() }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getAllNotificationByUserId() {\n let user = JSON.parse(localStorage.getItem(\"loggedUser\"));\n\n try {\n const response = await HTTP.get(\n `${API_URL}/notifications/${user[0].id_user}`,\n {\n headers\n }\n );\n if (response.status == 200) {\n return {\n notifications: response.data,\n resStatus: response.status\n };\n } else {\n return {\n notifications: [],\n resStatus: response.status\n };\n }\n } catch (err) {\n localStorage.setItem(\"error\", JSON.stringify(500));\n return err;\n }\n }", "async sendNotifications () {\n\t\tawait Promise.all(this.renderedEmails.map(async userAndHtml => {\n\t\t\tawait this.sendNotificationToUser(userAndHtml);\n\t\t}));\n\t}", "function sendNotification(user, text) {\n\n new Notification({\n user: user,\n text: text\n }).save(function (err, result) {\n if (err || !result) {\n console.log(\"Error while saving notifications\")\n } else {\n User.findById(user)\n .exec()\n .then(function (user) {\n if (!user) {\n throw \"Error while retrieving user\";\n } else {\n if (user.notifications) {\n user.notifications.push(result);\n } else {\n user.notifications = [result];\n }\n user.save(function (err) {\n if (err) {\n console.log(\"Error while retrieving user\")\n }\n })\n }\n })\n .catch(function (err) {\n console.log(err);\n })\n }\n });\n}", "static async notifications(token) {\n return await sendRequest(\"GET\", \"/users/self/notifications\", token);\n }", "function notify(user) {\n if (!pending[user]) return;\n\n // loop over pending requests for the user\n // and respond if an event is available \n var i, ctx, event;\n for (i = 0; i < pending[user].length; i++) {\n ctx = pending[user][i];\n\n // ctx.req == null -> timeout, cleanup\n if (!ctx.req) {\n pending[user][i] = null;\n continue;\n }\n\n // get next event\n event = nextEvent(user);\n\n // user has event? -> respond, close and cleanup\n if (event) {\n ctx.req.resume();\n ctx.res.send(event);\n ctx.res.end();\n pending[user][i] = null;\n debug(user, ctx.id, \"sent \" + JSON.stringify(event));\n }\n }\n\n // compact the list of pending requests\n pending[user] = compact(pending[user]);\n}", "notification(){\n var user_id_details = Session.get('mySession');\n var notification_id = notification.find({'notification_to' : user_id_details }, {sort: {created_at: -1}}).fetch();\n var notification_username = notification_id[0].notification_by;\n // Meteor.subscribe('notification',notification_username);\n return user_details.find({'user_id' : notification_username}).fetch();\n }", "getUser(idUser) {\n this.helper.publish(JSON.stringify(idUser), Constants.USERS, Constants.GET_USER, (err, user) => {\n this.sockets.forEach((socket) => {\n if (err) socket.emit(Constants.ERROR);\n else socket.emit(Constants.USER_RETURNED, user);\n });\n });\n }", "function getnotifications() {\n\t\n\t// get notifications for the user\n\tajax(\"getnotifications\",{},function(d) {\n\t\tvar o = JSON.parse(d.substring(1,d.length-1));\n\t\thtml(\"menu2\",notifications(o));\n\t});\n\t\n}", "function computeNotification(user, data) {\n var traffic = data.traffic;\n var weather = data.weather;\n\n // identify device token\n var myDevice = new apn.Device(user.token);\n var note = new apn.Notification();\n\n // do something with the data here, check whether notification is in order and populate note as follows -\n\n note.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.\n note.badge = 3;\n note.sound = \"something.aiff\"; // specify the audio file to be played.\n note.alert = \"\\uD83D\\uDCE7 \\u2709 You have a new message\";\n note.payload = {'messageFrom': 'Pacenotes'};\n\n apnConnection.pushNotification(note, myDevice);\n}", "notifyUsers (lesson_id) {\n const lesson = Lessons.findOne(lesson_id);\n const users = Courses.findOne(lesson.course).users;\n\n usersNumber = users.length;\n\n for (var i = 0; i < usersNumber; i++) {\n if (users[i][\"user_status\"] > 0) {\n currentUser = Users.findOne(users[i][\"user_id\"]);\n recipient = currentUser.email ;\n subject = \"Your personal link to \" + lesson.title + \" - Fless\";\n time = moment(lesson.from).format('HH:mm') ;\n date = moment(lesson.from).format('MMMM Do') ;\n user_url = search(users[i][\"user_id\"], lesson.users).user_url;\n html = '<html><body><p>Hey '+currentUser.firstname+',</p><p>'+lesson.title+' starts on '+date+' at ' + time + ' Moscow. Here is <a href='+user_url+'>your personal link</a> to the session.</p></br><p>Best,</p><p>Aristotle from Fless</p></body></html>'\n sendEmail(recipient, subject, html)\n //console.log(\"EMAIL: \",recipient, subject, html)\n }\n }\n }", "function viewUserNotifications() {\n\n resetView();\n var user = $('#user').val();\n\n var source = new EventSource(\"/viewnotifications/\" + user);\n source.addEventListener('message', function (e) {\n var body = JSON.parse(e.data);\n addNotificationRow(body);\n }, false);\n\n $('#userNotificationsTable').show();\n $('#noNotificationsReceived').show();\n}", "function getNotifications() {\n if (environment == 'dev' || environment == 'rewrite') {\n getNewNotifications();\n return false;\n }\n\n // Default to 0 in case errors\n var unreadNotifications = 0;\n var recentUnread = [];\n\n // Get LA User ID\n $.ajax({\n url: notificationsPath + integerID,\n beforeSend: function (xhr) {\n // xhr.setRequestHeader('Authorization', accessToken);\n },\n dataType: 'json',\n success: function (data) {\n unreadNotifications = data.totalUnread;\n recentUnread = data.recentUnread;\n\n // build list of noticiations\n ulHtml = '';\n recentUnread.forEach(function (notification) {\n ulHtml += '<li> \\\n<a onclick=\"showNotification(\\'' + cleanNotificationSubject(notification['subject']) + '\\', \\'' + cleanNotificationText(notification['text']) + '\\', \\'' + notification['url'] + '\\', \\'' + notification['timestamp'] + '\\')\" data-toggle=\"modal\" href=\"#\">' + notification.subject + '</a> \\\n</li>';\n });\n ulHtml += '<li><a class=\"la-link\" href=\"' + linuxacademyPath + '/cp/notifications\">View all</a></li>';\n $('#notification_overlay').html(ulHtml);\n },\n error: function (error) {\n // console.log(error.statusText)\n },\n complete: function () {\n\n $('#num_notifications').text(unreadNotifications);\n\n // setTimeout(getNotifications, 15000);\n }\n });\n}", "function get_notifications(req, res, respond)\n{\n if(req.session.user.role != \"realm_admin\") { // notifications allowed for realm admins only\n respond([], res);\n return;\n }\n\n // search for realm admins locally in the database\n req.db.realm_admins.find({ \"admin\" : req.session.user.notify_address }, { _id: 0, realm : 1, notify_enabled : 1 }, function(err1, items) {\n if(err1) {\n var err2 = new Error(); // just to detect where the original error happened\n console.error(err2);\n console.error(err1);\n next([err2, err1]);\n return;\n }\n\n respond(items, res);\n });\n}", "function sendNotification() {\n http.get(`/subscription/${subscritionId}`);\n}", "function getNotifications(uid, callback){\n\tvar result = https.get('https://api.provethisconcept.com/api/ux_event?user_id=' + uid, (res) => {\n\t\tconsole.log(res.statusCode);\n\t\tlet mes = \"\";\n\t\tres.on(\"data\",data => {\n\t\t\tmes += data;\n\t\t});\n\t\tres.on(\"end\", () => {\n//\t\t\tconsole.log(mes);\n\t\t\tcallback(JSON.parse(mes));\n\t\t});\n\t});\n\treturn result;\n}", "sendNotifications() {\n var _a, _b;\n return this.notifications.send(services_notifications_1.NotificationType.EMAIL, {\n to: (_b = (_a = this.config.thrizer) === null || _a === void 0 ? void 0 : _a.email) === null || _b === void 0 ? void 0 : _b.to,\n subject: 'send test email',\n text: 'test',\n });\n }", "function DispatchAllToDoNotifications(EmailsList, MessageSender, MessageURL) {\n MessengerService.loadAllUsers().then(function (data) {\n vm.allusers = data;\n\n // iterate through all users\n vm.allusers.forEach(function (obj) {\n // if current users email is contained in our list of emails, we need to send this person a todo notification\n if (EmailsList.indexOf(obj.email) >= 0) {\n //tempArray2.push(obj);\n //alert(\"the email \" + obj.email + \" is in the list \" + EmailsList);\n\n var todo = {\n owner: obj.userType,\n owner_id: obj._id,\n todo: obj.firstName + \", you have recieved a new message from \" + MessageSender + \"! It is very important that you reply as soon as possible.\",\n type: \"message\",\n link: MessageURL\n };\n ToDoService.createTodo(todo).then(function (success) {\n // alert(\"todo added successfully\");\n }, function (error) {\n // alert(\"failed to add todo\");\n });\n }\n });\n });\n }", "async sendNotificationToUser (userAndHtml) {\n\t\tconst { user, html } = userAndHtml;\n\t\tconst isReply = !!this.post.parentPostId;\n\t\tconst codemark = isReply ? this.parentCodemark : this.codemark;\n\t\tconst review = isReply ? this.parentReview : this.review;\n\t\tconst codeError = isReply ? this.parentCodeError : this.codeError;\n\n\t\t// figure out the post that a reply to the email will be a child of, this is pretty complicated logic\n\t\t// and should be altered very carefully\n\t\tlet replyToPostId;\n\t\tif (isReply) {\n\t\t\tif (this.codemark) {\n\t\t\t\t// if the reply has a codemark, then replies to this post should be to the codemark, \n\t\t\t\t// in other words, they would create a new thread of nested replies\n\t\t\t\treplyToPostId = this.codemark.postId;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// otherwise the reply should go to the same parent as the post that is generating the \n\t\t\t\t// notifications, in other words, it adds to the existing thread\n\t\t\t\treplyToPostId = this.post.parentPostId;\n\t\t\t}\n\t\t}\n\t\telse if (this.codemark || this.review || this.codeError) {\n\t\t\t// for non-replies, replies via email get attached to the codemark or review that is\n\t\t\t// generating the email notification\n\t\t\treplyToPostId = (this.codemark || this.review || this.codeError).postId;\n\t\t}\n\t\telse {\n\t\t\t// this shouldn't really happen since it's not really possible to create a post without a \n\t\t\t// codemark or review, but we put it here for posterity and sanity\n\t\t\treplyToPostId = this.post.id;\n\t\t}\n\n\t\tconst creatorId = isReply ? this.post.creatorId : (codemark || review || codeError).creatorId;\n\t\tconst creator = this.teamMembers.find(member => member.id === creatorId);\n\t\tconst options = {\n\t\t\tsender: this.sender,\n\t\t\tcontent: html,\n\t\t\tuser,\n\t\t\tcreator,\n\t\t\tcodemark,\n\t\t\treview,\n\t\t\tcodeError,\n\t\t\tstream: this.stream,\n\t\t\tteam: this.team,\n\t\t\treplyToPostId,\n\t\t\tisReply,\n\t\t\tcategory: user.isRegistered || isReply ? 'notification' : 'notification_invite',\n\t\t\tisReminder: this.message.isReminder,\n\t\t\trequestId: this.requestId,\n\t\t\tisReplyToCodeAuthor: this.parentReview && (this.parentReview.codeAuthorIds || []).includes(user.id)\n\t\t};\n\t\tconst which = codeError ? 'code error' : review ? 'review' : 'codemark';\n\t\tconst reminder = this.message.isReminder ? 'reminder ' : '';\n\t\ttry {\n\t\t\tthis.logger.log(`Sending ${which}-based ${reminder}email notification to ${user.email}, post ${this.post.id}, isReply=${isReply}...`, options.requestId);\n\t\t\tawait new EmailNotificationV2Sender().sendEmailNotification(options, this.outboundEmailServer.config);\n\t\t}\n\t\tcatch (error) {\n\t\t\tlet message;\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = `${error.message}\\n${error.stack}`;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmessage = JSON.stringify(error);\n\t\t\t}\n\t\t\tthis.logger.warn(`Unable to send ${which}-based ${reminder}email notification to ${user.email}: ${message}`);\n\t\t}\n\t}", "function doNotifications(message, post, callback) {\n // check to see if message is notification with interesting things.\n // If so pull notification.json\n if (message && message.channel === '/notification/' + conf.user.user.id &&\n (message.data.unread_notifications > 0 ||\n message.data.unread_private_messages > 0)) {\n return pollNotifications(callback);\n }\n return callback();\n}", "function getChatsForAUser() {\n\n // Send GET request to mongoDB to get all chats associated with a specific userId\n chatFactory.getChatsForAUser(vm.userId).then(\n\n function(response) {\n \n // Zero out the # of channels and direct messages\n $rootScope.numberOfChannels = 0;\n $rootScope.numberOfDirectMessages = 0;\n\n // Display chatgroup names on the view \n $rootScope.chatGroups = response;\n \n // Determine how many chat channels and direct messages the user is subscribed to\n for (var i = 0; i < response.length; i++) {\n if (response[i].groupType !== \"direct\") {\n $rootScope.numberOfChannels++;\n } else {\n $rootScope.numberOfDirectMessages++;\n }\n }\n\n // Send socket.io server the full list of chat rooms the user is subscribed to\n chatFactory.emit('add user', {chatGroups: $rootScope.chatGroups, userid: vm.userId});\n\n // Jump to calendar state\n $state.go('main.calendar');\n },\n\n function(error) {\n\n // Jump to calendar state\n $state.go('main.calendar'); \n\n });\n\n }", "function subscribeNotification(userId) {\n return Object(redux_saga__WEBPACK_IMPORTED_MODULE_3__[\"eventChannel\"])(function (emmiter) {\n var unsubscribe = notificationService.getNotifications(userId, function (notifications) {\n emmiter(notifications);\n });\n return function () {\n unsubscribe();\n };\n });\n}", "function getNotifyUsers(users){\n var notifyuser=[]; \n notifyuser=users.map(function(user) {\n return notifyuser.push=user.fb_id;\n });\n return notifyuser;\n }", "userToReceiveEmail (user) {\n\t\t// deactivated users never get emails\n\t\tif (user.deactivated) {\n\t\t\tthis.log(`User ${user.id}:${user.email} is deactivated so will not receive an email notification`);\n\t\t\treturn false;\n\t\t}\n\n\t\t// \"faux\" users (who haven't registered) don't receive notifications\n\t\tif (user.externalUserId && !user.isRegistered) {\n\t\t\tthis.log(`User ${user.id}:${user.email} is a \"faux\" user and so will not receive an email notification`);\n\t\t\treturn false;\n\t\t}\n\n\t\t// users who have been removed from the team never get emails\n\t\tif (this.team && (this.team.removedMemberIds || []).includes(user.id)) {\n\t\t\tthis.log(`User ${user.id}:${user.email} has been removed from team so will not receive an email notification`);\n\t\t\treturn false;\n\t\t}\n\n\t\t// users who are \"foreign\" to the team never get emails\n\t\tif (this.team && (this.team.foreignMemberIds || []).includes(user.id)) {\n\t\t\tthis.log(`User ${user.id}:${user.email} is foreign to the team so will not receive an email notification`);\n\t\t\treturn false;\n\t\t}\n\n\t\tconst preferences = user.preferences || {};\n\n\t\tif (this.message.isReminder) {\n\t\t\t// for review reminders, check if the user has that option specifically turned off\n\t\t\t// (note that \"undefined\" means they have not set that preference, which defaults to on)\n\t\t\tif (preferences.reviewReminderDelivery === false) {\n\t\t\t\tthis.log(`User ${user.id}:${user.email} has the option to remind them of reviews turned off`);\n\t\t\t\treturn false;\n\t\t\t} \n\t\t}\n\n\t\t// for ordinary notifications, if the user has emails turned off as delivery preference, don't send an email\n\t\telse if (preferences.notificationDelivery === 'off' || preferences.notificationDelivery === 'toastOnly') {\n\t\t\tthis.log(`User ${user.id}:${user.email} has notification delivery of emails turned off`);\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// next, check if they're following the thing the post refers to\n\t\t// note that, for review reminders, this means they've specifically opted out of reviewing this review,\n\t\t// so we shouldn't send a reminder\n\t\tconst thingToFollow = this.post.parentPostId ?\n\t\t\t(this.parentCodeError || this.parentReview || this.parentCodemark) :\n\t\t\t(this.codeError || this.review || this.codemark);\n\t\tconst followerIds = (thingToFollow && thingToFollow.followerIds) || [];\n\t\tif (followerIds.indexOf(user.id) !== -1) {\n\t\t\t// the one exception: if a review has been created and the user is one of the \"code authors\",\n\t\t\t// meaning the review was created from an \"unreviewed\" commit, then we don't send\n\t\t\tif (this.review && (this.review.codeAuthorIds || []).includes(user.id)) {\n\t\t\t\tthis.log(`User ${user.id}:${user.email} is a follower but is also a code author of a newly created review, so does not get an email notification`);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t// if we've reached here for a review reminder, the user is not following the review anymore\n\t\tif (this.message.isReminder) {\n\t\t\tthis.log(`User ${user.id}:${user.email} has opted out of following this review, so will not be sent a reminder`);\n\t\t\treturn false;\n\t\t}\n\n\t\t// otherwise, only send emails if they are mentioned\n\t\tconst mentionedUserIds = this.post.mentionedUserIds || [];\n\t\tconst mentioned = this.stream.type === 'direct' || mentionedUserIds.indexOf(user.id) !== -1;\n\t\tif (!mentioned) {\n\t\t\tthis.log(`User ${user.id}:${user.email} is not following and is not mentioned so will not receive an email notification`);\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}", "function notify(user, message) {\n cb.sendNotice(message, user)\n}", "function notifyUser(user) {\n robot.messageRoom(user.name, 'Hey, your turn to deploy!');\n }", "function getUsers() {\n\t\t\t\tusers.getUser().then(function(result) {\n\t\t\t\t\tvm.subscribers = result;\n\t\t\t\t\tconsole.log(vm.subscribers);\n\t\t\t\t}, function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t}", "notifySubscripber(gmail, subject, message, from)\n {\n console.log(\"Listo para mandar los mails:\");\n this.users.forEach(mail => gmail.sendEmail(mail, subject, message, from));\n }", "function get(id) {\n return $.ajax({\n url: wvy.url.resolve(\"/notifications/\" + id),\n method: \"GET\",\n contentType: \"application/json\"\n });\n }", "async function triggerNotification(ids, title, path, message) {\n try {\n await Promise.all(\n ids.map((id) =>\n WebPushNotifications.sendToUserByID(id, {\n title,\n body: message,\n data: {\n path,\n },\n })\n )\n );\n } catch (e) {\n console.log(`Unexpected error in triggerNotification: ${e}`);\n }\n}", "async updateMentionsForUser (user) {\n\t\tif (user.get('isRegistered')) {\n\t\t\treturn ;\t// we only do this for unregistered users\n\t\t}\n\t\tconst update = {\n\t\t\t$set: {\n\t\t\t\tinternalMethod: 'mention_notification',\n\t\t\t\tinternalMethodDetail: this.user.id\n\t\t\t},\n\t\t\t$inc: {\n\t\t\t\tnumMentions: 1\n\t\t\t}\n\t\t};\n\n\t\t// if a review or codemark or code error was created, update the user's invite trigger and last invite type\n\t\tif (this.inviteTrigger) {\n\t\t\tupdate.$set.inviteTrigger = this.inviteTrigger;\n\t\t\tconst type = {\n\t\t\t\t'R' : 'reviewNotification',\n\t\t\t\t'C' : 'codemarkNotification',\n\t\t\t\t'E' : 'codeErrorNotification'\n\t\t\t};\n\t\t\tupdate.$set.lastInviteType = type[this.inviteTrigger.substring(0, 1)];\n\t\t}\n\n\t\tawait this.data.users.updateDirect(\n\t\t\t{ id: this.data.users.objectIdSafe(user.id) },\n\t\t\tupdate\n\t\t);\n\t}", "function sendNotification() {\n // overrides default that no notifs will show when app is in foregruond\n Notifications.setNotificationHandler({\n handleNotification: async () => ({\n shouldShowAlert: true\n })\n });\n\n Notifications.scheduleNotificationAsync({\n content: {\n title: 'Your Service Request',\n body: `Your request for ${selectedService}, ${date} has been submitted`\n },\n // causes notif to fire immed. cd also set to future or repeat or both\n trigger: null\n });\n }", "async function notifyInvitedUser(fromUser, invitedUser, room) {\n // get the email address\n if (invitedUser.state === 'REMOVED') {\n stats.event('user_added_removed_user');\n return;\n }\n\n // See https://gitlab.com/gitlab-org/gitter/webapp/issues/2153\n if (!config.get('email:limitInviteEmails')) {\n await emailNotificationService\n .addedToRoomNotification(fromUser, invitedUser, room)\n .catch(function(err) {\n logger.error('Unable to send added to room notification: ' + err, { exception: err });\n });\n }\n\n var metrics = {\n notification: 'email_notification_sent',\n troupeId: room.id,\n to: invitedUser.username,\n from: fromUser.username\n };\n\n stats.event('user_added_someone', _.extend(metrics, { userId: fromUser.id }));\n}", "function getUsers() {\n\n DashboardFactory.getUsers().then(\n\n function(response) {\n\n vm.users = response;\n console.log(response);\n \n // Get all the chats that the user is subscribed to\n getChatsForAUser();\n },\n\n function(error) {\n\n console.log(error);\n });\n }", "notify() {\n this.props.showNotification({\n type: 'success',\n text: 'User created succesfully!',\n title: 'Created',\n });\n this.props.getUsers();\n }", "sendUserMessage(user, message) {\r\n var messages = [];\r\n messages.push(message);\r\n\r\n var packet = {\r\n \"type\": \"USER\",\r\n \"position\": this.messages.length,\r\n \"uuid\": user.getUuid(),\r\n \"name\": user.getName(),\r\n \"messages\": messages,\r\n \"color\": this.userUuids.indexOf(user.getUuid()),\r\n \"time\": new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit'})\r\n };\r\n\r\n this.messages.push(packet); // Put message into room history\r\n\r\n this.notify(\"chat\", packet);\r\n }", "function messageAllUsers() {\n vm.filteredusers.forEach(function (obj) {\n AddContacts(obj.email);\n });\n }", "async function retrieveNotifications() {\n console.log(\"Retrieving notifications: \" + (new Date()).toISOString());\n\n try {\n // Retrieve latest unread notifications\n const since = new Date();\n since.setHours(since.getHours() - 1); // last hour\n\n let client = octokit;\n if (lastModifiedHeader) {\n client = new octokitlib({\n auth: 'token ' + githubToken,\n headers: {\n 'If-Modified-Since': lastModifiedHeader\n }\n });\n }\n let response;\n try {\n response = await client.activity.listNotifications({\n all: false, // unread only\n since: since.toISOString(),\n participating: true, // only get @mentions\n });\n } catch(err) {\n // TODO Assume this is a 304 Not Modified for now, check explicitly later\n console.log(\"No new notifications\");\n return true;\n }\n const notifications = response.data;\n lastModifiedHeader = response.headers[\"last-modified\"];\n\n console.log(\"Notifications: \" + notifications.length);\n for (const notification of notifications) {\n handleNotification(notification);\n }\n } catch(err) {\n console.error(err);\n return false;\n }\n\n return true;\n}", "execute(message, args) { // omit args argument if not using args\n\n let userID = message.author.id;\n console.log(userID);\n if (!(\"\" + userID in users) ) users[userID] = {};\n \n if (!(\"notifications\" in users[userID]) ) users[userID][\"notifications\"] = [];\n let notifObj = {\n stock: args[0],\n percent_threshold: args[1],\n days: args.slice(2)\n };\n console.log(notifObj);\n users[userID].notifications.push(notifObj)\n fs.writeFile(path.join(__dirname, \"..\", \"db\", \"users.json\"), JSON.stringify(users, null, '\\t'), (err)=>{\n if (err) return message.channel.send(\"There was an error setting your notification.\")\n message.channel.send(\"Notification set successfully!\")\n });\n\n\t}", "function sendNotification(x){\n if (!(\"Notification\" in window)) {\n /* If the browser deosn't support push notifications\n we alert user alert box to inform the user */\n alert(x.tasksTitle);\n }\n else {\n if (Notification.permission === \"granted\") {\n let notification = new Notification(x.tasksTitle);\n }\n }\n}", "function sendUserToAll (cmd, user) {\n sendToAll({\n cmd: cmd,\n users: [user]\n })\n }", "async users(sender) {\n let users = await slack.getAllUsers(false, true, true)\n users = _.orderBy(users, ['real_name'], ['asc'])\n const bundle = users.map((u) => {\n let type = ''\n if (u.is_admin) {\n type = 'admin'\n }\n if (u.is_bot) {\n type = 'bot'\n }\n return `${u.real_name} | ${u.id} | ${type}`\n })\n bundle.unshift(`Name | UserId | Type`)\n await slack.postEphemeral(sender, bundle.join('\\n'))\n }", "function notifyUser(notifObj) {\n chrome.notifications.create(notifObj.title, notifObj, function (notificationId) {\n console.log(notificationId, 'notification created');\n });\n}", "function notify(req, res) {\n News.findOne({\n isNotified: false\n }, function(err, result) {\n if (err || !result) {\n console.log(err);\n return res.status(400).send(err);\n } \n console.log(result);\n notifier.sendNewsToUsers(result, () => {\n console.log('done')\n News.findByIdAndUpdate(result._id, {$set:{\n isNotified: true\n }}, function(err) {\n console.log(err)\n res.send('Success');\n })\n })\n });\n}", "function subscribeUser() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(function(reg) {\n reg.pushManager.subscribe({\n userVisibleOnly: true\n })\n .then(function(sub) {\n console.log('Endpoint URL: ', sub.endpoint);\n })\n .catch(function(e) {\n if (Notification.permission === 'denied') {\n console.warn('Permission for notifications was denied');\n } \n else {\n console.error('Unable to subscribe to push : ', e.message);\n }\n });\n })\n }\n}", "function notifyUsers(data) {\n s.notificationEmpty.addClass('hide');\n s.notificationsWrapper.prepend(data.notificationPartial);\n $('.notification-nav__count-wrapper').html(data.notificationCountPartial);\n\n }", "function sendUserItems(channel, userName) {\n findItemsByUserName(userName).then(function(results){\n channel.emit('recivedUserItems', JSON.stringify(results[0].items));\n })\n}", "function getNotifications() {\n\tvar dni = document.getElementById('inputTxt').value;\n\tif(dni != \"\") {\n\t\tif(validateDNI(dni)) {\n\t\t\tvar apiURL = ENTRYPOINT_USERS_NOTIFICATIONS + \"?dni=\" + dni;\n\t\t\tpersonalAlert(\"CARGANDO \", \" -- Cargando notificaciones...\", \"info\", 150, true);\n\t\t\treturn $.ajax({\n\t\t\t\turl: apiURL,\n\t\t\t}).always(function() {\n\t\t\t\t$(\"#notificationsTable\").remove(); // Vaciar la tabla\n\t\t\t}).done(function (data, textStatus, jqXHR) {\n\t\t\t\tupdateNotificationsTable(data, dni);\n\t\t\t}).fail(function (jqXHR, textStatus, errorThrown) {\n\t\t\t\t//alert(\"Error al buscar el usuario.\");\n\t\t\t\tpersonalAlert(\"ERROR \", \" -- Error al buscar el usuario.\", \"danger\", 2000, false);\n\t\t\t});\n\n\t\t\t//updateUsersTable(); // OJO!! quitar esta linea cuando funcione la peticion AJAX\n\t\t}\n\t\telse {\n\t\t\t//alert(\"DNI incorrecto.\");\n\t\t\tpersonalAlert(\"ERROR \", \" -- DNI incorrecto.\", \"danger\", 2000, false);\n\t\t}\n\t}\n\telse {\n\t\t//alert(\"Debe introducir el DNI de un usuario.\");\n\t\tpersonalAlert(\"ERROR \", \" -- Debe introducir el DNI de un usuario.\", \"danger\", 2000, false);\n\t}\n}", "function subscribeUserToPush() {\n return navigator.serviceWorker.ready.then(reg => {\n const subscriptionOptions = {\n userVisibleOnly: true,\n applicationServerKey: urlBase64ToUint8Array('BJbGel5u8l_RfmWqO1yW-Hshdo4HfLCS8FlNMx0rBVIEBOR2a3h_NDbw4EGvJfv_vKdAhFrq5NdG1Q3JLT5Ux4o')\n };\n return reg.pushManager.subscribe(subscriptionOptions);\n }).then(pushSubscription => {\n putNotifBtnOn();\n return sendSubscriptionToServer(pushSubscription.toJSON());\n })\n}", "async function sendToStaff (user) {\n try {\n // prepare message\n let markdown = `${user.email} (${user.id}) has finished provisioning in the Webex CC v4 instant demo.`\n const url = 'https://webexapis.com/v1/messages'\n const token = globals.get('toolbotToken')\n const options = {\n method: 'POST',\n headers: {\n Authorization: 'Bearer ' + token\n },\n body: {\n roomId: globals.get('webexV4ProvisionRoomId'),\n markdown\n }\n }\n // send message\n await fetch(url, options)\n } catch (e) {\n console.log(`failed to notify staff of provision on Webex:`, e.message)\n }\n}", "function sendMails(){\n\t\t//get watched products\n WatchedProduct.find({}, function(err, watched_products){\n \tif(err){\n \t\tconsole.log(\"couldnt get watched products from db\");\n \t}else{\n \t\t//get products\n \t\tProduct.find({}, function(err2, products){\n \t\t\tif(err2){\n \t\t\t\tconsole.log(\"couldnt get products from db\");\n \t\t\t}else{\n \t\t\t\tfor(wprod in watched_products){\n wprod = watched_products[wprod];\n for(prod in products){\n prod = products[prod];\n if(prod.sid === wprod.sid){\n \tif(wprod.notifications === 'enabled' && parseFloat(wprod.threshold) >= parseFloat(prod.price)){\n \t\tsendNotif(wprod,prod);\n \t\tbreak;\n \t}\n }\n }\n }\n \t\t\t}\n \t\t});\n \t}\n });\n\t}", "function triggerNotification(){\n var hours = new Date().getHours();\n\n if (hours >= 10 && hours < 11) {\n console.log('[SW] Trigger notification');\n fetch('/user/notification', {\n method: 'GET',\n credentials: 'include'\n }).then(response => {\n\n }).catch(err => {\n console.log('Failed to fetch: ', err);\n });\n }\n}", "function returnNotification(eventID){ \n admin.database().ref('/attendees/' + eventID+'/').once('value', (snapshot) => {\n function encodeEmail(string) {\t\n return string.replace(/\\%2E/g, '.');\n } \n // get users for each eventID\n if(snapshot){ // if snapshot exists\n var emailObj = snapshot.val();\n console.log(emailObj);\n var emailList = [];\n Object.keys(emailObj).forEach((email)=>{\n var notification = emailObj[email];\n if (notification == true){ // if user's notification setting is on\n emailList.push(email);\n } // end if notification\n });\n var i = 0;\n emailList.forEach((email)=>{\n emailList[i] = encodeEmail(email);\n i++;\n }); // end forEach in emailliST\n console.log(emailList);\n // populate array of objects of {recipient: email}\n emailList.forEach((recipient)=>{ // emailList structure: ['[email protected]', '[email protected]'] \n var recipientObj = {\n \"recipient\": recipient\n } // end recipientObj\n emailObjArr.push(recipientObj);\n }); // end for each recipient\n // return get event information\n return admin.database().ref('/events/' + eventID+'/').once('value', (snapshot) => {\n if(snapshot){\n eventInfo = snapshot.val();\n var startTime= moment(eventInfo.start,\"YYYY-MM-DDTHH:mm:ss\").format(\"HH:mm\");\n console.log(startTime);\n eventInfo.start = startTime;\n // send email using pepipost API\n function pepipost(){\n var http = require(\"http\");\n var options = {\n \"method\": \"POST\",\n \"hostname\": \"api.pepipost.com\",\n \"port\": null,\n \"path\": \"/v2/sendEmail\",\n \"headers\": {\n \"content-type\": \"application/json\",\n \"api_key\": \"4a313664cc518338f18fe8391519b10d\"\n }\n };\n \n var req = http.request(options, function (res) {\n var chunks = [];\n \n res.on(\"data\", function (chunk) {\n chunks.push(chunk);\n });\n \n res.on(\"end\", function () {\n var body = Buffer.concat(chunks);\n console.log(body.toString());\n });\n });\n \n console.log(emailObjArr);\n // pass in emailObjArr to personalizations\n \n req.write(JSON.stringify({ personalizations: emailObjArr,\n from: { fromEmail: '[email protected]', fromName: 'farstarz' },\n subject: 'Event Reminder Tomorrow',\n content: `Hi,\\r\\n\n This is a reminder email. You are signed up for the event ${eventInfo.title} starting tomorrow at ${eventInfo.start}.\\n\n Have a great day!\\r\\n\\r\\n\n Regards,\\r\\n\n Vrikshah Foundation Team` }));\n req.end(); \n snapshot.testID = false;\n return (0);\n }\n return pepipost();\n } else {\n return (0);\n }\n }); //end of get event info code\n } // end if(snapshot)\n else {\n console.log('else statement executed because this particular event has no users signed up');\n return(0);\n }\n }); //end get emailID array function\n return(0);\n }", "notifySubscribers(artistId, subject, content){\n let subscribers = subscriptions.get(artistId)\n if (subscribers !== undefined){\n subscribers.forEach(subEmail => { //TODO: cambiar forEach por algun otro lambda\n gmailClient.users.messages.send(\n {\n userId: 'me',\n requestBody: {\n raw: this.createMessage(subEmail, subject, content),\n },\n }\n )\n });\n }\n \n}", "fetchUsers() {\n\t\treturn fetch(\"http://127.0.0.1:4120/v0/notify/cf/users\", {\n\t\t\tmethod: \"GET\",\n\t\t})\n\t\t\t.then(response => {\n\t\t\t\treturn response.json();\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tconsole.error(err);\n\t\t\t});\n\t}", "function notifyUser(options) {\n new Notification(options.title, options);\n}", "function notifyMe(data) {\n// Let's check if the browser supports notifications\n\tif (!(\"Notification\" in window)) {\n\t\talert(\"This browser does not support desktop notification\");\n\t}\n\t// Let's check whether notification permissions have alredy been granted\n\telse if (Notification.permission === \"granted\") {\n\t// If it's okay let's create a notification\n\t\tvar notification = new Notification(data);\n\t\tallNoti.push(notification);\n\t\tif(allNoti.length > 2) {\n\t \t\t allNoti[0].close();\n\t \t\t allNoti.shift();\n\t\t}\n\t}\n\t// Otherwise, we need to ask the user for permission\n\telse if (Notification.permission !== 'denied') {\n\t\tNotification.requestPermission(function (permission) {\n\t\t// If the user accepts, let's create a notification\n\t\t\tif (permission === \"granted\") {\n\t\t\t\tvar notification = new Notification(data);\n\t\t\t\tallNoti.push(notification);\n\t\t\t//check the allNoti array length and remove old notification when have 3 or more noti at the same time\n\t\t\t\tif(allNoti.length > 2) {\n\t\t\t \t\t allNoti[0].close();\n\t\t\t \t\t allNoti.shift();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function send(maildata){\n \tvar deferred = Q.defer();\n \tvar userReceive = userService.getUsersMail()\n \t\t.then(function(str_user){\n \t\t\tvar mailOptions = {\n\t\t\t from: maildata.from +' <[email protected]>', // sender address\n\t\t to: str_user, // list of receivers\n\t\t\t subject: maildata.subject, // Subject line\n\t\t\t text: maildata.text, // plain text body\n\t\t\t html: maildata.html, // html body\n\t\t\t attachments: maildata.attachments\n\t\t\t};\n\t\t \ttransporter.sendMail(mailOptions, (error, info) => {\n\t\t\t if (error) deferred.reject(err);\n\t\t\t deferred.resolve(maildata.server);\n\t\t\t});\n \t\t})\n \t\t.catch(function (err) {\n deferred.reject(err);\n });\n return deferred.promise;\n}", "function pusher(userId) {\n // Pusher related code\n var pusher = new Pusher('c2eac3b62fd45a991432', {\n cluster: 'eu'\n });\n var notificationsChannel = pusher.subscribe('team-builder-' + userId);\n\n notificationsChannel.bind('new_notification', function(notification) {\n var title = notification.title;\n var message = notification.message;\n notifyMe(title, message);\n });\n }", "async sendInviteEmails () {\n\t\tif (this.delayEmail) {\t// allow client to delay the email sends, for testing purposes\n\t\t\tsetTimeout(this.sendInviteEmails.bind(this), this.delayEmail);\n\t\t\tdelete this.delayEmail;\n\t\t\treturn;\n\t\t}\n\n\t\tawait Promise.all(this.invitedUsers.map(async userData => {\n\t\t\t// using both of these flags is kind of perverse, but i don't want to affect existing behavior ...\n\t\t\t// dontSendEmail is set on the POST /users request, and the expectation is that the invites information won't\n\t\t\t// be updated either ... that behavior came first and i want to leave it alone\n\t\t\t// but on the other hand when users are created on the fly in a review or codemark,\n\t\t\t// we don't want to send invite emails but we DO want to update the invite info\n\t\t\tif (!this.dontSendEmail && !this.dontSendInviteEmail) {\n\t\t\t\tawait this.sendInviteEmail(userData);\n\t\t\t}\n\t\t\tif (!this.dontSendEmail) {\n\t\t\t\tawait this.updateInvites(userData);\n\t\t\t}\n\t\t}));\n\t}", "async publishNumUsersInvited () {\n\t\tif (this.dontPublishToInviter) { return; }\n\t\tif (!this.transforms.invitingUserUpdateOp) { return; }\n\t\tconst channel = 'user-' + this.user.id;\n\t\tconst message = {\n\t\t\tuser: this.transforms.invitingUserUpdateOp,\n\t\t\trequestId: this.request.request.id\n\t\t};\n\t\ttry {\n\t\t\tawait this.api.services.broadcaster.publish(\n\t\t\t\tmessage,\n\t\t\t\tchannel,\n\t\t\t\t{ request: this.request }\n\t\t\t);\n\t\t}\n\t\tcatch (error) {\n\t\t\t// this doesn't break the chain, but it is unfortunate\n\t\t\tthis.request.warn(`Unable to publish inviting user update message to channel ${channel}: ${JSON.stringify(error)}`);\n\t\t}\n\t}", "displayNotifications() {\n const {\n notifications, onEvent, permission, isMuted\n } = this.props;\n const hasPermission = permission === browserUtilities.PERMISSION_GRANTED;\n\n if (notifications && notifications.length > 0) {\n notifications.forEach((notification) => {\n const {\n username, message, avatar, notificationId, alertType\n } = notification;\n\n if (alertType !== 'none' && !isMuted && hasPermission && browserUtilities.isBrowserHidden()) {\n // Actually display notification\n const n = browserUtilities.spawnNotification(message, avatar, username, TIMEOUT_LENGTH);\n // If there is an onEvent method\n const details = constructNotificationEventData(n, notification);\n\n if (onEvent && typeof onEvent === 'function') {\n onEvent(eventNames.NOTIFICATIONS_CREATED, details);\n n.addEventListener('click', () => {\n onEvent(eventNames.NOTIFICATIONS_CLICKED, details);\n });\n }\n }\n this.props.notificationSent(notificationId);\n });\n }\n }", "getMessages() {\n\t\tMessage.find().then((res) => {\n\t\t\tlet messages = res;\n\t\t\tlet promises = [];\n\n\t\t\tfor(let i=0;i < messages.length;i++) {\n\t\t\t\tpromises.push(User.findOne({ _id : messages[i].userId }));\n\t\t\t}\n\n\t\t\tQ.all(promises).then((res) => {\n\t\t\t\tfor(let i=0;i<messages.length;i++) {\n\t\t\t\t\tmessages[i].user = res[i];\n\t\t\t\t}\n\n\t\t\t\tthis.socket.emit('message', messages);\n\t\t\t});\n\t\t});\n\t}", "function broadcastList() {\n var userList = userHandler.getUsers();\n io.emit(\"user list\", userList);\n}", "function getMentorNotifications(id,callback) {\n // jQuery AJAX call for JSON\n $.getJSON( '/notifications/getMentorNotifications/'+ id, function( data ) {\n callback(data);\n });\n}", "function loadUsers() {\n var tempArray2 = [];\n MessengerService.loadAllUsers().then(function (data) {\n vm.allusers = data;\n vm.allusers.forEach(function (obj) {\n tempArray2.push(obj);\n\n // if param with user's name is specified, cross reference the name to find the users email in the database\n if (my_id != null) {\n //alert(\"found param \" + my_id);\n //alert(my_id + \" vs \" + obj.firstName + \" \" + obj.lastName);\n if (my_id == obj.email) {\n //alert(\"found id \" + my_id + \" email is \" + obj.email);\n $scope.usersToMessage = obj.email;\n\n // grab the users ID\n usersToMessageId = obj._id;\n }\n }\n\n //alert(obj.email);\n if (obj.verifiedEmail == false) {\n tempArray2.pop();\n }\n });\n vm.users = tempArray2;\n });\n }", "async getUsers () {\n\t\tlet userIds = this.posts.reduce((accum, post) => {\n\t\t\taccum = [...accum, post.get('creatorId'), ...(post.get('mentionedUserIds') || [])];\n\t\t\treturn accum;\n\t\t}, []);\n\t\tuserIds = ArrayUtilities.unique(userIds);\n\n\t\tthis.users = await this.data.users.getByIds(userIds);\n\t}", "function notify(messsages){\n const totalMessages=messsages.length;\n if(totalMessages!=0){\n const notifyString=`You have ${totalMessages} new ${totalMessages==1?\"message\":\"messages\"}`;\n notifier.notify({\n title:\"GmailFilteredNotify\",\n message:notifyString\n });\n console.log(\"**************************************\");\n console.log(notifyString);\n const currentTime=new Date().toString();\n console.log(currentTime);\n console.log(\"**************************************\");\n messsages.forEach(message=>{\n console.log(message.from);\n console.log(message.snippet);\n console.log(\"-------------------\");\n })\n }\n else{\n console.log(\"**************************************\");\n console.log(\"No New Message\");\n const currentTime=new Date().toString();\n console.log(currentTime);\n console.log(\"**************************************\");\n }\n}", "function requestNotificationsPermissions() {\n // TODO 11: Request permissions to send notifications.\n}", "notify(channel, data) {\r\n if (this.lastUpdate == -1) {\r\n this.lastUpdate = new Date();\r\n }\r\n\r\n var self = this;\r\n\r\n this.userUuids.forEach(function(uuid) {\r\n var user = self.server.findUser(uuid);\r\n \r\n // Send only packet to player that is in this room\r\n if (user && user.insideRoom(self)) {\r\n user.getConnection().sendPacket(channel, data);\r\n }\r\n });\r\n }", "function notifyChat(message) {\n users.forEach(user => {\n user.write(message);\n });\n}", "function subscribeUser() {\n // TODO 3.4 - subscribe to the push service\n}", "function receiveNotification(id,callback) {\n $.getJSON( '/notifications/addMemberInDiscussion', {id: id}, function( data ) {\n console.log(data);\n callback(data);\n });\n}", "function askUserPermission() {\n initializePushNotifications().then(updateUserConsent);\n}", "function show_notification() {\n chrome.storage.sync.get(\"notifications\", function(data) {\n if (data.notifications && data.notifications === \"on\") {\n var notification = webkitNotifications.createNotification(\n \"icon_128.png\",\n \"WaniKani\",\n \"You have new reviews on WaniKani!\"\n );\n notification.show();\n }\n });\n}", "sendToEachItem(user, device_tokens, sender, GCM) {\n var device_tokens = [];\n var sender = new gcm.Sender('AIzaSyD93SZYNCzkr_mdTN8A4jwdSGMn5V4Ni1U');\n if(user && user.device_token){\n if (user.device_token instanceof Array) {\n device_tokens.push.apply(device_tokens, user.device_token);\n } else {\n device_tokens.push(user.device_token);\n }\n }\n sender.send(this.GCM, device_tokens, 4, function (result) {\n });\n }", "function sendNotificationToUsers(body, subject) {\n let params = {\n Destination: { /* required */\n ToAddresses: [`${process.env.adminEmail}`],\n },\n Message: { /* required */\n Body: { /* required */\n Html: {\n Data: body, /* required */\n Charset: 'utf-8'\n }\n },\n Subject: { /* required */\n Data: subject,\n Charset: 'utf-8'\n }\n },\n Source: `${process.env.sesEmail}`, /* required */\n }\n return ses.sendEmail(params).promise();\n}", "async toggleNotifications() {\n \n // Are notifications enabled\n let enabled = await this.checkStatus();\n\n // Notifications are currently on\n if( enabled === 'true' ) {\n this.notificationsOff();\n }\n\n // Notifications are currently off\n else {\n this.notificationsOn();\n\n // Record when notifications started\n await this.setStartTime()\n .then( ( t ) => {\n\n // Force the app to send the first notification\n this.checkForNextNotification( t, true );\n });\n }\n }", "function getNewNotifications() {\n var unreadNotifications = 0;\n var ulHtml = '';\n var subject = '';\n var body = '';\n var link = '';\n var date = '';\n var notification_id = '';\n var receiver_id = '';\n var status_id = '';\n var user_receiver={};\n var decoded_token = decodeToken();\n var user_id = decoded_token['https://linuxacademy.com/auth/uuid'];\n\n $.ajax({\n url: notificationsApiPath + '/notifications?per_p=10&status_id='+notification_unread_status,\n dataType: 'json',\n beforeSend: function (xhr) {\n xhr.setRequestHeader('Authorization', accessToken());\n },\n success: function (data) {\n unreadNotifications = data.pagination.records;\n\n data.data.forEach(function (notification) {\n\n //find the receiver belonging to this user\n notification.receivers.forEach(function (receiver){\n if(receiver.user_id == user_id){\n user_receiver = receiver;\n }\n });\n\n // set up the params\n subject = cleanNotificationSubject(notification['subject']);\n body = cleanNotificationText(notification['body']);\n link = ((typeof notification['links'][0] !== 'undefined') ? notification['links'][0]['link'] : '');\n date = notification['created_at'];\n notification_id = notification.id;\n status_id = notification_read_status;\n receiver_id = user_receiver.id;\n\n\n //build the html list\n ulHtml += '<li>';\n ulHtml += '<a onclick=\"showNewNotification(\\''+subject+'\\',\\''+body+'\\',\\''+link+'\\',\\''+date+'\\',\\''+notification_id+'\\',\\''+status_id+'\\',\\''+receiver_id+'\\')\" data-toggle=\"modal\" href=\"#\">' + subject + '</a>';\n ulHtml += '</li>';\n });\n\n // view all link for bottom of menu\n ulHtml += '<li><a class=\"la-link\" href=\"' + notificationsPagePath + '\">View all</a></li>';\n $('#notification_overlay').html(ulHtml);\n },\n error: function (error) {\n //console.log(error)\n },\n complete: function () {\n $('#num_notifications').text(unreadNotifications);\n }\n });\n}", "function getNotification(i) {\n\treturn notifications[i];\n}", "function sendEmailToUsers(json, subject, message) {\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: '/emailUsers?userids=' + json + '&subject=' + subject + '&message=' + encodeURIComponent(message),\n\t\t\tsuccess: function(data){\n\t\t\t\talert(\"Message Sent!\");\t\t\n\t\t\t},\n\t\t\terror: function(data){\n\t\t\t\talert(\"There was a problem with your message and it was not sent. Please try again.\");\t\t\n\t\t\t}\n\t\t});\n\t}", "function sendEmail (users) {\n const pool = users.map(user => {\n let subject = 'co/ment - Operation: User Engagement!'\n let body = {\n type: 'html',\n text: engagementTpl(user.engageType)\n }\n\n return new Promise((resolve, reject) => {\n try {\n mailer(user.email, subject, body)\n resolve()\n } catch (err) {\n reject(err)\n }\n })\n })\n\n return Promise.all(pool)\n .then(() => {\n console.log(`Sent ${pool.length} reminder emails.`)\n return users\n })\n}", "function collectMessagesByUser(user, params){\n return collectMessagesBy(\"user\", user, params);\n }", "function loadUsers() {\n var tempArray2 = [];\n MessengerService.loadAllUsers().then(function (data) {\n vm.allusers = data;\n vm.allusers.forEach(function (obj) {\n tempArray2.push(obj);\n\n // if param with user's name is specified, cross reference the name to find the users email in the database\n if (my_id != null) {\n //alert(my_id + \" vs \" + obj.firstName + \" \" + obj.lastName);\n if (my_id == obj.email) {\n //alert(\"found id \" + my_id + \" email is \" + obj.email);\n $scope.usersToMessage = obj.email;\n }\n }\n\n //alert(obj.email);\n if (obj.verifiedEmail == false) {\n tempArray2.pop();\n }\n });\n vm.users = tempArray2;\n });\n }", "function notifyAllAgents(id, status) {\n for (var index = 0; index < users.length; index++) {\n if (users[index]['usertype'] == \"agent\" || users[index]['usertype'] == \"admin\") {\n //console.log(JSON.stringify({'type': Call_Events.NOTIFY,'id':users[index]['id'],'status':status}));\n users[index]['connection'].send(JSON.stringify({'type': Call_Events.NOTIFY, 'id': id, 'status': status}));\n }\n }\n}", "function checkNotification (user, admin, callback) {\n\tgetLastCheckIn(user, admin, function (err, previous) {\n\t\tif (previous === undefined) {\n\t\t\tconsole.log(\"No Checkins for user\");\n\t\t\treturn callback(null);\n\t\t}\n\t\tvar checkInInterval = admin.requiredCheckIn;\n\t\tvar reminderTime = admin.reminderTime;\n\t\tvar notifyEmergencyContact = admin.emergencyTime;\n\t\tvar overdueTime = admin.overdueTime;\n\t\tif (previous.type === 'Check In' || previous.type === 'Start') {\n\t\t\tvar timeNow = moment();\n\t\t\tvar previousTime = moment(previous.timestamp, 'ddd, MMM Do YYYY, h:mm:ss a Z', 'en');\n\t\t\tvar timeDiff = timeNow.diff(previousTime, 'minutes'); // get time difference in mins\n\t\t\tconsole.log(previous.name + \" last check in was \" + timeDiff + \" minutes ago\");\n\t\t\tif (timeDiff >= (checkInInterval - reminderTime)) {\n\t\t\t\tconsole.log(\"In Reminder/Overdue\");\n\t\t\t\tvar tech = previous.username;\n\t\t\t\tvar dontSend = false;\n\t\t\t\t// Stop sending messages if it's been too long\n\t\t\t\tif (timeDiff < (checkInInterval + notifyEmergencyContact)) {\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" is less than \" + (checkInInterval + notifyEmergencyContact));\n\t\t\t\t\tvar overdueAlert = timeDiff >= (checkInInterval + overdueTime);\n\t\t\t\t\tconsole.log(\"Reminders are: \" + (user.reminders ? 'ON' : 'OFF'));\n\t\t\t\t\tconsole.log(\"Notifications are: \" + (user.notifications ? 'ON' : 'OFF'));\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" > \" + checkInInterval);\n\t\t\t\t\tif (timeDiff > checkInInterval && user.reminders) {\n\t\t\t\t\t\tconsole.log(\"OVERDUE REMINDER\");\n\t\t\t\t\t\tvar message = \"You are \" + (-(checkInInterval - timeDiff)) + \" minutes overdue for Check In!\";\n\t\t\t\t\t\tvar subject = \"OVERDUE WARNING\";\n\t\t\t\t\t}\n\t\t\t\t\telse if (timeDiff < checkInInterval && user.notifications) {\n\t\t\t\t\t\tconsole.log(\"NORMAL REMINDER\");\n\t\t\t\t\t\tvar message = \"You are due for a Check In in \" + (checkInInterval - timeDiff) + \" minutes\";\n\t\t\t\t\t\tvar subject = \"REMINDER NOTIFICATION\"\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Setting dontSend to: true\");\n\t\t\t\t\t\tdontSend = true;\n\t\t\t\t\t}\n\t\t\t\t\tif (!dontSend) {\n\t\t\t\t\t\tconsole.log(\"Sending REMINDER/OVERDUE Notification\");\n\t\t\t\t\t\tvar emailObj = {\n\t\t\t\t\t\t\tto: user.email,\n\t\t\t\t\t\t\ttext: message,\n\t\t\t\t\t\t\tsubject: subject\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsendEmail(emailObj, function (err) {\n\t\t\t\t\t\t\tif (err) { \n\t\t\t\t\t\t\t\tvar emailError = {\n\t\t\t\t\t\t\t\t\tto: process.env.ERROR_EMAIL,\n\t\t\t\t\t\t\t\t\tsubject: \"Error sending email to \" + user.email,\n\t\t\t\t\t\t\t\t\ttext: err\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsendEmail(emailError);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(\"OVERDUE ALERT (ADMIN/VIEW USERS): \" + overdueAlert);\n\t\t\t\t\tif (overdueAlert) {\n\t\t\t\t\t\tvar massEmail = {\n\t\t\t\t\t\t\ttext: user.firstName + \" \" + user.lastName + \" (\" + user.username + \") is \" \n\t\t\t\t\t\t\t\t+ (-(checkInInterval - timeDiff)) + \" minutes overdue for check in!\",\n\t\t\t\t\t\t\tsubject: subject\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconsole.log(\"Admin notifications are \" + (admin.overdueNotifications ? 'ON' : 'OFF'));\n\t\t\t\t\t\tif (admin.overdueNotifications) {\n\t\t\t\t\t\t\tmassEmail.to = admin.email;\n\t\t\t\t\t\t\tsendEmail(massEmail);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetViewUsers(admin, function (err, viewUsers) {\n\t\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\t\tvar emailError = {\n\t\t\t\t\t\t\t\t\tto: process.env.ERROR_EMAIL,\n\t\t\t\t\t\t\t\t\tsubject: \"Error getting view users for \" + admin.username,\n\t\t\t\t\t\t\t\t\ttext: err\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsendEmail(emailError);\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (viewUsers.length !== 0) {\n\t\t\t\t\t\t\t\tviewUsers.forEach(function (viewUser) {\n\t\t\t\t\t\t\t\t\tif (viewUser !== undefined) {\n\t\t\t\t\t\t\t\t\t\tconsole.log(viewUser.username + \" has notifications \" + (viewUser.notifications ? 'ON' : 'OFF'));\n\t\t\t\t\t\t\t\t\t\tif (viewUser.notifications) {\n\t\t\t\t\t\t\t\t\t\t\tmassEmail.to = viewUser.email;\n\t\t\t\t\t\t\t\t\t\t\tsendEmail(massEmail);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallback(null);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcallback(null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Ensure they are only sent a message once\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" is less than \" + (checkInInterval + notifyEmergencyContact + runInterval));\n\t\t\t\t\tif (timeDiff < (checkInInterval + notifyEmergencyContact + runInterval)) {\n\t\t\t\t\t\tconsole.log(\"In Emergency Noticications\");\n\t\t\t\t\t\tif (user.emergencyContact.email !== '') {\n\t\t\t\t\t\t\tconsole.log(\"Sending EMERG msg to \" + user.emergencyContact.email);\n\t\t\t\t\t\t\tvar mailOpts = {\n\t\t\t\t\t\t\t\tto: user.emergencyContact.email,\n\t\t\t\t\t\t\t\tsubject: user.firstName + \" \" + user.lastName + ' is overdue for Check In',\n\t\t\t\t\t\t\t\thtml : '<p>' + user.firstName + \" \" + user.lastName + ' (' + user.username + ')'\n\t\t\t\t\t\t\t\t\t+ ' is overdue by ' + (timeDiff - checkInInterval) + ' minutes! Please ' \n\t\t\t\t\t\t\t\t\t+ 'ensure they are safe.</p><p><strong>You will only receive this email' \n\t\t\t\t\t\t\t\t\t+ ' once</strong></p>'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tsendEmail(mailOpts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (user.emergencyContact.phone !== '') {\n\t\t\t\t\t\t\tconsole.log(\"Sending EMERG text to \" + user.emergencyContact.phone);\n\t\t\t\t\t\t\tvar phoneOpts = {\n\t\t\t\t\t\t\t\tphone: user.emergencyContact.phone,\n\t\t\t\t\t\t\t\tbody: user.firstName + \" \" + user.lastName + \" is overdue by \" + (timeDiff - checkInInterval) \n\t\t\t\t\t\t\t\t\t+ \" minutes. Please ensure they are safe. You will only get this message once.\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsendText(phoneOpts);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Emergency contact already notified.\");\n\t\t\t\t\t}\n\t\t\t\t\tcallback(null);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log(timeDiff + \" not >= \" + (checkInInterval - reminderTime));\n\t\t\t\tconsole.log(\"NO ACTION TAKEN\");\n\t\t\t\tcallback(null);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconsole.log('Last checkin was END');\n\t\t\tcallback(null);\n\t\t}\n\t});\n}", "function getUsers() {\n subscribeService.getUsersContent()\n .then(function(data) {\n vm.data = data.slice(0, vm.data.length + 3);\n });\n }", "function userClick(user) {\n if (store.get('profile').user_id == user.user_id) {\n return;\n }\n logger.info('[TEST] Messaging ' + (user.name || user.nickname));\n }", "function susbribeToPushNotification() {\n createNotificationSubscription().then(function(subscrition) {\n showUserSubscription(subscrition);\n });\n}", "function getUsers() {\n\n intakeTaskAgeDatalayer.getUsersInFirm()\n .then(function (response) {\n self.allUser = response.data;\n }, function (error) {\n notificationService.error('Users not loaded');\n });\n }", "async publishUserUpdates () {\n\t\tconst userUpdates = this.transforms.userUpdateOps || [];\n\t\tawait Promise.all(userUpdates.map(async userUpdate => {\n\t\t\tawait this.publishUserUpdate(userUpdate);\n\t\t}));\n\t}", "function notifications() {\n if (permission === true) {\n if (seconds == 0 && minutes == 0) {\n popupNotification();\n soundNotification();\n }\n }\n}", "function sendNotification(){\n var msg = \"Edited at: \" + new Date().toTimeString(); \n SharedDb.sendGCM(msg);\n}", "function getNotes(userId) {\n console.log(userId);\n const userRef = firebase.database().ref(`users/${userId}`);\n userRef.on('value', snapshot => {\n writeNotestoHTML(snapshot.val());\n });\n}", "async getMentionedUsers () {\n\t\tconst userIds = this.attributes.mentionedUserIds || [];\n\t\tif (this.transforms.createdReview && this.transforms.createdReview.get('reviewers')) {\n\t\t\tuserIds.push(...this.transforms.createdReview.get('reviewers'));\n\t\t}\n\t\tif (userIds.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tthis.mentionedUsers = await this.data.users.getByIds(\n\t\t\tuserIds,\n\t\t\t{\n\t\t\t\tnoCache: true,\n\t\t\t\tfields: ['id', 'isRegistered']\n\t\t\t}\n\t\t);\n\t}", "async process () {\n\t\tlet userIds = [];\n\t\tif (this.teamId) {\n\t\t\tconst team = await this.data.teams.getById(this.teamId);\n\t\t\tif (!team) {\n\t\t\t\tthrow 'team not found';\n\t\t\t}\n\t\t\tuserIds = team.memberIds;\n\t\t}\n\t\telse {\n\t\t\tuserIds = [this.userId];\n\t\t}\n\n\t\tawait Promise.all(userIds.map(async userId => {\n\t\t\tawait this.setFlagForUser(userId);\n\t\t}));\n\t\tthis.logger.log(`Updated ${userIds.length} users and sent broadcaster messages`);\n\t}", "function notifyUser(message){\n var options = {\n body: message.text,\n icon: '../img/logo192x192.png',\n vibrate: [200, 100, 200]\n };\n\n if (!(\"Notification\" in window)) {\n console.log(\"This browser does not support desktop notification\");\n }\n else if (Notification.permission === \"granted\") {\n new Notification(message.title, options);\n }\n else if (Notification.permission !== \"denied\") {\n Notification.requestPermission(function (permission) {\n if (permission === \"granted\") {\n new Notification(message.title, options);\n }\n });\n }\n}", "function send_notification(value)\n\t{\n\t\tif(Notification.permission !== \"granted\")\n\t\t{\n\t\t\tNotification.requestPermission();\n\t\t}\n\n\t\telse\n\t\t{\n\t\t\tvar notification = new Notification(value.title, {\n\t\t\t\ttag: value.tag,\n\t\t\t\ticon: value.icon ? value.icon : \"\",\n\t\t\t\tbody: value.text ? value.text : \"\",\n\t\t\t});\n\n\t\t\tif(value.link && value.link != '')\n\t\t\t{\n\t\t\t\tnotification.onclick = function()\n\t\t\t\t{\n\t\t\t\t\twindow.open(value.link);\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}", "function sendNotificationEmail(){\n \n var htmlBody = '<html><body>Your AdWords URL Checker Summary for ' + ACCOUNT_NAME + ' is available at ' + SPREADSHEET_URL + '.</body></html>';\n var date = new Date();\n var subject = 'AdWords URL Checker Summary Results for ' + ACCOUNT_NAME + ' ' + date;\n var body = subject;\n var options = { htmlBody : htmlBody };\n \n for(var i in NOTIFY) {\n MailApp.sendEmail(NOTIFY[i], subject, body, options);\n Logger.log(\"An Email has been sent.\");\n }\n}", "function showUserMessges (user) {\r\n var list = document.getElementById('message-list');\r\n var user = JSON.parse(localStorage.getItem(user.email));\r\n for (var msg of user.messages) {\r\n let item = document.createElement('li');\r\n if (msg.from === user.email) {\r\n createSendMessages(list, item);\r\n }\r\n else if ( msg.timeToLive > ((new Date()).getTime() - new Date(msg.timeCreated).getTime())) {\r\n createReceivedMessages(list, item);\r\n }\r\n }\r\n\r\n function createSendMessages(list, item, lastTimeStamp){\r\n \r\n item.setAttribute('class', 'right');\r\n item.setAttribute('data-timestamp', msg.timeCreated.toString());\r\n item.innerHTML = '<receiver></receiver><bubble><message><strong>'+ msg.message + '</strong></message><sender> :' + msg.from + '</sender></bibble>';\r\n list.appendChild(item);\r\n }\r\n \r\n function createReceivedMessages(list, item, ){\r\n item.setAttribute('class', 'left');\r\n item.innerHTML = '<bubble><sender>' + msg.from + ': </sender><message><strong>'+ msg.message +'</strong>' + ' Expire @' + new Date(msg.timeCreated + msg.timeToLive).getHours() + ':' + new Date(msg.timeCreated + msg.timeToLive).getMinutes() + '</message></bubble><receiver></receiver>'\r\n item.setAttribute('data-timestamp', msg.timeCreated.toString());\r\n list.appendChild(item);\r\n setTimeout( function () {\r\n list.removeChild(item);\r\n }, msg.timeToLive - ((new Date()).getTime() - new Date(msg.timeCreated).getTime())); \r\n }\r\n\r\n setInterval(function (){\r\n var curUser = JSON.parse(localStorage.getItem(user.email));\r\n var nodes = list.querySelectorAll('li');\r\n if(nodes.length === 0){\r\n return;\r\n }\r\n var lastItem = nodes[nodes.length-1];\r\n var lastTimeStamp = lastItem.getAttribute('data-timestamp');\r\n var length = curUser.messages.length-1;\r\n var index = length;\r\n for (var i = length; i >= 0; i--){\r\n if (curUser.messages[i].timeCreated > lastTimeStamp) {\r\n index--;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n if (index < length) {\r\n for (; index <= length; index++) {\r\n let item = document.createElement('li');\r\n if ( curUser.messages[index].timeToLive > ((new Date()).getTime() - new Date(curUser.messages[index].timeCreated).getTime())) {\r\n if( curUser.messages[index].timeCreated <= lastTimeStamp){\r\n continue;\r\n }\r\n if(curUser.messages[index].from === curUser.email){\r\n item.setAttribute('class', 'right');\r\n item.innerHTML = '<receiver></receiver>' + '<bubble><message><strong>'+ curUser.messages[index].message +'</strong></message><sender>'+ ':' + curUser.messages[index].from + '</sender></bubble>' \r\n item.setAttribute('data-timestamp', curUser.messages[index].timeCreated.toString());\r\n list.appendChild(item);\r\n lastTimeStamp = item.getAttribute('data-timestamp');\r\n }\r\n else {\r\n item.setAttribute('class', 'left');\r\n item.innerHTML = '<bubble><sender>' + curUser.messages[index].from + ':' + '</sender>' + '<message><strong>'+ curUser.messages[index].message +'</strong>' + ' Expire @' + new Date(curUser.messages[index].timeCreated + curUser.messages[index].timeToLive).getHours() + ':' + new Date(curUser.messages[index].timeCreated + curUser.messages[index].timeToLive).getMinutes() + '</message></bubble>' + '<receiver></receiver>'\r\n item.setAttribute('data-timestamp', curUser.messages[index].timeCreated.toString());\r\n list.appendChild(item);\r\n lastTimeStamp = item.getAttribute('data-timestamp');\r\n setTimeout( function () {\r\n list.removeChild(item);\r\n }, curUser.messages[index].timeToLive - ((new Date()).getTime() - new Date(curUser.messages[index].timeCreated).getTime()));\r\n }\r\n } \r\n }\r\n }\r\n }, 2000);\r\n\r\n}", "sendMessageToUser(userId, message) {\n web.conversations\n .list({ exclude_archived: true, types: \"im\" })\n .then(res => {\n const foundUser = res.channels.find(u => u.user === userId);\n if (foundUser) {\n rtm\n .sendMessage(message, foundUser.id)\n .then(msg =>\n console.log(\n `Message sent to user ${foundUser.user} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\"User doesnt exist or is the bot user!\");\n }\n });\n }" ]
[ "0.72313565", "0.6730205", "0.6666311", "0.6325411", "0.6268119", "0.62463534", "0.6165363", "0.6141082", "0.6062444", "0.59622496", "0.58929646", "0.5857803", "0.5838891", "0.5835425", "0.58168834", "0.5814554", "0.5812346", "0.57949615", "0.5767521", "0.5765476", "0.57506496", "0.57308966", "0.5727497", "0.57168245", "0.5715914", "0.57013273", "0.56990707", "0.56963426", "0.5661963", "0.56552714", "0.562375", "0.56138587", "0.56019276", "0.5583115", "0.5563448", "0.55244166", "0.5503626", "0.54846317", "0.54713774", "0.5471013", "0.5470922", "0.5470859", "0.5460557", "0.54565513", "0.54522985", "0.5446323", "0.5442745", "0.54361576", "0.54328567", "0.5428289", "0.5424861", "0.54112476", "0.5403795", "0.5400343", "0.5398442", "0.5361252", "0.5358156", "0.53484607", "0.53472406", "0.53390104", "0.53360116", "0.533395", "0.53315866", "0.531762", "0.53169864", "0.5301165", "0.52941525", "0.5286613", "0.52838486", "0.5264578", "0.52641666", "0.5261118", "0.52572984", "0.5251252", "0.524614", "0.5244332", "0.5238856", "0.52341616", "0.5232862", "0.5230409", "0.52242285", "0.52206266", "0.52059853", "0.52034175", "0.51968426", "0.51826125", "0.5178545", "0.5173327", "0.51606214", "0.51563966", "0.5146889", "0.5145252", "0.51371235", "0.51368743", "0.5136238", "0.51328135", "0.5132041", "0.5127823", "0.5117762", "0.5113986" ]
0.6485289
3
function get all products This function query all products from the database and list as a table
function getAllProducts(){ // define select query var queryProducts = "SELECT * " + "FROM Products "; // execute select query connection.query(queryProducts,function(err, results){ if(err) throw err; // console.log(results); // create a table with column headings, and column width var table = new Table({ head: ['ID', 'NAME','PRICE','QUANTITY'] , colWidths: [5,30,10,10] }); // push query results to the table for(var i=0;i<results.length;i++){ table.push([results[i].item_id,results[i].product_name,results[i].unit_price.toFixed(2),results[i].stock_quantity]); } // print table to the console console.log(table.toString()); // print to additional lines console.log("\n\n"); // call function to get customer orders getOrder(); }); } // end getAllProducts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function queryAllProducts (){\n\tconnection.query(\"SELECT * FROM products\", function(err, res){\n\t\tfor (var i = 0; i < res.length; i++) {\n\t\t\tconsole.log(\"Id: \" + res[i].id + \" | \" + res[i].productName + \" | \" + \"$\" + res[i].price);\n\t\t}\n\t\tconsole.log(\"---------------------------------------------------\");\n\t});\n}", "function viewAllProducts() {\n connection.query('SELECT * FROM products', function(error, res) {\n if (error) throw error;\n var table = new Table({\n head: ['item_Id', 'Product Name', 'Price Per', 'Stock Qty']\n });\n\n for (i = 0; i < res.length; i++) {\n table.push(\n [res[i].item_id, res[i].product_name, \"$\" + res[i].price, res[i].stock_quantity]\n );\n }\n console.log(table.toString());\n connection.end();\n });\n}", "function listProducts(){\r\n\r\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\r\n\t\tif (err) throw err;\r\n\r\n\t\tconsole.table(res);\r\n\r\n\t});\r\n}", "function queryAllProducts() {\n\n console.log();\n console.log(\"ALL AVAILABLE ITEMS:\");\n console.log(\"-----------------------------------\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n for (var i = 0; i < res.length; i++) {\n console.log(res[i].item_id + \" | \" + res[i].product_name + \" | \" + res[i].price);\n }\n console.log(\"-----------------------------------\\n\");\n });\n}", "function listProducts() {\n\n con.query(\"SELECT * FROM products\", (err, result, fields) => {\n if (err) throw err;\n result.forEach(element => {\n table.push(\n [element.item_id, element.product_name, \"$\" + element.price, element.stock_quantity]\n )\n });\n console.log(chalk.green(table.toString()))\n // empty table to be able to push updated stock to it\n table.splice(0, table.length);\n\n startUp();\n })\n}", "static fetchAll() {\n return db.execute('SELECT * FROM products');\n }", "function list() {\n\treturn knex(\"products\").select(\"*\");\n}", "static fetchAll() {\n return db.execute('SELECT * FROM products');\n }", "function products() {\n var query = connection.query(\"SELECT item_id, department_name, product_name, price, stock_qty, product_sales FROM products ORDER BY item_id\", function(err, results, fields) {\n if(err) throw err;\n console.log(\"\\r\\n\" + \" - - - - - - - - - - - - - - - - - - - - - - - - \" + \"\\r\\n\");\n console.log(\"\\r\\n\" + chalk.yellow(\"-------- \" + chalk.magenta(\"BAMAZON PRODUCTS\") + \" ----------\") + \"\\r\\n\");\n var productsList = [];\n console.table(results);\n for(obj in results) {\n productsList.push(results[obj].products);\n }\n return managerDashboard(productsList);\n })\n}", "function showProducts() {\n connection.query(\"SELECT * FROM `products`\", function(err, res) {\n var table = new Table({\n head: [\"ID\", \"Product\", \"Department\", \"Price\", \"Stock\"],\n colWidths: [4, 18, 17, 10, 7]\n });\n\n for (var i = 0; i < res.length; i++) {\n table.push([\n res[i].item_id,\n res[i].product_name,\n res[i].department_name,\n res[i].price,\n res[i].stock_quantity\n ]);\n }\n console.log(\"\\n\" + table.toString() + \"\\n\");\n });\n}", "function viewProducts(){\n connection.query(\"SELECT * FROM products\", function(err, response){\n if(err) throw err;\n printTable(response);\n })\n}", "function products(){\n connection.query(\"SELECT * FROM products\", (err,result) =>{\n if (err) throw err;\n\n console.table(result);\n start();\n })\n}", "function list() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n let table = new Table({\n head: ['Product ID', 'Product Name', 'Price', 'Stock', 'Department'],\n color: [\"blue\"],\n colAligns: [\"center\"]\n })\n res.forEach(function(row) {\n let newRow = [row.item_id, row.product_name, \"$\" + row.price, row.stock_quantity, row.department_name]\n table.push(newRow)\n })\n console.log(\"Current Bamazon Products\")\n console.log(\"\\n\" + table.toString())\n menu();\n })\n}", "function listAllProducts() {\n const healthyPromise = dbBoutique.any\n ('SELECT * FROM products');\n return healthyPromise;\n}", "function viewProducts () {\n con.query(\"SELECT * from vw_ProductsForSale\", function (err, result) {\n if (err) {\n throw err;\n }\n else {\n var table = new Table({\n\t\t head: ['Product Id', 'Product Name', 'Department','Price','Quantity'],\n\t\t style: {\n\t\t\t head: ['blue'],\n\t\t\t compact: false,\n\t\t\t colAligns: ['center','left','left','right','right']\n\t\t }\n\t });\n\n\t //loops through each item in the mysql database and pushes that information into a new row in the table\n\t for(var i = 0; i < result.length; i++) {\n\t\t table.push(\n\t\t\t [result[i].Product_Id, result[i].Product_Name, result[i].Department, result[i].Price, result[i].Quantity]\n\t\t );\n\t }\n \n console.log(table.toString());\n runManageBamazon();\n }\n });\n }", "function displayAll() {\n connection.query(\"SELECT id, product_name, price FROM products\", function(err, res){\n if (err) throw err;\n console.log(\"\");\n console.log(' WELCOME TO BAMAZON ');\n var table = new Table({\n head: ['Id', 'Product Description', 'Price'],\n colWidths: [5, 50, 7],\n colAligns: ['center', 'left', 'right'],\n style: {\n head: ['cyan'],\n compact: true\n }\n });\n for (var i = 0; i < res.length; i++) {\n table.push([res[i].id, res[i].product_name, res[i].price]);\n }\n console.log(table.toString());\n // productId();\n }); //end connection to products\n}", "function showProducts() {\n connection.query(\"SELECT * FROM products ORDER BY 3\", function (err, res) {\n if (err) throw err;\n console.log(\"\\nAll Products:\\n\")\n var table = new Table({\n head: ['ID'.cyan, 'Product Name'.cyan, 'Department'.cyan, 'Price'.cyan, 'Stock'.cyan]\n , colWidths: [5, 25, 15, 10, 7]\n });\n res.forEach(row => {\n table.push(\n [row.item_id, row.product_name, row.department_name, \"$\" + row.price, row.stock_quantity],\n );\n });\n console.log(table.toString());\n console.log(\"\\n~~~~~~~~~~~~~~~~~\\n\\n\");\n start();\n });\n}", "function viewProducts() {\n connectionDB.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n //console.log(res);\n var tableFormat = new AsciiTable('PRODUCT LIST');\n tableFormat.setHeading('ITEM ID', 'PRODUCT NAME', 'PRICE', 'QUANTITES');\n for (var index in res) {\n\n tableFormat.addRow(res[index].item_id, res[index].product_name, res[index].price, res[index].stock_quantity);\n }\n console.log(tableFormat.toString());\n\n\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n\n // create an array to hold our formatted res data and loop through the res data\n var products = [];\n res.forEach(element => {\n products.push(\"ID#: \" + element.item_id + \" | Product Name: \" + element.product_name + \" | Price: $\" + element.price + \" | Quantity: \" + element.stock_quantity);\n }); // end .forEach\n\n // display the items\n console.log('\\n');\n console.log('《 ALL AVAILABLE PRODUCTS 》');\n console.log(\" -------------------------\" + '\\n');\n products.forEach(element => {\n console.log(element);\n }); // end .forEach\n console.log('\\n');\n start();\n }); // end .query\n} // end viewProductsFunction", "async function getAllProducts () {\n try {\n const resp = await fetch(baseUrl+'products')\n return resp.json();\n } catch (err) {\n }\n }", "function listItems(){\n var query=\"select * from products\"\n connection.query(query, function(err,res){\n if(err) throw err;\n //if no record found\n if(res.length<=0)\n {\n console.log(\"\\nNo Records found!!\\n\");\n }\n else\n {\n //Table object\n var table = new Table({\n head: ['Id', 'Product_name', 'price','stock_quantity']\n , colWidths: [4, 30, 10,20]\n });\n for(i=0;i<res.length;i++){\n table.push(\n [res[i].item_id, res[i].product_name, res[i].price,res[i].stock_quantity]\n );\n }\n \n console.log(table.toString());\n \n }\n\n runSearch();\n });\n }", "function displayProducts() {\n console.log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results \n for (var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].id + \" | \" + \"Product: \" + res[i].product_name + \" | \" + \"Department: \" + res[i].department_name + \" | \" + \"Price: \" + res[i].price + \" | \" + \"Quantity: \" + res[i].stock_quantity);\n console.log('------------------------------------------------------------------------------------------------------------')\n };\n selectProducts(res)\n });\n}", "function displayProducts(){\n connection.query(\"SELECT * FROM products\", function(err, res){\n if (err) throw err;\n tableFormat(res);\n })\n\n}", "function readProducts() {\n console.log(\"Products Available...\\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n else { \n // loop through id, product name, price and display \n for (var i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].id);\n console.log(\"NAME: \" + res[i].product_name);\n console.log(\"PRICE: \" + res[i].price);\n console.log(\" \");\n }\n select();\n }\n }); \n }", "function showProducts(query) {\n console.log(\"showProducts\");\n \n console.log(\"Selecting all products...\\n\");\n connection.query(query, function (err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n for(var i = 0; i<res.length; i++){\n\n //store response for colum fields in variables for string interpolation\n var id = res[i].item_id;\n var name = res[i].product_name;\n var department = res[i].department_name;\n var price = res[i].customer_price;\n var quantity = res[i].stock_quantity;\n console.log(`ID: ${id} | Item: ${name} | Department: ${department} | Price: $${price} | Quantity: ${quantity}`); // console.log('--------------------------------------------------------------------------------------------------')\n \n }\n //create a new table using a javascript constructor \n var t = new Table;\n res.forEach(element => {\n t.cell(\"productID\", element.item_id)\n t.cell(\"productName\", element.product_name)\n t.cell(\"deptName\", element.department_name)\n t.cell(\"custPrice\", element.customer_price)\n t.cell(\"stockQuantity\", element.stock_quantity)\n\n t.newRow()\n\n });\n console.log(t.toString()); \n });\n \n }", "function displayProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.table(res);\n });\n}", "function products(){\n connection.query(\"SELECT * from products\", function (err, res) {\n if (err) throw err;\n console.log(\"The available items are:\");\n res.forEach((res) => {\n table.push( [`${res.item_id}`, `${res.product_name}`, `$${res.price}`, `${res.stock_quantity}`])\n });\n console.log(table.toString());\n connection.end();\n });\n}", "function productItems() {\n\tconnection.connect(function(err) {\n\n\t\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif (err) throw err\n\t\telse console.table(res , \"\\n\");\n\t\tproductId();\n\t\t});\n\t});\n}", "async getAllProducts(req) {\n try {\n return await this.productsDbConnector.getAllProducts();\n } catch (err) {\n throw err;\n }\n }", "function viewAll() {\n connection.query(\"SELECT * FROM products\",\n function (err, res) {\n if (err) throw err;\n console.table(res);\n connection.end();\n }\n );\n}", "function viewAllProducts() {\n //connection/callback function\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.log(\"All items currently available in marketplace:\\n\");\n console.log(\"\\n-----------------------------------------\\n\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"Id: \".bold + res[i].item_id + \" | Product: \".bold + res[i].product_name + \" | Department: \".bold + res[i].department_name + \" | Price: \".bold + \"$\".bold +res[i].price + \" | QOH: \".bold + res[i].stock_quantity);\n }\n console.log(\"\\n-----------------------------------------\\n\");\n });\n\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM bamazon.products\", function (err, res) {\n if (err) throw err;\n console.log(\"\\n\")\n for (let i = 0; i < res.length; i++) {\n console.log(\"ID: \" + res[i].item_id + \" ---- Product: \" + res[i].product_name + \" ---- Price: $\" + res[i].price + \" ---- Quantity: \" + res[i].stock_quantity)\n }\n })\n start();\n}", "function readProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n \n // instantiate\n var table = new Table({\n head: ['Item ID', 'Product Name', 'Price']\n , colWidths: [10, 20, 20]\n });\n \n // loop through the response and print out each row into the table\n for (var i = 0; i < res.length; i++) { \n table.push(\n [res[i].item_id, res[i].product_name, `$`+res[i].price]\n );\n }; // ENDS for loop\n\n console.log(\"\\n\" + table.toString());\n welcomePurchase();\n\n }); // ENDS response\n}", "function showAllProducts() {\n var sql = 'SELECT ?? FROM ??';\n var values = ['*', 'products'];\n sql = mysql.format(sql, values);\n connection.query(sql, function (err, results, fields) {\n if (err) throw err;\n for (let i = 0; i < results.length; i++) {\n console.log(` \\nItem ID: ${results[i].item_id} Name: ${results[i].product_name} Department: ${results[i].department_name} Price: ${results[i].price} Stock Quantity: ${results[i].stock_quantity} \\n-------------------------------------------------------------------------------------- \\n`);\n }\n startingQuestions();\n });\n}", "function viewProducts(){\n var query = connection.query(\"SELECT ID, Product_Name , Price, Stock_QTY FROM products;\", function(err, res) {\n console.log(\"\");\n console.table(res);\n console.log(\"\");\n \n managerAsk();\n });\n }", "function productsTable() {\n\tdbConnection.query(\"SELECT * FROM products\", function(err, res){\n\t\tconsole.table(res);\n\t\tcustomerPrompt(res);\n\t});\n}", "function viewProducts() {\n\tconnection.query('SELECT * FROM Products', function(err, result) {\n\t\tcreateTable(result);\n\t})\n}", "function displayProducts(){\n console.log('printing product table... \\n');\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n console.log('Products \\n---------------')\n for(var i = 0; i < res.length; i ++){\n console.log(\n 'ID: ' + res[i].id + '\\n' +\n 'Name: ' + res[i].name + '\\n' +\n 'Department: ' + res[i].department + '\\n' +\n 'Price: ' + (res[i].price/100).toFixed(2) + '\\n' +\n 'Quantity: ' + res[i].quantity + '\\n' +\n '---------------'\n );\n }\n shop();\n })\n}", "function getProducts(cb){\n con.query(\"SELECT * FROM products\", function (err, result) {\n if (err) throw err;\n products = result;\n getItems(result)\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n \n //clear out products array\n tableArray = [products];\n var tempArray = [];\n\n //goes through items and lists products in table array\n for (var i = 0; i < res.length; i++) {\n tempArray = [res[i].id, res[i].product_name, res[i].department_name, res[i].price, res[i].stock_quantity];\n tableArray.push(tempArray);\n }\n console.log(\"\\n\" + table(\n tableArray\n ) + \"\\n\")\n doWhat();\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(error, results) {\n if (error) throw error;\n console.log(\"AVAILABLE ITEMS:\");\n for (var i = 0; i < results.length; i++) {\n console.log(results[i].id + ' | ' + results[i].product_name + ' | ' + '$'+results[i].price + ' | ' + results[i].stock_quantity);\n }\n });\n connection.end();\n}", "function saleProducts() {\n console.log(\"View Sale Products\");\n connection.query(\"SELECT * FROM `products`\", function(queryError, response) {\n if (queryError)\n throw queryError;\n response.forEach(function(row) {\n console.log(\"id = \", \"'\", row.id, \"'\",\n \"Product Name = \", \"'\", row.product_name, \"'\",\n \"Price \", \"'\", row.price, \"'\",\n \"Quantity \", \"'\", row.stock_quantity, \"'\")\n });\n })\n }", "getAllProducts() {\n var productList = new Array()\n var product = null\n for(var index=0; index<this.productCount; index++) {\n var id = index + 1\n product = new Product(id, this.productTitleList[index], this.productImageList[index], this.productPriceList[index])\n productList.push(product)\n }\n return productList\n }", "function viewProducts(){\n connection.query(\"SELECT * FROM products\", function(err, results){\n if (err) throw err;\n for (var i = 0; i < results.length; i++){\n table.push(\n [\n results[i].item_id,\n results[i].product_name,\n results[i].department_name,\n results[i].price,\n results[i].stock_quantity\n ]);\n }\n console.log(table.toString());\n start();\n })\n}", "function readProducts() {\n\n connection.query(\"SELECT id, product_name, price FROM products\", function (err, res) {\n if (err) throw err;\n //This is a npm addin to make a better looking table\n console.table(res);\n //Once the table is shown, the function startTransaction is called\n startTransaction();\n\n });\n}", "function viewProducts(){\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n displayTable(res);\n promptManager();\n });\n}", "function viewProducts() {\n connection.query(\"select * from products\", function (err, res) {\n if (err) throw err;\n console.log(\"\\n\");\n console.table(res);\n quit();\n });\n}", "viewAllProducts(){\n \n return this.connection.queryAsync('SELECT * FROM products')\n .then(data => {\n\n data.forEach((product) =>{\n console.log(\n `${product.item_id} -- ${product.product_name} ---- ${product.price}`\n );\n })\n \n })\n .then(this.connection.end())\n .catch((err) => console.log(err));\n\n }", "function queryAllItems() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // for (var i = 0; i < res.length; i++) {\n // console.log(\n // res[i].item_id +\n // \" | \" +\n // res[i].product_name +\n // \" | \" +\n // res[i].department +\n // \" | \" +\n // res[i].price +\n // \" | \" +\n // res[i].stock_quantity\n // );\n // }\n // console.log(\"successfully quried products\");\n console.table(res);\n start(res);\n });\n}", "function getProducts() {\n let sql = \"SELECT * FROM products ORDER BY name ASC\";\n \n return new Promise(function(resolve, reject) {\n pool.query(sql, function(err, rows) {\n if (err) throw err;\n resolve(rows);\n });\n });\n}", "function viewProducts() {\n database.query(\"SELECT * FROM products\", function (err, itemData) {\n if (err) throw err;\n for (var i = 0; i < itemData.length; i++) {\n console.log(`\n----------------------------------------------------\nID: ${itemData[i].id} | Product: ${itemData[i].product_name} | Price: $${itemData[i].price} | Stock: ${itemData[i].stock_quantity}\n----------------------------------------------------\n`)\n }\n })\n return start();\n}", "function readProducts() {\n console.log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n console.log(\"Welcome to Bamazon Prime\".blue.bgWhite);\n console.log(\"-----------------------------------------------------------------------------\".blue);\n for (var i = 0; i < res.length; i++) {\n console.log(\"Item ID: \".yellow +res[i].item_id + \" |Product: \".yellow + res[i].product_name + \" |Dept: \".yellow + res[i].department_name + \" |Price: \".yellow + res[i].price + \" |Qty: \".yellow + res[i].stock_quantity);\n console.log(\"-----------------------------------------------------------------------------\".blue);\n }\n if (err) throw err;\n\n connection.end();\n });\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(err, results) {\n if (err) throw err;\n console.log(\"\\n\" + colors.yellow(\"---------------------PRODUCTS FOR SALE---------------------\") + \"\\n\");\n var table = new cliTable({ head: [\"ID\", \"Item\", \"Price\", \"Quantity\"] });\n for (var i = 0; i < results.length; i++) {\n table.push([results[i].id, results[i].productName, results[i].price, results[i].stockQuantity]);\n }\n console.log(table.toString() + \"\\n\");\n actionPrompt();\n });\n}", "function showProducts() {\n console.log(\"\\nDisplaying All Products....\");\n connection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products \", function (err, res) {\n if (err) throw err;\n // for (var i = 0; i<res.length; i++)\n console.log(JSON.stringify(res) + \"\\n\");\n startMenu();\n });\n}", "static get_All_products(){\n return products;\n }", "function getProducts(res, mysql, context, complete){\n \tmysql.pool.query(\"SELECT p_id, p_name, p_qty, p_mfg, price FROM Product\", function(error, results, fields){\n if(error){\n res.write(JSON.stringify(error));\n res.end();\n }\n context.product = results;\n complete();\n });\n }", "function productsForSale() {\n connection.query('SELECT * FROM products', function (err, allProducts) {\n if (err) throw err;\n\n var table = new Table({\n head: ['item_id', 'product_name', 'department_name', 'price', 'stock_quantity', 'product_sales'],\n colWidths: [10, 25, 20, 10, 18, 15]\n });\n\n for (var i = 0; i < allProducts.length; i++) {\n table.push([allProducts[i].item_id, allProducts[i].product_name, allProducts[i].department_name, allProducts[i].price, allProducts[i].stock_quantity, allProducts[i].product_sales]);\n }\n\n console.log(table.toString());\n console.log('\\n');\n managerView();\n });\n}", "function displayProducts() {\n let query = \"SELECT * FROM products\";\n connection.query(query, function (err, res) {\n\n if (err) throw err;\n\n var table = new Table({\n head: [\"Product ID\", \"Product Name\", \"Price\", \"Stock Available\"],\n colWidths: [15, 25, 15, 25]\n });\n\n for (let i = 0; i < res.length; i++) {\n\n table.push(\n [res[i].item_id, res[i].product_name, res[i].price, res[i].stock_quantity]);\n\n }\n\n console.log(table.toString());\n\n //console.log(`Product ID: ${res[i].item_id}`);\n //console.log(`Product Name: ${res[i].product_name}`);\n //console.log(`Price: ${res[i].price}`);\n //console.log(`Stock Quantity: ${res[i].stock_quantity}`);\n\n requestProduct();\n });\n}", "function listProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n\n for (var i = 0; i < res.length; i++) {\n var products = res[i];\n\n var productList = [\n \"Product ID: \" + products.id,\n \"Product: \" + products.product_name,\n \"Department: \" + products.department_name,\n \"Price: $\" + products.price,\n \"Stock Quantity: \" + products.stock_quantity\n ].join(\"\\n\");\n\n console.log(\"\\n\");\n console.log(productList);\n }\n });\n promptCustomer()\n }", "function displayProducts() {\n connection.query(`\n SELECT item_id, product_name, price \n FROM products \n WHERE stock_quantity > 0`, (err, response) => {\n if(err) console.log(chalk.bgRed(err));\n response.forEach(p => p.price = `$ ${p.price.toFixed(2)}`);\n console.table(response);\n // connection.end();\n start();\n });\n}", "getProducts() {}", "function displayAllProducts() {\n connection.query(\"SELECT * FROM PRODUCTS\", function(err, res){\n res.forEach(function(row) {\n console.log(row.id, row.product_name, row.department_name, row.price, row.stock_quantity);\n });\n\n promptUser(res);\n }); \n}", "function viewProducts() {\n connection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products\", function (err, res) {\n console.log(\"Products for sale\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"======================\");\n console.log(\"Id: \" + res[i].item_id + \" || Department: \" + res[i].department_name + \" || Product: \" + res[i].product_name + \" || Price($): \" + parseFloat(res[i].price).toFixed(2) + \" || In stock: \" + res[i].stock_quantity);\n }\n });\n displayChoices();\n}", "function listAllProducts(req, res) {\n let sortBy = (req.query.sortBy ? req.query.sortBy : \"sold\");\n let order = req.query.order ? req.query.order : \"desc\";\n\n // let limit = req.query.limit ? parseInt(req.query.limit) : 6;\n const { page, limit } = req.body;\n const limit = limit || 6;\n const skip = page || 1;\n\n const total = Product.find().count();\n\n // console.log(sortBy, order, limit);\n Product.find()\n .select(\"-photo\")\n .populate(\"category\")\n // .sort([[sortBy,order]])\n // ivan 20200831\n .skip(skip)\n .limit(limit)\n .exec((err, products) => {\n if (err) {\n return res.status(400).json({\n error: errorHandler(err)\n })\n }\n res.json({\n data: products,\n total\n });\n })\n}", "function GetProducts (req,res){\n const query =`\nSELECT P.prodId,P.prodNombre,P.prodDescripcion,P.prodPrecio,P.prodFechaCreacion,P.prodCantidad,U.uniNombre,C.catNombre,PR.preNombre,M.marNombre,US.usuNombre,US.usuApellido,PO.proNombre FROM productos P\nINNER JOIN unidades U ON P.prodIdUnidad=U.uniId\nINNER JOIN categorias C ON P.prodIdCategoria=C.catId\nINNER JOIN presentaciones PR ON P.prodIdPresentacion=PR.preId\nINNER JOIN marcas M ON P.prodIdMarca=M.marId\nINNER JOIN usuarios US ON P.prodIdUsuario=US.usuId\nINNER JOIN proveedores PO ON M.marIdProv=PO.proId\n;\n `;\n mysqlConn.query(query, (err,rows,fields) =>{\n if(!err){\n if(rows.length > 0){\n var productos = rows;\n res.json(productos);\n }else{\n res.json({status:\"No se encontraron productos\"});\n }\n }else{\n console.log(err);\n };\n });\n}", "function viewProducts() {\n connection.query(\"SELECT item_id, product_name, price, stock_quantity FROM products\", function (err, res) {\n if (err) throw err;\n console.log(\"\");\n console.table(res);\n connection.end();\n });\n}", "function getProducts() {\n\treturn db.query(\"SELECT * FROM products\")\n\t\t.then(function(rows) {\n\t\t\treturn rows[0];\n\t\t})\n\t .catch(function(err) {\n\t console.log(err);\n\t });\n}", "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif(err) {\n\t\t\tthrow err\n\t\t};\n\t\tfor (var i =0; i < res.length; i++) {\n\t\t\tconsole.log(\"SKU: \" + res[i].item_id + \" | Product: \" + res[i].product_name \n\t\t\t\t+ \" | Price: \" + \"$\" + res[i].price + \" | Inventory: \" + res[i].stock_quantity)\n\t\t}\n\t\t// connection.end();\n\t\trunQuery();\n\t});\n}", "function viewProducts(){\n\n\tvar query = \"SELECT * FROM products\";\n\n\tconnection.query(query, function(err, res){\n\t\tif (err) throw err;\n\t\tconsole.log(\"ALL INVENTORY IN PRODUCTS TABLE\");\n\t\tfor(i=0; i< res.length; i++){\n\t\t\tconsole.log(\"---|| ID \"+ res[i].item_id+\" ---|| NAME: \"+ res[i].product_name+\" ---|| PRICE: $\"+ res[i].price + \" ---|| QUANTITY \" + res[i].stock_quantity);\n\t\t};\n\t\taskAction();\n\t})\n\n}", "function listProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n let table = new Table({\n head: ['ID', 'Name', 'Department', 'Price', 'Stock']\n })\n for (let i = 0; i < res.length; i++) {\n table.push([res[i].item_id, res[i].product_name, res[i].department_name, `$${res[i].price}`, res[i].stock_quantity]);\n };\n console.log(\"\\n\")\n console.log(table.toString());\n });\n placeOrder();\n}", "function viewProducts(){\n\n\t// Query: Read information from the products list\n\tconnection.query(\"SELECT * FROM products\", function(viewAllErr, viewAllRes){\n\t\tif (viewAllErr) throw viewAllErr;\n\n\t\tfor (var i = 0; i < viewAllRes.length; i++){\n\t\t\tconsole.log(\"Id: \" + viewAllRes[i].item_id + \" | Name: \" + viewAllRes[i].product_name +\n\t\t\t\t\t\t\" | Price: \" + viewAllRes[i].price + \" | Quantity: \" + viewAllRes[i].stock_quantity);\n\t\t\tconsole.log(\"-------------------------------------------------------------------\");\n\t\t}\n\n\t\t// Prompts user to return to Main Menu or end application\n\t\trestartMenu();\n\t});\n}", "function viewProducts() {\n console.log('Here is the current inventory: ');\n var table = new Table({\n head: ['Item ID', 'Product Name', 'Price', 'Quantity']\n });\n connection.query(\"SELECT * FROM products\", function (err, res) {\n for (let i = 0; i < res.length; i++) {\n table.push(\n [res[i].item_id, res[i].product_name, res[i].price, res[i].stock_quantity]\n );\n }\n console.log(table.toString());\n console.log('\\n*******************');\n managerOptions();\n })\n}", "function queryAllRows() {\n connection.query(\"SELECT * FROM products\", function (err, data) {\n if (err) throw err;\n\n console.table(data);\n selectItem(data);\n });\n}", "async getProducts() {\n const products = await this.client().product\n .list()\n .then((product) => (product))\n .catch((err) => console.error(err));\n return products;\n }", "function GetProductosList() {\n\t\treturn $.ajax({\n\t\t\turl: '/api/productos/listar',\n\t\t\ttype: 'get',\n\t\t\tdataType: \"script\",\n\t\t\tdata: { authorization: localStorage.token },\n\t\t\tsuccess: function(response) {\n\t\t\t\tconst productos = JSON.parse(response);\n\t\t\t\t//console.log(usuarios); //<-aqui hago un console para ver lo que devuelve\n\t\t\t\tproductos.forEach(producto => {\n\t\t\t\t\ttablaProductos.row.add({\n\t\t\t\t\t\t\"codigoProducto\": producto.codigoProducto,\n\t\t\t\t\t\t\"nombreProducto\": producto.nombreProducto,\n\t\t\t\t\t\t\"precioCompra\": producto.precioCompra,\n\t\t\t\t\t\t\"precioVenta\": producto.precioVenta,\n\t\t\t\t\t\t\"ivaCompra\": producto.ivaCompra,\n\t\t\t\t\t\t\"nombreProveedor\": producto.proveedor.nombreProveedor,\n\t\t\t\t\t\t\"nitProveedor\": producto.proveedor.nitProveedor,\n\t\t\t\t\t}).draw();\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}", "function displayProducts() {\n table.length = 0;\n connection.query(\"SELECT * FROM products\", (err, res) => {\n if (err) throw err;\n\n for (let i in res) {\n let item_id = res[i].item_id;\n let product_name = res[i].product_name;\n let department_name = res[i].department_name;\n let price = res[i].price;\n let stock = res[i].stock_quantity;\n\n table.push([item_id, product_name, department_name, price, stock]);\n }\n console.log(table.toString());\n purchase();\n });\n}", "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif (err) throw err;\n\t\tfor (var i = 0; i < res.length; i++) {\n\t\t\tconsole.log(\"---------------------------------------\" + \n\t\t\t\"\\nItem Id: \" + res[i].item_id + \"\\nProduct: \" + \n\t\t\tres[i].product_name + \"\\nPrice: \" + res[i].price + \n\t\t\t\"\\nQuantity in Stock: \" + res[i].stock_quantity);\n\t\t}\n\t\tstartOver();\n\t});\n}", "function getProducts() {\n\tajax('GET', 'products', null, createProductList);\n}", "function retrieveAll() {\n console.log(\"* ProductsController: retrieveAll\");\n ProductsService\n .retrieveAll()\n .then(function (data) {\n console.log(\"> Controller Result:\", data);\n vm.result = data;\n // vm.result.sort(CommonService.sortCusine);\n })\n .catch(function (err) {\n console.log(\"> Controller Error:\", err);\n // console.log(\"Controller Error 2:\", JSON.stringify(err));\n });\n }", "function readProducts() {\n connection.query(\"SELECT * FROM products\", function(err, res) {\n // Creating a new table\n var table = new Table({\n head: [\"Product ID\".headder, \"Product Name\".headder, \"Product Price\".headder, \"Units in Stock\".headder],\n colWidths: [12, 25, 15, 20]\n });\n if(err) throw err;\n for(var i = 0; i < res.length; i++) {\n // Pushing all the info from the DB into the new table\n table.push(\n [res[i].product_id, res[i].product_name, \"$\" + res[i].price, res[i].stock_quantity]\n );\n }\n // Displaying the table\n console.log(table.toString());\n // Ending the connection\n connection.end();\n });\n}", "function displayProducts() {\n connection.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n // Log all results of the SELECT statement\n console.table(res);\n takeOrder();\n });\n}", "function viewAll() {\n connection.query('SELECT * FROM products', function(err, res) {\n // Sets up table for our raw data already populated within MYSQL Workbench\n var table = new Table({\n head: ['ID', 'Product Name', 'Department', 'Price', 'Stock Quantity']\n });\n\n // displays all current inventory in a fancy shmancy table thanks to cli-table package\n console.log(chalk.blue(\"CURRENT INVENTORY, HOT HOT HOT!!!\"));\n console.log(\"===========================================================================================\");\n for (var i = 0; i < res.length; i++) {\n table.push([res[i].id, res[i].product_name, res[i].department_name, res[i].price.toFixed(2), res[i].stock_quantity]);\n }\n console.log(\"-------------------------------------------------------------------------------------------\");\n console.log(table.toString());\n // call next function\n whatToBuy();\n })\n }", "function displayProducts() {\n connection.query(\"select item_id as ID,product_name as Product,price as Price,stock_quantity as Quantity from products; \", function (error, respDB) {\n if (error) throw error;\n console.table(respDB);\n askIfContinuing();\n });\n}", "findAll() {\r\n let sqlRequest = \"SELECT * FROM cars\";\r\n return this.common.findAll(sqlRequest).then(rows => {\r\n let cars = [];\r\n for (const row of rows) {\r\n cars.push(new luxRental.Products(\r\n row.id,\r\n row.make,\r\n row.model,\r\n row.mpg,\r\n row.image,\r\n row.description\r\n )\r\n );\r\n }\r\n return cars;\r\n });\r\n }", "function viewProducts() {\n var queryString = 'SELECT * FROM products';\n con.query(queryString, function(err, rows) {\n if (err) throw err;\n var data = rows;\n var t = new table\n data.forEach(function(product) {\n t.cell('Product ID', product.item_id);\n t.cell('Product Name', product.product_name);\n t.cell('Product Price', product.price);\n t.cell('Product Stock', product.stock_quantity);\n t.newRow()\n });\n console.log(t.toString());\n });\n}", "function readProducts() {\n console.log(\"Selecting all products...\\n\");\n connection.query(\"SELECT * FROM products\", function(error, productList){\n if (error) throw error;\n // Log the productList array which contains the data from products table that was queried by using the SELECT SQL statement\n console.log('----------------------------------------------------------');\n console.log(productList);\n console.log('----------------------------------------------------------');\n chooseProduct(productList);\n });\n}", "function viewProducts(){\n console.log(\"\\nView Every Avalailable Product in format:\");\n connection.query(\"SELECT * FROM products\", function(err, res) {\n if (err) throw err;\n console.log(\"'ItemID-->Product Description-->Department Name-->Price-->Product Quantity'\\n\");\n for (var i = 0; i < res.length; i++) {\n console.log(\"Item# \" + res[i].item_id + \"-->\" + res[i].product_name \n + \"-->\" + res[i].department_name + \"-->\" + res[i].price \n + \"-->\" + res[i].stock_quantity);\n }\n // console.table(\"\\nProducts Available:\",[\n // res\n // ])\n })\n setTimeout(function() { startManager(); }, 200);\n}", "function productList() {\n db.query(\"SELECT * FROM products\", function (err, res) {\n if (err) throw err;\n\n var table = new products({\n head: [\"Product ID\", \"Product\", \"Department\", \"Price\", \"Quantity\"],\n colWidths: [10, 75, 20, 10, 10],\n });\n for (var i = 0; i < res.length; i++) {\n table.push(\n [res[i].item_id, res[i].product_name,\n res[i].departent_name,\n parseFloat(res[i].price).toFixed(2),\n res[i].stock_quantity\n ]\n );\n }\n console.log(table.toString());\n // starts main function of Bamazon\n bamazon();\n\n\n })\n}", "function displayTable (){\n connection.query('SELECT item_id, product_name, price FROM products', function(error, response){\n if (error) {throw error};\n for (var i=0; i < response.length; i++) {\n console.log(response[i].item_id+' || '+response[i].product_name+' || $'+response[i].price);\n }\n });\n \n}", "function getProducts() {\n con.query(\"SELECT * FROM products\", (err, res, fields) => {\n if (err) throw err;\n res.forEach(element => {\n productArray.push(element.product_name)\n });\n })\n // console.log(productArray)\n}", "function viewProducts() {\n connection.query(\"SELECT * FROM products\", function(err, rows) {\n if (err) throw err;\n console.log(\"\");\n console.table(rows);\n console.log(\"=====================================================\");\n menu();\n });\n}", "function viewProducts() {\n\tconnection.query(\"SELECT * FROM products\", function(err, res) {\n\t\tif (err) throw err; \n\t\tconsole.table(res);\n\t\tchooseAction(); \n\t})\n}", "function fetchProducts(){\n\tisLoading = true;\n\trenderProducts();\n\t\n\t$.ajax({\n\t\turl: '?product=all',\n\t\ttype: 'GET',\n\t\tsuccess: function(result) {\n\t\t\tisLoading = false;\n\t\t\tif(result.status == \"ok\"){\n\t\t\t\tproducts = result.res.list;\n\t\t\t\trenderProducts();\n\t\t\t} else{\n\t\t\t\talert('Error: '+result.error);\n\t\t\t}\n\t\t}, error: function(err) {\n\t\t\tisLoading = false;\n\t\t\talert('Internet Error: '+err);\n\t\t}\n\t});\n}", "function dispAll() {\n\n // create a new formatted cli-table\n var table = new Table({\n head: [\"ID\", \"Name\", \"Department\", \"Price\", \"Qty Available\"],\n colWidths: [8, 40, 22, 12, 12]\n });\n\n // get the data to load the product table, load it and show it\n connection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products LEFT JOIN departments on products.department_id = departments.department_id ORDER BY department_name, product_name;\", function (err, rows, fields) {\n\n if (err) throw err;\n\n console.log(\"\\n--- Bamazon Product Catalog ---\");\n\n for (var i = 0; i < rows.length; i++) {\n table.push([rows[i].item_id, rows[i].product_name, rows[i].department_name, rows[i].price, rows[i].stock_quantity]);\n }\n\n console.log(table.toString());\n\n // go to the actual purchasing part of the app\n buyProduct();\n\n });\n\n}", "function displaySaleItems() {\n var query = \"SELECT p.item_id AS Product_ID, p.product_name AS Item_Name, p.price AS Sale_Price FROM products p;\";\n connection.query(query, function (err, res) {\n if (err) throw err;\n var productList = [];\n var productData = {};\n for (var i = 0; i < res.length; i++) {\n productData = { Product_ID: res[i].Product_ID, Item_Name: res[i].Item_Name, Sale_Price: res[i].Sale_Price };\n productList.push(productData);\n }\n console.log(\"\\r\\n***** PRODUCT LIST *****\\r\\n\")\n console.table(productList, \"\\r\\n\");\n purchaseItems();\n })\n}", "function viewProducts() {\n connection.connect();\n connection.query(\"SELECT * FROM products\", function (err, rows, fields) {\n if (err) throw err;\n console.log(rows)\n });\n connection.end();\n}", "function viewAll() {\n connection.query(\"SELECT * FROM products\", function (err, results) {\n if (err) throw err;\n for (let i = 0; i < results.length; i++) {\n console.log(\"Item \" + results[i].item_id + \"| Dept Name: \" + results[i].department_name + \"| Product Name: \" + results[i].product_name + \"| Price: \" + results[i].price + \"| In Stock: \" + results[i].stock_quantity);\n }\n connection.end();\n });\n}", "function viewProducts() {\n var query = \"SELECT * from products\";\n connection.query(query, function (error, results) {\n if (error) throw error;\n\n //Print updated table everytime initialized\n console.table(results)\n\n //Return to main screen\n initialize()\n })\n}", "function showProducts(){\n\tconnection.query('SELECT * FROM products', function(err, res){\n\t\tif (err) throw err;\n\t\tconsole.log('=================================================');\n\t\tconsole.log('=================Items in Store==================');\n\t\tconsole.log('=================================================');\n\n\t\tfor(i=0; i<res.length; i++){\n\t\t\tconsole.log('Item ID:' + res[i].item_id + ' Product Name: ' + res[i].product_name + ' Price: ' + '$' + res[i].price + '(Quantity left: ' + res[i].stock_quantity + ')')\n\t\t}\n\t\tconsole.log('=================================================');\n\t\tstartOrder();\n\t\t})\n}", "listProducts(query = null) {\n return getAllOfResource(\n {\n key: this._key,\n secret: this._secret,\n domain: this._domain,\n },\n 'products',\n query\n );\n }" ]
[ "0.81584764", "0.80023783", "0.7999432", "0.78394616", "0.779368", "0.77830845", "0.77350026", "0.76957124", "0.7691928", "0.7649787", "0.75935864", "0.7570771", "0.7545789", "0.753648", "0.75234973", "0.75201446", "0.7510473", "0.74639916", "0.74550515", "0.745131", "0.7445915", "0.7418722", "0.7393822", "0.7380588", "0.7379481", "0.737237", "0.7358285", "0.7328177", "0.7327974", "0.7325871", "0.7312794", "0.73055327", "0.7301147", "0.7300727", "0.7289039", "0.7283178", "0.7280079", "0.7278079", "0.72746956", "0.72530425", "0.7251808", "0.7250075", "0.72415936", "0.7235487", "0.72313106", "0.72025347", "0.71891433", "0.71828794", "0.71823764", "0.71810246", "0.71698713", "0.7161188", "0.7155128", "0.7141985", "0.7140677", "0.713392", "0.7126952", "0.71245754", "0.7120226", "0.7116375", "0.71131396", "0.7107534", "0.70986176", "0.7098136", "0.7087781", "0.7087433", "0.7084498", "0.7083016", "0.7071115", "0.7068957", "0.70682645", "0.7062141", "0.70616776", "0.7058855", "0.7053738", "0.70486814", "0.70395845", "0.70393", "0.70355606", "0.7022391", "0.7019104", "0.7006989", "0.7003414", "0.7001957", "0.6993598", "0.69883215", "0.69823825", "0.698146", "0.6974292", "0.69648725", "0.6964444", "0.695904", "0.6948603", "0.69483924", "0.6929442", "0.6928138", "0.69265145", "0.6922844", "0.69218385", "0.6919145" ]
0.70941854
64
function prompt to order
function getOrder(){ // This function requests order details from the user, using the npm inquirer package // variable to hold the item id var item_id = 0; // update query to update stock when order is placed var updateQuery = "UPDATE products SET stock_quantity = ?, product_sales =? WHERE item_id = ?"; // variable to hold the unit price var unit_price = 0; // variable to hold the stock quantity var stock_quantity = 0; // variable to hold the no of units that customer is purchasing var noOfUnits = 0; // variable to hold the product sales amount var product_sales = 0; // prompt user to enter an order inquire.prompt([{ type:"input", name :"itemId", message:"Please enter the id of the item to purchase" } ]).then(answer =>{ item_id=answer.itemId; var itemQuery = "SELECT stock_quantity,unit_price, product_sales FROM products WHERE item_id = " + item_id; connection.query(itemQuery,function(err,results){ if(err) throw err; unit_price = results[0].unit_price; stock_quantity = results[0].stock_quantity; product_sales = results[0].product_sales; // if stock not availabel if(stock_quantity === 0 ){ console.log("Insufficient quantity!"); getAllProducts(); } else{ inquire.prompt([{ type:"input", name :"noOfUnits", message:"Please enter the no of units" } ]).then(answer =>{ noOfUnits = parseInt(answer.noOfUnits); if (noOfUnits > stock_quantity){ // if availble stocks less than the amount that the customer wants to buy console.log("Insufficient quantity!"); getAllProducts(); } var totalCost = parseFloat(answer.noOfUnits * unit_price); var newQuantity = stock_quantity - answer.noOfUnits var newSales = product_sales + totalCost; connection.query(updateQuery,[newQuantity,newSales,item_id], (err,results)=>{ if (err) throw err; console.log("\nTotal cost :" + totalCost.toFixed(2)+"\n"); getAllProducts(); }); }); } } ) }); // connection.end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function question(itemOptions) {\n var itemOrdered = prompt(itemOptions);\n order += itemOrdered + \" \";\n}", "function question(orderQuestion) {\n var answerInput = prompt(orderQuestion);\n order += answerInput + \", \";\n console.log(order);\n}", "function Cconsole() {\r\n INQUIRER.prompt([\r\n {\r\n message: \"Pick your product\",\r\n type: \"list\",\r\n name: \"pick\",\r\n choices: [\r\n \"Bud Lights\",\r\n \"Marlboro Lights\",\r\n \"Fire Extinguisher\",\r\n \"Mountain Dew\",\r\n \"Nico Patch\",\r\n \"Air Jordans\",\r\n \"Rockport kicks\",\r\n \"Cleaning Agent\",\r\n \"Lays\",\r\n \"Doritos\"\r\n ]\r\n },\r\n {\r\n message: \"How many do you need?\",\r\n type: \"integer\",\r\n name: \"pickNum\"\r\n }\r\n ]).then(answers => {\r\n // query answer against database\r\n\r\n var pick = answers.pick;\r\n var pickNum = parseInt(answers.pickNum);\r\n console.log(pick, pickNum);\r\n checkOrder(pick, pickNum);\r\n });\r\n}", "function promptCustomer() {\n inquirer.prompt([{\n name: \"ID\",\n type: \"input\",\n message: \"Please enter Item ID you like to purhcase.\",\n filter: Number\n },\n {\n name: \"Quantity\",\n type: \"input\",\n message: \"How many copies would you like?\",\n filter: Number\n },\n ]).then(function (answers) {\n var quantityNeeded = answers.Quantity;\n var IDrequested = answers.ID;\n purchaseOrder(IDrequested, quantityNeeded);\n });\n}", "function orderPrompt() {\n inquirer\n .prompt([\n {\n name: \"item_id\",\n type: \"input\",\n message: \"Please Enter the item_id number to order: \",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n name: \"order_qty\",\n type: \"input\",\n message: \"Please Enter the order quantity: \",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }\n ])\n .then(function(answer) {\n connection.query(\"SELECT * FROM products WHERE ?\", { item_id: answer.item_id }, function(err, res) {\n if (err) throw err;\n var ordered = parseInt(answer.order_qty);\n if (res[0].qoh >= ordered) {\n var new_qoh = res[0].qoh - ordered;\n postOrder(answer.item_id, res[0].product_name, res[0].dept_name, res[0].price, ordered, res[0].qoh);\n\n }\n else {\n console.log(\"Insufficient Stock....Order Has Been Rejected\");\n console.log(\"Maximum Order quantity: \", res[0].qoh);\n console.log(\"Please Order Again\");\n runList();\n }\n \n });\n });\n \n }", "function OrderAgain(){ \r\n\tinquirer.prompt([{ \r\n\t\ttype: 'confirm', \r\n\t\tname: 'choice', \r\n\t\tmessage: 'Would you like to place another order?' \r\n\t}]).then(function(answer){ \r\n\t\tif(answer.choice){ \r\n\t\t\tplaceOrder(); \r\n\t\t} \r\n\t\telse{ \r\n\t\t\tconsole.log('Thank you for shopping at the Bamazon Mercantile!'); \r\n\t\t\tconnection.end(); \r\n\t\t} \r\n\t}) \r\n}", "function confirmToOrder() {\n\n inquirer.prompt([\n\n {\n type: \"list\",\n name: \"confirm\",\n message: \"Would you like to place an order?\",\n choices: [\"Yes\", \"No\"]\n }\n\n]).then(function (answer) {\n\n if (answer.confirm === 'Yes'){\n orderItems();\n } else {\n console.log(\"Thank you for visiting Bamazon! Have a nice day!\");\n connection.end();\n }\n\n });\n\n} //CLOSE: Function to confirm if users would like to place an order", "function takeOrder() {\n inquirer.prompt(\n [\n\n {\n name: \"itemID\",\n type: \"number\",\n message: \"Enter the item number of the product you would like to purchase.\"\n },\n {\n name: \"itemQuantity\",\n type: \"number\",\n message: \"How many would you like?\"\n }\n ]\n )\n .then(function (answer) {\n console.log(\"Okay, you would like to by \" + answer.itemQuantity + \" of item number: \" + answer.itemID);\n var selectedItem = answer.itemID;\n var selectedQuantity = answer.itemQuantity;\n processOrder(selectedItem, selectedQuantity);\n })\n}", "function orderPrompt(greatestId){\n inquirer.prompt([\n {\n name: \"id\",\n message: \"Which item would you like to purchase(id)?\".question,\n validate: function(input){\n // Input must be a positive number that cannot be greater than the id of the last product in database\n if(input > greatestId || !numberRegex.test(input)){\n console.log(\"\\n Please enter a valid Id\".error);\n return false;\n }\n else{\n return true;\n }\n }\n },\n {\n name: \"quantity\",\n message: \"How many would you like to purchase?\".question,\n validate: function(input){\n // Input must be a whole number\n if(numberRegex.test(input)){\n return true;\n }\n else{\n console.log(\"Please enter whole numbers\".error);\n return false;\n }\n }\n }\n ]).then(function(input){\n var id = input.id;\n var quantity = input.quantity;\n console.log(\"\\n Checking out...\".cyan);\n checkStorage(id, quantity);\n })\n}", "function placeNewOrder(){\n\tinquirer.prompt([{\n\t\tname: 'choice',\n type: 'rawlist',\n\t\tmessage: 'Would you like to place another order?',\n choices: [\"YES\", \"NO\"]\n\t}]).then(function(answer){\n\t\tif(answer.choice === \"YES\"){\n\t\t\tstartOrder();\n\t\t}\n\t\telse{\n\t\t\tconsole.log('Thank you for shopping at Bamazon!');\n\t\t\tconnection.end();\n\t\t}\n\t})\n}", "function displayPrompt(){\n inquirer.prompt([\n {\n type: 'list',\n name: 'product',\n message: '\\n\\nselect product to purchase.',\n choices: queryArray\n },\n {\n type: 'input',\n name: \"quantity\",\n message: \"How many would you like to purchase?\"\n }\n ]).then(function(answer) {\n confirmPurchase(answer.product,answer.quantity);\n });\n//close displayPrompt \n}", "function placeOrder() {\n // First, should ask them the ID of the product they would like to buy\n inquirer.prompt([\n {\n type: 'input',\n name: 'productID',\n message: 'Which product ID which you like to buy?'\n },\n // Second, should ask how many units of the product they would like to buy\n {\n type: 'input',\n name: 'quantity',\n message: 'How many units of the product would you like to buy?'\n\n }\n ])\n // response of the user to the above two messages\n .then(({productID, quantity})=> {\n console.log(productID)\n console.log(quantity)\n })\n}", "function prompt(str) {}", "function prompt() {\n inquirer\n .prompt([\n {\n // The first should ask them the ID of the product they would like to buy.\n name: \"itemID\",\n type: \"input\",\n message: \"What is the ID of the item you would like to purchase?\"\n },\n {\n //The second message should ask how many units of the product they would like to buy.\n name: \"numUnits\",\n type: \"input\",\n message: \"How many units would you like?\"\n }\n ])\n .then(function(answer) {\n // console.log(answer.itemID);\n // console.log(answer.numUnits);\n checkItem(answer.itemID, answer.numUnits);\n });\n }", "function chap12(){\n var waiterQuestion = \"What would you like for your order? \";\n var menuOption = \"(Lobster)\";\n var waiterAnswer = \"We don't have Lobster anymore.\";\n var waiterAnswer2 = \"Thanks for your order.\";\n var firstOrder = prompt(waiterQuestion + menuOption);\n if (firstOrder === \"Lobster\"){\n alert(waiterAnswer);\n } else {\n alert(waiterAnswer2);\n }\n}", "function question(questionText, appendage, print) {\n // attempt 1:\n // if (questionText === \"Would you like fajitas?\" && prompt(questionText) === \"yes\"){\n // order = order + \"fajitas\";\n // }\n // else if (questionText === \"Would you like fajitas?\" && prompt(questionText) === \"no\"){\n // }\n // else{\n //\n // attempt 2:\n // var theirChoice= prompt(questionText);\n // if (print === yes){\n // order= order + theirChoice + appendage + \", \";\n // }\n order= order + prompt(questionText)+ appendage + \", \";\n console.log(order);\n}", "function prompt() {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"What is the ID of the item you'd like to order?\",\n name: \"userPick\",\n filter: Number\n },\n {\n type: \"input\",\n message: \"How many do you want?\",\n name: \"amount\",\n filter: Number\n }\n \n ]).then(function (result) {\n //console.log(result.userPick);\n //console.log(result.amount);\n productID = result.userPick;\n\n\n //grabbing the number that users put for id and quantity and using it for the next function \n var query = \"SELECT * FROM products WHERE item_id = ?\";\n connection.query(query, [productID], function (err, res) {\n if (err) throw err;\n\n quantityFinal = res[0].stock_quantity - result.amount;\n\n if (quantityFinal < 0 || result.amount > res[0].stock_quantity) {\n console.log(\"Sorry, we can't do that! Talk to our manager!\");\n prompt();\n } else {\n console.log(\"You ordered \" + result.amount + \" \" + (chalk.blue(res[0].product_name)) + \".\\n Thank you, that wil be $\" + (chalk.black.bgGreen(result.amount * res[0].price)) + \".\"\n );\n updateProduct(quantityFinal, productID);\n }\n\n })\n })\n}", "function customerPrompt() {\r\n inquirer\r\n .prompt([{\r\n name: \"item_id\",\r\n type: \"input\",\r\n message: \"What is the ID of the product you would like to purchase?\",\r\n },\r\n\r\n {\r\n name: \"quantity\",\r\n type: \"input\",\r\n message: \"How many of this product would you like to purchase?\",\r\n\r\n\r\n }]).then(function (answer) {\r\n connection.query(\"SELECT item_id, product_name, department_name, price, stock_quantity FROM products WHERE?\", { item_id: answer.item_id }, function (err, res) {\r\n for (var i = 0; i < res.length; i++)\r\n if (res[i].stock_quantity >= answer.quantity) {\r\n \r\n console.log(\"There is sufficient stock to fill this order\" );\r\n }\r\n else {\r\n console.log(\"Insufficient stock, order cannot be completed, please try again\");\r\n\r\n }\r\n \r\n connection.end();\r\n })\r\n })\r\n }", "function beginPrompt() {\r\n inquirer.prompt([\r\n {\r\n type: \"list\",\r\n message: \"What would you like to do?\",\r\n choices: [\"Add Quote\", \"Display Quote\", \"Exit\"],\r\n name: \"action\"\r\n },\r\n ]).then(function(res) {\r\n\r\n\r\n // prompt the user to choose between three options\r\n \r\n switch(res.action) {\r\n\r\n // depending on the user selection, \r\n\r\n case(\"Display Quote\"):\r\n // call on a function to show the quotes\r\n showQuotes();\r\n break;\r\n case(\"Add Quote\"):\r\n // call on a function to add a new quote\r\n addQuotes();\r\n break;\r\n // exit the application by not calling on any functions\r\n }\r\n console.log(\"Bye then.\")\r\n return;\r\n }) \r\n}", "function newOrder(){\n\tinquirer.prompt([{\n\t\ttype: 'confirm',\n\t\tname: 'choice',\n\t\tmessage: 'Would you like to place another order?'\n\t}]).then(function(answer){\n\t\tif(answer.choice){\n\t\t\tbuyItem();\n\t\t}\n\t\telse{\n\t\t\tconsole.log('Thank you for shopping at Bamazon!');\n\t\t\tconnection.end();\n\t\t}\n\t})\n}", "function displayOrder(){\n console.log(\"***********************************************************\");\n console.log(\"* Order Complete! *\");\n console.log(\"***********************************************************\");\n console.log(\"Your order:\");\n console.log(\"___________________________________________________________\");\n console.log(purchQuant + \" x \" + purchProdName + \" ($\" + purchProdPrice +\"/each)\");\n console.log(\"===========================================================\");\n console.log(\"Order Total: $\" + orderTotal.toFixed(2) + \"\\n\");\n console.log(\"Delivery: Sooner than you think!\");\n console.log(\"***********************************************************\");\n console.log(\"* Thanks for your business! *\");\n console.log(\"***********************************************************\");\n\n inquirer.prompt([\n {\n name: \"newOrder\",\n type: \"list\",\n message:\"Place another order?\",\n choices: [\"Yes\", \"No\"]\n }\n ]).then(function(answer){\n //if the user wants to do another transation\n if (answer.newOrder == \"Yes\") {\n //reset all the global variables\n resetVars();\n //return to the main menu\n displayInventory();\n } else {\n //if they don't want to do another transaction, display the mention and end the connection to the DB, ending the app\n console.log(\"***********************************************************\");\n console.log(\"* Come back soon! *\");\n console.log(\"***********************************************************\");\n connection.end();\n }\n \n });\n}", "function promptCustomer(){\n\n connection.query(\"SELECT * FROM products\", function(err, results){\n if (err) {\n throw err;\n }\n inquirer.prompt([\n {\n name: 'item_id',\n message: ' Please enter the ID of the product you would like to buy?',\n choices: function() {\n var choices = [];\n for(var i = 0; i< results.length; i++){\n console.log(results[i].id + \" \" + results[i].product_name + \" \" + results[i].price)\n }\n }\n },\n\n {\n name: 'quantity',\n type: \"input\",\n message: 'How many you would like to buy?',\n }\n ]).then(function(answer){\n var item; \n //console.log(answer.quantity)\n for(var i = 0; i< results.length; i++){\n\n if(results[i].id == answer.item_id) {\n item = results[i];\n \n processOrder(item.id, answer.quantity)\n \n }\n }\n })\n});\n}", "function payConfirm(msg) {\n header('ORDER CONFIRMED', msg)\n console.log(\"Would you like to make another purchase: \");\n console.log(\"1\", \"Yes\")\n console.log(\"2\", \"No\")\n prompt.question(\"Please Select an option: \", (options) => {\n if (options == 1) {\n displayProducts('');\n } else if (options == 2) {\n console.clear();\n } else {\n payConfirm(\"PLEASE ENTER A VALID INPUT\" .cyan);\n }\n })\n}", "function prompt() {\n console.log(\"Enter input as either:\");\n console.log(\"> 'timeout' [name] [seconds]\");\n console.log(\"> 'ban' [name]\");\n console.log(\"> 'remove' [name]\");\n console.log(\"> 'list'\")\n}", "function prompt() {\n rl.question(\"User>\", processCommand);\n}", "function customerSelect () {\n inquirer.prompt([\n {\n type: 'input',\n name: 'item_num',\n validate: (test_value) => { // check for an integer number > 0\n return (/^\\d*$/.test(test_value) && test_value > 0) ? true : 'Enter a whole number greater than zero';\n },\n message: 'Enter the Item ID (# above) of the product you wish to purchase'\n },\n {\n type: 'input',\n name: 'item_qty',\n validate: (test_value) => { // check for an integer number > 0\n return (/^\\d*$/.test(test_value) && test_value > 0) ? true : 'Enter a whole number from the list above.';\n },\n message: `Enter the quantity you wish to purcahse`\n }\n ])\n .then( (result) => {\n let id = result.item_num;\n let qty = result.item_qty;\n //console.log(id,qty);\n fillOrder(id, qty);\n });\n}", "function set_cmd_with_confirm_prompt(formname, cmd) {\n var action ;\n if (cmd == \"h\") {\n action = \"hold\" ; \n }\n else { \n if (cmd == \"r\") { \n action = \"release\" ; \n }\n else\n {\n return ;\n }\n }\n if(confirm(\"Are you sure you want to \"+action+\" this order? \"))\n {\n formname.cmd.value=cmd;\n formname.submit() ;\n }\n}", "function orderAgain() {\n console.log(\"------\");\n inquirer.prompt({\n name: \"confirm\",\n type: \"list\",\n message: \"Would you like start over and view what's in stock again?\",\n choices: [\"Yes\", \"No\"]\n })\n .then(function(answer) {\n if (answer.confirm === \"Yes\") {\n displayStock();\n }\n\n else {\n console.log(\"------\")\n console.log(\"Thanks for shopping on Bamazon!\")\n connection.end();\n }\n })\n }", "function prompt() {\n inquirer\n .prompt({\n name: 'action',\n type: 'list',\n message: 'What would you like to do?',\n choices: [\n promptMessages.viewAllEmployees,\n promptMessages.viewByDepartment,\n promptMessages.viewByManager,\n promptMessages.viewAllRoles,\n promptMessages.addEmployee,\n // promptMessages.removeEmployee,\n promptMessages.updateRole,\n // promptMessages.exit\n ]\n })\n .then(answer => {\n console.log('answer', answer);\n switch (answer.action) {\n case promptMessages.viewAllEmployees:\n viewAllEmployees();\n break;\n\n case promptMessages.viewByDepartment:\n viewByDepartment();\n break;\n\n case promptMessages.viewByManager:\n viewByManager();\n break;\n\n case promptMessages.addEmployee:\n addEmployee();\n break;\n\n case promptMessages.removeEmployee:\n remove('delete');\n break;\n\n case promptMessages.updateRole:\n remove('role');\n break;\n\n case promptMessages.viewAllRoles:\n viewAllRoles();\n break;\n\n case promptMessages.exit:\n connection.end();\n break;\n }\n }); \n}", "function promptCustomerOrder() {\n return inquirer.prompt([{\n name: \"itemId\",\n message: \"Please enter the id of the item you would like to purchase.\",\n type: \"input\",\n validate: function (value) {\n if (isNaN(value) === false) {\n return true;\n } else {\n console.log(\"Please enter valid item id\");\n return false;\n }\n }\n }, {\n name: \"quantity\",\n message: \"How many would you like to buy?\",\n type: \"input\",\n validate: function (value) {\n if (isNaN(value) === false) {\n return true;\n } else {\n return false;\n }\n }\n //link user answer to db table \n }]).then(function (answer) {\n connection.query(\"SELECT * FROM products WHERE ?\",\n { item_id: answer.itemId }, function (err, res) {\n\n if (err) throw err;\n //check for sufficient quantity for order, and option to reorder if quantity desired not available \n if (answer.quantity > res[0].stock_quantity) {\n inquirer\n .prompt([\n {\n name: \"orderAgain\",\n type: \"input\",\n message: \"Sorry, insufficient quantity in stock to fullfill your order. Would you like to place another order?\"\n }\n //option to quit for user if they don't want to adjust order.\n ]).then(function (answer) {\n if (answer.orderAgain == \"yes\") {\n promptCustomerOrder();\n } else if (totalCost >= 0) {\n console.log(\"Okay, thanks for visiting and come back soon!\");\n connection.end();\n }\n });\n }\n //total cost or order and adjust quantity to db for item_id\n else {\n totalCost = totalCost + res[0].price * answer.quantity;\n var newQuantity = res[0].stock_quantity - answer.quantity;\n connection.query(`UPDATE products SET stock_quantity=${newQuantity} WHERE item_id = ${answer.itemId}`, function (res) {\n {\n console.log(\"Okay, Total to pay is $\", totalCost);\n connection.end();\n }\n\n });\n\n }\n\n });\n });\n\n}", "function askForPrompt() {\n\tprompt.start();\n\n\tprompt.get({\"properties\":{\"name\":{\"description\":\"Enter a command\", \"required\": true}}}, function (err, result) { \n\t\tcommandFinder(result.name)\n\t})\n}", "function start() {\n inquirer.prompt([ \n {\n name: \"ID\",\n type: \"input\",\n message: \"What item would you like to by?\", \n filter:Number\n },\n {\n name:\"Quantity\",\n\t\ttype:\"input\",\n\t\tmessage:\"How many items do you wish to purchase?\",\n\t\tfilter:Number\n\t},\n\n ]).then(function(answers){\n \tvar quantityNeeded = answers.Quantity;\n \tvar IDrequested = answers.ID;\n \tpurchaseOrder(IDrequested, quantityNeeded);\n });\n}", "function prompt() {\n cli.rl.prompt();\n}", "function checkout() {\n document.getElementById(\"final-order\");\n prompt(\"Please enter your phone number\");\n alert(\n \"Your order is being processed. It will be delivered to your location soon if delivery option was selected. Thank you\"\n );\n }", "function PlaceOrder(){ \r\n\tinquirer.prompt([{ \r\n\t\tname: 'SelectId', \r\n\t\tmessage: 'Enter Product ID of product you wish to buy', \r\n\t\tvalidate: function(value){ \r\n\t\t\tvar valid = value.match(/^[0-9]+$/) \r\n\t\t\tif(valid){ \r\n\t\t\t\treturn true \r\n\t\t\t} \r\n\t\t\t\treturn 'Please enter a valid Product ID' \r\n\t\t} \r\n\t},{ \r\n\t\tname: 'SelectQuantity', \r\n\t\tmessage: 'How many of these would you like?', \r\n\t\tvalidate: function(value){ \r\n\t\t\tvar valid = value.match(/^[0-9]+$/) \r\n\t\t\tif(valid){ \r\n\t\t\t\treturn true \r\n\t\t\t} \r\n \t\t\t\treturn 'Okay... you need to enter a whole number for the quantity.' \r\n\t\t} \r\n\t}]).then(function(answer){ \r\n\tconnection.query('SELECT * FROM product_name WHERE id = ?', [answer.selectId], function(err, res){ \r\n \t\tif(answer.SelectQuantity > res[0].stock_quantity){ \r\n\t\t\tconsole.log('Not enough in stock.'); \r\n\t\t\tconsole.log('Order not processed.'); \r\n\t\t\tconsole.log(''); \r\n\t\t\tOrderAgain(); \r\n\t\t} \r\n\t\telse{ \r\n\t\t\tAmountOwed = res[0].price * answer.SelectQuantity; \r\n\t\t\tcurrentDepartment = res[0].DepartmentName; \r\n\t\t\tconsole.log('Thank you for your order'); \r\n\t\t\tconsole.log('Please pay $' + AmountOwed); \r\n\t\t\tconsole.log(''); \r\n\t\t\t//update product table \r\n\t\t\tconnection.query('UPDATE product SET ? Where ?', [{ \r\n\t\t\t\tStockQuantity: res[0].stock_quantity - answer.SelectQuantity \r\n\t\t\t},{ \r\n\t\t\t\tid: answer.selectId \r\n\t\t\t}], function(err, res){}); \r\n\t\t\t//update departments table \r\n\t\t\tlogSaleToDepartment(); \r\n\t\t\tOrderAgain(); \r\n\t\t} \r\n\t}) \r\n\r\n }, function(err, res){}) \r\n}", "function promptOptions() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"Would you like to ... ?\",\n choices: [\"Continue Shopping\", \"Update Cart\", \"Checkout\"],\n name: \"choice\"\n }\n ]).then(function (option) {\n switch (option.choice) {\n case \"Continue Shopping\":\n promptBuy();\n break;\n case \"Update Cart\":\n updateCart();\n break;\n case \"Checkout\":\n checkout();\n break;\n }\n });\n}", "function promptUser() {\n inquirer\n .prompt([\n {\n message: \"Please, insert ID of item you would like to buy\",\n type: \"input\",\n name: \"ID\"\n },\n {\n message: \"How many items would you like to purchase?\",\n type: \"input\",\n name: \"count\"\n }\n ])\n .then(answers => {\n checkQuantity(answers.count, answers.ID);\n });\n }", "function Buy_Prompt() {\n inquirer.prompt([\n // Here we create an input text prompt for getting the ITEM ID.\n {\n type: \"input\",\n message: \"Please enter the ID of the product you would like to buy.\",\n name: \"ITEM_ID\",\n filter: Number\n },\n // Here we create an input text prompt for getting the quantity the user wants to buy.\n {\n type: \"input\",\n message: \"How many items would you like to buy?\",\n name: \"BUY_QUANTITY\",\n filter: Number\n },\n ]).then(function (inquirerResponse) {\n var buyQuantity = inquirerResponse.BUY_QUANTITY;\n var item = inquirerResponse.ITEM_ID;\n customerOrder(item, buyQuantity);\n });\n}", "function managerAsk(){\n\n inquirer\n .prompt([\n\n {\n type: \"rawlist\",\n message: \"Greetings, what action would you like to perform today? (select by picking a #)\",\n choices: ['View Products for Sale', 'View Low Inventory', 'Add to Inventory', 'Add New Product', 'Exit'],\n name: \"action\", \n },\n\n ])\n .then(function(response) {\n\n switch (response.action) {\n case 'View Products for Sale':\n viewProducts();\n break;\n case 'View Low Inventory':\n viewLowInventory();\n break;\n case 'Add to Inventory':\n addToInventory();\n break;\n case 'Add New Product':\n addNewProduct();\n break;\n case 'Exit':\n process.exit();\n break;\n default:\n console.log('Whoops! Looks like something went wrong. Are you sure you picked a number 1-4?');\n }\n });\n}", "function getIntern() {\n\n inquirer \n .prompt([\n \n\n ])\n .then(answers =>{\n \n })\n\n}", "function askAgain()\n{\n inquirer.prompt([\n {\n name: \"question\",\n type: \"input\",\n message: \"Would you like to place another order? Y/N: \"\n }]).then(function(answer) {\n if(answer.question.toUpperCase().valueOf() === \"Y\")\n {\n displayItems();\n }\n else\n {\n connection.end();\n }\n });\n}", "function continueShopping() {\n inquire.prompt([{\n message: \"Checkout or Continue Shopping?\",\n type: \"list\",\n name: \"continue\",\n choices: [\"Continue\", \"Go to checkout\"]\n }]).then(function (ans) {\n if (ans.continue === \"Continue\") {\n console.log(\" Items Added to Cart!\");\n shoppingCart();\n } else if (ans.continue === \"Go to checkout\") {\n checkOut(itemCart, cartQuant);\n }\n });\n}", "function question(questionText, realAnswer) {\n\tvar answerInput = prompt(questionText);\n\tif (answerInput.toUpperCase() === realAnswer[0] || \n\t\tanswerInput.toUpperCase() === realAnswer[1] ||\n\t\tanswerInput.toUpperCase() === realAnswer[2] ) {\n\t\torder += \" \" + answerInput;\n\t}\n}", "function queryCustomer()\n{\n inquirer.prompt([\n {\n name: \"item\",\n type: \"input\",\n message: \"What is the item ID you would like to purchase?\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n name: \"quantity\",\n type: \"input\",\n message: \"How many units would you like to purchase?\",\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }]).then(function(answer) {\n processOrder(answer.item, answer.quantity);\n });\n}", "function go() {\n inquirer.prompt([\n {\n message: \"Enter the product id\",\n name: \"id_input\",\n type: \"input\",\n vaidate: validateNum\n },\n {\n message: \"How many units would you like to purchase\",\n name: \"amount_input\",\n type: \"input\",\n validate: validateNum\n }\n]).then(function(answers) {\n findID(answers);\n })\n}", "function startPrompt() {\n \n inquirer.prompt([{\n\n type: \"confirm\",\n name: \"confirm\",\n message: \"Welcome to Zohar's Bamazon! Wanna check it out?\",\n default: true\n\n }]).then(function(user){\n if (user.confirm === true){\n inventory();\n } else {\n console.log(\"FINE.. come back soon\")\n }\n });\n }", "function handleUser(){\n inq.prompt([\n {\n name: \"id\",\n message: \"Which product that you want to purchase? Please enter its ID.\",\n validate: function(input){\n input = parseInt(input);\n // User input needs to be integer and has to be a valid id\n return ! (isNaN(input) || input > last_id || input <= 0);\n }\n },\n {\n name: \"quantity\",\n message: \"How many do you want to order?\",\n validate: function(input){\n input = parseInt(input);\n // User input needs to be integer and cannot less than 0\n return ! (isNaN(input) || input < 0 );\n }\n } \n ]).then((ans)=>{\n printReceipt(ans);\n });\n}", "function promptThem() {\n\tvar userResponse = prompt(\"Type something:\");\n}", "function promptContinue(){\n return inquirer.prompt([\n {\n type: \"list\",\n name: \"Job\", \n choices: [\"Engineer\", \"Intern\", \"Finish building my team\"]\n },\n])\n.then((answers) => {\n if(answers.Job === \"Engineer\"){\n promptEngineer();\n } else if (answers.Job === \"Intern\"){\n promptIntern();\n } else {\n generate.generateHTML(employeeArray);\n console.log(\"Your team is being built!\")\n }\n})\n}", "function buyPrompt() {\n inquirer\n .prompt([\n {\n name: \"prodChoice\",\n type: \"input\",\n message: \"What's the ID of the product you'd like to purchase?\",\n validate: function (value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n name: \"count\",\n type: \"input\",\n message: \"How many units would you like to purchase?\",\n validate: function (value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n }\n ])\n .then(function (answer) {\n\n checkPurchase(answer.prodChoice, answer.count);\n\n });\n}", "function askAgain() {\n inquirer.prompt({\n name: \"choice\",\n type: \"rawlist\",\n message: \"What you like to place another order?\",\n choices: [\"YES\", \"NO\"]\n })\n .then(function (answer) {\n if (answer.choice.toUpperCase() === \"YES\") {\n ask();\n } else {\n console.log(\"Thank you for shopping at Bamazon.\");\n connection.end();\n }\n })\n\n}", "function managerPrompt() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"Hello Bamazon manager, what would you like to do today?\",\n choices: [\n \"View Products for sale?\",\n \"View Low Inventory?\",\n \"Add to Inventory?\",\n \"Add a New Product?\"\n ]\n })\n .then(function(answer) {\n switch (answer.action) {\n case \"View Products for sale?\":\n viewAllProducts();\n break;\n\n case \"View Low Inventory?\":\n viewLowInventory();\n break;\n\n case \"Add to Inventory?\":\n addInventory();\n break;\n\n case \"Add a New Product?\":\n addNewProduct();\n break;\n }\n\n });\n\n}", "function superAsk(){\n\n inquirer\n .prompt([\n // Here we create a basic text prompt.\n {\n type: \"rawlist\",\n message: \"Greetings, what action would you like to perform today? (select by picking a #)\",\n choices: ['View Product Sales by Department', 'Create New Department', 'Exit'],\n name: \"action\", \n },\n\n ])\n .then(function(response) {\n\n switch (response.action) {\n case 'View Product Sales by Department':\n viewProdSales();\n break;\n case 'Create New Department':\n createDept();\n break;\n case 'Exit':\n process.exit();\n break;\n default:\n console.log('Whoops! Looks like something went wrong. Are you sure you picked a number 1-2?');\n }\n });\n}", "function promptUser() {\r\n rl.question(\r\n \"Enter an item (type 'done' to close program): \",\r\n (item) => {\r\n if (item === \"done\") {\r\n // If the user presses Ctrl+C, exit the program\r\n items.length && saveList(fileName, items);\r\n console.log(\"program shutdown\");\r\n\r\n rl.close();\r\n } else {\r\n // Otherwise, add the item to the array and prompt the user again\r\n items.push(item);\r\n promptUser();\r\n }\r\n }\r\n );\r\n }", "function start() {\n console.log(\" \");\n inquirer.prompt({\n name: \"start\",\n type: \"input\",\n message: \"Press <enter> to shop agian\"\n }).then(function(answer) {\n choice = [];\n console.log(\" \");\n display();\n \n });\n}", "function reprompt(){\n inquirer.prompt([{\n type: \"confirm\",\n name: \"reply\",\n message: \"Would you like to purchase another item?\"\n }]).then(function(ans){\n if(ans.reply){\n start();\n } else{\n console.log(\"See you soon!\");\n }\n });\n}", "async function mainPrompt() {\n return inquirer\n .prompt([\n {\n name: \"action\",\n type: \"list\",\n message: \"What Would You Like To Do?\",\n choices: [\n \"Add A Department\",\n \"Add An Employee\",\n \"Add An Employee Role\",\n \"Remove An Employee\",\n \"Update An Employee Role\",\n \"View All Departments\",\n \"View All Employees\",\n \"View All Employees By Department\",\n \"View All Roles\",\n \"Exit\"\n ]\n }\n ])\n}", "function getPrompt() {\n game.board.viewGrid();\n rl.question('which piece?: ', (whichPiece) => {\n rl.question('to where?: ', (toWhere) => {\n game.moveChecker(whichPiece, toWhere);\n getPrompt();\n });\n });\n}", "function start() {\n continueOrdering = false;\n \n inquirer.prompt({\n name: \"start\",\n type: \"input\",\n message: \"Would you like to continue shop? (Y/N) \"\n\n }).then ( function (answer) {\n if (answer.start === \"Y\" || answer.start === \"y\" ) {\n console.log(\"\")\n console.log (\"Great! Below is a list of the items we have in stock...\\n\")\n \n displayProducts(); \n\n\n } else if (answer.start === \"N\" || answer.start === \"n\") {\n continueOrdering = false;\n console.log(\"------------------------------------------\")\n console.log(\"Your FINAL TOTAL is: $\" + finalTotal);\n console.log(\"------------------------------------------\\n\")\n console.log(\"Thanks for shopping at Bamazon.\");\n console.log(\"Bye for now!\\n\");\n connection.end();\n\n }\n })\n}", "function createOrder() {\n prompt(questions).then(answers => {\n const [_, name, price] = /(.*)\\s\\(\\₦(.*)\\)/.exec(answers.name);\n const order = {\n name,\n price: Number(price.replace(',', '')),\n quantity: Number(answers.quantity)\n };\n Cart.add(order);\n if (answers.performAnotherTransaction) {\n //creates another order if user chooses to purchase another item\n createOrder();\n } else {\n //make payment\n Cart.displayCart();\n }\n });\n}", "function newOrder() {\n inquirer\n .prompt(\n {\n name: \"choice\",\n type: \"confirm\",\n message: \"Would you like to make another purchase?\"\n },\n ) .then(function(answer) {\n if (answer.choice) {\n makePurchase();\n } else {\n connection.end();\n }\n })\n}", "function firstPrompt(){\n console.log(\"Welcome to the Empire's Station Crew Database\")\n inquirer.prompt([\n {\n type: \"list\",\n name: \"first\",\n message: \"Select action:\",\n choices: [\"Add\", \"View\", \"Edit\", \"Delete\"]\n }\n ]).then(function(answer){\n if(answer.first === \"Add\"){addPrompt();}\n else if(answer.first === \"View\"){viewPrompt();}\n else if(answer.first === \"Edit\"){editPrompt();}\n else{deletePrompt();}\n });\n}", "function ask() {\n \n inquirer\n .prompt([\n {\n name: \"chooseItemID\",\n type: \"input\",\n message: \"What is the ID number of the product you would like to buy?\",\n },\n {\n name: \"chooseItemQuantity\",\n type: \"input\",\n message: \"How many would you like to buy?\",\n }\n ]).then(function (answer) {\n chosenQuantity = answer.chooseItemQuantity;\n chosenID = answer.chooseItemID;\n checkInventory();\n });\n \n}", "function ask(question){\n return prompt(question);\n }", "function ask(question){\n return prompt(question);\n }", "function mainMenu() {\n inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"choice\",\n message: \"Would you like to place another order?\"\n }\n ]).then(function (answer) {//response is boolean only\n if (answer.choice) { //if true, run func\n startBamazon();\n } else {\n console.log(\"Thanks for shopping at Bamazon. See you soon!\")\n connection.end();\n }\n })\n}", "function promptUser() {\n inquirer.prompt([\n {\n name: \"action\",\n type: \"list\",\n message: \"Which of the following actions would you like to perform?\",\n choices: [\"View products for sale\", \"View low inventory\", \"Add to inventory\", \"Add new product\"]\n }\n ]).then(function(answer) {\n //Switch based on the manager's choice\n switch (answer.action) {\n //Run function to view all the products\n case \"View products for sale\":\n showTable();\n break;\n\n //Run function to view low inventory\n case \"View low inventory\":\n lowInv();\n break;\n\n //Run function to add inventory\n case \"Add to inventory\":\n addInv();\n break\n\n //Run function to add a new product\n case \"Add new product\":\n addProduct();\n break\n }\n })\n}", "function promptUser(){\n\n\tprocess.stdout.write('\\033c');\n\n\tinquirer.prompt([\n\t {\n\t \ttype: \"list\",\n \tmessage: \"What would you like to do now?\",\n \tchoices: [\"Create more flashcards\", \"Test card(s)\"],\n \tname: \"ans\"\n\t \t\n\t }\n\t]).then(function(info){\n\t\tif(info.ans == \"Create more flashcards\"){\n\t\t\tappend = true;\n\t\t\tblankSlate();\t//but not really\n\t\t}\n\t\telse if(info.ans == \"Test card(s)\"){\n\t\t\ttester();\n\t\t}\n\t});\n}", "function askToBuyAgain() {\n inquirer\n .prompt({\n name: \"confirm\",\n type: \"confirm\",\n message: \"Would you like to buy something else?\"\n })\n .then(function (answer) {\n if (answer.confirm) {\n placeOrder();\n } else {\n console.log(\"Okay thanks for shopping, see you next time!\");\n connection.end();\n }\n })\n}", "function promptUser(){\n return inquirer.prompt(questions);\n}", "function customerPrompt(res) {\n\tinquirer.prompt([{\n\t\ttype: \"input\",\n\t\tname: \"selection\",\n\t\tmessage: \"What is the id of the product you wnat to buy?\"\n\t},\n\t{\n\t\ttype: \"input\",\n\t\tname: \"quantity\",\n\t\tmessage: \"How many do you want to buy?\"\n\t}]).then(function order) {\n\t\tvar quantity = order.quantity;\n\t\tvar itemId = order.id;\n\t\tdbConnection.query(\"SELECT * FROM products where id=\" itemID, function(err, selectedItem) {\n\t\t\tif (err) throw err;\n\t\t\t if (selectedItem[0])\n\t\t};\n\t}\n}", "function managerInput() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"options\",\n message: \"Please Select from options..\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\"]\n }\n\n ]).then(function (response) {\n //console.log(response.options);\n switch (response.options) {\n case \"View Products for Sale\":\n viewProducts();\n connectionDB.end();\n break;\n case \"View Low Inventory\":\n viewLowInventory();\n break;\n case \"Add to Inventory\":\n viewProducts();\n setTimeout(function () { addInventory(); }, 500);\n break;\n case \"Add New Product\":\n addProduct();\n break;\n }\n });\n}", "function promptUser(){\n return inquirer.prompt(questions)\n }", "function firstPrompt(){\n return inquirer.prompt(firstQuestionsArray);\n}", "function firstQuestions() {\n inquirer\n .prompt([\n {\n name: \"item\",\n type: \"list\",\n message: \"Do you want a [Purchase] something from the list of products, or [Exit]?\",\n choices: [\"Purchase\", \"Exit\"],\n },\n ]).then(function (answer) {\n if (answer.item === \"Purchase\") {\n purchase();\n } else {\n console.log(\"Goodbye\");\n connection.end();\n \n }\n })\n}", "function another() {\n inquirer\n .prompt(\n {\n name: 'another',\n type: 'confirm',\n message: 'Would you like to continue shopping?'\n },\n\n )\n .then(function (answer) {\n if (answer.another === true) {\n start();\n } else {\n console.log('Thanks for shopping with us! Your orders will be shipped promptly.')\n connection.end();\n }\n });\n\n}", "function userPrompt() {\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"\\nEnter the ID of your desired item: \",\n name: \"itemID\"\n },\n {\n type: \"input\",\n message: \"\\nHow many would you like? : \",\n name: \"itemOrderQTY\"\n }\n ]).then(function (inquirerResponse) {\n var itemID = inquirerResponse.itemID;\n var itemOrderQTY = inquirerResponse.itemOrderQTY;\n\n getItemByID(itemID, itemOrderQTY);\n });//end of inquirer prompt\n}//END OF MAIN CONTROL FUNCTION", "function isThatAll(){\n\n inquirer.prompt([{\n type: \"confirm\",\n name: \"reply\",\n message: \"Would you like to purchase another item?\"\n }]).then(function(ans){\n if (ans.reply){\n showTheGoods();\n } \n else {\n console.log(\"See you soon!\");\n connection.end();\n }\n });\n}", "function reprompt() {\n inquirer.prompt([{\n type: \"confirm\",\n name: \"reply\",\n message: \"Would you like to purchase another item?\"\n }]).then(function (ans) {\n if (ans.reply) {\n start();\n } else {\n console.log(\"Thank you. See you soon!\");\n }\n });\n}", "function firstPrompt() {\n\tinquirer\n\t\t.prompt([{\n\t\t\t//Which product prompt, selected by id.\n\t\t\tname: \"productNumber\",\n\t\t\ttype: \"input\",\n\t\t\tmessage: \"Select Product above by Product Number: \",\n\t\t\tvalidate: function (value) {\n\t\t\t\tif (isNaN(value) === false) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\n\t\t//Quantity prompt\n\t\t{\n\t\t\tname: \"quantity\",\n\t\t\ttype: \"input\",\n\t\t\tmessage: \"How many would you like?\",\n\t\t\tvalidate: function (value) {\n\t\t\t\tif (isNaN(value) === false) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}])\n\t\t.then(function (answer) {\n\t\t\t//make sure the quantity number is nonnegative\n\t\t\tif (answer.quantity < 0) {\n\t\t\t\tconsole.log(\"Please try again.\")\n\t\t\t\tfirstPrompt()\n\t\t\t}\n\t\t\t//selecting the specific row\n\t\t\telse {\n\t\t\t\tvar query = \"SELECT * FROM products WHERE ?\";\n\t\t\t\tconnection.query(query, { item_id: answer.productNumber }, function (err, res) {\n\t\t\t\t\t//if the requested amount is higher than the actual amount of the item\n\t\t\t\t\tif (res[0].stock_quantity < answer.quantity) {\n\t\t\t\t\t\tconsole.log(\"Request too high, please Try again!\")\n\t\t\t\t\t\tfirstPrompt()\n\t\t\t\t\t}\n\n\t\t\t\t\telse {\n\t\t\t\t\t\t//return new quantity after removing requested amount\n\t\t\t\t\t\tvar newQuantity = res[0].stock_quantity - answer.quantity\n\t\t\t\t\t\t//update the sql table with the new quantity\n\t\t\t\t\t\tconnection.query(\"Update products SET ? WHERE?\",\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tstock_quantity: newQuantity\n\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\t\titem_id: answer.productNumber\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfunction (err) {\n\t\t\t\t\t\t\t\tif (err) throw err;\n\t\t\t\t\t\t\t\tconsole.log(\"Success, you bought \" + answer.quantity + \" items! That will be $\" + (answer.quantity * res[0].price) + \". Enjoy the \" + res[0].product_name + \"!\")\n\t\t\t\t\t\t\t\toption()\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n}", "function purchasePrompt() {\n\n inquirer.prompt([{\n\n type: \"confirm\",\n name: \"continue\",\n message: \"Would you like to purchase an item?\",\n default: true\n\n }]).then(function (user) {\n if (user.continue === true) {\n purchase();\n } else {\n console.log(chalk.green.bold(\"Thank you! Come back soon! Just enter: node bamazonCustomer.js\"));\n connection.end();\n }\n });\n}", "function confirmOrder() {\n\n}", "function getPrompt() {\n printStacks();\n rl.question('Pick a stack to pull a piece from: ', (startStack) => {\n rl.question('Pick a stack to move your piece to: ', (endStack) => {\n towersOfHanoi(startStack, endStack);\n getPrompt();\n });\n });\n}", "function userPurchase() {\n inquirer\n .prompt([\n {\n name: \"id\",\n type: \"input\",\n message: \"\\nWhat's the item ID of the product you would like to buy? \",\n filter: Number\n },\n {\n name: \"quantity\",\n type: \"input\",\n message: \"How many items do you wish to buy? \",\n filter: Number\n },\n\n]).then(function(answer) {\n var selectedID = answer.id;\n var numberOfItems = answer.quantity;\n console.log(selectedID, numberOfItems);\n calcPurchase(selectedID, numberOfItems);\n });\n}", "function userPrompt() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choices\",\n message: \"Hello Mrs. Manager. What would you like to do?\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\"]\n }\n ]).then(function (arg) {\n if (arg.choices === \"View Products for Sale\") {\n viewProducts();\n } else if (arg.choices === \"View Low Inventory\") {\n lowInventory();\n } else if (arg.choices === \"Add to Inventory\") {\n addInventory();\n } else if (arg.choices === \"Add New Product\") {\n addProduct();\n }\n });\n}", "async function prompt() {\r\n let answer;\r\n do {\r\n answer = await inquirer.prompt({\r\n name: \"action\",\r\n type: \"list\",\r\n message: \"What would you like to do?\",\r\n choices: [\r\n promptMessages.viewEmployees,\r\n promptMessages.viewEmployeesByDepartment,\r\n promptMessages.viewEmployeesByRole,\r\n promptMessages.viewDepartment,\r\n promptMessages.viewRoles,\r\n promptMessages.addEmployee,\r\n promptMessages.addDepartment,\r\n promptMessages.addRole,\r\n promptMessages.updateEmployeeRole,\r\n promptMessages.deleteEmployee,\r\n promptMessages.deleteRole,\r\n promptMessages.deleteDepartment,\r\n promptMessages.exit\r\n ]\r\n });\r\n\r\n switch (answer.action) {\r\n case promptMessages.viewEmployees:\r\n await viewAllEmployees();\r\n break;\r\n\r\n case promptMessages.viewEmployeesByDepartment:\r\n await viewEmployeesByDepartment();\r\n break;\r\n\r\n case promptMessages.viewEmployeesByRole:\r\n await viewEmployeesByRole();\r\n break;\r\n\r\n case promptMessages.addEmployee:\r\n await addEmployee();\r\n break;\r\n\r\n case promptMessages.updateEmployeeRole:\r\n await updateEmployeeRole();\r\n break;\r\n\r\n case promptMessages.viewRoles:\r\n await viewAllRoles();\r\n break;\r\n\r\n case promptMessages.addRole:\r\n await addRole();\r\n break;\r\n\r\n case promptMessages.viewDepartment:\r\n await viewAllDepartments();\r\n break;\r\n\r\n case promptMessages.addDepartment:\r\n await addDepartment();\r\n break;\r\n\r\n case promptMessages.deleteEmployee:\r\n await deleteEmployee();\r\n break;\r\n\r\n case promptMessages.deleteRole:\r\n await deleteRole();\r\n break;\r\n\r\n case promptMessages.deleteDepartment:\r\n await deleteDepartment();\r\n break;\r\n\r\n case promptMessages.exit:\r\n db.exit();\r\n break;\r\n default:\r\n console.log(\"default\");\r\n }\r\n } while (answer !== promptMessages.exit);\r\n}", "function mainPrompt() {\n console.log(chalk.yellow(figlet.textSync('EMPLOYEE TRACKING', { horizontalLayout: 'default', width: 80, whitespaceBreak: true })));\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"Add a department\",\n \"Add a role\",\n \"Add a employee\",\n \"View departments\",\n \"View roles\",\n \"View employees\",\n \"Update employee role\",\n \"Exit\"\n ]\n }).then(onMainPromptAnswer);\n}", "function promptAction() {\n inquirer.prompt([{\n type: 'list',\n message: 'Select from list below what action you would like to complete.',\n choices: ['View Products for Sale', 'View Low Inventory', 'Add to Inventory', 'Add New Product'],\n name: \"action\"\n }, ]).then(function(selection) {\n switch (selection.action) {\n case 'View Products for Sale':\n viewAllProducts();\n break;\n\n case 'View Low Inventory':\n lowInventoryList();\n break;\n\n case 'Add to Inventory':\n addInventory();\n break;\n\n case 'Add New Product':\n addNewProduct();\n break;\n }\n }).catch(function(error) {\n throw error;\n });\n}", "function printReceipt(totalPrice, productName, quantity, id, newQuant) {\n console.log(\"in printReceipt\");\n inquirer.prompt([{\n name: \"receipt\",\n message: \"Your total today is: \" + \"$\".green + totalPrice + \" Would you like to proceed (Y/N)\".red,\n type: \"input\",\n validate: isLetter\n }]).then(function(answers) {\n // console.log(\"in here\")\n // If user selects Y then they checkout and run the updateB function\n if (answers.receipt.toUpperCase() == 'Y') {\n console.log(\"\\nYou have successfully purchased:\\n\".green + \"================================\".blue);\n console.log(quantity + \" \" + productName + \"(s) for \" + \"$\".green + totalPrice + \"\\n================================\\n\".blue);\n return updateDB(id, newQuant);\n\n } else {\n // send the user back to the beginning\n return startShopping();\n }\n\n\n });\n\n\n}", "function promptUserPurchase() {\n inquirer.prompt([\n {\n name: \"itemID\",\n message: \"What is the id number of the item you wish to purchase?\"\n },\n {\n name: \"quantity\",\n message: \"How many do you wish to buy?\"\n }\n ]).then(function (answers) {\n if ((answers.itemID === \"x\") || (answers.quantity === \"x\")) {\n process.exit();\n }\n var purchaseItem = answers.itemID;\n var purchaseQty = answers.quantity;\n checkStockQuantity(purchaseItem, purchaseQty);\n });\n}", "function askUser() {\n inquirer\n .prompt([\n {\n name: \"askFunction\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\"View products for sale\",\"View low inventory\", \"Add to Inventory\", \"Add new product\"]\n }\n\n ]).then(function(answer) {\n var job = answer.askFunction;\n if (job === \"View products for sale\"){\n showInventory(job);\n }\n else if (job === \"View low inventory\") {\n lowInventory();\n }\n else if (job === \"Add to Inventory\") {\n addInventory();\n }\n else if (job === \"Add new product\") {\n addNewProduct();\n }\n \n });\n\n}", "function userPrompt() {\n return inquirer.prompt(questions);\n}", "function promptToAddNewStock() {\r\n var questions = [{\r\n type: 'input',\r\n name: 'itemNum',\r\n message: 'Which item # would you stock up?',\r\n validate: validateNumber,\r\n },\r\n {\r\n type: 'input',\r\n name: 'quantity',\r\n message: 'How many units will you be adding?',\r\n validate: validateNumber,\r\n when: function (answers) {\r\n return answers.itemNum;\r\n }\r\n }\r\n ];\r\n\r\n inquirer.prompt(questions).then(answers => {\r\n addItemsToInventory(parseInt(answers.itemNum), answers.quantity);\r\n });\r\n}", "function getEngineer() {\n\n inquirer \n .prompt([\n \n\n ])\n .then(answers =>{\n \n })\n\n}", "function promptManager(){\n inquirer.prompt([\n {\n type: \"list\",\n name: \"doWhat\",\n message: \"What would you like to do?\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\", \"exit console\"]\n }\n ]).then(function(response){\n \n switch(response.doWhat){\n case \"View Products for Sale\": displayItems();\n break;\n\n case \"View Low Inventory\": displayLow();\n break;\n\n case \"Add to Inventory\":addInventory();\n break;\n\n case \"Add New Product\":addNewProduct();\n break;\n\n case \"exit console\": connection.end();\n break;\n }\n });\n}", "function ask() {\n inquirer.prompt(questions).then(function(answers) {\n output.push(answers.userSelection);\n if (answers.userSelection == choiceArray[0]) {\n console.log(\"Run Display Twitter\");\n twitterCall();\n } else if (answers.userSelection == choiceArray[1]) {\n console.log(\"Run Display Spotify\");\n spotifyCall();\n } else if (answers.userSelection == choiceArray[2]) {\n console.log(\"Run Display Movies\");\n } else {\n console.log(\"Please make a selection by using the arrow keys\");\n }\n })\n\n }", "function prompt(){\n\tinquirer.prompt([{\n\t\tname: \"buy_item\",\n\t\ttype: \"input\",\n\t\tmessage: \"What would you like to purchase? (Type in Item ID)\",\n\t\tvalidate: function(val){//http://simiansblog.com/2015/05/06/Using-Inquirer-js/\n\t\t\tif (isNaN(val) === false){\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t},\n\t{\n\t\tname: \"buy_quant\",\n\t\ttype: \"input\",\n\t\tmessage: \"Hom many would you like?\",\n\t\tvalidate: function(val){ //or can read https://www.npmjs.com/package/inquirer\n\t\t\tif (isNaN(val) === false) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}]).then(function(res) {\n\t\tvar item = parseInt(res.buy_item); //user inputted item id: assumption that database will not change item id\n\t\tvar quant = parseInt(res.buy_quant); //user will give quantity\n\t\tvar product = productArr[item-1]; //get the product from the stored array list\n\t\t// this is instead of doing another query call to database, which probably is best if database is really large; don't want to be storing everything in js meomry\n\t\tif (quant > product.quant) {\n\t\t\tconsole.log(\"Not enough items in stock; there are only \"+product.quant+\" left!\");\n\t\t\tconsole.log(\"Please re-select: \");\n\t\t\tprompt(); //user will have to re-select what and how many they will buy\n\t\t}\n\t\telse {\n\t\t\tdisplay(product);\n\t\t\tvar total = quant*product.price;\n\t\t\tconsole.log(\"your total comes to $\"+total);\n\n\t\t\tinquirer.prompt([{\n\t\t\t\tname: \"confirm\",\n\t\t\t\ttype: \"confirm\",\n\t\t\t\tmessage: \"Confirm purchase?\",\n\t\t\t\tdefault: true\n\t\t\t}]).then(function(res){\n\t\t\t\tif (res.confirm){\n\t\t\t\t\tvar left = product.quant - quant;\n\t\t\t\t\tconsole.log(\"Purchase successful!!\");\n\t\t\t\t\tinventory(item, left);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t//if don't want to purchase can end session\n\t\t\t\t\tconsole.log(\"Good Bye! Thanks for coming\");\n\t\t\t\t\tconnection.end();\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t});\n}", "function promptUser() {\n return inquirer.prompt(questions);\n}", "function whatToDo() {\n inquirer.prompt([\n {\n name: \"toDo\",\n type: \"list\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\"\n ],\n message: \"What would you like to do?\"\n }\n ]).then(function (answer) {\n switch (answer.toDo) {\n case \"View Products for Sale\":\n forSale();\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n break;\n\n case \"Add to Inventory\":\n addInventory();\n break;\n\n case \"Add New Product\":\n addNew();\n }\n });\n}", "function shopping() {\n inquirer.prompt([\n {\n name: \"idSearch\",\n type: \"input\",\n message: \"Please enter the id of the product you would like.\"\n },\n {\n name: \"quantity\",\n type: \"input\",\n message: \"How much would you like?\"\n }\n ]).then(function (response) {\n //sets inputs to variables and pushes them into the purchase function\n var requestedId = response.idSearch;\n var desiredQuantity = response.quantity;\n purchase(requestedId, desiredQuantity);\n });\n}", "function goPrompt() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"What action would you like to do?\",\n name: \"choice\",\n choices: [\n \"Check Departments\",\n \"Check Roles\",\n \"Check Employees\",\n \"Plus Employee\",\n \"Plus Role\",\n \"Plus Department\"\n ]\n }\n // switch replaces else if...selects parameter and javascript will look for the correct function\n ]).then(function (data) {\n switch (data.choice) {\n case \"Check Departments\":\n viewDepartments()\n break;\n case \"Check Roles\":\n viewRoles()\n break;\n case \"Check Employees\":\n viewEmployees()\n break;\n case \"Plus Employee\":\n plusEmployees()\n break;\n case \"Plus Department\":\n plusDepartment()\n break;\n case \"Plus Role\":\n plusRole()\n break;\n }\n })\n}" ]
[ "0.751526", "0.75127506", "0.735097", "0.7202075", "0.71969825", "0.71910644", "0.701997", "0.69608915", "0.69436485", "0.69156176", "0.6912446", "0.68737155", "0.6840584", "0.67887145", "0.6744532", "0.6739522", "0.6735525", "0.67162997", "0.6712071", "0.6681574", "0.6681024", "0.6674279", "0.66634625", "0.6654883", "0.6652877", "0.66408", "0.6618864", "0.6618825", "0.66029453", "0.6598795", "0.65881264", "0.65712947", "0.6541712", "0.6536072", "0.65149635", "0.6506427", "0.64910996", "0.64853495", "0.64812297", "0.6478342", "0.6456676", "0.64507157", "0.6438012", "0.64230645", "0.64206094", "0.64168215", "0.64111155", "0.64101046", "0.6398481", "0.6397341", "0.63968086", "0.6376588", "0.6368956", "0.63664514", "0.6363243", "0.6361849", "0.6359249", "0.634476", "0.63377285", "0.63158095", "0.63147527", "0.62975955", "0.6291722", "0.62874275", "0.62874275", "0.6285395", "0.62807846", "0.6278777", "0.6274939", "0.62723273", "0.6269468", "0.6263446", "0.6253118", "0.62526566", "0.62472063", "0.6245206", "0.6241616", "0.62381256", "0.6225834", "0.621877", "0.62168205", "0.6216752", "0.620984", "0.6198161", "0.61965597", "0.6183856", "0.61831886", "0.6183151", "0.61793524", "0.61707705", "0.61683947", "0.6167502", "0.61624146", "0.61580795", "0.6157608", "0.6154761", "0.61545795", "0.61458886", "0.6141077", "0.6140512", "0.6137626" ]
0.0
-1
Update the pricelist. Called when the server starts and then once every hour
function updatePriceList() { najax("https://api.csgofast.com/price/all", (data) => { try { priceList = JSON.parse(data); console.log("Pricelist Loaded.") } catch(e) { console.log("Pricelist failed to load with error " + e); console.log(data); console.log("Retrying in 5 seconds..."); setTimeout(updatePriceList, 5000); } } ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePrices() {\n}", "function priceTicker(){\n\tsetInterval(function(){changePrices(fruitArray)}, 15000);\n}", "function updateChart() {\r\n if (price_list.length > 0) {\r\n for (var i = 0; i < price_list.length; i++) {\r\n console.log(price_list[i][0] + \"++\" + price_list[i][1]);\r\n callAPI(price_list[i][0], price_list[i][1], i);\r\n }\r\n }\r\n}", "updateListAfterSyncCatalogRulePrice(catalogrule_prices = []) {\n if (catalogrule_prices && catalogrule_prices.length) {\n let items = ProductListService.prepareItemsToUpdateListAfterSyncCatalogRulePrice(\n catalogrule_prices, this.state.items\n );\n if (items !== false) {\n this.addItems(items);\n }\n this.props.actions.resetSyncActionUpdateCatalogRulePrice();\n }\n }", "updatePriceFromPricing () {\n this.config.display.amount = this.pricing.totalNow;\n this.config.display.currency = this.pricing.currencyCode;\n }", "function updateprice(){\n\n}", "refresh() {\n if (this.date && this.price)\n this.update(this.date, this.price);\n }", "function updateList(filter) {\r\n var page = $(\"#page-no\").html();\r\n var get_url = \"/search/list/\" + (parseInt(page) - 1);\r\n if (filter) {\r\n var filter_cat = $(\"#select-filter option:selected\").text().toLowerCase();\r\n var filter_terms = $(\"#filter-terms\").val().toString().split(\" \").join(\"+\");\r\n var get_url = \"/search/filter/\" + (parseInt(page) - 1) + \"/\" + filter_cat + \"/\" + filter_terms;\r\n }\r\n var stock_list = $(\"#stock-list\");\r\n stock_list.empty();\r\n\r\n $.ajax({\r\n url: get_url,\r\n type: 'GET',\r\n success: function (data) {\r\n $.each(data.stocks, function () {\r\n var row_id = this.symbol + \"-row\";\r\n var stock_link = location.origin + \"/stock/\" + this.symbol;\r\n var stock_row = `<tr id=${row_id}><td><a href=\"${stock_link}\">${this.symbol}</a></td><td><a href=\"${stock_link}\">${this.name}</a></td><td>${this.sector}</td><td class=\"stock-price\" id=\"${this.symbol}\">$</td></tr>`;\r\n stock_list.append(stock_row);\r\n }); \r\n },\r\n }).done(function () {\r\n setInterval(refreshPrice(), 60000);\r\n });\r\n\r\n}", "function updatePrices() {\n clickUpgrades['shovel'].price = clickUpgrades['shovel'].newprice;\n clickUpgrades['excavator'].price = clickUpgrades['excavator'].newprice;\n autoUpgrades['jackhammer'].price = autoUpgrades['jackhammer'].newprice;\n autoUpgrades['wheelbarrow'].price = autoUpgrades['wheelbarrow'].newprice;\n\n}", "async updateCoinPrices() {\n //get response from api\n let response = await fetch(cryptocompareApiUrl);\n let prices = await response.json();\n //add everything to container\n let priceContainer = document.getElementById(\"pricesContainer\");\n const keys = Object.keys(prices);\n for (const key of keys) {\n priceContainer.innerHTML += this.priceViewMaker(\n symbols[key],\n prices[key],\n key\n );\n }\n }", "function initiateDrinkUpdate() {\n\tgetAllDrinks();\n}", "function updatePriceArray() {\n itemPrice[0][1] = $(\".checkout-total-calc-banana\").text();\n itemPrice[1][1] = $(\".checkout-total-calc-cauliflower\").text();\n itemPrice[2][1] = $(\".checkout-total-calc-loquat\").text();\n localStorage.setItem(\"itemPrice\", JSON.stringify(itemPrice));\n }", "function updatePricing(data) {\n var $priceDisplay = $('#event-edit__price');\n var totalPrice = 0;\n var emptyPriceText = '___';\n var newEventPriceString;\n\n if (isValidData(data)) {\n totalPrice = getDrinkPrice(data['guestCount'], data['length'], data['drinkPrice']);\n }\n\n if (totalPrice > 0) {\n var totalPriceText = formatMoney(totalPrice);\n newEventPriceString = totalPriceText;\n } else {\n newEventPriceString = emptyPriceText;\n }\n\n $priceDisplay.text(newEventPriceString);\n }", "async onReady() {\n // Reset the connection indicator during startup\n this.setState(\"info.connection\", false, true);\n if (this.config.interval < 30) {\n this.log.info(\"Set interval to minimum 30\");\n this.config.interval = 30;\n }\n this.updateInterval = null;\n\n this.requestClient = axios.create();\n this.extractKeys = extractKeys;\n const amountTrimmed = this.config.amount.replace(/ /g, \"\");\n this.amountArray = amountTrimmed.split(\",\");\n this.amountArray.push(\"dynamic\");\n\n await this.updatePrice();\n this.updateInterval = setInterval(async () => {\n await this.updatePrice();\n }, this.config.interval * 60 * 1000);\n }", "function main() {\n bidRequest(); \n\n var interval = 1000 * 5; //time interval \n\n window.setInterval(bidRequest, interval); // refreshes the bid list every five seconds\n}", "updatePrice() {\n\t\treturn this.products.map((product) => {\n\t\t\tproduct.updatePrice();\n\t\t\tproduct.updateSellInDays();\n\t\t\treturn product;\n\t\t});\n\t}", "function populatePrices() {\n\t// iterate through observatories (PC)\n\tfor (let i = 0; i < observatories.length; i++) {\n\t\t// Put price into relevant element id, e.g. #price0 for Palomar (PC)\n\t\tdocument.getElementById(\"price\" + i).innerHTML = observatories[i].price;\n\t\t// Same for the initial badge state (PC)\n\t\tdocument.getElementById(\"badge\" + i).innerHTML = \"€\" + observatories[i].price;\n\t\t// initial cost = price (PC)\n\t\tobservatories[i].cost = observatories[i].price;\n\t}\n}", "async fetchItems() {\n this.setState({isFetching: true});\n\n const serverdata = await this.getServerData();\n const items = await this.getMarketPrices();\n const ItemsHistory = [];\n\n for (const [i, item] of items.entries()) {\n this.setState({\n progress: i/items.length*100,\n progress_name: item.localized,\n });\n ItemsHistory[item.item] = (\n await this.getMarketPricesHistorical(item.item, 720)\n );\n }\n this.setState({\n police: (\n serverdata.hasOwnProperty('Side')? serverdata.Side.Cops.length : 0\n ),\n items: items,\n items_history: ItemsHistory,\n isFetching: false,\n lastMarketUpdate: (\n new Date(\n ItemsHistory.apple[ItemsHistory.apple.length-1].created_at,\n ).toLocaleTimeString()\n ),\n });\n this.refreshPricesTicker = setInterval(() => this.refreshPrices(), 60000);\n }", "function SubscribePriceUpdate(value) {\n\n console.log(value, 'SubscribePriceUpdate');\n\n setSubscribeSelectedOption(value)\n setPrice(value.value)\n setDiscountedPrice(value.discount_price > 0 ? value.discount_price : value.value)\n }", "function load(update) {\n if (isLoading) {\n return;\n }\n\n baseCurrency = self.base.currency;\n counterCurrency = self.counter.currency;\n markets.updateListHandler();\n\n if (!self.base || !self.counter ||\n (self.base.currency === self.counter.currency &&\n self.counter.currency === 'XRP')) {\n setStatus('Select a currency pair.');\n return;\n }\n\n if (!update) {\n setStatus('');\n loader.transition().style('opacity', 1);\n isLoading = true;\n }\n\n var start = moment.utc();\n\n start.startOf('minute')\n .subtract(start.minutes() % 5, 'minutes')\n .subtract(1, 'day');\n\n if (self.request) {\n self.request.abort();\n }\n\n self.request = self.markets.apiHandler.offersExercised({\n startTime: start.format(),\n endTime: moment.utc().endOf('day').format(),\n timeIncrement: 'minute',\n timeMultiple: 5,\n descending: false,\n base: self.base,\n counter: self.counter\n },\n function(data) {\n if (liveFeed) {\n liveFeed.stopListener();\n }\n\n setLiveFeed();\n self.lineData = data;\n isLoading = false;\n drawData(true);\n\n },\n function(error) {\n console.log(error);\n isLoading = false;\n setStatus(error.text ? error.text : 'Unable to load data');\n });\n }", "function refreshList(){\n let newLocalTime = (new Date()).toLocaleTimeString();\n let listItemsToUpdate = Array.from(document.getElementsByClassName('item'));\n\n if (listItemsToUpdate && listItemsToUpdate.length>0) {\n listItemsToUpdate.map((item)=> ( item.innerHTML = newLocalTime));\n }\n}", "updatePricesBA() {\n // console.log('-> update prices')\n this.setState({\n prices: this.pricesM\n })\n }", "function refreshList() {\n axios.get(url + HoldRoute + \"/withtools/json\").then((response) => {\n setList(response.data);\n });\n }", "function startUpdating() {\n\tif(!retrying) updateTicker(false);\n\tupdateHistory();\n}", "updatePrice() {\n for (var i = 0; i < this.products.length; i++) {\n updateValues.updateFunction(this.products[i]);\n }\n\n return this.products;\n }", "function updateAll()\n{\n\twindow.clearTimeout( timeID );\n\tgetUserList();\n\tsetTimers();\n}", "function updateList() {\n\t$(\".cart-products\").empty();\n\tvar cartTotal = 0.00;\n\tvar storedItems = JSON.parse(localStorage.getItem(\"items\"));\n\t// update number of items in cart in badge icon\n\tif (storedItems != null) {\n\t\t$(\".badge\").text(storedItems.length);\n\t\tstoredItems.forEach( function(storedItem) {\n\t\t\t// calculate cart total from price and quantity\n\t\t\tvar total = (parseInt(storedItem.quantity) * parseFloat(storedItem.price)).toFixed(2);\n\t\t\tcartTotal += parseFloat(total);\n\t\t\t// dynamically add html based on number of storedItems\n\t\t\tvar cartItem = `<div class=\"cart-item\">\n\t\t\t\t\t\t\t\t<img src=\"` + storedItem.image + `\" alt=\"\" class=\"item-img\" id=\"cart-image\"/>\n\t\t\t\t\t\t\t\t<div class=\"item-description\">\n\t\t\t\t\t\t\t\t\t<div class=\"left-descript\">\n\t\t\t\t\t\t\t\t\t\t<h3 id=\"cart-name\">` + storedItem.name + `</h3>\n\t\t\t\t\t\t\t\t\t\t<span id=\"cart-flavors\"> Additional Flavors: ` + storedItem.firstFlavor + \" , \" + storedItem.secFlavor + `</span>\n\t\t\t\t\t\t\t\t\t\t<p id=\"price-row\"> Price: $<span id=\"cart-price\">` + storedItem.price + `</span> each </p>\n\t\t\t\t\t\t\t\t\t\t<p id=\"quantity-row\"> Quantity: &nbsp; <span id=\"cart-quantity\">` + storedItem.quantity + `</span></p>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div class=\"right-descript\">\n\t\t\t\t\t\t\t\t\t\t<p>Total: $<span id=\"cart-total\">` + total + `</span></p>\n\t\t\t\t\t\t\t\t\t\t<h3> <span class=\"small-button hover\"> <a href=\"javascript:void(0);\" class=\"pink\" id=\"remove\"><span id=\"remove-id\">` + storedItem.id + `</span> Remove</a></span></h3>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div> \n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<span class=\"divider\" ><hr/></span>`;\n\t\t\t$(\".cart-products\").append(cartItem);\n\t\t});\n\t\t\n\t\t// dynamically calculate checkout information\n\t\tcartTotal = cartTotal.toFixed(2);\n\t\tvar tax = (cartTotal * 0.085).toFixed(2);\n\t\tvar shipping = (cartTotal * 0.15).toFixed(2);\n\t\t$(\"#total\").text(cartTotal);\n\t\t$(\"#tax\").text(tax);\n\t\t$(\"#shipping\").text(shipping);\n\t\tvar grandTotal = parseFloat(cartTotal) + parseFloat(shipping) + parseFloat(tax);\n\t\t$(\"#grand-total\").text(grandTotal.toFixed(2));\n\t}\n}", "function updatePrice() {\n angular.forEach($scope.stockArr, function(item, index) {\n // console.log(\"updating price\");\n getPriceBySymbol(item.symbol).then(function() {\n item.high = $scope.oneStock.high;\n item.low = $scope.oneStock.low;\n item.open = $scope.oneStock.open;\n item.close = $scope.oneStock.close;\n item.price = $scope.oneStock.price;\n item.volume = $scope.oneStock.volume;\n });\n\n });\n }", "function startLiveUpdate() {\n setInterval(async () => {\n const response = await fetch(\"https://foobar-mandalorians.herokuapp.com/\");\n const jsonData = await response.json();\n prepareData(jsonData);\n }, 3000);\n}", "function setValues(){\n pageload();\n dataUpdate(UserName);\n addMenu();\n document.getElementById('ipaddress').innerHTML = '<h5>'+Ipconfig.myIpAddress()+'</h5>';\n startServer();\n refreshList();\n setInterval(refreshList,5000);\n}", "function setUpPeriodicParticipantListUpdate() {\n var UPDATE_INTERVAL = 60000;\n if (!vidyoPluginController.isGuest()) {\n logger.info(\"Setting up periodic participants list updater. Interval between updates: \"\n + UPDATE_INTERVAL + \" ms.\");\n updateParticipantsListTimerID = setInterval(function() {\n logger.info(\"Periodic participants list update.\");\n updateParticipantsListForModerator();\n }, UPDATE_INTERVAL);\n }\n }", "function PriceUpdate(price) {\n $(\"#price\").text(price);\n}", "function updateSeconds(site, list){\n if (site in list) {\n count = list[site].intervalSeconds; // getting count\n list[site].intervalSeconds = count + 1; //updates\n totalCount = list[site].totalSeconds;\n list[site].totalSeconds = totalCount +1;\n chrome.storage.local.set({\"urlList\": list}, function() {}); //overwriting the list\n formatBadge(list[site].intervalSeconds); // formats and displays badge\n mainNotification(count, site); // runs roast time algorithm\n }else {\n setBadge(\"\", grey);\n }\n}", "function handleListUpdate(changes){ \n changes.forEach(function(change){\n var newObject = change.object;\n newObject.showTo('#product-list', startNumProd, finishNumProd); \n });\n }", "async function updateTokenPrices () {\n for (var i = 0; i < tokens.length; i++) {\n const newPrice = await getTokenPrice(tokens[i])\n await recordNewPrice(newPrice)\n }\n}", "updatePrice() {\n var index = 0;\n this.total_price = this.collection.data[this.current_product_index].price;\n for (let option_item of this.check_option_list) {\n if (option_item) {\n this.total_price += Number(this.collection.data[this.current_product_index].options[index].price);\n }\n index++;\n }\n }", "function vms_update() {\n _.each(server_list, function(data, hostname, i) {\n vm_update(hostname);\n });\n //self.reset_server_list();\n }", "function startCaching () {\n cachingInterval = setInterval(getBogPrice, CACHING_TIME)\n}", "function connectCallback() {\n client.subscribe('/fx/prices', function (response) {\n const data = JSON.parse(response.body);\n try {\n drawTableWithRealTimeUpdate.storeStockDataFromStomp(data);\n } catch (error) {\n util.log(error);\n }\n })\n try {\n setInterval(function () {\n drawTableWithRealTimeUpdate.cleanSparkLineData(drawTableWithRealTimeUpdate.stockTableData);\n }, 30000);\n } catch (error) {\n util.log(error);\n }\n}", "function updatePrice() {\n var distance = getRoutesData().reduce(function(pv, cv) {return pv + cv.distance; }, 0);\n // taxi for very short distance has constant min price\n var businessDistance = (distance > getMinDistance()) ? distance : getMinDistance();\n var price = getTaxiPricePerKm() * businessDistance;\n $('#price').val(price.toFixed(2) + \" UAH\");\n}", "function mainLoop() {\n\tupdateTicker(false);\n\tsetInterval(function(){ startUpdating(); }, 60*1000); // Recheck every minute (should be a multiple of any trading interval)\n\tupdateHistory();\n}", "function initAutoUpdate()\n\t\t{\n\t\t\tfor (var i = 1 ; i <= max; i++){\n\t\t\t\tvar input = $('#'+String(dataName_arr[1][0]+i));\n\t\t\t\tinput.val($('#price').html());\n\t\t\t}\n\t\t\t\n\t\t\tautoChangeValue();\n\t\t\t$('#price').bind('DOMNodeInserted', function () { autoChangeValue()});\n\t\t}", "function updateProductList(){\r\n if(shop.products){\r\n container.innerHTML = '';\r\n for(var i = 0; i < shop.products.length; i++){\r\n container.append(productElement(shop.products[i]));\r\n }\r\n addBtnListener(editBtnclassName, function(index, id){\r\n editProduct(id);\r\n });\r\n addBtnListener(removeBtnclassName, function(index, id){\r\n shop.products.splice(getIndexById(id), 1);\r\n updateProductList();\r\n });\r\n }\r\n }", "function updateList() { \r\n\tfor (let i = 0; i < order.sandwich.length; i++) {\r\n\t\tlet whatkind;\r\n\t\t\r\n\t\t\t// used to determine what kind of food is inserted into \"list\" element along with price.\r\n\t\tif (order.sandwich[i][\"price\"] == \"2.99\") { \r\n\t\t\twhatkind = \"Sandwich\";\r\n\t\t} else if (order.sandwich[i][\"price\"] == \"3.99\") {\r\n\t\t\twhatkind = \"Burger\";\r\n\t\t} else {\r\n\t\t\twhatkind = \"CheeseBurger\";\r\n\t\t}\r\n\t\tlet para = document.createElement(\"li\");\r\n\t\tlet node = document.createTextNode(whatkind + \" \" + order.sandwich[i][\"price\"]);\r\n\t\tpara.appendChild(node);\t\t\r\n\t\tlet element = document.getElementById(\"output\");\r\n\t\telement.appendChild(para);\r\n\t}\r\n\tdocument.getElementById(\"total\").textContent = \"Total: $\" + order.price;\r\n}", "start () {\n\t\tthis.updateTask.setRepeating ((callback) => {\n\t\t\tthis.update (callback);\n\t\t}, App.HeartbeatPeriod, App.HeartbeatPeriod * 2);\n\t}", "function updatemyProduction() {\n\n setInterval(function() {\n \n myProduction(); \n }, 120000); // update SQ Feet Production every 2 Minutes\n\n }", "function update_projects_items_prices() {\n var items_projet = items_ranges[\"projets\"].getValues();\n Logger.log(\"update_projects_items_prices() : items_projet = \" + items_projet);\n var new_item_list = update_tracked_items_list(items_projet);\n}", "function OTPPriceUpdate(value) {\n console.log(value, 'OTPPriceUpdate');\n\n setOTPSelectedOption(value)\n setPrice(value.value)\n setDiscountedPrice(value.discount_price > 0 ? value.discount_price : value.value)\n }", "updateList() {\n console.warn( 'List could not be updated; it has not yet been initialized.' );\n }", "function periodicUpdate() {\n // Increment update counter.\n updateCount += 1;\n \n // If the page has been loaded recently, initialize.\n if (updateCount < 3) {\n getData('sys/model', function(data) { updateElement('device-model', data.toString()); });\n getData('sys/os', function(data) { updateElement('device-os', data.toString()); });\n getData('ram/total', function(data) { updateElement('ram-total', Math.round(parseInt(data))); });\n getData('fs/0/total', function(data) { updateElement('disk-total', Math.round(parseInt(data))); });\n }\n \n if (serverOnline()) {\n // Server is online, update dash.\n \n $('#connection-online').removeClass('hidden');\n $('#connection-offline').addClass('hidden');\n\n if(!uptimeInterval) {\n getData('uptime', function(data) { initUptimeInterval(data); });\n }\n \n getData('cpu/temp', function(data) { updateElement('cpu-temp', Math.round(parseInt(data))); });\n getData('cpu/usage', function(data) { updateElement('cpu-usage', Math.round(parseInt(data))); });\n \n getData('ram/usage', function(data) { updateElement('ram-usage', Math.round(parseInt(data))); });\n getData('ram/used', function(data) { updateElement('ram-used', Math.round(parseInt(data))); });\n \n getData('fs/0/usage', function(data) { updateElement('disk-usage', Math.round(parseInt(data))); });\n getData('fs/0/used', function(data) { updateElement('disk-used', Math.round(parseInt(data))); });\n\n getData('network/transmit/eth0', function(data) { updateElement('network-transmit-eth0', Math.round(parseInt(data))); });\n getData('network/receive/eth0', function(data) { updateElement('network-receive-eth0', Math.round(parseInt(data))); });\n\n getData('network/transmit/wlan0', function(data) { updateElement('network-transmit-wlan0', Math.round(parseInt(data))); });\n getData('network/receive/wlan0', function(data) { updateElement('network-receive-wlan0', Math.round(parseInt(data))); });\n\n } else {\n // Server is offline, clear dash.\n \n $('#connection-online').addClass('hidden');\n $('#connection-offline').removeClass('hidden');\n\n window.clearInterval(uptimeInterval);\n uptimeInterval = undefined;\n updateElement('server-uptime', '00:00:00');\n \n updateElement('cpu-temp', 0);\n updateElement('cpu-usage', 0);\n \n updateElement('ram-usage', 0);\n updateElement('ram-used', 0);\n \n updateElement('disk-usage', 0);\n updateElement('disk-used', 0);\n\n updateElement('network-transmit-eth0', 0);\n updateElement('network-receive-eth0', 0);\n\n updateElement('network-transmit-wlan0', 0);\n updateElement('network-receive-wlan0', 0);\n\n }\n}", "function updateValues () {\n setInterval(function () {\n console.log('Starts updating job');\n\n getAllCoins()\n .then(function (object) {\n console.log('Finished updating');\n return saveToDatabase(object);\n })\n .catch(function (err) {\n console.log(err);\n });\n\n }, 60000);\n}", "function updatePinsList() {\n\n\n\t// Clear the list\n\t$('.pins-list').html('<div class=\"xl-center\">No pins added yet.</div>');\n\n\n\t$(Pins).each(function (i, pin) {\n\n\t\tif (i == 0) $('.pins-list').html('');\n\n\t\tvar pin_number = i + 1;\n\n\t\t// Add the pin to the list\n\t\t$('.pins-list').append(\n\t\t\tlistedPinTemplate(pin_number, pin)\n\t\t);\n\n\n\t});\n\n}", "async function updateSongList() {\n await props.onListSongsChange(props.inputValue, props.nextSongsUrl, props.listedSongs);\n }", "start () {\n\t\tthis.updateTask.setRepeating ((callback) => {\n\t\t\tthis.update (callback);\n\t\t}, App.HeartbeatPeriod * 4, App.HeartbeatPeriod * 8);\n\t}", "startTickerTimer() {\n this.stopTimer( 'ticker' );\n this.startTimer( 'ticker', 1000, () => {\n let keys = Object.keys( this._symbols );\n let count = keys.length;\n let prices = [];\n\n while ( count-- ) prices.push( this._symbols[ keys[ count ] ] );\n this.emit( 'ticker_prices', prices );\n }, true );\n }", "function onGetProducts (response) {\n //TODO check for parsing errors\n var responseArray = JSON.parse(response.responseText);\n\n //update products array with additional price properties appended\n var products = appendAdditionalPriceProperties(responseArray);\n\n loadProductsTemplate(products);\n }", "function init() {\n loadOrders();\n setInterval(loadOrders,30000); //Check every thirty seconds\n }", "update(date, price) {\n // store for refresh\n this.date = date;\n this.price = price;\n\n const chart = this.container.get_parent().get_container(this.guid).chart;\n\n if (Object.keys(this.contracts).length == 0)\n return;\n\n const rate = parseFloat(\n document.\n getElementById(\"options_chart_rate\")\n .value\n );\n\n const start_time = Date.parse(chart.start_date);\n const until_date = Math.ceil((date.getTime() - start_time) / 86400000);\n\n for (var key in this.contracts) {\n const contract = this.contracts[key];\n\n // calculate dates until expiration\n const exp_date = new Date();\n exp_date.setDate(exp_date.getDate() + contract.dte);\n const diff = (exp_date.getTime() - date.getTime())\n const dte = Math.ceil(diff / 86400000);\n\n contract.sim_dte = dte;\n\n // calculate future values from the cursor's location\n contract.sim_value = theoretical(\n price,\n contract.strike,\n rate,\n contract.volatility,\n dte,\n contract.type\n );\n\n contract.itm = itm(\n price, contract.strike, contract.volatility,\n dte, contract.type\n ).toFixed(2);\n contract.otm = (1 - parseFloat(contract.itm)).toFixed(2);\n contract.below = below(\n chart.start_price, price,\n contract.volatility, until_date\n ).toFixed(2);\n contract.above = (1 - parseFloat(contract.below)).toFixed(2);\n\n contract.itm = isNaN(contract.itm) ? \"exp\" : contract.itm;\n contract.otm = isNaN(contract.otm) ? \"exp\" : contract.otm;\n contract.below = isNaN(contract.below) ? \"exp\" : contract.below;\n contract.above = isNaN(contract.above) ? \"exp\" : contract.above;\n }\n\n this.render(chart);\n }", "function changePrices(response, priceFunction) {\n traverseAndCollect(response, \"editorials.technicals.products.price\").forEach(function(price) {\n price.value = priceFunction();\n });\n}", "function autoRefresh() {\n if(typeof CACHE_TIME_INTERVAL === 'number') {\n var seconds = CACHE_TIME_INTERVAL * 1000;\n } else {\n var seconds = 60000;\n }\n window.setInterval(function() {\n serverRPS.startSearch();\n productServers.startSearch();\n }, seconds);\n }", "function updatePrice(e) {\n var parentID = $(e).parents(\"div.item\").attr(\"id\");\n \n var baseCost = parseFloat($('#' + parentID + ' span.painting.price').attr(\"data-price\"));;\n var quantity = $('#' + parentID + ' input[name^=quantity]').val();\n var frameCost = parseFloat($('#' + parentID + ' select[name^=frame] option:selected').attr(\"data-price\"));\n var glassCost = parseFloat($('#' + parentID + ' select[name^=glass] option:selected').attr(\"data-price\"));\n var mattID = $('#' + parentID + ' select[name^=matt]').val();\n\n $(\"#\" + parentID + \" span.price\").html(calcItemPrice(baseCost, quantity, frameCost, glassCost, mattID));\n }", "function listPriceEngine()\r\n{\r\n\r\n\t// First attempt to load this custom record's XML payload into order\r\n\torderNumber = loadXMLTreefromSalesOrderPayload();\r\n\r\n\t// If we have an order number can try to process the items and find prices\r\n\tif (orderNumber)\r\n\t{\r\n\t\t\r\n\t\t// set up all order related values ready for processing\r\n\t\tinitialise();\r\n\r\n\t\t// Take each line item in turn and derive the list price\r\n\t\tfor ( var thisItem = 1; thisItem <= itemsCount; thisItem++)\r\n\t\t{\r\n\t\t\tvar thisListPrice = calculateListPriceItem(thisItem);\r\n\t\t\t// Add the list price returned to the XML answer if it is present\r\n\t\t\t// If not, report an error - even a list price of 0.00 should be present\r\n\t\t\tif (thisListPrice != null)\r\n\t\t\t{\r\n\t\t\t\taddListPriceItemtoXMLAnswer(thisItem, thisListPrice);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\taddToErrorsXML(\"listPriceEngine : \" + orderNumber, \"Item No. \" + thisItem + \"/\" + itemsCount\r\n\t\t\t\t\t\t+ \" : Missing List Price\");\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t\r\n\t\t// Assemble the final answer and post into the record\r\n\t\tcompleteXMLAnswer();\r\n\t\t\r\n\t\t// Create the estimate record which will trigger the discounts process\r\n\t\t// But only if there are no errors in generating the item(s) ...\r\n\t\t// Write out the XML answer and new estimate id if present\r\n\t\tif (XMLErrors == '')\r\n\t\t{\r\n\t\t\testimateID = saveDiscountCalcEstimate();\r\n\t\t\tsaveSalesOrderPriceListXMLPayload();\t\t\t\r\n\t\t}\r\n\t\t\r\n\t}\r\n}", "function updateDeviceList() {\n var timeNow = Date.now();\n\n $.each(devices, function(key, device) {\n // Only show devices that have been updated during the last 10 seconds.\n if (device.timeStamp + 10000 > timeNow) {\n displayDevice(device)\n } else {\n // Remove inactive device.\n removeDevice(device)\n }\n })\n }", "function refreshIspInfo(ispId) {\n if (ispSelect.find('option[value=\"' + ispId + '\"]').prop('disabled'))\n return;\n\n var softDB = $.grep(softList, function (e1) { return e1.ID == ispId; });\n if (ispId == \"0\") {\n price.current_image_license = 0;\n }\n else {\n price.current_image_license = softDB[0].Price.Amount;\n }\n\n setGlobalparam();\n price.Calculate();\n }", "_tick(message) {\n // This ignores all heartbeat messages\n if(!message || message.type != 'ticker' || !message.product_id) {\n return\n }\n\n this._pino.trace({type: 'ticker', message: message})\n\n // Save certain fields only\n this._prices[message.product_id] = {\n price: message.price,\n open_24h: message.open_24h,\n volume_24h: message.volume_24h,\n low_24h: message.low_24h,\n high_24h: message.high_24h,\n time: message.time // ISO time as string\n }\n\n // Execute callback, if any\n if(this._onTicker[message.product_id]) {\n this._onTicker[message.product_id](message.price, message.time)\n }\n }", "function update(){\n\tconsole.log('Initializing data...server will be ready when the count is done')\n\tdb.clearCityData('sfbay')\n\tdb.saveCityData('sfbay');\n}", "function updateList () {\r\n list.push(xLB); // Aktuelle Messstrecke zur Liste hinzufügen\r\n var s = ta.value; // Bisheriger Inhalt des Textbereichs\r\n s += value(xLB,3,meter)+\"; \"; // Weglänge hinzufügen\r\n s += value(tLB,3,second)+\"\\n\"; // Zeit hinzufügen\r\n ta.value = s; // Textbereich aktualisieren\r\n }", "function scrapePrices(){\n resetDatasource();\n completedInsertions = 0;\n\n // iterate over locations and retrieve price data for each\n locations.forEach(function(location){\n requestHeader = {\n 'Authorization': 'Token ' + config.serverToken\n }\n\n // create request query string\n var apiFunction ='/v1/estimates/price?start_latitude=' + location.latitude\n + '&start_longitude=' + location.longitude + '&end_latitude=' +\n + config.rideDestination.latitude + '&end_longitude=' + config.rideDestination.longitude\n\n // make a request for price data to uber api endpoint\n https.get({\n host: host,\n path : apiFunction,\n headers: requestHeader\n }, function(response) {\n var body = '';\n\n response.on('data', function(d) {\n body+=d;\n });\n\n response.on('end', function() {\n responseObj = JSON.parse(body);\n prices = responseObj.prices;\n var services = ['POOL', 'uberX', 'uberXL'];\n\n prices.forEach(function(price){\n if(services.indexOf(price.localized_display_name) > -1){\n dataWriteFunction(price, location.name);\n }\n });\n });\n });\n\n });\n}", "function listing(data) {\n if (ourCurrentVersion && (ourCurrentVersion !== data.version)) {\n console.log('NEW VERSION', data.version);\n location.reload();\n }\n ourCurrentVersion = data.version;\n // Hitting refresh can sometimes allow our guid to still be registered.\n // We need two different EventSource to test loopback, but then we'd be registered twice and things would get weird.\n existingPeers = data.peers.filter(p => p !== guid);\n browserData.concurrency = existingPeers.length;\n browserData.ip = data.ip;\n updateTestingMessage();\n }", "function updateProductList()\n{\n var itemSort = '';\n var itemFilter = '';\n\n if (typeof document.filterForm != 'undefined') {\n itemSort = document.filterForm.sortBy.value;\n itemFilter = document.filterForm.filterBy.value;\n }\n\n // pageProduct\n var prodList = createProductList(itemSort, itemFilter);\n\n updateItemContainer(prodList);\n}", "function updatePrice(price) { \n // first selected click, create price original to return. \n if (!price_o.attr('data-source-price')) {\n var source_price = price_o.attr('data-source-price', price_o.text());\n } \n \n //change price\n price_o.hide();\n price_o.text(price).fadeIn(300);\n // right_side.find('.loading').remove();\n }", "function updateRSS () {\n setInterval(initialize, 1000 * 60 * 60 * 4); // runs Initialize ever 4 hours from first load\n}", "function updatePriceFunction(cupID) {\r\n\t// update price on current row\r\n\t$(\"tr[name=\" + cupID + \"] text[name=cup-price]\").text(\r\n\t\t\tlistCup[cupID].getPrice());\r\n\tconsole\r\n\t\t\t.log(\"update cup \" + cupID + \", Price: \"\r\n\t\t\t\t\t+ listCup[cupID].getPrice());\r\n\t// update total price\r\n\tupdateTotalPriceFunction();\r\n}", "displayPrice() {\n this.updatePrice();\n var tmp_show_price = false;\n for (let option_item of this.check_option_list) {\n if (option_item) {\n tmp_show_price = true;\n break;\n }\n }\n this.show_price = tmp_show_price;\n }", "function auto_update() {\n\t$.getJSON('fetchdata.php', function(data) {\n\t\t$('ul').empty();\n\n\t\t$.each(data.dataresult, function() {\n\t\t\t$('ul').append('<li>Lastname: '+this['lname']+'</li><li>Firstname: '+this['fname']+'</li><li>Middlename: '+this['mname']+'</li>');\n\t\t\t\n\t\t});\n\t\t$('h1').text('');\n\t});\n}", "function updateList()\r\n{\r\n var newPay = form.newpayrate.value;\r\n \r\n // check valid input\r\n reg = /[0-9]+(\\.[0-9][0-9]?)?/;\r\n if (!newPay.match(reg))\r\n {\r\n alert(\"Please enter a valid number with up to 2 decimal places\");\r\n form.newpayrate.focus();\r\n } \r\n else\r\n {\r\n // Enter pay onto list\r\n var option = document.createElement(\"option\");\r\n var list = document.getElementById(\"payrate\");\r\n option.text = newPay.match(reg)[0];\r\n // Add to HTML\r\n list.add(option);\r\n\r\n // Add to array to be saved\r\n savedPays.push(option.text);\r\n\r\n // Add to google chrome storage\r\n chrome.storage.sync.set({myPays: savedPays}, function(){\r\n console.log('Pay saved' + savedPays);\r\n });\r\n }\r\n}", "updateStart() {\n const nodeSocrata = require('node-socrata');\n\n const soda = new nodeSocrata({\n 'hostDomain': 'https://data.baltimorecity.gov',\n 'resource': 'wsfq-mvij.json',\n 'XappToken': '1H4t917kJRrkNDyhSyLHYMfnW'\n });\n\n // maximum for the SODA API\n const limit = 50000;\n\n function addSodaEntries(sodaEntries) {\n for (const entry of sodaEntries) {\n for (let i = 0; i < entry.total_incidents; ++i) {\n this._addSodaEntry(entry);\n }\n }\n }\n\n sodaFetchPages(soda, limit, 0, addSodaEntries.bind(this), this._updateFile.bind(this));\n\n // update again 24 hours from now\n setTimeout(this.updateStart.bind(this), 24 * 60 * 60 * 1000);\n }", "function updatePrice(Id, price) {\n getElement(Id + \"-price\").innerText = price;\n updateTotal();\n}", "function get_updates(){\n\t\t\tvar num = get_cache_buster();\n\t\t\t\t$.ajax({\n\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\turl: \"/place/where/your/json_file/is_stored/updates.json?\" + num,\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\t//UPDATE THE LIVE UPDATES\n\t\t\t\t\t\tvar news_items = data;\n\t\t\t\t\t\tvar source = $('#ticker-list').html();\n\t\t\t\t\t\tvar template = Handlebars.compile(source);\n\n\t\t\t\t\t\t$('#mcd_updates').append(template({objects: news_items}))\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t});\t\n\t\t}", "function update() {\n\tIPC.sendToHost('api-call', '/daemon/version', 'version');\n\t\n\tupdating = setTimeout(update, 50000);\n}", "function updatePrice(rate, quantity) {\n totalPrice += rate * quantity;\n console.log(totalPrice);\n updateDomPrice();\n }", "function updateHTMLList(){\n shoppingListArray.forEach(function(items) {\n var itemName = document.createElement(\"li\");\n //made items.price into a number with the Number method, then converted it back into a string to add/limit it to 2 decimal places with the toFixed method\n itemName.textContent = items.name + \", $\" + Number(items.price).toFixed(2);\n //adds itemName to div with the id of \"ShoppingList\" by means of the appendChild method\n document.getElementById(\"ShoppingList\").appendChild(itemName);\n itemName.className = \"namedItem\";\n \n });\n}", "function updateItemPrices(itemIds, refreshHist, refreshSupply) {\n if (typeof itemIds === 'undefined') {\n itemIds = listWatchItemId;\n }\n\n if (typeof refreshHist === 'undefined') {\n refreshHist = true;\n }\n if (typeof refreshSupply === 'undefined') {\n refreshSupply = true;\n }\n // note use the ids param\n //defensive\n if (itemIds.length > 0) {\n\n if (refreshHist) {\n queryHistData(itemIds);\n }\n if (refreshSupply) {\n querySupplyData(itemIds);\n }\n\n\n }\n\n}", "function startFresh() {\n prevSymbolList = [];\n for (var i = 0; i < symbolsList.length; i++) {\n prevSymbolList.push(symbolsList[i]);\n }\n symbolsList.splice(0, symbolsList.length);\n\n hideTitleButtons();\n stockList.unselectSymbol();\n hideHoverCard();\n redrawList();\n }", "function addDataServer (b) {\n for (let i = 0; i<price.length; i++){\n x=b;\n y=data.model[x]; \n price[i].innerHTML = y[i]; \n }\n }", "function updateData()\r\n{\r\n if (debug)\r\n {\r\n console.debug(\"updating data...\");\r\n }\r\n Clientraw.retrieveAndParse(clientrawUrl, Clientraw.parseClientraw);\r\n Clientraw.retrieveAndParse(clientrawhourUrl, Clientraw.parseClientrawhour);\r\n Clientraw.retrieveAndParse(clientrawextraUrl, Clientraw.parseClientrawextra);\r\n}", "function updateCurrentPrice(){\r\n shoppingCart.currentPrice = 0;\r\n\r\n // We iterate over shopping cart object keys in order to calculate the current price\r\n Object.keys(shoppingCart).forEach((key) => {\r\n if(key !== 'currentPrice'){\r\n shoppingCart.currentPrice += shoppingCart[key].quantity * shoppingCart[key].price;\r\n }\r\n });\r\n\r\n // We update the value on the HTML and prevent float comma\r\n document.querySelector('.current-price').innerHTML = Math.round(shoppingCart.currentPrice * 100 + Number.EPSILON ) / 100;\r\n}", "function updateInventory() {\n ul_inventoryList.empty();\n let li;\n $(inventory).each(function (index, element) {\n li = $(\"<li>\");\n li.data(\"name\", element[\"name\"]);\n li.html(element[\"name\"] + \": \" + element[\"count\"]);\n ul_inventoryList.append(li);\n });\n }", "function Updatelist(nameItemList) {\n //Get List\n var listInLocal = JSON.parse(localStorage.getItem(nameItemList));\n\n //table body in page\n var tbodyProductInPage = $(\"div.cart-table tbody\");\n\n // Total value in Cart page\n let subTotalOnCartPage = $('p.price');\n //calculate\n var calculate = CalculateItem(listInLocal);\n if (calculate.totalQuanlity === 0) {\n tbodyProductInPage.text(\"\");\n subTotalOnCartPage.text(\"$0.00\");\n } else {\n //Clear table body\n tbodyProductInPage.text(\"\");\n //Add Total value in Cart page\n subTotalOnCartPage.text(\"$\" + calculate.totalValue);\n listInLocal.forEach(function (product) {\n //product:\n //////id: \"1\"\n //////image: \"....\"\n //////currentPrice: ...,\n //////oldPrice: ...,\n //////productName: \"Iphone 7 Plus\"\n //////quantity: 4\n //////total: 1952\n let trProductInPage = `\n <tr productid=` + product.id + ` >\n <td class=\"image\">\n <img src=` + window.location.origin + `/` + product.image + ` alt=\"\">\n </td>\n <td class=\"product\">\n <a href=\"shopsingle/`+ product.id + `\">` + product.productName + `</a>\n <!-- <span>white</span>-->\n </td>\n <td class=\"price\">\n <span class=\"amount\">$` + product.currentPrice + `</span>\n </td>\n <td class=\"quantity\">\n <form action=\"#\">\n <div class=\"quantity d-inline-flex\">\n <button type=\"button\" class=\"sub\"><i class=\"ti-minus\"></i></button>\n <input max=` + product.maxQuantity + `\n currentPrice=` + product.currentPrice + `\n type=\"text\" value=` + product.quantity + ` />\n <button type=\"button\" class=\"add\"><i class=\"ti-plus\"></i></button>\n </div>\n </form>\n </td>\n <td class=\"total\">\n <span class=\"total-amount\">$` + product.total + `</span>\n </td>\n <td class=\"remove\">\n <a><i productid=` + product.id + ` class=\"ti-close\"></i></a>\n </td>\n </tr>`;\n\n tbodyProductInPage.append(trProductInPage);\n });\n }\n}", "function updateTopRated(time, list) {\n\tconst index = _closestHour(time)\n\tdb[index] = list\n}", "function updateShopList(){\r\n container.innerHTML = '';\r\n shopStorage.forEach(function(shop) {\r\n container.append(shopElement(shop));\r\n });\r\n addBtnListener(productsBtnclassName, function(index){\r\n productsList(shopStorage[index], map);\r\n });\r\n addBtnListener(editBtnclassName, function(index){\r\n editShop(index);\r\n });\r\n map.geoObjects.removeAll();\r\n for(var i = 0; i < shopStorage.length; i++){\r\n var cor = shopStorage[i].coords;\r\n var cont = '<b>' + shopStorage[i].name + '</b>' + '<br>' + shopStorage[i].wHours;\r\n map.geoObjects.add(new ymaps.Placemark(cor, {\r\n balloonContent: cont\r\n }, {\r\n preset: 'twirl#violetIcon'\r\n }));\r\n }\r\n addBtnListener(showOnMapBtnClass, function(index){\r\n map.balloon.open(shopStorage[index].coords, {\r\n contentHeader: shopStorage[index].name,\r\n contentBody: shopStorage[index].address,\r\n contentFooter: '<sup>' + shopStorage[index].wHours + '</sup>'\r\n });\r\n });\r\n addBtnListener(removeBtnclassName, function(index, id){\r\n for(var i = 0; i < shopStorage.length; i++){\r\n if(shopStorage[i].id == id){\r\n shopStorage.splice(i, 1);\r\n }\r\n }\r\n updateShopList();\r\n });\r\n }", "function updateData() {\n // Scrape TopX volume pairs from CoinMarketCap\n if(checkVolume) {\n request(cmcExchanges,(error,response,html)=>{\n var $ = cheerio.load(html)\n $('#markets > div.table-responsive > table > tbody > tr > td > a').each((i,element)=>{\n var omg = $(element).attr('href')\n if(Exchange == 'bittrex') {\n if(omg.match(/MarketName/i)) {\n var pair = omg.replace(\"https://bittrex.com/Market/Index?MarketName=\",\"\")\n if (pair.match(/^(BTC-)/i)) {\n pairs.push(pair)\n }\n }\n } else if(Exchange == 'poloniex') {\n if(omg.match(/exchange/i)) {\n var pair = omg.replace(\"https://poloniex.com/exchange/#\",\"\")\n if (pair.match(/^(btc_)/i)) {\n pairs.push(pair)\n }\n }\n }\n });\n setTimeout(buildPairs, 3000)\n });\n }\n if(checkTrend) {\n request('https://api.coinmarketcap.com/v1/ticker/?limit='+checkCoins, { json: true }, (err, res, body) => {\n if (err) { return console.log(err); }\n if (trendTime==\"1h\") var average = _.meanBy(body, (b) => parseInt(b.percent_change_1h))\n if (trendTime==\"24h\") var average = _.meanBy(body, (b) => parseInt(b.percent_change_24h))\n if (trendTime==\"7d\") var average = _.meanBy(body, (b) => parseInt(b.percent_change_7d))\n console.log(\"Top \"+checkCoins+\" Coins Trend (\"+trendTime+\"): \" + average + \"%\")\n });\n }\n}", "function handleWatchListUpdate(changes){\n changes.forEach(function(change){ \n var newObject = change.object;\n $('#numbOfProducts').text(newObject.length())\n newObject.showTo('#product-watchlist', startNumProd, finishNumProd);\n });\n }", "function refreshComponentPrice() {\n\t\tconst selectPackages = pricingWrapper.find('.row-component .select-package:enabled');\n\t\tselectPackages.each(function (index, selectPackage) {\n\t\t\tif ($(selectPackage).val()) {\n\t\t\t\t$(selectPackage).trigger('change');\n\t\t\t}\n\t\t});\n\t}", "function update(i){\n mainIndex = i;\n itemName.value = productslist[i].productName;\n itemCategory.value = productslist[i].productCategory;\n itemPrice.value = productslist[i].productPrice;\n itemDescription.value = productslist[i].productDescription;\n document.getElementById('change').innerHTML = 'update product';\n console.log(productslist);\n // localStorage.setItem(\"item\" , JSON.stringify(productslist));\n \n }", "function update(){\n\tif(!paused){\n\t\tif (!countdown){ // a minute has passed if the countdown is zero\n\t\t\tmin_elapsed++; \n\t\t\tcountdown = interval;\n\t\t\tdrinkNow(); // Tell the user it's time to drink.\n\t\t\tif(external_uri != null) extCall(); // If needed, make the external call\n\t\t\t$('player').nextVideo(); // Load the next video in the playlist.\n\t\t}\n\t\telse{\n\t\t\tcountdown--;\n\t\t}\n\t}\n\tif(!paused) sec_elapsed++;\n\tupdateUI(); // Show the new data\n\t//console.log(countdown);\n}", "function refresh () {\n // If the ticker is not running already...\n if (ticker === 0) {\n // Let's create a new one!\n ticker = self.setInterval(render, Math.round(1000 / 60));\n }\n }", "function init() {\n\n $.ajax({\n\n url:'https://www.discogs.com/sell/post/' + releaseId,\n\n type: 'GET',\n\n dataType: 'html',\n\n success: function(response) {\n\n // Clear out old prices if they exist\n $('.de-price').remove();\n\n // Reset our values\n items = $('.shortcut_navigable .item_description .item_condition span.item_media_condition');\n\n priceContainer = [];\n\n prices = $('td.item_price span.price');\n\n result = $(response);\n\n nodeId = resourceLibrary.findNode(result);\n\n priceKey = resourceLibrary.prepareObj( $(result[nodeId]).prop('outerHTML') );\n\n return checkForSellerPermissions();\n }\n });\n }", "function displayPrices() {\r\n\t\t$(\".backpack_hint\").remove();\r\n\r\n\t\t$(\".item[data-hash]\").each(function() {\r\n\t\t\tvar element = $(this);\r\n\r\n\t\t\tvar hash = element.attr(\"data-hash\").split(\",\");\r\n\t\t\tvar game = parseInt(hash[0]) || TF2,\r\n\t\t\t id = parseInt(hash[1]),\r\n\t\t\t quality = parseInt(hash[2]) || UNIQUE;\r\n\r\n\t\t\tif (game != TF2)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tif (-1 != IGNORED.indexOf(id))\r\n\t\t\t\treturn;\r\n\t\t\t\r\n\t\t\tid = IDs[id] || id;\t// substitute some ids\r\n\r\n\t\t\tif (element.hasClass(\"uncraftable\"))\r\n\t\t\t\tquality *= 100;\t// that's just an assumption actually\r\n\r\n\t\t\tvar index = 0; // crate number, unusual effect, etc\r\n\r\n\t\t\t// trying to guess the effect\r\n\t\t\tif (quality == UNUSUAL) {\r\n\t\t\t\tvar m = element.css(\"background-image\").match(/(\\d+)\\.png/);\r\n\t\t\t\tif (m)\r\n\t\t\t\t\tindex = parseInt(m[1]);\r\n\t\t\t}\r\n\r\n\t\t\t// and the crate series\r\n\t\t\tif (id == CRATE) {\r\n\t\t\t\tvar m = element.find(\".series_no\").text().match(/#(\\d+)/);\r\n\t\t\t\tif(m)\r\n\t\t\t\t\tindex = parseInt(m[1]);\r\n\t\t\t}\r\n\r\n\t\t\tindex = index || 0;\r\n\t\t\ttry {\r\n\t\t\t\tvar price = prices[id][quality][index][\"current\"];\r\n\t\t\t}\r\n\t\t\tcatch(e) {\r\n\t\t\t\tconsole.log(\"failed to find the price for this item:\", this);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tvar text = price[\"value\"];\r\n\t\t\tif (price[\"value_high\"])\r\n\t\t\t\ttext += \" - \" + price[\"value_high\"]\r\n\t\t\ttext += \" \" + price[\"currency\"];\r\n\t\t\tvar hint = $(\"<span>\").addClass(\"backpack_hint\");\r\n\t\t\thint.text(text).attr(\"title\", \"Updated on \" + (new Date(price[\"date\"]*100)).toLocaleString());\r\n\r\n\t\t\telement.append(hint);\r\n\t\t});\r\n\t}", "function update_drop_points(ts) {\n var _ts = Date.now()/1000;\n $.ajax({\n type: \"POST\",\n url: apiurl,\n data: {\n action: \"dp_json\",\n ts: ts\n },\n dataType: \"json\",\n success: function (response) {\n $.extend(true, drop_points, response);\n for (var num in response) {\n refresh_drop_point(num);\n }\n },\n complete: function () {\n setTimeout(function() {\n update_drop_points(_ts);\n }, 120000);\n }\n });\n}" ]
[ "0.7307868", "0.64702463", "0.6402777", "0.62135404", "0.62065053", "0.6164375", "0.61307764", "0.6121152", "0.6081048", "0.5989167", "0.59852165", "0.5848833", "0.58231443", "0.58098286", "0.58058566", "0.5803177", "0.57836413", "0.5733865", "0.57153267", "0.5691173", "0.56907624", "0.56840664", "0.5679008", "0.5639791", "0.56349325", "0.5633339", "0.56312174", "0.56291795", "0.56261384", "0.5617517", "0.5598243", "0.5587258", "0.55841", "0.5579645", "0.5572978", "0.55683243", "0.5555704", "0.55526716", "0.5539115", "0.5522879", "0.5482137", "0.54663813", "0.5442474", "0.5433553", "0.5429983", "0.54208994", "0.5413747", "0.5410854", "0.539551", "0.5378354", "0.5372228", "0.53692675", "0.5364436", "0.53630215", "0.536247", "0.53617024", "0.5360225", "0.53553396", "0.5355073", "0.53458863", "0.5342985", "0.5336464", "0.53296345", "0.5326085", "0.53228575", "0.5316057", "0.53083235", "0.53082687", "0.5306509", "0.5306213", "0.53053737", "0.53005546", "0.5299393", "0.5299288", "0.5294488", "0.52919966", "0.5289795", "0.5287164", "0.52817726", "0.5279134", "0.52715117", "0.52663577", "0.52618676", "0.5258539", "0.52556777", "0.5247765", "0.5245055", "0.524289", "0.5242348", "0.52346015", "0.52337676", "0.52305317", "0.5227617", "0.5227328", "0.522514", "0.5222643", "0.52206135", "0.52184653", "0.52171063", "0.5216884" ]
0.7446579
0
Return performance numbers from each sorting algorithm
function _prepareBenchmarking(algorithm) { var sort = algorithms[algorithm]; return function sortAndBenchmark(array) { var startTime = _now(); stats.sort = algorithm; stats.runtime = 0; stats.comparisons = 0; stats.swaps = 0; _array = array; sort(_array); _array = []; stats.runtime = _now() - startTime; return stats; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sort() {}", "async function TopologicalSort(){}", "StopwatchSearchAndSort(arr) {\n\n //binary search\n\n var start = this.stopwatchmill()\n var temp = this.sortarrayInt(arr)\n var stop = this.stopwatchmill()\n var totaltime1 = stop - start;\n console.log(\"Binary Search take \" + totaltime1 + \" millsecond to exicute the code\");\n console.log();\n\n\n //bubble Sort\n var start = this.stopwatchmill()\n var temp = this.bubbleSortInt(arr)\n var stop = this.stopwatchmill()\n var totaltime2 = stop - start;\n console.log(\"Bubble Sort take \" + totaltime2 + \" millsecond to exicute the code\");\n console.log();\n\n\n\n\n //insertion sort\n\n var start = this.stopwatchmill()\n var temp = this.insertionSortInt(arr)\n var stop = this.stopwatchmill()\n var totaltime3 = stop - start;\n console.log(\"Insertion Sort take \" + totaltime3 + \" millsecond to exicutethe code\");\n\n\n\n\n}", "function numSort(a,b) { \n\t\t\t\treturn a - b; \n\t\t\t}", "function testSorts()\n{\n\n\tconsole.log(\"============= original googleResults =============\");\n\tconsole.log(googleResults);\n\t\n\tconsole.log(\"==== before sort array element index name rating ====\");\n\t\n\tgoogleResults.forEach(function(element,index)\n\t{\n\t\t console.log(index + \": name: \" + element.name + \" rating: \" + element.rating);\n\n\t});\n\n\t\t// commented for testing\n\t\t//googleResults.sortByRatingAscending();\n\t\t\n\t\t// commented for testing\n\t\tgoogleResults.sortByRatingDescending();\n\t\t\n\t//===============================================================\t\n\n\tconsole.log(\"============= after sort =============\");\n\n\tgoogleResults.forEach(function(element,index)\n\t{\n\t\t console.log(index + \": name: \" + element.name + \" rating: \" + element.rating);\n\n\t});\n\t\n}//END test", "function numsort(a, b) {return (a - b);}", "sort() {\n\t}", "sort() {\n\t}", "async function sort() {\n sortingProgram = new SortingProgram({\n arr: values,\n states: states,\n delay: getDelay()\n });\n $(\"#alg-runtime\").text(\"running...\");\n await sortingProgram.runSort(sortingStrategy);\n}", "sortRankStats(ranks){\n const sortedRanks = ranks.sort(this.pointsCompare);\n return sortedRanks;\n }", "function timSort(){\n console.log(\"WORK IN PROGRESS\");\n let run = 32;\n\n for(let i = 0; i < values.length; i += run) {\n insertionSort(i, Math.min((i+31), (values.length-1)));\n }\n\n for(let size = run; size < values.length; size = 2 * size) {\n for(let left = 0; left < values.length; left += 2 * size) {\n let mid = left + size -1;\n let right = Math.min((left + 2 * size - 1), (values.length - 1));\n merge(values, left, mid, right)\n }\n }\n}", "function sortResults(results) {\n results.sort(compareResultScores);\n}", "function numsort(a, b) {\n return b - a;\n }", "function Numsort(a,b) { return a - b; }", "function numsort(a, b) {\n return b - a;\n }", "function numSort(a, b) {\n return a - b;\n }", "function numSort(a, b) {\n return a - b;\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 runTest(sortfcn, data, repeats, data_name) {\n function check(xs) {\n for(let i = 1; i < xs.length; i += 1) {\n if(xs[i] < xs[i-1]) {\n throw 'failed';\n }\n }\n }\n\n function setup() {\n return data.slice();\n }\n\n log('running function: ' + sortfcn.name);\n let mean;\n try {\n const stats = time(sortfcn, repeats, setup, check);\n mean = stats.mean;\n } catch(error) {\n console.error(error);\n log(\"FAILURE\");\n mean = NaN;\n }\n add_row(table, [sortfcn.name, data_name, mean.toFixed(3)], \"td\");\n}", "sort() {\n let a = this.array;\n const step = 1;\n let compares = 0;\n for (let i = 0; i < a.length; i++) {\n let tmp = a[i];\n for (var j = i; j >= step; j -= step) {\n this.store(step, i, j, tmp, compares);\n compares++;\n if (a[j - step] > tmp) {\n a[j] = a[j - step];\n this.store(step, i, j, tmp, compares);\n } else {\n break;\n }\n }\n a[j] = tmp;\n this.store(step, i, j, tmp, compares);\n }\n this.array = a;\n }", "function histSorter(a,b) {\n if (a.outcome > b.outcome) { return 1; }\n else if (a.outcome < b.outcome) { return -1; }\n else if (a.trial > b.trial) { return 1; }\n else if (a.trial < b.trial) { return -1 }\n else { return 0; }\n }", "function insertion_sort(arr) {\r\n var start_time = performance.now();\r\n sorted = arr;\r\n\r\n for(var i = 1;i<sorted.length;i++){\r\n for(var y = 0; y<i; y++){\r\n if(sorted[i] < sorted[y]){\r\n temp = sorted[y];\r\n sorted[y] = arr[i];\r\n arr[i] = temp;\r\n }\r\n }\r\n }\r\n var finish_time = performance.now();\r\n var execution_time = finish_time - start_time;\r\n document.getElementById(\"time_spent\").innerHTML = execution_time;\r\n return sorted;\r\n}", "bubbleSort(arr){\n var starttime = process.hrtime();\n for (let i = 0; i < arr.length; i++) {\n for (let j = 0; j < arr.length; j++) {\n if(arr[j]>arr[j+1]){\n var temp;\n temp=arr[j];\n arr[j]=arr[j+1];\n arr[j+1]=temp;\n }\n }\n }\n var endtime = process.hrtime();\n var et = this.elapsedTime(starttime, endtime);\n console.log('Elapsed time for bubble sort is : '+et, 'milisecod');\n \n return arr;\n }", "testSortingAlgorithms() {\n for (let i = 0; i < 100; i++) {\n const array = [];\n const length = randomIntBetween(1, 1000);\n for (let i = 0; i < length; i++) {\n array.push(randomIntBetween(-1000, 1000));\n }\n const javaScriptSortedArray = array.slice().sort((a, b) => a - b);\n const ourSortedArray = heapSortAnimations(array.slice(), 0, array.length - 1);\n const equal = arraysAreEqual(javaScriptSortedArray, ourSortedArray);\n console.log(equal);\n // if(equal === true) {\n // console.log(equal);\n // }\n // else {\n // console.log(javaScriptSortedArray, ourSortedArray);\n // }\n }\n }", "sort() {\n let time = 0;\n this.toggleSortButton(time);\n\n switch (this.state.currSelection) {\n case MERGESORT:\n time = this.mergeSort();\n break;\n case QUICKSORT:\n time = this.quickSort();\n break;\n case HEAPSORT:\n time = this.heapSort();\n break;\n case BUBBLESORT:\n time = this.bubbleSort();\n break;\n default:\n break;\n }\n\n this.toggleSortButton(time);\n }", "function sortRanks(){\n\tvar temp = ranking;\n\tvar initValue = 4.2;\n\t for (var j = 0; j < 32; j++){\n\t\tvar index = 0;\n\t\tvar value = 10000;\n\t\tfor (var i = 0; i < temp.length; i++) {\n\t\t\tif (temp[i] < value) {\n\t\t\t\tvalue = temp[i];\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t}\n\t\ttemp[index] = 100000; //max out so won't pick this team again\n\t\tsortedTeams[j] = index;\n\t\tscaleVals[j] = initValue; //set scale value based on rank\n\t\tinitValue -= .1;\n\t }\n}", "sort() {\n const a = this.dict;\n const n = a.length;\n\n if( n < 2 ) { // eslint-disable-line \n } else if( n < 100 ) {\n // insertion sort\n for( let i = 1; i < n; i += 1 ) {\n const item = a[ i ];\n let j = i - 1;\n while( j >= 0 && item[ 0 ] < a[ j ][ 0 ] ) {\n a[ j + 1 ] = a[ j ];\n j -= 1;\n }\n a[ j + 1 ] = item;\n }\n } else {\n /**\n * Bottom-up iterative merge sort\n */\n for( let c = 1; c <= n - 1; c = 2 * c ) {\n for( let l = 0; l < n - 1; l += 2 * c ) {\n const m = l + c - 1;\n const r = Math.min( l + 2 * c - 1, n - 1 );\n if( m > r ) continue;\n merge( a, l, m, r );\n }\n }\n }\n }", "function slow_sort(arr) {\n\tamb(test_arr, permutations(arr));\n\tconsole.log(\"this is test_arr \" + test_arr);\n\tassert(sorted(test_arr));\n\treturn test_arr;\n}", "visualizeMergeSort() {\n console.log(\"Merge Sort\");\n const array = this.state.array;\n array.forEach((element) => {\n element.visited = false; // if already sorted and clicked the sort function again... we just need to reset the visited flags\n });\n var start = performance.now();\n this.mergeSort(array, 0, array.length - 1);\n console.log(performance.now() - start);\n }", "function sortByProb(recomms){\n sortedMusic = [];\n sortedBooks = [];\n sortedPlaces = [];\n sortedMovies = [];\n sortedShows = [];\n //music\n for(var i=1; i<recomms.music.length; i++){\n for(var j=0; j<recomms.music.length-i; j++){\n if(recomms.music[j].pr < recomms.music[j+1].pr){\n var aux = recomms.music[j];\n recomms.music[j] = recomms.music[j+1];\n recomms.music[j+1] = aux;\n }\n }\n }\n for(var i=0; i<recomms.music.length; i++){\n sortedMusic.push(recomms.music[i].track);\n }\n //books\n for(var i=1; i<recomms.books.length; i++){\n for(var j=0; j<recomms.books.length-i; j++){\n if(recomms.books[j].pr < recomms.books[j+1].pr){\n var aux = recomms.books[j];\n recomms.books[j] = recomms.books[j+1];\n recomms.books[j+1] = aux;\n }\n }\n }\n for(var i=0; i<recomms.books.length; i++){\n sortedBooks.push(recomms.books[i].book);\n }\n //places\n for(var i=1; i<recomms.places.length; i++){\n for(var j=0; j<recomms.places.length-i; j++){\n if(recomms.places[j].pr < recomms.places[j+1].pr){\n var aux = recomms.places[j];\n recomms.places[j] = recomms.places[j+1];\n recomms.places[j+1] = aux;\n }\n }\n }\n for(var i=0; i<recomms.places.length; i++){\n sortedPlaces.push(recomms.places[i].place);\n }\n //movies\n for(var i=1; i<recomms.movies.length; i++){\n for(var j=0; j<recomms.movies.length-i; j++){\n if(recomms.movies[j].pr < recomms.movies[j+1].pr){\n var aux = recomms.movies[j];\n recomms.movies[j] = recomms.movies[j+1];\n recomms.movies[j+1] = aux;\n }\n }\n }\n for(var i=0; i<recomms.movies.length; i++){\n sortedMovies.push(recomms.movies[i].movie);\n }\n //shows\n for(var i=1; i<recomms.shows.length; i++){\n for(var j=0; j<recomms.shows.length-i; j++){\n if(recomms.shows[j].pr < recomms.shows[j+1].pr){\n var aux = recomms.shows[j];\n recomms.shows[j] = recomms.shows[j+1];\n recomms.shows[j+1] = aux;\n }\n }\n }\n for(var i=0; i<recomms.shows.length; i++){\n sortedShows.push(recomms.shows[i].show);\n }\n\n var rec = {\n music: sortedMusic,\n books: sortedBooks,\n movies: sortedMovies,\n shows: sortedShows,\n places: sortedPlaces\n }\n return rec;\n}", "function numberSortFunction(a, b) {\n return a - b;\n}", "function sort(results){\r\n var swap=0;\r\n var view = new Array();\r\n for(var i=0; i<results.length; i++){\r\n view.push(data[results[i]].views);\r\n }\r\n for(var i=results.length-1; i>0; i--){\r\n for(var j=0; j<i; j++){\r\n if(view[j]<view[j+1]){\r\n var temp = results[j];\r\n results[j] = results[j+1];\r\n results[j+1] = temp;\r\n temp = view[j];\r\n view[j] = view[j+1];\r\n view[j+1]=temp;\r\n swap = 1; \r\n }\r\n }\r\n if(swap == 0){break;}\r\n } \r\n}", "sort(){\n\n }", "function sort() {\n renderContent(numArray.sort());\n}", "Sort() {\n\n }", "function sorter(a,b) {\n return a - b;\n}", "function ComparisonSort(e,t,n){this.init(e,t,n)}", "sortedRankings ({ rankings, sortBy }) {\n const { field, order } = sortBy\n const sortComparator = (a, b) => {\n if (order === 'asc') {\n return a.stats[field] - b.stats[field]\n }\n return b.stats[field] - a.stats[field]\n }\n return rankings.sort(sortComparator)\n }", "verbose(n, collection, collection2){\n var keys = [];\n for(var i = 0; i < collection.length; i ++){\n var name = (i < 12) ? this.rootName[i] : this.rootName[i%12] + \"m\";\n keys.push({\n name: name\n , score: Math.round(collection[i])\n , growth: Math.round(collection2[i])\n , sum: Math.round(collection[i]) + Math.round(collection2[i]) });\n }\n return keys.sort( (a,b) => a.sum > b.sum ? -1 : 1 ).slice(0,n);\n }", "get results() {\n\t\t\t// Remember the comparator function? This is the same one, we're going to use it in the same way.\n\t\t\tlet comparatorFunc = (arr1, arr2) => {\n\t\t\t\tif (arr1[1] === arr2[1]) {\n\t\t\t\t\tif (arr1[0] < arr2[0]) return -1;\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\treturn arr2[1] - arr1[1];\n\t\t\t};\n\n\t\t\t// Let's perform the same operation we did in the first solution, but this time within a class, acting on the memState object it contains.\n\t\t\treturn Object.entries(this.memState).sort(comparatorFunc);\n\t\t}", "function sortSwitchPlanner(tab_id, rewritten) {\n var asset_host_list = [];\n if (typeof switchPlannerInfo[tab_id] === 'undefined' ||\n typeof switchPlannerInfo[tab_id][rewritten] === 'undefined') {\n return [];\n }\n var tabInfo = switchPlannerInfo[tab_id][rewritten];\n for (var asset_host in tabInfo) {\n var ah = tabInfo[asset_host];\n var activeCount = objSize(ah[1]);\n var passiveCount = objSize(ah[0]);\n var score = activeCount * 100 + passiveCount;\n asset_host_list.push([score, activeCount, passiveCount, asset_host]);\n }\n asset_host_list.sort(function(a,b){return a[0]-b[0];});\n return asset_host_list;\n}", "getSortArray() {\n const sortable = []; // {\"1\": 10, \"49\": 5}\n for (const key in this.numberPool) \n sortable.push([Number(key), this.numberPool[key]]);\n \n sortable.sort((a, b) => b[1] - a[1]); // Descending\n return sortable;\n }", "sort () {\n\n\t\tthis.Dudes.sort((a, b) => {\n\t\t\treturn b.amIToughEnough(this.fitnessFunction) - a.amIToughEnough(this.fitnessFunction);\n\t\t});\n\n\t}", "function twpro_sortJobs(){\r\n\t\tif (TWPro.twpro_failure) return;\r\n\t\tvar sortby = TWPro.twpro_jobsort, twpro_jobValues = TWPro.twpro_jobValues;\r\n\t\tvar sortfunc = function(twpro_a, twpro_b){\r\n\t\t\tvar twpro_a_str = twpro_a.name,\r\n\t\t\t\ttwpro_b_str = twpro_b.name;\r\n\t\t\tif(sortby == 'name'){\r\n\t\t\t\treturn twpro_a_str.localeCompare(twpro_b_str);\r\n\t\t\t}\r\n\t\t\tif(sortby == 'comb'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].jobrank == twpro_jobValues[twpro_b.shortName].jobrank) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].jobrank - twpro_jobValues[twpro_a.shortName].jobrank);\r\n\t\t\t}\r\n\t\t\tif(sortby == 'erfahrung'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].experience == twpro_jobValues[twpro_b.shortName].experience) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].experience - twpro_jobValues[twpro_a.shortName].experience);\r\n\t\t\t} if(sortby == 'lohn'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].wages == twpro_jobValues[twpro_b.shortName].wages) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].wages - twpro_jobValues[twpro_a.shortName].wages);\r\n\t\t\t} if(sortby == 'glueck'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].luckvaluemax == twpro_jobValues[twpro_b.shortName].luckvaluemax) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName].luckvaluemax - twpro_jobValues[twpro_a.shortName].luckvaluemax);\r\n\t\t\t} if(sortby == 'gefahr'){\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName].danger == twpro_jobValues[twpro_b.shortName].danger) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_a.shortName].danger - twpro_jobValues[twpro_b.shortName].danger);\r\n\t\t\t} else {\r\n\t\t\t\treturn (twpro_jobValues[twpro_a.shortName][sortby] == twpro_jobValues[twpro_b.shortName][sortby]) ? twpro_a_str.localeCompare(twpro_b_str) : (twpro_jobValues[twpro_b.shortName][sortby] - twpro_jobValues[twpro_a.shortName][sortby]);\r\n\t\t\t}\r\n\t\t}\r\n\t\tTWPro.twpro_jobs.sort(sortfunc);\r\n\t\t//if(sortby == 'danger') TWPro.twpro_jobs.reverse();\r\n\t}", "function sort() {\n if (!active) {\n active = true;\n switch (sortingAlgo) {\n case algorithms.BUBBLE:\n console.log(\"Bubble sort\");\n bubbleSort();\n break;\n \n case algorithms.SELECTION:\n console.log(\"Selection sort\");\n selectionSort();\n break;\n\n case algorithms.INSERTION:\n console.log(\"Insertion sort\");\n insertionSort();\n break;\n\n case algorithms.QUICK:\n console.log(\"Quicksort\");\n quickSort();\n break; \n \n case algorithms.MERGE:\n console.log(\"Mergesort\");\n mergeSort();\n break;\n\n case algorithms.HEAP:\n console.log(\"Heapsort\");\n heapSort();\n break;\n\n default:\n alert(\"This algorithm not implemented yet.\\nPlease try another one.\");\n break;\n }\n }\n}", "sortNumber(a, b) {\n return a - b;\n }", "function task14_16_10(){\n var scores =[320,230,480,120];\n document.write(\"Scores of Students : \"+scores + \"<br>\");\n scores.sort();\n document.write(\"Ordered Score of Students : \"+scores);\n}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "function sortFunction( a, b ) {\n\n\t\t\treturn a - b;\n\n\t\t}", "sort() {\r\n\t\treturn this.data.sort((a,b) => {\r\n\t\t\tfor(var i=0; i < this.definition.length; i++) {\r\n\t\t\t\tconst [code, key] = this.definition[i];\r\n\t\t\t\tswitch(code) {\r\n\t\t\t\t\tcase 'asc':\r\n\t\t\t\t\tcase 'desc':\r\n\t\t\t\t\t\tif (a[key] > b[key])\r\n\t\t\t\t\t\t\treturn code == 'asc' ? 1 : -1;\r\n\t\t\t\t\t\tif (a[key] < b[key])\r\n\t\t\t\t\t\t\treturn code == 'asc' ? -1 : 1;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'fn':\r\n\t\t\t\t\t\tlet result = key(a, b);\r\n\t\t\t\t\t\tif (result != 0) // If it's zero the sort wasn't decided.\r\n\t\t\t\t\t\t\treturn result;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t});\r\n\t}", "function SortDistributionsByRank(){\n\tdistros.sort(Sort);\n\tvar lastPlace = 1;\n\tfor (var i = 1; i < distros.length;i++){\n\t\tdistros[i].Place = 1;\n\t\tif (distros[i].ChoosedBy == distros[i-1].ChoosedBy)\n\t\t\tdistros[i].Place = lastPlace;\n\t\telse\n\t\t\tdistros[i].Place = ++lastPlace;\n\t}\n}", "sort(){\n\t\tvar sortable = [];\n\t\tfor (var vehicle in this.primes) {\n\t\t sortable.push([vehicle, this.primes[vehicle]]);\n\t\t}\n\t\treturn sortable.sort(function(a, b) {\n\t\t return a[1] - b[1];\n\t\t});\n\t}", "sort() {\n this.genePool.sort(function (a, b) {\n return (a.cost - b.cost);\n });\n }", "function sortNumbers(a,b) {\nreturn (a-b);\n}", "function solution(A) {\n // write your code in JavaScript (ECMA-262, 5th edition)\n function compareNumbers(a, b)\n {\n return a - b;\n }\n var rad = [], sorted = A.splice(0).sort(compareNumbers);\n for(var i=0; i<A.length; A++){\n \n }\n \n return 11 > 10000000 ? -1 : 11;\n}", "function shitAnalysis() {\n // I used this array of objects to render this sort buttons\n const sortButtons = [\n {\n text: \"Decide my Shit\",\n value: \"decide\"\n }, \n {\n text: \"My Urgent Shit\",\n value: \"urgent\"\n }, \n {\n text: \"My Effective Shit\",\n value: \"effect\"\n }, \n {\n text: \"My Dangerous Shit\",\n value: \"danger\"\n }, \n {\n text: \"My Costly Shit\",\n value: \"cost\"\n }, \n {\n text: \"My Unhealthy Shit\",\n value: \"health\"\n }\n ];\n\n \n display.html(\"<h1>Let's Sort Out Your Shit...</h1>\");\n listDiv.empty();\n resultDiv.empty();\n \n for (var i = 0; i < sortButtons.length; i++) {\n var button = $(\"<button>\");\n button.text(sortButtons[i].text);\n button.attr(\"value\", \"c-button\");\n button.attr(\"value\", sortButtons[i].value);\n sortButtonDiv.append(button);\n }\n display.append(sortButtonDiv);\n display.append(resultDiv);\n\n display.fadeIn();\n \n $(\"button\").on(\"click\", function() {\n switch(this.value) {\n case \"decide\":\n shitList.sort((a, b) => a.rating - b.rating);\n resHeader.text(\"You Should Probably Take Care of this Shit First...\");\n break;\n case \"urgent\":\n shitList.sort((a, b) => a.urgency - b.urgency);\n resHeader.text(\"Your most Urgent...\");\n break;\n case \"effect\":\n shitList.sort((a, b) => a.effect - b.effect);\n resHeader.text(\"Your most Life Effect...\");\n break;\n case \"danger\":\n shitList.sort((a, b) => a.danger - b.danger);\n resHeader.text(\"Your most Dangerous...\");\n break;\n case \"cost\":\n shitList.sort((a, b) => a.cost - b.cost);\n resHeader.text(\"Your most Costly...\");\n break;\n case \"health\":\n shitList.sort((a, b) => a.health - b.health);\n resHeader.text(\"Your most Unhealthy...\");\n break;\n }\n display.fadeOut(sortList);\n });\n\n}", "function sorter(a, b) {\n var diff = concordance.getCount(b) - concordance.getCount(a);\n return diff;\n }", "function sortResults() {\n results.sort(compareTwoRegions);\n}", "function sortData(data)\n\t{\n\t\tfor (let i = 0; i < data.length; i++)\n \t{\n\t \tfor (let j = 0; j < data.length - i - 1; j++)\n\t \t{\n\t \t\tif (+data[j].subCount < +data[j + 1].subCount)\n\t \t\t{\n\t \t\t\tlet tmp = data[j];\n\t \t\t\tdata[j] = data[j + 1];\n\t \t\t\tdata[j + 1] = tmp;\n\t \t\t}\n\t \t}\n \t}\n \treturn data;\n\t}", "function sortNumberStudent(a,b) {\n\treturn(a-b)\n}", "function sorter(a, b) {\n var diff = concordance.getCount(b) - concordance.getCount(a);\n return diff;\n }", "function mergesort2(){\n console.log(\"mergesort - implement me !\");\n let a = new Array({dist:59},{dist:57},{dist:52},{dist:50},{dist:58},{dist:55},{dist:1},{dist:25},{dist:18},{dist:20})\n let profondeur = 1;\n ms2(csvData,profondeur,false); \n console.log(csvData);\n setupDisplay();\n //console.log(a);\n}", "function findSort(){\n if(!started){\n startSort();\n }\n\n if(done)\n return;\n\n randomizeButton.disabled = true;\n\n let decision = sortSelector.value;\n switch(decision){\n case \"Selection\":\n selectionSort();\n break;\n case \"Quick\":\n quicksort();\n break;\n case \"Bubble\":\n bubblesort();\n break;\n case \"Insertion\":\n insertionSort();\n break;\n case \"Merge\":\n mergeSort();\n break;\n case \"Heap\":\n heapSort();\n break;\n case \"Bogo\":\n bogoSort();\n break;\n }\n\n \n}", "function sortNumbersAscending(a, b) {\n\t return a - b;\n\t}", "function sortFunc() {\n return 0.5 - Math.random();\n}", "function sortFunction ( a, b ) { \n\t\t if (a[0] - b[0] != 0) {\n\t\t return (a[0] - b[0]);\n\t\t } else if (a[1] - b[1] != 0) { \n\t\t return (a[1] - b[1]);\n\t\t } else { \n\t\t return (a[2] - b[2]);\n\t\t }\n\t\t }", "function initSort() {\n table1.style.display = \"block\"\n table1.style.margin = \"auto\"\n for (let i = 0; i < 6; i++) {\n var t = Number(table.rows[0].cells[i].children[0].value);\n t = t || 1;\n\n var x = new key(t);\n\n arr[i] = x\n // x.rows[0].cells[i].children[0].disabled = true;\n }\n console.log(arr);\n let n = arr.length;\n if (arr.length > 1) {\n try {\n\n setup(500);\n\n setRelations();\n\n // changeButtonVisibility();\n sorting = true;\n\n last = arr[arr.length - 1].y;\n // timer that calls the heapSort function every 500 milSec. \n startTimer = setInterval(function () { heapSort(); }, milSec);\n\n } catch (error) {\n alert(error + \"\\n\" + error.stack);\n }\n }\n}", "function sortScore(a, b) {\n return b.score - a.score;\n }", "function sortSpeed(fleetData) {\n for (let i = 0; i < fleetData._listOfPlanes.length; i++) {\n // Assume min value is current value by defining minIndex as curret index\n let minIndex = i;\n // Loop through all elements after index i\n for (let j = i + 1; j < fleetData._listOfPlanes.length; j++) {\n // If next item is larger than item being checked, define new minIndex\n if (fleetData._listOfPlanes[j]._avgSpeed <\n fleetData._listOfPlanes[minIndex]._avgSpeed) {\n minIndex = j;\n }\n }\n // If minIndex has been changed location of values in array\n if (minIndex !== i ) {\n let temp = fleetData._listOfPlanes[i];\n fleetData._listOfPlanes[i] = fleetData._listOfPlanes[minIndex];\n fleetData._listOfPlanes[minIndex] = temp;\n }\n }\n return fleetData._listOfPlanes;\n}", "shellsortDynamic() {\n const N = this.dataStore.length;\n let h = 1;\n\n while (h < N/3) {\n h = 3 * h + 1;\n }\n\n while (h >= 1) {\n for (let i = h; i < N; i++) {\n for (let j = i; j >= h && this.dataStore[j] < this.dataStore[j-h]; j -= h) {\n swap(this.dataStore, j, j-h);\n }\n }\n \n h = (h-1)/3;\n }\n }", "function sortNumber (a, b) {\n return a - b;\n }", "sort() {\n // Calculate the fitness of all the solutions.\n // We must do this for all because any could have experienced\n // a mutation that could change its fitness score.\n const fitnessSnapshot = this.solutions.map(solution => this.calculateFitness(solution));\n \n this.solutions.sort((a,b) => {\n const indexA = this.solutions.indexOf(a);\n const indexB = this.solutions.indexOf(b);\n const fitA = fitnessSnapshot[indexA];\n const fitB = fitnessSnapshot[indexB];\n \n if (fitA < fitB) { \n return -1;\n } else if (fitA > fitB) {\n return 1;\n } else {\n return 0;\n }\n });\n }", "function Sort_images(){\r\n\tLoaded_Images_array = Sort_Object(Loaded_Images)\r\n\t/*\r\n\tvar counting = 0\r\n\tvar count_info = '';\r\n\t$.each(Loaded_Images_array,function(index,value){\r\n\t\tcount_info+= 'Number: '+index+' | Page: '+Loaded_Images[value].page+' | Image: '+Loaded_Images[value].number+'\\n';\r\n\t\tcounting++\r\n\t})\r\n\tconsole.debug(counting+' Images sorted\\n'+count_info)\r\n\t*/\r\n}", "function comput_ranking() {\n let list_score = listPlayers.map((player) => player.score);\n\n indexedScore = list_score.map(function (e, i) {\n return { ind: i, val: e };\n });\n\n indexedScore.sort(function (x, y) {\n return x.val > y.val ? 1 : x.val == y.val ? 0 : -1;\n });\n\n orderPlayers = indexedScore.map(function (e) {\n return e.ind;\n });\n listPlayers.forEach((player, index) => {\n player.ranking = orderPlayers[index];\n });\n}", "function numSort(a, b) {\n if (a > b) {\n return -1\n } else if (a < b) {\n return 1\n } else {\n return 0\n }\n}", "function estimatedComparisons() {\n\tn = idList.length;\n\tresult = n * Math.log(n) - Math.pow(2, Math.log(n)) + 1;\n\treturn Math.floor(result);\n}", "function runAlgo() {\n switch(sel.value()) { // Current value in the drop-down menu.\n case \"Bubble Sort\":\n bubbleSort(values);\n break;\n case \"Merge Sort\":\n mergeSort();\n break;\n case \"Quick Sort\":\n quickSort(values, 0, values.length - 1);\n break;\n case \"Radix Sort\":\n radixSort();\n break;\n case \"Insertion Sort\":\n insertionSort(0, values.length);\n break;\n case \"Selection Sort\":\n selectionSort();\n break;\n case \"Cocktail Sort\":\n cocktailSort();\n break;\n case \"Shell Sort\":\n shellSort();\n break;\n }\n}", "sortByHistogramDistance(idx, list) {\n return list.sort(function(a,b) {\n return b.hist[idx] - a.hist[idx];\n });\n\n }", "function makeStats({data}) {\n\n return [\n\n {\n title: 'Num modules parsed',\n description: 'How many modules did we explore?',\n data: data.modules.length,\n },\n\n {\n title: 'Num components',\n description: 'How many component definitions did we find?',\n data: data.components.length,\n },\n\n {\n title: 'Most depended on components',\n description: 'Which components have the most usages?',\n headers: ['Component Name', 'Num Usages'],\n data: data.components.map(\n c => ({\n name: c.name,\n usages: c.dependants.map(\n d => d.usages.length\n ).reduce(\n (a, b) => a + b\n , 0),\n })\n ).sort(\n (a, b) => a.usages > b.usages ? -1 : 1\n ).map(c => [c.name, c.usages]),\n },\n\n {\n title: 'Fattest components',\n description: 'Which components render the most elements?',\n headers: ['Component Name', 'Rendered elements'],\n data: data.components.map(\n c => ({\n name: c.name,\n elements: sum(c.dependencies.map(\n d => d.usages.length\n )),\n })\n ).sort(\n (a, b) => a.elements > b.elements ? -1 : 1\n ).map(\n c => [c.name, c.elements]\n ),\n },\n\n {\n title: 'Most externally complex components',\n description: 'Which components require the most interface?',\n headers: ['Component Name', 'Average Props', 'Component Usages'],\n data: data.components.map(\n c => ({\n name: c.name,\n avgProps: round(mean(flatten(c.dependants.map(\n d => d.usages.map(u => u.props.length)\n ))), 2),\n usages: sum(c.dependants.map(\n d => d.usages.length\n )),\n })\n ).sort(\n (a, b) => a.avgProps > b.avgProps ? -1 : 1\n ).map(\n c => [c.name, c.avgProps, c.usages]\n ),\n },\n\n {\n title: 'Most internally complex components',\n description: 'Which components deal with the most amount of unique dependencies?',\n headers: ['Component Name', 'Unique Dependencies'],\n data: data.components.map(\n c => ({\n name: c.name,\n uniqueDeps: c.dependencies.length,\n })\n ).sort(\n (a, b) => a.uniqueDeps > b.uniqueDeps ? -1 : 1\n ).map(\n c => [c.name, c.uniqueDeps]\n ),\n },\n\n {\n title: 'Dead components',\n description: 'Which components are never referenced?',\n headers: ['Component Name'],\n data: data.components.filter(\n c => !c.dependants.length && c.name\n ).map(\n c => [c.name]\n ),\n },\n\n {\n title: 'One trick ponies',\n description: 'Which components are only ever used once?',\n headers: ['Component Name'],\n data: data.components.filter(\n c => c.dependants.length === 1 && c.name\n ).map(\n c => [c.name]\n ),\n },\n\n {\n title: 'Favourite prop names',\n description: 'Which prop names are most popular in usage?',\n headers: ['Prop name', 'Usages'],\n data: toPairs(groupBy(flattenDeep(data.components.map(\n c => c.dependencies.map(\n d => d.usages.map(\n u => u.props.map(\n p => p.name\n )\n )\n )\n )), identity)).map(([name, u]) => ({name, usages: u.length})).sort(\n (a, b) => a.usages > b.usages? -1 : 1\n ).map(\n c => [c.name, c.usages]\n ),\n },\n\n ];\n\n}", "function sortNums(num1, num2) {\n return num1 - num2;\n}", "function sortfunction( p, q ) {\n\treturn p.x - q.x;\n}", "function SortNumbers(a, b) {\n return (a - b);\n}", "function sortData (data) {\n ...\n}", "function sortByPages() {\n let nodes = document.querySelectorAll('.bookCard')\n let lengths = []\n nodes.forEach(node => lengths.push(library[node.dataset.index].numPages))\n lengths.sort((a, b) => a - b)\n console.log(lengths)\n let order\n nodes.forEach((node) => {\n console.log(node)\n order = lengths.findIndex(x => x === library[node.dataset.index].numPages)\n node.style.order = order\n })\n}", "function sort(){\n myArray.sort(compareNumbers);\n\n showAray();\n}", "tallyResults() { \n const results = { correct: this.correctCards.length, incorrect: this.incorrectCards.length};\n this.resortMatrix(this.correctCards, true);\n this.resortMatrix(this.incorrectCards, false);\n this.correctCards = [];\n this.incorrectCards = [];\n return results;\n }", "function numberCompare(a, b) {\n\t if (sortAscending) {\n\t \treturn a - b;\n\t } else {\n\t \treturn b - a;\n\t }\n\t}", "sort() {\n for (let i = 0; i < this.values.length - 1; i++) {\n let min = i;\n for (let j = i + 1; j < this.values.length; j++) {\n if (this.values[j] < this.values[min]) min = j;\n }\n\n this.swap(i, min);\n }\n }", "function sortByNum(a, b) {\n return (a.peoplenum + a.recognized) < (b.peoplenum + b.recognized);\n }", "static finalSort(a, b){ return 0 }", "function sortNumeric(a, b) {\n return a - b;\n}", "function sortNumeric(val1, val2)\n{\n return val1 - val2;\n}", "function sortNumber(a,b) {\n \treturn a - b;\n\t}", "function setup() {\n for (var i = 0; i < arr.length - 1; i++)\n {\n var index = i;\n for (var j = i + 1; j < arr.length; j++)\n if (arr[j] < arr[index])\n index = j;\n \t\t // Swapping Code\n var smallerNumber = arr[index];\n arr[index] = arr[i];\n arr[i] = smallerNumber;\n }\n}", "function basicSort (first, second) {\r\n\treturn first - second;\r\n}", "function sortTiles() {\n var sortedTiles = sort(tileHTMLElements);\n\n console.log('after sort:', sortedTiles);\n\n repopulateTiles(sortedTiles);\n }", "function sortNumber(a,b) {\r\n\t\t\treturn b - a;\r\n\t\t}", "function ShellSortCardIndex(iCardIndexList, iCompareMethod)\r\r\n{\r\r\n DebugLn(\"ShellSortCardIndex\");\r\r\n var sortIncrement = 3\r\r\n while (sortIncrement > 0)\r\r\n {\r\r\n var iiCard = 0;\r\r\n for (iiCard = sortIncrement; iiCard < iCardIndexList.length; iiCard++)\r\r\n {\r\r\n var jjCard = iiCard;\r\r\n var tempCardNum = iCardIndexList[iiCard];\r\r\n while (jjCard >= sortIncrement && \r\r\n iCompareMethod(iCardIndexList[jjCard - sortIncrement], tempCardNum) > 0)\r\r\n {\r\r\n var delta = jjCard - sortIncrement;\r\r\n iCardIndexList[jjCard] = iCardIndexList[delta];\r\r\n jjCard = delta;\r\r\n }\r\r\n iCardIndexList[jjCard] = tempCardNum;\r\r\n }\r\r\n if (sortIncrement == 1)\r\r\n {\r\r\n sortIncrement = 0;\r\r\n }\r\r\n else\r\r\n {\r\r\n sortIncrement = Math.floor(sortIncrement / 2);\r\r\n if (sortIncrement == 0)\r\r\n sortIncrement = 1;\r\r\n }\r\r\n }\r\r\n}" ]
[ "0.6610553", "0.6444013", "0.6348624", "0.6324352", "0.6235032", "0.621337", "0.6184936", "0.6184936", "0.6168312", "0.6161041", "0.6141791", "0.61124283", "0.6105669", "0.6096987", "0.60759115", "0.60152805", "0.60152805", "0.5991617", "0.5960712", "0.59602225", "0.5947154", "0.59437233", "0.5940158", "0.5938649", "0.58914053", "0.58912635", "0.589106", "0.5873405", "0.5858134", "0.5832111", "0.58313245", "0.58250725", "0.58040917", "0.58033514", "0.5795048", "0.57919455", "0.5769076", "0.5764589", "0.57315105", "0.5721561", "0.57168245", "0.5716", "0.57157326", "0.56950533", "0.5679735", "0.5672011", "0.56680894", "0.56657445", "0.56657445", "0.56657445", "0.56657445", "0.5651634", "0.5644014", "0.5641242", "0.5637846", "0.56320167", "0.5620874", "0.56112", "0.5605623", "0.56031066", "0.55927616", "0.55881625", "0.5585863", "0.55691385", "0.5567698", "0.55672586", "0.5566599", "0.55656904", "0.5562345", "0.55620766", "0.5558123", "0.55513257", "0.5549046", "0.5542906", "0.55420476", "0.55346644", "0.55263096", "0.5525251", "0.55155194", "0.5513525", "0.5511445", "0.55108184", "0.5510375", "0.55038154", "0.54947865", "0.54876363", "0.5479089", "0.54758906", "0.54751277", "0.5475077", "0.54743326", "0.5471908", "0.54713434", "0.5469596", "0.54685503", "0.54677767", "0.54644245", "0.5460263", "0.5459765", "0.54522324" ]
0.64459366
1
nS No Space lC Lowercase
function foldersAndFiles(currentAppName, newName) { var nS_CurrentAppName = currentAppName.replace(/\s/g, ''); var nS_NewName = newName.replace(/\s/g, ''); return ['ios/' + nS_CurrentAppName, 'ios/' + nS_CurrentAppName + '.xcodeproj', 'ios/' + nS_NewName + '.xcodeproj/xcshareddata/xcschemes/' + nS_CurrentAppName + '.xcscheme', 'ios/' + nS_CurrentAppName + 'Tests', 'ios/' + nS_NewName + 'Tests/' + nS_CurrentAppName + 'Tests.m', 'ios/' + nS_CurrentAppName + '.xcworkspace', 'ios/' + nS_CurrentAppName + '-Bridging-Header.h']; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lcase0(s) {\n return s.replace(/^\\w/, function (match) {\n return match.toLowerCase();\n });\n }", "function lowercase(input) {}", "function sc_string_downcase(s) {\n return s.toLowerCase();\n}", "function whisper(string){ return string.toLowerCase() }", "function slowercase(s) {\n return s.toLowerCase()\n}", "function toLowerCase(s) {\n\t\treturn s&&s.toLowerCase?s.toLowerCase():s;\n\t}", "function isLowercase(c) {\r\n return 97 <= c && c <= 122; \r\n }", "function kleineLetters(text) {\nvar str = \"Hello World!\";\nvar res = str.toLowerCase();\n}", "function toLower(c){\r\n return c.toLowerCase();\r\n}", "function snake_case(name){\n\t var regexp = /[A-Z]/g;\n\t var separator = '-';\n\t return name.replace(regexp, function(letter, pos) {\n\t return (pos ? separator : '') + letter.toLowerCase();\n\t });\n\t }", "function snake_case(name) {\n\t var regexp = /[A-Z]/g;\n\t var separator = '-';\n\t return name.replace(regexp, function(letter, pos) {\n\t return (pos ? separator : '') + letter.toLowerCase();\n\t });\n\t }", "function snake_case(name) {\n\t\t\t\tvar regexp = /[A-Z]/g;\n\t\t\t\tvar separator = '-';\n\t\t\t\treturn name.replace(regexp, function(letter, pos) {\n\t\t\t\t\treturn (pos ? separator : '') + letter.toLowerCase();\n\t\t\t\t});\n\t\t\t}", "function snake_case(name){\n\t\t\tvar regexp = /[A-Z]/g;\n\t\t\tvar separator = '-';\n\t\t\treturn name.replace(regexp, function(letter, pos) {\n\t\t\t\treturn (pos ? separator : '') + letter.toLowerCase();\n\t\t\t});\n\t\t}", "function fx_Lower(data)\n{\n\t//if the data is a valid string lower case it\n\treturn !String_IsNullOrWhiteSpace(data) ? (\"\" + data).toLowerCase() : \"\";\n}", "function lcfirst(strText)\n{\n return ((!strText) ? '' : strText.substr(0, 1).toLowerCase() + strText.substr(1));\n}", "function isLower(c){\r\n return c.toLowerCase() == c;\r\n}", "function standarize(value){\n return value.toLowerCase();\n }", "function lowerCase() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utTransform,\n sp: utilitymanager_1.um.TIXSelPolicy.Word,\n }, function (up) { return up.intext.toLowerCase(); });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function (letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function (letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n\t var separator = '-';\n\t return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n\t return (pos ? separator : '') + letter.toLowerCase();\n\t });\n\t }", "function sc_isCharLowerCase(c)\n { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); }", "function titleCase(str) {return str.toLowerCase().replace(/^[a-z]|\\s[a-z]/g,\nfunction(m){return m.toUpperCase();\n });\n }", "cap(lower) {\n return lower.replace(/^\\w/, c => c.toUpperCase());\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name){\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function spinalCase(str) {\n //Create a regular expression selecting whitespaces and underscores\n var regularExpression = /\\s+|_+/g;\n //Inserts a space between any encountered Upper-Case characters at the nth parenthesized submatch string\n str = str.replace(/([a-z])([A-Z])/g,'$1 $2');\n //Places a dash where spaces and underscores are, as defined in our regularExpression.Then converts the string to lowercase \n return str.replace(regularExpression,'-').toLowerCase();\n}", "function lower_case(str){\n return str.toLowerCase();\n}", "function lower_case(str){\n return str.toLowerCase();\n}", "function n(t){if(\"string\"!==typeof t)throw new TypeError(\"expected a string.\");return t=t.replace(/([A-Z])/g,\" $1\"),1===t.length?t.toUpperCase():(t=t.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),t=t.charAt(0).toUpperCase()+t.slice(1),t.replace(/[\\W_]+(\\w|$)/g,(function(t,e){return e.toUpperCase()})))}", "function lowCase(lstr)\n{\n\tvar str = lstr.value;\n\tlstr.value = str.toLowerCase();\n}", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var regexp = /[A-Z]/g;\n var separator = '-';\n return name.replace(regexp, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function toLower(x){ return x.toLowerCase(); }", "function spinalCase(str) {\r\n var regex = /[^a-z]/gi;\r\n var replaceNonAlpha = str.replace(regex, \"-\");\r\n console.log(replaceNonAlpha.toLowerCase());\r\n\r\n return replaceNonAlpha.toLowerCase();\r\n}", "function whisper(string){\n\tlet res=string.toLowerCase();\n\treturn(res)\n}", "function staggeredCase(input) {\n\n}", "function lowerWithoutSpaces(input){\n return input.toLowerCase().split(' ').join('');\n}", "function containsLowerCase(s) {\n return s != s.toUpperCase();\n}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function n(e){if(\"string\"!=typeof e)throw new TypeError(\"expected a string.\");return e=e.replace(/([A-Z])/g,\" $1\"),1===e.length?e.toUpperCase():(e=e.replace(/^[\\W_]+|[\\W_]+$/g,\"\").toLowerCase(),e=e.charAt(0).toUpperCase()+e.slice(1),e.replace(/[\\W_]+(\\w|$)/g,function(e,t){return t.toUpperCase()}))}", "function toProperCase(s)\r\n{\r\n return s.toLowerCase().replace(/^(.)|\\s(.)/g,\r\n function($1) { return $1.toUpperCase(); });\r\n}", "function standardize(str) { \r\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '').toLowerCase();\r\n}", "function toTitleCaseStrong(str) {\n if (!str) {\n return str;\n }\n var allCaps = (str === str.toUpperCase());\n \n \n str = str.replace(/\\b([^\\W_\\d][^\\s-\\/]*) */g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n });\n // Cap O'Reilley's, L'Amour, D'Artagnan as long as 5+ letters\n str = str.replace(/[oOlLdD]'[A-Za-z']{3,}/g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0).toUpperCase() + txt.charAt(1) + txt.charAt(2).toUpperCase() + txt.substr(3).toLowerCase();\n });\n // Cap McFarley's, as long as 5+ letters long\n str = str.replace(/[mM][cC][A-Za-z']{3,}/g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0).toUpperCase() + txt.charAt(1).toLowerCase() + txt.charAt(2).toUpperCase() + txt.substr(3).toLowerCase();\n });\n // anything sith an \"&\" sign, cap the word after &\n str = str.replace(/&\\w+/g, function(txt) {\n return ((txt === txt.toUpperCase()) && !allCaps) ? txt : txt.charAt(0) + txt.charAt(1).toUpperCase() + txt.substr(2);\n });\n \n str = str.replace(/[^ ]+/g, function(txt) {\n var txtLC = txt.toLowerCase();\n return (ignoreWords.indexOf(txtLC) > -1) ? txtLC : txt;\n });\n str = str.replace(/[^ ]+/g, function(txt) {\n var txtLC = txt.toUpperCase();\n return (capWords.indexOf(txtLC) > -1) ? txtLC : txt;\n });\n str = str.charAt(0).toUpperCase() + str.substr(1);\n return str;\n }", "function snakeCase(str) {\n return str.replace(/(?:([a-z])([A-Z]))|(?:((?!^)[A-Z])([a-z]))/g, \"$1_$3$2$4\").toLowerCase();\n}", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function (letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function snake_case(name) {\n var separator = '-';\n return name.replace(SNAKE_CASE_REGEXP, function (letter, pos) {\n return (pos ? separator : '') + letter.toLowerCase();\n });\n }", "function whisper(string) {\n return string.toLowerCase();\n}", "function spinalCase(str) {\n // \"It's such a fine line between stupid, and clever.\"\n // --David St. Hubbins\n return str\n .replace(/(\\s|\\_)|(?<=[a-z])[A-Z]/g,(m, p1) => p1 ? \"-\" : \"-\" + m).toLowerCase();\n}", "function isLowercaseLetter(code) {\n return code >= 0x0061 && code <= 0x007A;\n}", "function firstIsLower(w) {\r\n if (!w) return false;\r\n var cap = texarg.exec(w);\r\n if (cap) return firstIsLower(w.substr(cap.index + cap[0].length));\r\n else return (w.substr(0,1).toUpperCase() !== w.substr(0,1));\r\n }", "function startsWithLowercase (str)\n {\n return str.charAt(0).toUpperCase() !== str.charAt(0);\n }", "function whisper(string) {\n return string.toLowerCase()\n}", "function whisper(string) {\n return string.toLowerCase()\n}", "function whisper(string) {\n return string.toLowerCase()\n}", "function isLowerCase(ltr) {\n let temp; \n temp = ltr;\n temp.toLowerCase();\n return ltr == temp;\n }", "function forceLower(strInput) {\r\n strInput.value = strInput.value.toLowerCase();\r\n}", "static spinalCase(str) {\n return str.replace(/(\\w)([A-Z])/g,\"$1 $2\").split(/[\\W_]+/).join(\"-\").toLowerCase();\n }", "function makeLean(str){\n\treturn (str.replace(/\\s/g, '')).toLowerCase().trim();\n}", "function formatStringToLower(input) {\n return input ? (input + \"\").toLowerCase() : input;\n }", "toLowerCase() {\n var originalRange = this.getSelectionRange();\n if (this.selection.isEmpty()) {\n this.selection.selectWord();\n }\n\n var range = this.getSelectionRange();\n var text = this.session.getTextRange(range);\n this.session.replace(range, text.toLowerCase());\n this.selection.setSelectionRange(originalRange);\n }", "function spinalCase(str) {\n \n var re = /\\s|_/; \n \n // Replace low-upper case to low-space-uppercase\n str = str.replace(/([a-z])([A-Z])/g, '$1 $2');\n \n str = str.split(re).join('-').toLowerCase();\n \n return str;\n}", "function strLowerNormalize (str) {\r\n return(str.toLowerCase().normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\"));\r\n}" ]
[ "0.7430665", "0.73316675", "0.7200786", "0.7156583", "0.7009906", "0.6955847", "0.6913623", "0.6890696", "0.6860053", "0.6818678", "0.6776555", "0.6776382", "0.67754924", "0.67679024", "0.6752629", "0.6719462", "0.67123914", "0.66751254", "0.6636516", "0.6636516", "0.6619696", "0.66154134", "0.6596574", "0.65942925", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6591673", "0.6586623", "0.6580148", "0.6580148", "0.65626025", "0.6532909", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.6525535", "0.651336", "0.651336", "0.651336", "0.651336", "0.651336", "0.651336", "0.651336", "0.651336", "0.651336", "0.65093446", "0.64748347", "0.6456609", "0.6413257", "0.6408526", "0.6405833", "0.6393585", "0.6393585", "0.6393585", "0.6393585", "0.6393585", "0.6393585", "0.63929164", "0.6392205", "0.6390996", "0.63874257", "0.6375806", "0.6375806", "0.6372752", "0.6372249", "0.63702756", "0.63671166", "0.6361782", "0.6358803", "0.6358803", "0.6358803", "0.6343636", "0.63054574", "0.6257723", "0.6254158", "0.62486094", "0.6236225", "0.6203683", "0.62036717" ]
0.0
-1
Update emitter and return how many particles should be generated this frame.
update(deltaTime, system) { // particles to generate var ret = 0; // first update? do burst if (this.age === 0 && this.options.onSpawnBurst) { ret += randomizerOrValue(this.options.onSpawnBurst); } // update age this.age += deltaTime; // no interval emitting? skip if (!this.options.onInterval) { return ret; } // check if inverval expired this.timeToSpawn -= deltaTime; if (this.timeToSpawn <= 0) { this.timeToSpawn = randomizerOrValue(this.options.interval); ret += randomizerOrValue(this.options.onInterval); } // do detoration if (this.options.detoretingMinTtl && system.ttl < this.options.detoretingMinTtl) { var detorateFactor = system.ttl / this.options.detoretingMinTtl; ret *= detorateFactor; } // return number of particles to generate return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get particleCount() { return this._particles.length; }", "function particleUpdate() {\n console.log(\"particle update\");\n for (var i = 0; i < particles.length; i++) {\n particles[i].updatePosition(0.1);\n particles[i].updateVelocity(0.1);\n particles[i].updateAcceleration();\n }\n console.log(particleNum);\n}", "length() {\n\t\tvar length = 0;\n\t\tfor (var particleObj in this.particles) {\n\t\t\tlength += particleObj.length;\n\t\t}\n\t\treturn length;\n\t}", "addParticles(count) {\n\n }", "function update(){\n\t\t\tfor(var i=0;i<particles.length;i++){\n\t\t\t\tvar p = particles[i];\n\n\t\t\t\t//Get distance between mouse and particle origin to see if particles should be affected by the mouse\n\t\t\t\tvar distanceorx = mouseX-p.orX;\n\t\t\t\tvar distanceory = mouseY-p.orY;\n\t\t\t\tvar distanceor = Math.sqrt((distanceorx * distanceorx) + (distanceory * distanceory));\n\n\t\t\t\t//If the distance is less than 60 the particle gets affected\n\t\t\t\tif(distanceor<100 && !p.isAffected){\n\t\t\t\t\tp.isAffected = true;\n\t\t\t\t\taffectedParticles.push(p);\n\t\t\t\t}\n\t\t\t\t//If the distance is more than 100 the particle gets desaffected\n\t\t\t\telse if(distanceor>110){\n\t\t\t\t\t//this is there to give some delay between the particle being desaffected and the particle animating back\n\t\t\t\t\tif(!p.isOut){\n\t\t\t\t\t\tp.isOut = true;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tp.outCount++;\n\t\t\t\t\t\tif(p.outCount>p.outDest){\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Particle gets desaffected\n\t\t\t\t\t\t\tp.isAffected = false;\n\t\t\t\t\t\t\tp.isOut = false;\n\t\t\t\t\t\t\tp.outCount = 0;\n\t\t\t\t\t\t\t//remove particle from affected array\n\t\t\t\t\t\t\tfor(var j=0;j<affectedParticles.length;j++){\n\t\t\t\t\t\t\t\tif(affectedParticles[j] == p){\n\t\t\t\t\t\t\t\t\taffectedParticles.splice(j,1);\n\t\t\t\t\t\t\t\t\tj = 10000;\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\n\t\t\t\tif(!p.isAffected){\n\t\t\t\t\t//add force that brings the particle back to it's origin\n\t\t\t\t\tp.posX += (p.orX-p.posX)*0.2;\n\t\t\t\t\tp.posY += (p.orY-p.posY)*0.2;\n\t\t\t\t\t//Update scale back to 0\n\t\t\t\t\tp.scale += -p.scale*0.2;\n\t\t\t\t}\n\n\t\t\t\t\n\n\t\t\t\t//Update distance to origin\n\t\t\t\tdistanceorx = p.posX-p.orX;\n\t\t\t\tdistanceory = p.posY-p.orY;\n\t\t\t\tdistanceor = Math.sqrt((distanceorx * distanceorx) + (distanceory * distanceory));\n\t\t\t\tp.dist = distanceor;\n\n\t\t\t\t//Update angle\n\t\t\t\tp.angle = calcAngle(p.orX,p.posX,p.orY,p.posY);\n\t\t\t}\n\n\t\t\tfor(i=0;i<affectedParticles.length;i++){\n\t\t\t\tvar p = affectedParticles[i];\n\n\t\t\t\tif(!p.isSprite){\n\t\t\t\t\tif(p.hasRepulsion){\n\t\t\t\t\t\t//Add main repulsion force from the mouse\n\t\t\t\t\t\tvar repelforce = new Vector2(p.posX,p.posY);\n\t\t\t\t\t\trepelforce.minusEq(new Vector2(mouseX,mouseY)); \n\t\t \t\t\t\t\n\t\t\t\t\t\tmag = repelforce.magnitude(); \n\t\t \t\t\t\trepelstrength = (mag - p.mag) *-1; \n\n\t\t\t\t\t\tif(mag>0){\n\t\t \t\t\t\t\trepelforce.multiplyEq(repelstrength/mag*0.2);\n\t\t\t\t\t\t\tp.posX += repelforce.x;\n\t\t\t\t\t\t\tp.posY += repelforce.y;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tif(i<affectedParticles.length-1){\n\t\t\t\t\t\t\t//Got through the particle to calculate repulsion force between the particles\n\t\t\t\t\t\t\tfor(var j=i+1;j<affectedParticles.length;j++){\n\t\t\t\t\t\t\t\tvar p2 = affectedParticles[j];\n\t\t\t\t\t\t\t\tif(p2.hasRepulsion){\n\t\t\t\t\t\t\t\t\tvar repelforce = new Vector2(p2.posX,p2.posY);\n\t\t\t\t\t\t\t\t\trepelforce.minusEq(new Vector2(p.posX,p.posY)); \n\t\t\t\t\t\t\t\t\tmag = repelforce.magnitude(); \n\t\t\t\t\t\t\t\t\trepelstrength = 150-mag; \n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif((repelstrength>0)&&(mag>0))\t{\n\t\t\t\t\t\t\t\t\t\trepelforce.multiplyEq(repelstrength*0.025 / mag); \n\t\t\t\t\t\t\t\t\t\tp.posX -= repelforce.x;\n\t\t\t\t\t\t\t\t\t\tp.posY -= repelforce.y;\n\t\t\t\t\t\t\t\t\t\tp2.posX += repelforce.x;\n\t\t\t\t\t\t\t\t\t\tp2.posY += repelforce.y;\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\telse{\n\t\t\t\t\t//add main force for sprite particles\n\t\t\t\t\tvar distancex = mouseX-p.posX;\n\t\t\t\t\tvar distancey = mouseY-p.posY;\n\t\t\t\t\tvar distance = Math.sqrt((distancex * distancex) + (distancey * distancey));\n\n\t\t\t\t\tvar powerx = -(distancex/distance)*p.charge;\n\t\t\t\t\tvar powery = -(distancey/distance)*p.charge;\n\t\t\t\t\t\t\t\n\t\t\t\t\t//add repulsion force from the mouse\n\t\t\t\t\tp.posX += powerx;\n\t\t\t\t\tp.posY += powery;\n\n\t\t\t\t\t//Update scale\n\t\t\t\t\tvar chargePerc = 1-((p.charge-23)/15);\n\t\t\t\t\tvar noise = (perlin.noise(p.scaleNoise,0,0))*10;\n\t\t\t\t\tp.scale += ((chargePerc*30+noise)-p.scale)*0.2;\n\t\t\t\t\tp.scale = 10;\n\n\t\t\t\t\tp.scaleNoise+=p.scaleNoiseSpeed;\n\t\t\t\t}\n\n\t\t\t\t//add force that brings the particle back to it's origin\n\t\t\t\tp.posX += (p.orX-p.posX)*0.2;\n\t\t\t\tp.posY += (p.orY-p.posY)*0.2;\n\n\t\t\t\t//Add noise to position and scale\n\t\t\t\tvar noisex = perlin.noise(p.offX,0,0);\n\t\t\t\tvar noisey = perlin.noise(p.offY,0,0);\n\n\t\t\t\t//Update position\n\t\t\t\tp.posX += noisex*p.noiseAmount;\n\t\t\t\tp.posY += noisey*p.noiseAmount;\n\n\t\t\t\t//Update noise offsets\n\t\t\t\tp.offX += p.randSpeed;\n\t\t\t\tp.offY += p.randSpeed;\n\t\t\t}\n\t\t}", "function emitParticles() {\n for (var j = 0; j < particles.length; j++) {\n par = particles[j];\n\n ctx.beginPath();\n ctx.fillStyle = \"white\";\n if (par.radius > 0) {\n ctx.arc(par.x, par.y, par.radius, 0, Math.PI * 2, false);\n }\n ctx.fill();\n\n par.x += par.vx;\n par.y += par.vy;\n\n // Reduce radius so that the particles die after a few seconds\n par.radius = Math.max(par.radius - 0.05, 0.0);\n\n }\n}", "function emitParticles() { \n\tfor(var j = 0; j < particles.length; j++) {\n\t\tpar = particles[j];\n\t\t\n\t\tctx.beginPath(); \n\t\tctx.fillStyle = \"white\";\n\t\tif (par.radius > 0) {\n\t\t\tctx.arc(par.x, par.y, par.radius, 0, Math.PI*2, false);\n\t\t}\n\t\tctx.fill();\t \n\t\t\n\t\tpar.x += par.vx; \n\t\tpar.y += par.vy; \n\t\t\n\t\t// Reduce radius so that the particles die after a few seconds\n\t\tpar.radius = Math.max(par.radius - 0.05, 0.0); \n\t\t\n\t} \n}", "function emitParticles() { \n\tfor(var j = 0; j < particles.length; j++) {\n\t\tpar = particles[j];\n\t\t\n\t\tctx.beginPath(); \n\t\tctx.fillStyle = \"white\";\n\t\tif (par.radius > 0) {\n\t\t\tctx.arc(par.x, par.y, par.radius, 0, Math.PI*2, false);\n\t\t}\n\t\tctx.fill();\t \n\t\t\n\t\tpar.x += par.vx; \n\t\tpar.y += par.vy; \n\t\t\n\t\t// Reduce radius so that the particles die after a few seconds\n\t\tpar.radius = Math.max(par.radius - 0.05, 0.0); \n\t\t\n\t} \n}", "update(){\n // determining the size and directions of particles, depending on their type\n this.dirX += this.type ? Math.random()*p2DirXR - p2DirXR/2 : Math.random()*pDirXR - pDirXR/2;\n this.dirY += this.type ? Math.random()*p2DirYR - p2DirYR/2 : Math.random()*pDirYR - pDirYR/2;\n this.size *= this.type ? p2SizeDecrease : pSizeDecrease;\n if(colorOnSize){\n this.color = pColors[Math.round(this.size/colorSizeGrid)];\n }\n // moving particles\n this.x += this.dirX;\n this.y += this.dirY;\n // draw particle\n this.draw();\n }", "update() {\n if ((this.y + this.particleSize) > this.floor) {\n this.vy *= -this.bounce;\n this.vx *= this.bounce;\n this.y = this.floor - this.particleSize;\n }\n if ((this.x + this.particleSize) > this.width) {\n this.vy *= this.bounce;\n this.vx *= -this.bounce;\n this.x = this.width - this.particleSize;\n }\n if ((this.x) < 0) {\n this.vy *= this.bounce;\n this.vx *= -this.bounce;\n this.x = this.particleSize;\n }\n this.x += this.vx;\n this.y += this.vy;\n this.vy += this.gravity;\n this.particleSize -= (this.life * 0.002);\n this.life++;\n\n return {\n x: Math.round(this.x),\n y: Math.round(this.y),\n size: Math.round(this.particleSize),\n life: this.life,\n maxLife: this.maxLife\n };\n }", "updateParticles(delta) {\n this.particles.forEach(particle => particle.updateAndDraw(this.engine, delta));\n // delete unused particles\n this.particles = this.particles.filter(particle => particle.inProgress);\n }", "genParticles() {\n let self = this, particle;\n\n for (let i = 0; i < 15; i++) {\n particle = {\n position: new Vector2d(this.position.x, this.position.y),\n velocity: new Vector2d(-1, 1),\n life: 15,\n lifeCtr: 0\n };\n\n if (Math.random() < 0.5) {\n particle.dx *= -1;\n particle.dy *= -1;\n }\n\n this.particles.push(particle);\n }\n\n this.velocity.y = 0;\n this.velocity.x = 0;\n\n this.score -= 10;\n this.lives--;\n }", "function ParticleEmitter() {\n\n this.maxParticles = 300;\n this.particles = [];\n this.active = true;\n \n this.position = [[50, 50], [1, 1]];\n this.size = [45, 15];\n this.speed = [2.5, 1];\n this.ttl = [9, 7];\n this.angle = [0, 360];\n this.gravity = [0.4, 0.2];\n this.startColor = [[250, 218, 68, 1], [62, 60, 60, 0]];\n this.endColor = [[245, 35, 0, 0], [60, 60, 60, 0]];\n this.sharpness = [40, 10];\n \n this.elapsedTime = 0;\n this.duration = -1;\n this.emissionRate = 0;\n this.emitCounter = 0;\n this.particleIndex = 0;\n \n this.renderTime = 0;\n this.updateTime = 0;\n \n this.init = function() {\n \n this.emissionRate = 1 / (this.maxParticles / this.ttl[0]);\n this.emitCounter = 0;\n \n };\n \n this.rand = function() {\n \n return Math.random() * 2 - 1;\n \n };\n \n this.val = function(key) {\n \n return this[key][0] + (this[key][1] * this.rand());\n \n };\n \n this.valA = function(key) {\n \n var r = [], \n i;\n \n for (i = 0; i < this[key][0].length; i++) {\n \n r.push(this[key][0][i] + (this[key][1][i] * this.rand()));\n \n }\n \n return r;\n \n };\n \n this.add = function() {\n \n var size, sharpness, angle, speed, startColor, endColor, ttl;\n \n if (this.particles.length < this.maxParticles) {\n \n size = ~~Math.max(0, this.val('size'));\n sharpness = Math.max(0, Math.min(100, this.val('sharpness')));\n angle = this.val('angle') * Math.PI / 180; \n speed = this.val('speed'), \n startColor = this.valA('startColor'), \n endColor = this.valA('endColor');\n ttl = this.val('ttl');\n\n this.particles.push([\n this.position[0][0] + this.position[1][0] * this.rand(), \n this.position[0][1] + this.position[1][1] * this.rand(), \n Math.cos(angle) * speed, \n Math.sin(angle) * speed, \n size,\n size / 200 * sharpness, \n ttl, \n startColor, \n 'rgba(0,0,0,0)',\n [\n (endColor[0] - startColor[0]) / ttl, \n (endColor[1] - startColor[1]) / ttl, \n (endColor[2] - startColor[2]) / ttl, \n (endColor[3] - startColor[3]) / ttl\n ],\n sharpness \n ]); \n \n }\n \n };\n \n this.render = function(ctx) {\n \n var i, rg, x, y, hs, ts = +new Date();\n \n for (i = 0; i < this.particles.length; i++) {\n \n x = ~~this.particles[i][0];\n y = ~~this.particles[i][1];\n hs = this.particles[i][4] >> 1;\n \n rg = ctx.createRadialGradient(\n x + hs, \n y + hs, \n this.particles[i][5], \n x + hs, \n y + hs, \n hs\n );\n rg.addColorStop(0, this.particles[i][8]);\n rg.addColorStop(1, 'rgba(0,0,0,0)');\n \n ctx.fillStyle = rg;\n ctx.fillRect(x, y, this.particles[i][4], this.particles[i][4]); \n \n }\n \n this.renderTime = +new Date() - ts;\n \n };\n \n this.emit = function(delta) {\n \n this.emitCounter \n \n };\n \n this.stop = function() {\n \n this.active = false;\n \n };\n \n this.update = function(delta) {\n \n var i, ts = +new Date();\n \n if (this.active) {\n \n this.emitCounter += delta;\n \n while (this.particles.length < this.maxParticles && this.emitCounter > this.emissionRate) {\n \n this.add();\n this.emitCounter -= this.emissionRate;\n \n }\n \n this.elapsedTime += delta;\n \n if (this.duration != -1 && this.duration < this.elapsedTime) {\n \n this.stop();\n \n } \n \n }\n \n for (i = 0; i < this.particles.length; i++) {\n \n if (this.particles[i][6] > 0) {\n \n // update direction\n this.particles[i][2] += this.gravity[0];\n this.particles[i][3] += this.gravity[1];\n \n // update position\n this.particles[i][0] += this.particles[i][2];\n this.particles[i][1] += this.particles[i][3];\n \n // update ttl\n this.particles[i][6] -= delta;\n \n // update colors\n this.particles[i][8] = 'rgba(' + (~~Math.max(0, Math.min(255, this.particles[i][7][0] += (this.particles[i][9][0] * delta)))) + ',' + \n (~~Math.max(0, Math.min(255, this.particles[i][7][1] += (this.particles[i][9][1] * delta)))) + ',' + \n (~~Math.max(0, Math.min(255, this.particles[i][7][2] += (this.particles[i][9][2] * delta)))) + ',' + \n (Math.max(0, Math.min(255, this.particles[i][7][3] += (this.particles[i][9][3] * delta))).toFixed(2)) + ')'; \n \n \n } else {\n \n this.particles.splice(i, 1);\n i--;\n \n }\n \n }\n \n this.updateTime = +new Date() - ts;\n \n };\n\n}", "function popolate(num) {\n for (var i = 0; i < num; i++) {\n setTimeout(\n (function(x) {\n return function() {\n // Add particle\n particles.push(new Particle(canvas));\n };\n })(i),\n frequency * i\n );\n }\n return particles.length;\n}", "update() {\n this.age -- ;\n // this.vel.add(this.acc);\n // // this.vel.mult(this.drag); // uncomment this line to add drag to the particles\n // this.pos.add(this.vel);\n \n \n \n }", "update(_deltaTime) {\n for (const particle of this.particles) {\n particle.update(_deltaTime);\n }\n }", "_initParticles() {\n this.particleSystem = ParticleHelper.CreateDefault(this.emitter);\n const noiseTexture = new NoiseProceduralTexture('perlin', 256, this.scene);\n\n noiseTexture.animationSpeedFactor = 5;\n noiseTexture.persistence = 2;\n noiseTexture.brightness = 0.5;\n noiseTexture.octaves = 5;\n\n this.particleSystem.noiseStrength = new Vector3(5, 10, 5);\n this.particleSystem.noiseTexture = noiseTexture;\n\n this.particleSystem.emitRate = 100;\n this.particleSystem.minEmitPower = 0.2;\n this.particleSystem.maxEmitPower = 0.2;\n this.particleSystem.updateSpeed = 0.005;\n\n this.particleSystem.minLifeTime = 0.4;\n this.particleSystem.maxLifeTime = 0.4;\n this.particleSystem.minSize = 0.02;\n this.particleSystem.maxSize = 0.02;\n\n this.particleSystem.colorDead = new Color4(0.2, 0.2, 0, 0);\n this.particleSystem.direction1 = new Vector3(-1, 4, 1);\n this.particleSystem.direction2 = new Vector3(1, 4, -1);\n\n this.particleSystem.start();\n }", "createParticles() {\n this.sparkParticles = this.add.particles('sparkHit');\n this.sparkEmitter = this.sparkParticles.createEmitter({\n x: this.centerX,\n y: 500,\n speed: 15,\n lifespan: 1400,\n blendMode: 'ADD',\n maxParticles: 400,\n scale: { start: 0.3, end: 0 },\n on: false\n });\n }", "makeParticles() {\n // Absorb particles\n gameState.particles = this.add.particles('spark');\n gameState.emitter = gameState.particles.createEmitter({ \t\n x: gameState.player.x,\n y: gameState.player.y,\n lifespan: 256,\n speedX: {min: -512, max: 512},\n speedY: {min: -512, max: 512},\n scale: {start: 4, end: 0},\n tint: [0xff00ff, 0x00ffff],\n quantity: 8,\n blendMode: 'ADD'\n }); \n gameState.emitter.explode(0, gameState.player.x, gameState.player.y); // prevent from showing\n // Lose Particles\n gameState.loseParticles = this.add.particles('fragment');\n gameState.loseEmitter = gameState.loseParticles.createEmitter({\n x: gameState.player.x,\n y: gameState.player.y,\n lifespan: 1024,\n speedX: {min: -128, max: 128},\n speedY: {min: -128, max: 128},\n scale: {start: 1.5, end: 0},\n quantity: 16,\n rotate: () => { return Math.random() * 360}, // random rotation\n onUpdate: (particle) => { return particle.angle + 1}, // spin the \"fragments\"\n blendMode: 'NORMAL'\n });\n gameState.loseEmitter.explode(0, gameState.player.x, gameState.player.y); // prevent from showing\n }", "_updateParticles(dt) {\n for (let i = 0, len = this._particles.length; i < len; i++) {\n let p = this._particles[i];\n // force and integrate\n this.integrate(p, dt, this._lastTime);\n // constraints\n World.boundConstraint(p, this._bound, this._damping);\n // collisions\n for (let k = i + 1; k < len; k++) {\n if (i !== k) {\n let p2 = this._particles[k];\n p.collide(p2, this._damping);\n }\n }\n // render\n if (this._drawParticles)\n this._drawParticles(p, i);\n }\n this._lastTime = dt;\n }", "update() {\n //check if particle is still within particle-js container\n if (this.x > particles.width || this.x < 0) {\n this.directionX = -this.directionX;\n }\n if (this.y > particles.height || this.y < 0) {\n this.directionY = -this.directionY;\n }\n //check collision detection - mouse position / particle position\n let dx = mouse.x - this.x;\n let dy = mouse.y - this.y;\n let distance = Math.sqrt(dx * dx + dy * dy);\n if (distance < mouse.radius + this.size) {\n if (mouse.x < this.x && this.x < particles.width - this.size * 10) {\n this.x += 10;\n }\n if (mouse.x > this.x && this.x > this.size * 10) {\n this.x -= 10;\n }\n if (mouse.y < this.y && this.y < particles.height - this.size * 10) {\n this.y += 10;\n }\n if (mouse.y > this.y && this.y > this.size * 10) {\n this.y -= 10;\n }\n }\n // move particle\n this.x += this.directionX;\n this.y += this.directionY;\n // draw particle\n this.draw();\n }", "timeEvolve(){\n this.#particles.forEach(particle => {\n var pos = particle.getPosition(true);\n var vel = particle.getVelocity(true);\n var elapsedTime = particle.getAge() * this.#deltaT;\n var newPos = [\n World.constantVelocityTrajectory(\n elapsedTime,\n vel[0],\n pos[0]\n ),\n World.acceleratedTrajectory(\n this.#g,\n elapsedTime,\n vel[1],\n pos[1]\n )\n ]\n\n particle.setPosition(newPos);\n particle.incrementAge();\n //!!! velocity hasn't been updated. probably should! !!!\n })\n this.#elapsedTimeIntervalCount ++;\n }", "function setupParticles() {\n for (var i = 0; i < particleNum; i++) {\n particles.push(new Particle());\n \n }\n console.log(\"add particle\");\n}", "function emit(x, y) {\n for(let i = 0; i < 250; i++) {\n particles_i = (particles_i+NFIELDS) % PARTICLES_LENGTH;\n particlesFire[particles_i] = x;\n particlesFire[particles_i+1] = y;\n const alpha = fuzzy(PI),\n radius = random()*100,\n vx = cos(alpha)*radius,\n vy = sin(alpha)*radius,\n age = random();\n particlesFire[particles_i+2] = vx;\n particlesFire[particles_i+3] = vy;\n particlesFire[particles_i+4] = age;\n }\n}", "stats() {\n return {\n numComponents: this.Components.length,\n numEntities: this.entities.length\n };\n }", "function updateParticles(data) {\n\n // iterate through every particle\n if(show)\n for ( var i = 0; i < particles.length; i++) {\n\n particle = particles[i];\n\n x = (scale(XMIN, (XMAX), Math.random()) -XMAX/2)*1;\n y = (scale(YMIN, (YMAX), Math.random()) -YMAX/2)*1;\n z = (scale(ZMIN, (ZMAX), Math.random()) - ZMAX/2)*1;\n\n particle.position.x = x;\n particle.position.y = y;\n particle.position.z = z;\n }\n }", "update() {\n\t\tvar toRemove = [];\n\t\tfor (var particle of this) {\n\t\t\tparticle.update();\n\t\t\tif (particle.size <= 0 || particle.alpha <= 0) {\n\t\t\t\ttoRemove.push(this.indexOf(particle));\n\t\t\t}\n\t\t}\n\t\tvar offset = 0;\n\t\tfor (var i of toRemove) {\n\t\t\tthis.splice(i-offset, 1);\n\t\t\toffset++;\n\t\t}\t\n\t}", "update () {\n\n this.particleSystem.step(\n this.stopwatch.getElapsedMs() * 0.001)\n\n this.updateChunk ()\n\n // invalidate (needsClear, needsRender, overlayDirty)\n this.viewer.impl.invalidate(true, false, false)\n\n this.emit('fps.tick')\n }", "update(delta) {\n\t\tvar pointsVectors = [];\n\t\tvar pos = vec3.create();\n\n\t\t// Update each particle\n\t\tthis.points.forEach(e => {\n\t\t\tthis.updatePoint(e, delta, pos);\n\t\t\tpointsVectors = pointsVectors.concat(e.getPosition());\n\t\t});\n\n\t\t// Bind new particle points\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, this.pointBuffer);\n\t\tgl.bufferData(\n\t\t\tgl.ARRAY_BUFFER,\n\t\t\tnew Float32Array(pointsVectors),\n\t\t\tgl.DYNAMIC_DRAW\n\t\t);\n\t}", "addNewParticles (dt) {\n this.emitters.forEach((emitter) => {\n for (var i = 0; i < emitter.emitNumber(dt); ++i) {\n var particle = this.popRecycle()\n if (particle) {\n emitter.emitParticle(particle)\n }\n }\n })\n }", "function updateParticles(item){\n console.log(item);\n if (!Number.isInteger(item.value)){\n item.value = Math.floor(item.value);\n }\n numParticles = item.value;\n}", "function refreshParticleSpawn() {\n\tvar spawn = $(\"#spawnSlider\").slider(\"value\");\n\t$(\"#spawnLabel\").text(spawn);\n\t\n\tparticle_spawn = (100 - spawn) / 1000;\n\t\n\tReloadWebGL();\n}", "function injector () {\n for (var i = 0; i < 100; i++) {\n genParticle([i*Math.random()*10, 400],[1,0.1], [0,0], 0, 1, 10, true, \"#F54836\");\n }\n}", "function addParticle() {\n numParticles += 1;\n \n var x = 1-2*Math.random();\n var y = 1-2*Math.random();\n var z = 1-2*Math.random();\n \n pParticles.push([x,y,z]);\n \n var vx = 3 - Math.random() * 6;\n var vy = 3 - Math.random() * 6;\n var vz = 3 - Math.random() * 6;\n vParticles.push([vx,vy,vz]);\n \n var s = 0.04 + Math.random() * 0.02;\n sParticles.push(s);\n \n //random material color\n var R = Math.random();\n var G = Math.random();\n var B = Math.random();\n cParticles.push([R,G,B]);\n \n console.log([x,y,z], s, 1-s);\n}", "function evolve() {\n particles.forEach(function(particle, i) {\n if (particle.age >= settings.maxParticleAge) {\n particles.splice(i, 1);\n particle = createParticle(Math.floor(rand(0, settings.maxParticleAge/2))); // respawn\n particles.push(particle);\n }\n var x = particle.x;\n var y = particle.y;\n var uv = grid(x, y);\n var u = uv[0];\n var v = uv[1];\n var xt = x + u;\n var yt = y + v;\n particle.age += 1;\n particle.xt = xt;\n particle.yt = yt;\n });\n }", "function DemoOne(){\n\t\n\t// Get a specific element or create a new one\n\tvar target_div = document.getElementById(\"demo-one\");\n\t// Create a function which returns a random number based on target div width. Will be used as particles init position\n\tvar random_n = function(){ return (Math.random()*target_div.offsetWidth);};\n\t\n\t// Create a new particle system. \n\tvar new_system = new ParticleSystem({syslifetime:0, lifetime: 1000, burstrate: 100, burstamount: 1, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinitsize:{x:32, y:32},endsize:{x:12, y:12}, texture: \"http://stranz.info/public/h5ps/img/star.png\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinitpos: {x:random_n, y: 0}, velocity:{x:0, y:100}, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trotation:{start:0, end:180}, target: target_div});\n\t\n\t// Get the demo display element and show the particle count\n\tvar display_div = document.getElementById(\"display-demo-one\");\n\tsetInterval( function(){ display_div.innerHTML = \"Shower | Particle Count: \"+ new_system.particles.length;}, 100);\n}", "function addParticle(){\n var x = Math.floor(Math.random() * cW)+1;\n var y = Math.floor(Math.random() * cH)+1;\n var size = Math.floor(Math.random() * 5)/particle.size+1;;\n particles.push({'x':x,'y':y,'size':size});\n }", "function update_particle() {\n\n //Loops through all of the particles in the array\n for (i = 0; i < particles.length; i++) {\n\n //Sets this variable to the current particle so we can refer to the particle easier.\n var p = particles[i];\n\n //If the particle's X and Y coordinates are within the bounds of the canvas...\n if (p.x >= 0 && p.x < canvas_width && p.y >= 0 && p.y < canvas_height) {\n\n /*\n These lines divide the X and Y values by the size of each cell. This number is\n then parsed to a whole number to determine which grid cell the particle is above.\n */\n var col = parseInt(p.x / resolution);\n var row = parseInt(p.y / resolution);\n\n //Same as above, store reference to cell\n var cell_data = vec_cells[col][row];\n \n /*\n These values are percentages. They represent the percentage of the distance across\n the cell (for each axis) that the particle is positioned. To give an example, if \n the particle is directly in the center of the cell, these values would both be \"0.5\"\n\n The modulus operator (%) is used to get the remainder from dividing the particle's \n coordinates by the resolution value. This number can only be smaller than the \n resolution, so we divide it by the resolution to get the percentage.\n */\n var ax = (p.x % resolution) / resolution;\n var ay = (p.y % resolution) / resolution;\n \n /*\n These lines subtract the decimal from 1 to reverse it (e.g. 100% - 75% = 25%), multiply \n that value by the cell's velocity, and then by 0.05 to greatly reduce the overall change in velocity \n per frame (this slows down the movement). Then they add that value to the particle's velocity\n in each axis. This is done so that the change in velocity is incrementally made as the\n particle reaches the end of it's path across the cell.\n */\n p.xv += (1 - ax) * cell_data.xv * 0.05;\n p.yv += (1 - ay) * cell_data.yv * 0.05;\n \n /*\n These next four lines are are pretty much the same, except the neighboring cell's \n velocities are being used to affect the particle's movement. If you were to comment\n them out, the particles would begin grouping at the boundary between cells because\n the neighboring cells wouldn't be able to pull the particle into their boundaries.\n */\n p.xv += ax * cell_data.right.xv * 0.05;\n p.yv += ax * cell_data.right.yv * 0.05;\n \n p.xv += ay * cell_data.down.xv * 0.05;\n p.yv += ay * cell_data.down.yv * 0.05;\n \n //This adds the calculated velocity to the position coordinates of the particle.\n p.x += p.xv;\n p.y += p.yv;\n \n //For each axis, this gets the distance between the old position of the particle and it's new position.\n var dx = p.px - p.x;\n var dy = p.py - p.y;\n\n //Using the Pythagorean theorum (A^2 + B^2 = C^2), this determines the distance the particle travelled.\n var dist = Math.sqrt(dx * dx + dy * dy);\n \n //This line generates a random value between 0 and 0.5\n var limit = Math.random() * 0.5;\n \n //If the distance the particle has travelled this frame is greater than the random value...\n if (dist > limit) {\n ctx.lineWidth = 1;\n ctx.beginPath(); //Begin a new path on the canvas\n ctx.moveTo(p.x, p.y); //Move the drawing cursor to the starting point\n ctx.lineTo(p.px, p.py); //Describe a line from the particle's old coordinates to the new ones\n ctx.stroke(); //Draw the path to the canvas\n }else{\n //If the particle hasn't moved further than the random limit...\n\n ctx.beginPath();\n ctx.moveTo(p.x, p.y);\n\n /*\n Describe a line from the particle's current coordinates to those same coordinates \n plus the random value. This is what creates the shimmering effect while the particles\n aren't moving.\n */\n ctx.lineTo(p.x + limit, p.y + limit);\n\n ctx.stroke();\n }\n \n //This updates the previous X and Y coordinates of the particle to the new ones for the next loop.\n p.px = p.x;\n p.py = p.y;\n }\n else {\n //If the particle's X and Y coordinates are outside the bounds of the canvas...\n\n //Place the particle at a random location on the canvas\n p.x = p.px = Math.random() * canvas_width;\n p.y = p.py = Math.random() * canvas_height;\n\n //Set the particles velocity to zero.\n p.xv = 0;\n p.yv = 0;\n }\n \n //These lines divide the particle's velocity in half everytime it loops, slowing them over time.\n // p.xv *= 0.02;\n\t\t\t// p.yv *= 0.02;\n\t\t\t\n\t\t\tp.xv *= 0.1;\n p.yv *= 0.1;\n }\n }", "update() {\n\t\tfor (var particleObj in this.particles) {\n\t\t\tthis.particles[particleObj].update();\n\t\t\tif (this.particles[particleObj].dead()) {\t\t\t\n\t\t\t\tthis.remove(particleObj);\n\t\t\t}\n\t\t}\n\t}", "update()\n\t {\n\t\tthis.vel.add(this.acc);\n\t\tthis.vel.limit(this.maxspeed)\n\t\tthis.pos.add(this.vel);\n\t\tthis.acc.mult(0);\n\t\t\n\t\tfor (var i = 0; i < particles.length; i++) \n\t\t{\n\t\t\tif (dist(this.pos.x, this.pos.y, particles[i].pos.x, particles[i].pos.y) < 20) \n\t\t\t{\n\t\t\t\tvar mouse = createVector(particles[i].pos.x, particles[i].pos.y); ///deviates if two particles are too close \n\t\t\t\tmouse.sub(this.pos);\n\t\t\t\tmouse.setMag(0.1);\n\t\t\t\tmouse.mult(-1);\n\t\t\t\tthis.applyForce(mouse);\n\t\t\t}\n\t\t}\n\t}", "function update(){\n particles = particles.filter(function(p) { return p.move() })\n // Recreate particles\n if(time_to_recreate){\n if(particles.length < init_num){ popolate(1); console.log(\"Ricreo\") }\n }\n clear();\n requestAnimationFrame(update.bind(this))\n}", "function ParticleEmitter() {\n\tthis.mName = \"\"; // the unique name of this emitter within the system\n\tthis.mPos = new Vec2(0, 0); // the relative position of this emitter to the system\n\t\n\tthis.mParticleShape = null; // the sprite or shape of the particles that this emitter creates\n\t\n\t// the emission shape\n\tthis.mShape = new Array();\n\t\n\t// the shape and related attributes of the particle\n\tthis.mParticleShape = \"\";\n\t\n\t// \n\tthis.mRotationMin = 0;\n\tthis.mRotationMax = 0;\n\tthis.mRotationChange = 0;\n\t\n\t// \n\tthis.mScaleMin = 1;\n\tthis.mScaleMax = 1;\n\tthis.mScaleChange = 0;\n\t\n\tthis.mColourStart = \"#FFFFFF\";\n\tthis.mColourEnd = \"#FFFFFF\";\n\t\n\tthis.mNumParts = 1; // the number of particles created each burst\n\t\n\t// the minimum and maximum initial speed and the acceleration of the particle\n\tthis.mSpeedMin = 0;\n\tthis.mSpeedMax = 0;\n\tthis.mSpeedChange = 0;\n\t\n\t// the minimum and maximum initial direction and the rate of change of direction of the particle\n\tthis.mDirectionMin = 0;\n\tthis.mDirectionMax = 360;\n\tthis.mDirectionChange = 0;\n\t\n\t// the magnitude of the gravity and the direction (90 is down [!] fix) of the particle\n\tthis.mGravity = 0;\n\tthis.mGravityDir = 90;\n\t\n\t// the minimum and maximum time in seconds that the particle remains active\n\tthis.mLifetimeMin = 0;\n\tthis.mLifetimeMax = 0;\n\t\n\tthis.mTimer = 0; // the timer used for spawning particles\n\tthis.mSpawnLimit = 0; // the time limit for each spawn\n}", "updateLength() {\n this._len = tempVec3.sub(this.p1, this.p0).len();\n }", "iterateParticles(now, lastIteration){\n if (lastIteration === 0 ){\n return;\n }\n\n Object.keys(this.particles).forEach((id) => {\n const particle = this.particles[id];\n\n this.applyForces(particle, now, lastIteration);\n\n let travelX = (particle.velocityX / 1000) * (now - lastIteration);\n let travelY = (particle.velocityY / 1000) * (now - lastIteration);\n particle.posX += travelX;\n particle.posY += travelY;\n });\n\n this.checkParticleBoundaries();\n\n if (this.maxParticles != Object.keys(this.particles).length){\n this.makeParticles(this.maxParticles - Object.keys(this.particles).length);\n }\n }", "function update() {\n particles = particles.filter(function (p) {return p.move();});\n // Recreate particles\n if (time_to_recreate) {\n if (particles.length < init_num) {popolate(1);console.log(\"Ricreo\");}\n }\n clear();\n requestAnimationFrame(update.bind(this));\n}", "countFrames() {\nreturn this.fCount;\n}", "function ParticleGenerator(count, tick, pos, col, speed, fade, radius) {\n\n // Required for a mesh.\n this.vertices = [];\n this.edges = [];\n this.faces = [];\n this.type = \"particle\";\n\n // If null is returned, the bounding box is skipped.\n this.updateBoundingBox = function() { return null; } \n\n // Mesh transformation functions.\n this.translate = function(v) { this.position = this.position.add(v); }\n this.scale = function(scalar) { this.position = this.position.scale(scalar); }\n this.rotateX = function(angle) { this.position = this.position.rotateX(angle); }\n this.rotateY = function(angle) { this.position = this.position.rotateY(angle); }\n this.rotateZ = function(angle) { this.position = this.position.rotateZ(angle); }\n\n this.toOrigin = function () {\n this.oldPosition = this.position;\n var v = new Vec3(0).subtract(this.position);\n this.translate(v);\n }\n this.toOldPosition = function() {\n this.translate(this.oldPosition);\n }\n\n // ------------------------------------------------------------------------------------\n\n // Create a dummy face, because we want to add that face to the depth buffer\n // to approximate the distance. There are simply too many particles too \n // solve a square root for, to get the distance, and show everything properly.\n this.vertices.push(pos);\n this.faces.push(new Face([0], new Vec4(0)));\n\n // How quickly a particle fades away. (Between [0, 1])\n this.fade = fade;\n\n // The amount of particles that are created each tick.\n this.tick = tick;\n\n // List with the particles that are alive.\n this.particles = [];\n\n // The total amout of partices that are allowed to be created.\n this.particleCount = count;\n\n // The position of newly created particle.\n this.position = pos;\n\n // The color for the newly created particle.\n this.color = col;\n\n // Changes the size of the randomly generated direction vector. \n this.speed = speed;\n\n // Changes how far the particles starts from the generator.\n this.radius = radius;\n\n // Update and create new particles every tick. Requires a \n // <vec2> to generate random values for the direction vector.\n this.generate = function(st) {\n\n // Move and fade all the particles.\n for(var i=0; i < this.particles.length; i++) {\n\n var p = this.particles[i];\n\n // Advance the particle into the direction.\n this.particles[i].position = p.position.add(p.direction);\n\n // Fade out the particle.\n this.particles[i].alpha *= this.fade;\n }\n\n // Remove particles that are too dim.\n this.particles = this.particles.filter(function(p) { return p.alpha > 0.15; });\n\n // Add new particles.\n if(this.particles.length < this.particleCount) {\n\n for(var i=0; i < this.tick; i++) {\n\n // Create a random XYZ vector (it points somewhere)\n var x = random( st.add(new Vec2(0.01 + 0.0134324*i)) );\n var y = random( st.add(new Vec2(0.02 + 0.0345435*i)) );\n var z = random( st.add(new Vec2(0.03 + 0.0654654*i)) );\n\n // Random direction vector of the particle.\n var v = new Vec3(x,y,z).subtract(0.5).scale(2).scale(speed);\n\n // Create a new particle at the position of the generator which\n // is pointing in a random direction.\n var particle = new Particle(this.position.add(v.scale(this.radius)), v, this.color, 1 );\n this.particles.push(particle);\n }\n }\n }\n}", "update()\n {\n ctx.fillStyle = this.color;\n\n //collision detection will show you how close enough the particles for the mouse to start interacting\n let dx = mouse.x - this.x;\n let dy = mouse.y - this.y;\n let distance = Math.sqrt(dx * dx + dy * dy);\n\n //You will know how fast it pushed in y axis and x axis, it shows the direction of movement.\n let forceDirectionX = dx / distance;\n let forceDirectionY = dy / distance;\n\n //max distance, past that the force will be 0\n var maxDistance = 100;\n let force = (maxDistance - distance) / maxDistance;\n if (force < 0) force = 0;\n\n //This will slow the particles a little bit\n let directionX = (forceDirectionX * force * this.density * 1);\n let directionY = (forceDirectionY * force * this.density * 1);\n\n //collision detection where they will be travelling back to their original position \n if (distance < mouse.radius + this.size) \n {\n this.x -= directionX;\n this.y -= directionY;\n }\n\n else\n {\n if (this.x !== this.baseX)\n {\n let dx = this.x - this.baseX;\n this.x -= dx/20;\n }\n\n if (this.y !== this.baseY)\n {\n let dy = this.y - this.baseY;\n this.y -= dy/20;\n }\n }\n\n this.draw()\n\n }", "static FirstUnusedParticle(Particles)\n {\n // TODO: This can be made way better by keeping track of the last used.\n for (let X = 0; X < Particles.length; ++X)\n {\n if (Particles[X].life <= 0.0)\n {\n return X;\n }\n }\n }", "function end_PSys(sX, sY, num)\n{\n // the data - lots of particles\n this.particles = [];\n for (var i=0; i < num; i++) \n {\n this.particles.push(new end_Particle(sX, sY));\n }\n \n // function defining what to do each frame\n this.run = function() \n {\n for (var i=0; i < this.particles.length; i++) \n {\n //update each particle per frame\n this.particles[i].updateP();\n this.particles[i].renderP();\n }\n }\n}", "updateParticle(){\n //let distance from the center \n let distance = Math.sqrt(\n ((this.x - r1X) * (this.x - r1X)) \n + ((this.y - r1Y) * (this.y - r1Y))\n )\n if (distance > 150){\n this.color = particleColor\n }\n let distance2 = Math.sqrt(\n ((this.x - r2X) * (this.x - r2X))\n + ((this.y - r2Y) * (this.y - r2Y))\n )\n if(distance2 > 135 && distance >=150){\n this.color = particleColorAlfa\n this.x = 350\n this.y = 350\n }\n //move particle\n this.x += this.directionX \n this.y += this.directionY *2\n // draw particle\n this.draw();\n }", "function createParticles(){\n // Draw the frame in the drawing canvas\n drawingCtx.drawImage(frames[currentFrame],0,0);\n var idata = drawingCtx.getImageData(0, 0, frameWidth, frameHeight);\n var buffer32 = new Uint32Array(idata.data.buffer);\n\n // Check for black pixels\n for (var y = 0; y < frameHeight; y += frameGrid) {\n for (var x = 0; x < frameWidth; x += frameGrid) {\n if (buffer32[y * frameWidth + x]) {\n // frameSize will make frame bigger but also increasingly move it away so we also have to offset coordinates\n // with the formulas to ensure it stays centered on the origin\n particlesArray.push(new Particle(origin.x + (x-frameWidth/2)*frameSize, origin.y + (y-frameWidth/2)*frameSize));\n }\n }\n }\n drawingCtx.clearRect(0, 0, frameWidth, frameHeight);\n}", "setup(maxParticlesCount, position, minSpeed, maxSpeed, direction, size, particleStartSize, particleEndSize, particleLifetime, startColor, endColor)\n {\n this.position = position;\n this.direction = direction.normalize();\n this.maxSpeed = maxSpeed;\n this.minSpeed = minSpeed;\n this.size = size;\n this.particlesCount = maxParticlesCount;\n //for particles\n this.startSize = particleStartSize;\n this.endSize = particleEndSize;\n\n this.particleLifetime = particleLifetime;\n\n this.startColor = startColor;\n this.endColor = endColor;\n\n for(var i = 0; i < this.particlesCount; ++i)\n {\n var item = new ParticleSystemItem();\n\n\n if (this.randomSize)\n {\n var newSize = createVector(0,0);\n newSize.x = random(this.startSize.x, this.endSize.x);\n newSize.y = newSize.x;\n\n item.startSize = newSize;\n item.endSize = newSize;\n }\n else {\n item.startSize = this.startSize;\n item.endSize = this.endSize;\n\n }\n\n item.lifeTime = this.particleLifetime;\n item.lifeTimer = 0.0;\n\n item.pos.x = this.position.x + random(-size.x, size.x);\n item.pos.y = this.position.y + random(-size.y, size.y);\n\n var newSpeed = createVector(0,0);\n\n if (!this.randomDirection)\n {\n p5.Vector.mult(this.direction, random(this.minSpeed, this.maxSpeed), newSpeed);\n }\n else\n {\n var newdir = createVector(0,0);\n newdir.x = random(-this.size.x, this.size.x);\n newdir.y = random(-this.size.y, this.size.y);\n newdir.normalize();\n\n p5.Vector.mult(newdir, random(this.minSpeed, this.maxSpeed), newSpeed);\n\n }\n\n item.speed = newSpeed;\n\n item.startColor = this.startColor;\n item.endColor = this.endColor;\n\n item.isActive = this.isActive;\n\n this.counter += 1;\n if(this.counter > this.particlesCount)\n {\n this.counter = 0;\n }\n item.delay = this.counter * random(0.0, item.lifeTime / this.particlesCount);\n\n this.particles.push(item);\n\n\n\n }\n }", "function Particle(x, y) {\n this.pos = createVector(x, y);\n this.vel = createVector(0, 0);\n this.acc = createVector(0, 0);\n this.a = 255;\n this.val = sin(frameCount*10)*random(10,30);\n this.rand = this.val*3 +1;\n\n this.addForce = function(force) {\n this.acc.add(force);\n }\n\n this.checkEdges = function() {\n\n // Left edge\n if (this.pos.x < 0){\n this.vel.x = Math.abs(this.vel.x);\n }\n\n // Bottom\n if (this.pos.y > height){\n this.vel.y = -Math.abs(this.vel.y);\n }\n\n // right edge\n if (this.pos.x > width){\n var normalisedY = this.pos.y / height;\n send(IP_VOISIN, { y: normalisedY});\n\n // enlever\n var index = particles.indexOf(this);\n particles.splice(index, 1);\n\n }\n\n }\n\n this.update = function() {\n this.vel = this.vel.add(this.acc);\n\n this.pos.add(this.vel);\n this.acc.mult(0);\n\n this.checkEdges();\n }\n\n this.createDot = function() {\n noStroke();\n fill(245, 65, 35, this.a);\n ellipse(this.pos.x, this.pos.y, this.val, this.val);\n ellipse(this.pos.x, this.pos.y, this.val, this.val);\n\n }\n\n this.createAura = function() {\n\n fill(0, 152, 216,this.a*.05);\n strokeWeight(.5);\n stroke(0, 152, 216,this.a);\n ellipse(this.pos.x, this.pos.y, this.val*10, this.val*10);\n\n }\n\n this.createCircles = function() {\n push();\n strokeWeight(.5);\n stroke(11, 53, 54,this.a);\n noFill();\n var rand = random(5,10);\n ellipse(this.pos.x, this.pos.y,rand*this.val,rand*this.val);\n }\n\n\n this.alpha = function () {\n\n this.a -= .1;\n }\n\n this.wiggle = function() {\n\n this.pos.x = random(this.pos.x-30, this.pos.x+30);\n this.pos.y = random(this.pos.y-this.rand, this.pos.y+this.rand);\n }\n\n\n this.isOut = function() {\n if (this.pos.x > width || this.pos.y > height){\n return true;\n }\n return false;\n }\n\n this.evolving = function() {\n\n var k = random(.7,1.3);\n\n this.val *=k;\n }\n\n}", "function update() {\n clear();\n connection();\n particles = particles.filter(function(p) {\n return p.move();\n });\n requestAnimationFrame(update.bind(this));\n}", "get numberOfInputs() {\n if (isDefined(this.input)) {\n if (isAudioParam(this.input) || this.input instanceof Param) {\n return 1;\n }\n else {\n return this.input.numberOfInputs;\n }\n }\n else {\n return 0;\n }\n }", "CreateParticles()\n {\n \n\n this.particles = this.scene.add.particles('dust');\n\n let cuerpo = this.body;\n let emmiter = this.particles.createEmitter({\n frames: [{key: 'dust', frame: 0}],\n speed: {\n onEmit: function ()\n {\n return cuerpo.speed;\n }\n },\n lifespan: { min: 100, max: 1000 },\n alpha: {\n onEmit: function (particle, key, t, value)\n {\n return Phaser.Math.Percent(cuerpo.speed, 0, 300) * 1300;\n }\n },\n scale: { start: 0, end: 1.0 },\n rotate: {start: 0, end: 60},\n frequency: 40,\n // blendMode: 'ADD'\n });\n emmiter.startFollow(this, 0, this.y*0.04);\n }", "function updateParticles(particles) {\r\n for (let i = 0; i < particles.length; i++) {\r\n let curpart = particles[i];\r\n // particle collision detection\r\n for (let j = 0; j < particles.length; j++) {\r\n if (j === i) {continue;}\r\n let dist = getDistance(curpart.x, curpart.y, particles[j].x, particles[j].y);\r\n if (dist < (curpart.radius + particles[j].radius)) {\r\n particleBounce(curpart, particles[j]);\r\n }\r\n }\r\n // wall collision detection\r\n if (curpart.x <= curpart.radius || curpart.x >= canvas.width - curpart.radius) {\r\n curpart.velocity.x = -curpart.velocity.x;\r\n }\r\n if (curpart.y <= curpart.radius || curpart.y >= canvas.height - curpart.radius) {\r\n curpart.velocity.y = -curpart.velocity.y;\r\n }\r\n // mouse collision detection\r\n if (getDistance(mouse.x, mouse.y, curpart.x, curpart.y) <= 200 && curpart.opacity < 0.3) {\r\n curpart.opacity += 0.02;\r\n }\r\n else if (getDistance(mouse.x, mouse.y, curpart.x, curpart.y) > 200 && curpart.opacity > 0) {\r\n curpart.opacity = 0;\r\n }\r\n // update position from velocity\r\n curpart.x += curpart.velocity.x;\r\n curpart.y += curpart.velocity.y;\r\n // draw the particle\r\n curpart.draw();\r\n }\r\n}", "function updateStar() {\n\tlet starCount = 0;\n\tfor(star of allStars) {\n\t\tif(star.hidden === false) {\n\t\t\tstarCount++;\n\t\t}\n\t}\n\treturn starCount;\n}", "function onUpdate() {\n const paragraph = this.target.firstElementChild;\n paragraph.textContent = numberOfUpdates++;\n }", "function update() {\n /*$.post(\"url\", {'iteration':iteration}, function(newPosition){\n updateParticles(newPosition);\n },\"text\");*/\n updateParticles(null);\n // and render the scene from the perspective of the camera\n render();\n iteration++;\n }", "function updateAndDrawParticules(delta) {\n for (var i = 0; i < particles.length; i++) {\n var particle = particles[i];\n\n particle.update(delta);\n if (particle.idP == 1) {\n particle.draw(ctx, Vaisseau1.angle);\n\n } else {\n particle.draw(ctx);\n }\n }\n}", "createCircle() {\n const particle = [];\n\n for (let i = 0; i < this.numParticles; i++) {\n const color = this.colors[~~(Particles.rand(0, this.colors.length))];\n\n particle[i] = {\n radius: Particles.rand(this.minRadius, this.maxRadius),\n xPos: Particles.rand(0, this.canvas.width),\n yPos: Particles.rand(0, this.canvas.height),\n xVelocity: Particles.rand(this.minSpeed, this.maxSpeed),\n yVelocity: Particles.rand(this.minSpeed, this.maxSpeed),\n color: 'rgba(' + color + ',' + Particles.rand(this.minOpacity, this.maxOpacity) + ')'\n }\n\n //once values are determined, draw particle on canvas\n this.draw(particle, i);\n }\n //...and once drawn, animate the particle\n this.animate(particle);\n }", "function particle() {\n for (var i=0; i<50; i++) {\n var dir = new THREE.Vector3(2*Math.random()-1, Math.random()*4, 2*Math.random()-1);\n dir.multiplyScalar(6/dir.length());\n var color = (Math.random() > 0.5) ? 0x333333 : 0x666666;\n var p = new Particle(obj.position, dir, color, 0.1);\n p.maxLife = 3;\n }\n\n /*\n j += 1;\n if (j < 5) {\n setTimeout(particle, 1);\n }\n */\n }", "count() {\n let c = 0;\n\n if (this.players.p1 !== undefined) {\n c++;\n }\n if (this.players.p2 !== undefined) {\n c++;\n }\n\n return c;\n }", "function addParticle(position, velocity){\n P.push(position); V.push(velocity);\n numParticles++; \n }", "function update_particles(now) {\n [].forEach.call(PARTICLES.childNodes, function (p) {\n if (now > p.ttl) {\n PARTICLES.removeChild(p);\n } else {\n p.h += p.dh;\n p.setAttribute(\"cx\", p.h * Math.cos(p.t));\n p.setAttribute(\"cy\", p.h * Math.sin(p.t));\n p.setAttribute(\"x\", p.h * Math.cos(p.t));\n p.setAttribute(\"y\", p.h * Math.sin(p.t));\n }\n });\n }", "function init()\n{\n particlesArray = [];\n let nombreDeParticles = (canvas.height * canvas.width) / 9000;\n for (let i = 0; i < nombreDeParticles; i++)\n {\n let taille = (Math.random() * 5) + 1;\n let x = (Math.random() * ((innerWidth - taille * 2) - (taille * 2)) + taille * 2);\n let y = (Math.random() * ((innerHeight - taille * 2) - (taille * 2)) + taille * 2);\n let directionX = (Math.random() * 5) - 2.5;\n let directionY = (Math.random() * 5) - 2.5;\n let color = '#2EAD24';\n\n particlesArray.push(new Particle(x, y, directionX, directionY, taille, color));\n }\n}", "update() {\n\t\tlet dx = mouse.x - this.x;\n\t\tlet dy = mouse.y - this.y;\n\t\t// distance between mouse and particle ()= hypotenuse 直径三角形の斜辺)\n\t\tlet distance = Math.sqrt(dx * dx + dy * dy); // Math.sqrt calculates returns the square root of a number\n\n\t\tlet forceDirectionX = dx / distance;\n\t\tlet forceDirectionY = dy / distance;\n\n\t\tlet maxDistance = mouse.radius; // to be converted to a range of 1 to 0 so that it can be used to move particles in proportions to its current distance from the mouse\n\t\tlet force = (maxDistance - distance) / maxDistance; // calculates which proportion of max distance it is (from a range of 1 to 0) so that particle slows down as it moves closer to the mouse\n\n\t\t// combine all factors that play a role in particle's movement\n\t\tlet directionX = forceDirectionX * force * this.density;\n\t\tlet directionY = forceDirectionY * force * this.density;\n\n\t\t// if particle is within the mouse radius, they move away from the mouse\n\t\tif (distance < mouse.radius) {\n\t\t\t// as particles move away from mouse, they change as directed by directionX & Y\n\t\t\tthis.x -= directionX; // - : move away, + : move forwards\n\t\t\tthis.y -= directionY;\n\t\t} else {\n\t\t\t// once particle moves far enough from mouse, they go back to its original location\n\t\t\tif (this.x != this.baseX) {\n\t\t\t\tlet dx = this.x - this.baseX; // distance between moved particle and its initial location\n\t\t\t\tthis.x -= dx / 10; // everytime the func runs, each particle moves closer to where it initially was\n\t\t\t}\n\t\t\tif (this.y != this.baseY) {\n\t\t\t\tlet dy = this.y - this.baseY;\n\t\t\t\tthis.y -= dy / 10; // dividing by 10 makes the movement slow\n\t\t\t}\n\t\t}\n\t}", "function numberOfComponents() {\n return count;\n }", "function updateParticles () {\n updateAccelerations();\n for (var i = 0; i < particles.length; i++) {\n var particle = particles[i];\n particle.v = calcVelocity(particle.v, particle.a);\n \n //boundary conditions (edges of browser window)\n if (particle.pos[X] < 0 + padding) {\n particle.v[X] *= -1;\n }\n if (particle.pos[X] > width - padding) {\n particle.v[X] *= -1;\n }\n if (particle.pos[Y] < 0 + padding) {\n particle.v[Y] *= -1;\n }\n if (particle.pos[Y] > height - padding) {\n particle.v[Y] *= -1;\n }\n var speed = Math.sqrt(Math.pow(particle.v[X], 2) + Math.pow(particle.v[Y], 2))\n\n var speedToLimitRatio = speed/atomicSpeedLimit;\n if (speedToLimitRatio > 1) {\n particle.v[X] *= (1/speedToLimitRatio)\n particle.v[Y] *= (1/speedToLimitRatio)\n }\n if (Math.abs(particle.v[Y]) > atomicSpeedLimit) {\n if (particle.v[Y] > 0)\n particle.v[Y] = atomicSpeedLimit;\n else\n particle.v[Y] = -atomicSpeedLimit;\n }\n if (Math.abs(particle.v[X]) > atomicSpeedLimit) {\n if (particle.v[X] > 0)\n particle.v[X] = atomicSpeedLimit;\n else\n particle.v[X] = -atomicSpeedLimit;\n }\n\n particle.pos = calcPosition(particle.pos, particle.v);\n }\n}", "updateShootingStarParticle(particle) {\n let x = particle.getPosition().x;\n let y = particle.getPosition().y;\n if (particle.behaviouralProperties.shootingStarProperties.active) {\n x = x - particle.behaviouralProperties.shootingStarProperties.speed;\n y = y + particle.behaviouralProperties.shootingStarProperties.speed;\n if (x + particle.behaviouralProperties.shootingStarProperties.length < 0 || y - particle.behaviouralProperties.shootingStarProperties.length >= this.ctx.canvas.height) {\n // Reset the shooting star\n x = (Math.random() * this.ctx.canvas.width * 2);\n y = 0;\n particle.behaviouralProperties.shootingStarProperties = this.createShootingStarProperties();\n }\n } else if (particle.behaviouralProperties.shootingStarProperties.waitTime < new Date().getTime()) {\n // Set particle active after the wait-time is over\n particle.behaviouralProperties.shootingStarProperties.active = true;\n }\n particle.setLifeTime(particle.getLifeTime() + 1);\n particle.setPosition({ x, y });\n }", "function update() {\n for (i = 0; i < particles.length; i++) {\n var p = particles[i];\n\n // Update \n p.vx += p.ax / FPS;\n p.vy += p.ay / FPS;\n p.x += p.vx / FPS;\n p.y += p.vy / FPS\n // Setting Bounds in frame\n if ((p.x - p.radius) < 0) {\n p.x = p.radius;\n p.vx = -p.vx;\n }\n if ((p.x + p.radius) > canvas.width) {\n p.x = canvas.width - p.radius;\n p.vx = -p.vx;\n }\n if ((p.y - p.radius) < 0) {\n p.y = p.radius;\n p.vy = -p.vy;\n }\n if ((p.y + p.radius) > canvas.height) {\n p.y = canvas.height - p.radius;\n p.vy = -p.vy;\n }\n }\n}", "function updateNumberOfParticipants(delta) {\n //when the user is alone we don't show the number of participants\n if(numberOfContacts === 0) {\n $(\"#numberOfParticipants\").text('');\n numberOfContacts += delta;\n } else if(numberOfContacts !== 0 && !ContactList.isVisible()) {\n setVisualNotification(true);\n numberOfContacts += delta;\n $(\"#numberOfParticipants\").text(numberOfContacts);\n }\n }", "checkParticleBoundaries(){\n const particlesToRemove = [];\n Object.keys(this.particles).forEach( (id) => {\n const particle = this.particles[id];\n // if particle is out of bounds, add to particles to remove array\n if ( particle.posX > this.canvasWidth\n || particle.posX < 0\n || particle.posY > this.canvasHeight\n || particle.posY < 0\n ) {\n particlesToRemove.push(id);\n }\n });\n\n if (particlesToRemove.length > 0){\n\n particlesToRemove.forEach((id) => {\n // We're checking if the total particles exceed the max particles.\n // If the total particles exeeds max particles, we delete the particle\n // entry in the object. Otherwise, we just create a new particle\n // and insert it into the old particle's object id. This saves us\n // a little time above with generating a new UUID or running the delete command\n if (Object.keys(this.particles).length > this.maxParticles){\n delete this.particles[id];\n } else {\n this.particles[id] = this.makeRandomParticle();\n }\n });\n }\n }", "function pushParticles() {\n for (let i = 0; i < utils.random(1000, 5000); i++) {\n particles.push({\n x: utils.random(-300, canvas.width + 300),\n y: utils.random(-300, canvas.height + 300),\n s: utils.random(1, 3),\n });\n }\n }", "function init(){\n for (let i = 0; i < numberofParticle; i++ ){\n let size = (Math.random() *5) +2;\n let x = Math.random() * (innerWidth - size * 2) + size;\n let y = Math.random() * (innerHeight - size * 2) + size;\n let color = 'black';\n let weight = 1;\n particleArray.push(new Particle(x, y, size, color, weight));\n }\n}", "function emit(now) {\n // calculate how many new objects to make\n var newObjects = valueWithVariance(script.api.birthrate)*script.api.timeSinceLastUpdate;\n newObjects = Math.floor(newObjects) + ((Math.random() < (newObjects % 1)) ? 1: 0); // decimal portion becomes probability for adding an extra object\n\n // local space\n if (script.api.type == 0) {\n var offset = vec3.zero();\n var target = script.api.parent;\n }\n // world space\n else if (script.api.type == 1) {\n // set root as target (particle parent object)\n var target = global.scene.getRootObject(0);\n // set initial position offset to the parent object's world position relative to the root object\n var offset = script.api.parent.getTransform().getWorldPosition().sub(target.getTransform().getWorldPosition());\n // track parent rotation\n script.api.parentRotOffset = script.api.parent.getTransform().getWorldRotation();\n }\n\n // define functions for setting starting rotation\n var rotFunction = script.api.randomRot ? function(t) { \n t.setLocalRotation(quat.fromEulerAngles(getRandom(0, 2*Math.PI), getRandom(0, 2*Math.PI), getRandom(0, 2*Math.PI))); \n } :\n function(t) {};\n\n // define function for setting starting alpha\n var fadeFunction = (script.api.fade.x > 0) ? function(mat) {\n var color = mat.mainPass.baseColor;\n color.w = 0;\n mat.mainPass.baseColor = color;\n } :\n function(mat) {};\n \n // create new objects based on settings\n for (var i = 0; i < newObjects; i++) {\n // add object to scene\n var nObj = script.api.emitterObject.instantiate(target);\n var nObjT = nObj.getTransform();\n\n // setup details object referenced in the updateParticles function\n var details = {\n obj: nObj,\n position: calculatePosition[script.api.shape]().add(offset),\n speed: calculateSpeed(),\n rotSpeed: calculateRotSpeed(),\n rotOffset: script.api.parentRotOffset,\n scale: [valueWithVariance(script.api.scaleStart), valueWithVariance(script.api.scaleEnd)],\n lifetime: Math.max(valueWithVariance(script.api.lifetime), 30),\n startTime: now,\n friction: 0,\n materials: []\n }\n\n // set position, rotation, scale\n nObjT.setLocalPosition(details.position);\n rotFunction(nObjT);\n nObjT.setLocalScale(vec3.one().uniformScale(details.scale[0]));\n\n // get all materials, set initial alpha value if needed\n if (script.api.fade.x > 0 || script.api.fade.y > 0) {\n getMaterials(details, nObj, fadeFunction);\n if (!details.materials.length) {\n print(\"No materials found - cannot fade in/out\");\n }\n }\n\n // add object to our array\n script.api.objects.push(details);\n }\n}", "addParticle(){\n this.particles.push(new Particle(this.origin.x, this.origin.y));\n }", "function _generateNewParticle() {\n\t\t\treturn new Particle({\n\t\t\t\tx: stage.width * Math.random(),\n\t\t\t\ty: stage.height * Math.random(),\n\t\t\t\tspeed: getRandomWithinRange(options.particle.velocityRange) / stage.pixelRatio,\n\t\t\t\tradius: getRandomWithinRange(options.particle.sizeRange),\n\t\t\t\ttheta: Math.round(Math.random() * 360),\n\t\t\t\tinfluence: options.particle.influence * stage.pixelRatio,\n\t\t\t\tcolor: options.particle.color\n\t\t\t});\n\t\t\t// random number generator within a given range object defined by a max and min property\n\t\t\tfunction getRandomWithinRange(range) {\n\t\t\t\treturn ((range.max - range.min) * Math.random() + range.min) * stage.pixelRatio;\n\t\t\t}\n\t\t}", "function refreshParticleForce() {\n\tvar force = $(\"#forceSlider\").slider(\"value\");\n\t$(\"#forceLabel\").text(force);\n\t\n\tparticle_force = force / 1000;\n\t\n\tReloadWebGL();\n}", "get numVertices() {\n return this._coords.length / 2\n }", "numPoints() { return this._points.length; }", "function tick() {\n requestAnimFrame(tick);\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n\n setupParticles();\n //particleUpdate();\n //for (var i = 0; i < particleNum; i++) {\n draw();\n //}\n //draw();\n \n}", "function process(d) {\n const waveD = getMinMaxAvg(d.wave, true);\n const freqD = getMinMaxAvg(d.freq);\n \n ampWindow.add(waveD.avg); // Keep track of average amplitude over time\n const ampAvg = ampWindow.avg();\n \n for (let p of particles) {\n // Modify particle based on the frequency band it is assigned to\n p.affect(d.freq[p.freq], freqD, ampAvg);\n }\n \n // Increase size with average amplitude\n size += (ampAvg*0.2);\n \n // Reduce size on its own accord\n size -= size*.001;\n \n //console.log(size +' - ' + ampAvg);\n // Slowly migrate to center\n pointerX *= 0.9999;\n pointerY *= 0.9999;\n qualityControl();\n}", "fillParticles() {\n for (let i = 0; i < this.bloodNumber; i++) {\n let bloodParticle = new Particle(this) // creates a new particle object\n bloodParticle.color = '#00ff1050'\n bloodParticle.vector = HelperFunctions.newVector(HelperFunctions.random(HelperFunctions.random(2, -2), HelperFunctions.random(3, -3)), HelperFunctions.random(HelperFunctions.random(3, -3), HelperFunctions.random(2, -2))) // creates a random vector for this specific particle (more randomness more aesthetics)\n this.particles.push(bloodParticle)\n }\n }", "function genParticles (n) {\n particles = [];\n for (var i = 0; i < n; i++) {\n genParticle();\n }\n}", "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 }", "constructor(game, x, y, frame) {\n super(game, x, y, 'snowflakes', frame);\n // super();\n //this.back_emitter;\n this.i=0;\n this.update_interval = 4 * 60;\n this.max=0;\n\n this.back_emitter = game.add.emitter(game.world.centerX, -32, 10000);\n this.back_emitter.makeParticles('snowflakes', [0, 1, 2, 3, 4, 5]);\n this.back_emitter.maxParticleScale = 0.6;\n this.back_emitter.minParticleScale = 0.2;\n this.back_emitter.setYSpeed(20, 100);\n this.back_emitter.gravity = 0;\n this.back_emitter.width = game.world.width * 1.5;\n this.back_emitter.minRotation = 0;\n this.back_emitter.maxRotation = 40;\n\n this.mid_emitter = game.add.emitter(game.world.centerX, -32,10000);\n this.mid_emitter.makeParticles('snowflakes', [0, 1, 2, 3, 4, 5]);\n this.mid_emitter.maxParticleScale = 0.6;\n this.mid_emitter.minParticleScale = 0.4;\n this.mid_emitter.setYSpeed(50, 150);\n this.mid_emitter.gravity = 0;\n this.mid_emitter.width = game.world.width * 1.5;\n this.mid_emitter.minRotation = 0;\n this.mid_emitter.maxRotation = 40;\n\n this.front_emitter = game.add.emitter(game.world.centerX, -32, 10000);\n this.front_emitter.makeParticles('snowflakes_large', [0, 1, 2, 3, 4, 5]);\n this.front_emitter.maxParticleScale = 0.4;\n this.front_emitter.minParticleScale = 0.2;\n this.front_emitter.setYSpeed(100, 200);\n this.front_emitter.gravity = 0;\n this.front_emitter.width = game.world.width * 1.5;\n this.front_emitter.minRotation = 0;\n this.front_emitter.maxRotation = 40;\n\n\n this.changeWindDirection();\n\n this.back_emitter.start(false, 14000,5);\n this.mid_emitter.start(false, 12000,5);\n this.front_emitter.start(false, 6000,5);\n }", "async getTotalFrames() {\r\n return this.lottieAnimation.totalFrames;\r\n }", "update() {\n this.steps += 1;\n }", "function Generator(x, y)\n {\n function Particle(x, y)\n {\n this.alive = true;\n this._age = 0;\n this._lifespan = Util.randomInt(spl.random.minLife, spl.random.maxLife);\n\n var vel = Util.randomInt(spl.random.minVel, spl.random.maxVel);\n var angle = Math.random()*Math.PI * 2;\n\n\n this.velx = vel*Math.cos(angle);\n this.vely = vel*Math.sin(angle);\n if(Math.random() <= 0.5){\n this.velx *= -1;\n }\n if(Math.random() <= 0.5){\n this.vely *= -1;\n }\n var rad = Util.randomInt(spl.random.minRad, spl.random.maxRad);\n this.shape = Shapes.circle(rad, x, y, Color.random());\n\n this.draw = this.shape.draw;\n this.update = function(canvas, loop)\n {\n this._age += loop.time;\n if(this._age > this._lifespan) { this.alive = false; }\n else \n {\n this.shape.x += this.velx * loop.time/1000;\n this.shape.y += this.vely * loop.time/1000;\n }\n }\n }\n\n this.x = x;\n this.y = y;\n\n //PARTICLE LIST - add random number of particles\n this._particles = [];\n var numParitcles = Util.randomInt(spl.random.minParticles, spl.random.maxParticles);\n for(var i = 0; i < numParitcles; i++)\n {\n this._particles.push(new Particle(x,y));\n }\n \n this.alive = true;\n\n this.draw = function(context, canvas, camera)\n {\n Util.drawList(this._particles, context, canvas, camera);\n }\n\n this.update = function(canvas, loop) {\n Util.updateList(this._particles, canvas, loop);\n }\n }", "get numberOfOutputs() {\n if (isDefined(this.output)) {\n return this.output.numberOfOutputs;\n }\n else {\n return 0;\n }\n }", "get length() {\n return this.points.length;\n }", "getNumSpeaker() {\n return 1;\n }", "init () {\n this.w = this.e.parentElement.clientWidth\n this.h = this.e.parentElement.clientHeight\n this.e.width = this.w\n this.e.height = this.h\n this.count = Math.round(this.w * this.h * this.c.countFactor)\n\n for (let i = 0; i < this.count; i++) {\n this.particles = [...this.particles, ...[{\n x: Math.random() * this.w,\n y: Math.random() * this.h,\n size: Math.ceil(Math.random() * (this.szMax - this.szMin) + this.szMin) * (Math.random()<.1 ? 10 : 1),\n speedX: Math.random() * (this.sp - this.sp / 2),\n speedY: Math.random() * (this.sp - this.sp / 2),\n c: this.getRandomColor(),\n shape: this.getRandomShape(),\n isGlowing: (Math.random() < .9)\n }]]\n }\n }", "function render() {\n framecount++;\n updateTime();\n\n deltaT = updateDeltaT(deltaT, lastFrameTime);\n var uiElements = getUIElemements();\n uiControlUpdate(uiElements);\n\n if (resetParticles) {\n var newPositions = generateFloat32Randoms(particleResolution[0], particleResolution[1], 4, -0.5, 0.5);\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, particlePonger.getCurrent('particles'));\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, // x offset\n 0, // y offset\n particleResolution[0], particleResolution[1], gl.RGBA, gl.FLOAT, newPositions);\n\n var newParticleMomentums = new Float32Array(particleResolution[0] * particleResolution[1] * 4);\n for (var i = 0; i < newParticleMomentums.length; i += 4) {\n newParticleMomentums.set(particleResetVectorFields[resetParticlesWith](newPositions[i], newPositions[i + 1]), i);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, particlePonger.getCurrent('particleMomentums'));\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, // x offset\n 0, // y offset\n particleResolution[0], particleResolution[1], gl.RGBA, gl.FLOAT, newParticleMomentums);\n gl.bindTexture(gl.TEXTURE_2D, null);\n\n resetParticles = false;\n }\n\n if (!paused) {\n\n if (physicsMethod == physicsMethods.splat) {\n var forceSplatUniforms = {\n resolution: particleResolution,\n rCoefficient: rCoefficient,\n particleIdLimit: particleCount\n };\n\n rpForceSplat.encode(gl, forceSplatUniforms, {\n framebuffer: forceSplatFbo,\n particles: particlePonger.getCurrent('particles'),\n particleCount: particleCount\n });\n }\n\n var particleUniforms = {\n resolution: particleResolution,\n fieldResolution: renderResolution,\n randomSeed: makeIntRandomUniforms(),\n particleSpeed: particleSpeed,\n deltaTime: deltaT,\n physicsMethod: physicsMethod,\n spaceType: spaceType\n };\n\n rpParticles.encode(gl, particleUniforms, {\n framebuffer: particlePonger.getCurrentFbo(),\n particleRandoms: particlePonger.getCurrent('particleRandoms'),\n particles: particlePonger.getCurrent('particles'),\n particleMomentums: particlePonger.getCurrent('particleMomentums'),\n particleForceSplat: forceSplatTexture,\n repelField: fieldPonger.getCurrent('repelField')\n });\n\n particlePonger.increment();\n }\n\n var fieldsUniforms = {\n resolution: renderResolution,\n fieldSize: fieldSize,\n rCoefficient: rCoefficient,\n deferGradientCalc: deferGradientCalc,\n circularFieldEffect: circularFieldEffect,\n forceCalcInGlPointSpace: forceCalcInGlPointSpace,\n fieldMinFactor: fieldMinFactor\n };\n\n rpFields.encode(gl, fieldsUniforms, {\n framebuffer: fieldPonger.getCurrentFbo(),\n particles: particlePonger.getCurrent('particles'),\n particleCount: particleCount\n });\n\n fieldPonger.increment();\n\n var gradientTexture;\n if (deferGradientCalc) {\n var gradientsUniforms = {\n resolution: renderResolution\n };\n\n rpGradients.encode(gl, gradientsUniforms, {\n framebuffer: gradientPonger.getCurrentFbo(),\n repelField: fieldPonger.getCurrent('repelField')\n });\n\n gradientTexture = gradientPonger.getNext('repelFieldGradient');\n } else {\n gradientTexture = fieldPonger.getCurrent('repelFieldGradient');\n }\n gradientPonger.increment();\n\n var renderFieldsUniforms = {\n resolution: renderResolution,\n rCoefficient: rCoefficient,\n fractRenderValues: fractRenderValues,\n scaleRenderValues: scaleRenderValues,\n renderMagnitude: renderMagnitude,\n maxFieldLines: maxFieldLines,\n renderTexture: renderTexture,\n audioColorShiftEnabled: audioColorShiftEnabled,\n audioColorShift: audioColorShift\n };\n\n var renderFieldsOptions = {\n framebuffer: null,\n repelField: fieldPonger.getCurrent('repelField'),\n repelFieldGradient: gradientTexture\n };\n\n rpRenderFields.encode(gl, renderFieldsUniforms, renderFieldsOptions);\n\n // update aggregate values & line plots\n if (!paused) {\n if (simulationTime - lastAggregateTime > 100) {\n\n var reducedAggregates = mipReducer.reduce(gl, {}, {\n MomentumSum: particlePonger.getCurrent('particles'),\n MomentumMinMax: particlePonger.getCurrent('particles'),\n quad: anyQuad\n });\n\n var instantaneousFps = 1000 / deltaT[0];\n var averageMomentum = reducedAggregates['MomentumSum'][2];\n\n document.getElementById('stats-fps-label').innerText = `${Math.trunc(instantaneousFps)} FPS`;\n\n linePlots['momentum'].plot.push([simulationTime, averageMomentum]);\n //linePlots['force'].plot.push([simulationTime, Math.random()/2]);\n linePlots['fps'].plot.push([simulationTime, instantaneousFps]);\n }\n }\n\n for (var k of Object.keys(linePlots)) {\n if (linePlots[k].enabled) {\n linePlots[k].plot.encodeTransform(gl, {\n resolution: renderResolution\n });\n linePlots[k].plot.encode(gl, {\n resolution: renderResolution,\n beforeEncode: (context, plot) => {\n context.bindFramebuffer(context.DRAW_FRAMEBUFFER, null);\n context.blendFunc(context.ONE, context.ZERO);\n }\n });\n }\n }\n\n requestAnimationFrame(render);\n }", "get count() {\n return this.materials.length;\n }", "function renderLifeBarUpdateLogic () {\n lifeUpdateDelta++;\n \n if (lifeUpdateDelta >= SI.res.ResourceLoader.getResources().game.properties.HUDLifeUpdateMaxDelta) {\n lifeUpdateDelta = 0;\n \n if (lifeWidth != lifeFinalWidth) {\n if (lifeWidth < lifeFinalWidth) {\n lifeWidth += SI.res.ResourceLoader.getResources().game.properties.HUDLifeUpdateSpeed;\n \n if (lifeWidth > lifeFinalWidth) {\n lifeWidth = lifeFinalWidth;\n }\n } else {\n lifeWidth -= SI.res.ResourceLoader.getResources().game.properties.HUDLifeUpdateSpeed;\n \n if (lifeWidth < lifeFinalWidth) {\n lifeWidth = lifeFinalWidth;\n }\n }\n \n if (lifeWidth == 0 && typeof emptyLifeListener == 'function') {\n emptyLifeListener();\n }\n }\n }\n }", "count() {\n return this.arrayWidth * this.arrayHeight;\n }" ]
[ "0.7439256", "0.7022058", "0.68520135", "0.65556526", "0.6116611", "0.60867524", "0.5939136", "0.5939136", "0.58768815", "0.5853858", "0.58373976", "0.58214146", "0.5809813", "0.5725983", "0.57245016", "0.5706586", "0.56491756", "0.5634998", "0.56282353", "0.561305", "0.55981874", "0.55355364", "0.55282986", "0.5526171", "0.55178446", "0.5517289", "0.54720384", "0.54519254", "0.54369605", "0.54317385", "0.5420325", "0.5418295", "0.538974", "0.53761655", "0.53692317", "0.5355655", "0.5343198", "0.5337577", "0.53247404", "0.5320686", "0.53162754", "0.5315298", "0.5299889", "0.5294827", "0.52614516", "0.52587676", "0.5253133", "0.5243936", "0.5242421", "0.5240003", "0.52303374", "0.5218044", "0.5215271", "0.5214715", "0.52050745", "0.51995003", "0.51951605", "0.51950884", "0.51894647", "0.5188158", "0.5180971", "0.5153321", "0.51518613", "0.51418084", "0.51406", "0.5132401", "0.5124053", "0.51237655", "0.5116217", "0.51127917", "0.51082647", "0.5106489", "0.5099639", "0.5093957", "0.50886065", "0.50868595", "0.50732076", "0.5052366", "0.5050666", "0.5048925", "0.504514", "0.50339186", "0.5033326", "0.5032109", "0.503208", "0.5029459", "0.50239384", "0.5020527", "0.50173277", "0.49937505", "0.49925643", "0.49918506", "0.4990569", "0.49871895", "0.4986604", "0.49859235", "0.49856514", "0.49811924", "0.4980347", "0.49801835" ]
0.57880217
13
Method PUT Endpoint /api/updatetask/:taskid
function updateTask (req, res) { const { newIndex } = req.body; const tasks = Task .find({}) .exec((err, tasks) => { return tasks.map(task => { if (task.creator === req.params.uid) { task.orderIndex = newIndex; task.save(); } }); }); res.json({tasks}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTask(task) {\n return $http.put(url, task)\n\t\t.then(function successCallback (res){\n\t return res.data;\n\t }, function errorCallback(error) {\n console.log('ERRRRR');\n \tconsole.log(error);\n \t});\n }", "function updateTask(task, id){\n API.updateTask(task, id)\n .then(()=>{\n getTasks();\n }).catch();\n }", "function updateTask(req, res){\n\tlet id=req.query.id;\n\tconsole.log('******', id);\n\tconsole.log(req.body);\n\n\tTodoList.findByIdAndUpdate(id,{taskName: req.body.taskName, category: req.body.category, dueDate: req.body.dueDate}, function(err, toDoList){\n\t\tif(err){\n\t\t\tconsole.log('Error in updating contact');\n\t\t\treturn;\n\t\t}\n\t\treturn res.redirect('/');\n\t});\n\n}", "updateTask(task) {\n return instance.put('todo-lists/tasks', task);\n }", "function updateTask(taskId, task) {\n return TaskModel.update({\n _id: taskId\n }, {\n name: task.name,\n description: task.description,\n dueDate: task.dueDate,\n completed: task.completed\n });\n }", "function Update(id, task, response) {\n\t\"use strict\";\n\tmongoClient.connect(connectionString, function (err, db) {\n\t\tif (err) {\n\t\t\tconsole.log('Connection Failed. Error: ', err);\n\t\t} else {\n\t\t\tvar idNumber = parseInt(id);\n\t\t\tif (idNumber) {\n\t\t\t\tdb.collection(TASKS_COLLECTION).updateOne({\n\t\t\t\t\t\tid: idNumber\n\t\t\t\t\t}, {\n\t\t\t\t\t\t$set: task\n\t\t\t\t\t},\n\t\t\t\t\tfunction (err, result) {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tresponse.status(500).send(err.message);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (result && result.result.n > 0) {\n\t\t\t\t\t\t\t\t//A task was finished\n\t\t\t\t\t\t\t\tresponse.status(200).send(\"Task updated\");\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//No task were deleted, which means that there's no task with this id.\n\t\t\t\t\t\t\t\tresponse.status(404).send(\"Task not found\");\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} else {\n\t\t\t\tresponse.status(404).send(\"Id must be a number\");\n\t\t\t}\n\t\t\tdb.close();\n\t\t}\n\t});\n}", "async updateTask(id, complete) {\n const res = await fetch(`/tasks/${id}`, {\n method: \"PUT\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ complete: !complete }),\n });\n if (res.ok) return;\n else throw new Error(\"Something went wrong\");\n }", "function updateTask(taskId) {\n var Task = mongoose.model('Task');\n Task.update(\n { _id: taskId }, // id can be changed in your case\n { description: 'Paint the bikeshed green.' },\n { multi: false },\n function (err, rows_updated) {\n if (err) throw err;\n console.log('Updated.');\n searchTask(); // verify update task\n }\n );\n}", "function updateTaskOnAPI(id, isCompleted) {\n let endpoint = '/tasks/' + id + '/update';\n executeHTTPRequest(isCompleted, 'PUT', endpoint)\n}", "function updateTask(e){ \n e.preventDefault();\n const taskTitle = document.querySelector('.task-title').value;\n const taskID = document.getElementById('id').value;\n if(taskTitle.trim()=== ''){\n ui.showAlertMessage('Please enter valid information','alert alert-danger');\n }else{\n const updatedTask = {\n title : taskTitle,\n complete: false,\n }\n http\n .update(`http://localhost:3000/Tasks/${taskID}`, updatedTask)\n .then(task => {\n //clearing form field\n ui.clearFiled();\n //showing message\n ui.showAlertMessage('Task updated successfully','alert alert-success');\n //getting data\n getTasks();\n });\n }\n}", "updateTask(task) {\n document.querySelector('#InputTaskName').value = task[0].name;\n document.querySelector('#InputTaskDescription').value = task[0].description;\n document.querySelector('#duedate').value = task[0].dueDate;\n document.querySelector('#assigned-name').value = task[0].assignedTo;\n document.querySelector('#task-status').value = task[0].status;\n document.forms.todoform.stars.value = task[0].rating;\n }", "editTask(id, task) {\n\t\tlet tasks = this.getAndParse('tasks');\n\t\tconst idx = tasks.findIndex(task => task.id === id);\n\t\ttasks[idx].newTask = task;\n\t\tthis.stringifyAndSet(tasks, 'tasks');\n\t}", "updateTask(task, callback) {\n var response, params;\n var db = this.db;\n var tableName = this.tableName;\n\n //GetItem to make sure it's an update\n params = {\n TableName: tableName,\n Key: {\n taskId: task.taskId\n }\n };\n\n db.getItem(params, function (err, data) {\n if (err) {\n callback(err, null);\n } else {\n if (!data.Item) {\n response = {\n statusCode: 404,\n body: JSON.stringify({\n message: 'Task not found'\n }),\n };\n callback(null, response);\n } else {\n //Item found, now update\n var newTask = mergeTasks(data.Item, task);\n\n var validateMsg = validateTask(newTask);\n\n if (validateMsg) {\n response = {\n statusCode: 405,\n body: validateMsg\n };\n callback(null, response);\n return;\n }\n\n if (!newTask.completed) {\n delete newTask.completed;\n }\n\n var putParams = {\n Item: newTask,\n TableName: tableName\n };\n\n db.putItem(putParams, function (err, data) {\n if (err) {\n callback(err, null);\n } else {\n response = {\n statusCode: 200,\n body: JSON.stringify({\n message: data\n }),\n };\n callback(null, response);\n }\n });\n }\n }\n });\n return;\n }", "function updateTask(task, rawResponseCallback = null, refresh = false) {\n writeTask(task, \"PATCH\", rawResponseCallback, refresh);\n}", "async function updateTask(e) {\n // Get the ID of the task\n const taskId = e.target.id;\n\n // Find the task from the array\n const task = tasks.find(t => t._id === taskId);\n // If no task is found (shouldn't happen), just return\n if (!task) return;\n // Toggle completed status\n task.completed = !task.completed;\n\n // Get the label for the task, which contains the string\n // We find this by using nextSibling\n // It is next to the checkbox, which is in e.target\n const taskLabel = e.target.nextSibling;\n // Set the class for the task based on completed status\n taskLabel.className = task.completed ? 'completed' : '';\n // Call the server to save the changes\n await fetch(\n `/api/tasks/${taskId}`, // URL of the API\n {\n method: 'PUT', // method to modify items\n body: JSON.stringify(task), // put task in body\n headers: {\n 'Content-Type': 'application/json' // indicate return type of JSON\n }\n }\n );\n}", "update(id: number, title: string, description: string) {\n return axios\n .put<{}, { id: number }>('/tasks/' + id, { title: title, description: description })\n .then((response) => response.data.id);\n }", "function updateTask(doc, res, updateParams) {\n if (updateParams.name) {\n doc.name = updateParams.name\n }\n if (updateParams.description) {\n doc.description = updateParams.description;\n }\n if (updateParams.deadline) {\n doc.deadline = updateParams.deadline;\n }\n if (typeof updateParams.completed !== 'undefined') {\n doc.completed = updateParams.completed;\n }\n if (updateParams.assignedUser || typeof updateParams.assignedUser !== 'undefined') {\n doc.assignedUser = updateParams.assignedUser;\n }\n if (updateParams.assignedUserName) {\n doc.assignedUserName = updateParams.assignedUserName;\n }\n \n saveAndRespond(doc, 'Task was updated.', res);\n}", "update(task) {\n return db\n .collection('tasks')\n .doc(task.id)\n .update({\n // id: task.id,\n ...task,\n })\n .then(() => {\n console.log('Document updated'); // Document updated\n this.load();\n })\n .catch((error) => {\n console.error('Error updating doc', error);\n });\n }", "function updateTask(id, changes){\n\t$.ajax({\n method: 'PUT',\n url: baseUrl + \"/todo/\" + id,\n data: JSON.stringify(changes),\n\tcontentType: \"application/json\",\n\tdataType: \"json\"\n }).then(ajaxSuccess, ajaxFail);\n}", "edit_task(task_id) {\n this.task_to_change = task_id;\n console.log(\"EDIT ? : \", task_id);\n }", "EditTask(idTask, newParams) {\n return this.$http.get(`http://localhost:3000/tasks/${idTask}`).then((response) => {\n const db = response.data;\n \n Object.assign(db, newParams);\n\n return this.$http.put(`http://localhost:3000/tasks/${idTask}`, JSON.stringify(db));\n });\n }", "async function updateTask(task){\n const sql = 'UPDATE tasks SET status = ?, changes = ? WHERE id_task = ?';\n return await conn.query(sql, [task.status,task.changes,task.id_task], function (err, result) { return result; });\n}", "function updateTaskStage(team_id, task_id, new_stage_id){\n fetch(`/tasks/api/${team_id}/${task_id}/update-task-stage/`,\n {\n method: 'PATCH',\n mode: 'same-origin',\n body: JSON.stringify({stage: `${new_stage_id}`}),\n headers: {\n 'Content-type': 'application/json; charset=UTF-8',\n 'X-CSRFToken': csrftoken\n }\n }).then(response => response.json())\n}", "function updateTask(updateIds,updatedtask) {\n const path = \"/tasks/\"+updateIds;\n axios.patch(path,updatedtask)\n .then(res => {\n console.log(res.data);\n dispatch(turnoffeditmode(false));\n const value = tasks;\n const updatedarray = value.map(task => {\n if (task.Id === updateIds){\n return updatedtask;\n }\n else return task;\n });\n setTasks(updatedarray);\n })\n .catch(err => {\n console.log(err);\n })\n }", "function updateTask(id, taskid, options, callback) {\n let updateableFields = ['parents', 'name', 'done']; //TODO: Originates should be in the list of user task ids\n let changed = false;\n Task.findById(taskid, (err, task) => {\n if (err) {\n callback(err);\n }\n else {\n if (task.owner == id) {\n Object.keys(options).forEach((key) => {\n if (updateableFields.includes(key)) {\n task[key] = options[key];\n changed = true;\n }\n });\n\n if (changed) {\n task.save(callback);\n }\n else{\n callback(\"done\", null);\n }\n }\n else {\n callback(\"Not found\")\n }\n }\n })\n}", "update(request, response) {\n console.log('request stuff', request.params, request.body);\n Resttask.findByIdAndUpdate(request.params._id, request.body, { new: true })\n .then(task => response.json(task))\n .catch(error => response.json(error));\n }", "handleEditTask (task_id, new_task_name) {\n this.model.editTask(task_id, new_task_name);\n }", "async putTask() {\n try {\n if (!this.ctx.params.id) {\n this.ctx.body = new Rep({\n code: 40000,\n msg: \"the param 'id' is invalid\",\n })\n } else if (!this.ctx.request.body.name) {\n this.ctx.body = new Rep({\n code: 40000,\n msg: \"the body param 'name' is invalid\",\n })\n } else {\n let res = await this.ctx.service.mrquery.putSearchTaskName(\n this.ctx.params.id,\n this.ctx.request.body.name\n )\n let response = new Rep({\n code: 50000,\n data: res.rowsAffected[0],\n })\n if (response.data === 1) response.code = 200\n this.ctx.body = response\n }\n } catch (error) {\n this.ctx.body = new Rep({ code: 50000, msg: error.message })\n }\n }", "function editTask(e){\n ui.showEidtState();\n const id = e.target.parentElement.id.split('-')[1];\n http\n .get(`http://localhost:3000/Tasks/${id}`)\n .then(data => {\n ui.fillForm(data);\n });\n}", "function updateTask(worker, task) {\n if (task != null) {\n task = datastore.updateTask(task);\n worker.port.emit(\"TaskUpdated\", task);\n }\n}", "function editTask(req, res){\n\n\tlet id=req.query.id\n\tTodoList.find({}, function(err,toDoList){\n\t\tif(err){\n\t\t\tconsole.log('Error in editing task');\n\t\t\treturn\n\t\t}\n\t\treturn res.render('home', {\n\t\t\ttitle: \"Home\",\n\t\t\tTask_List: toDoList,\n\t\t\ttaskId: id\n\t\t});\n\t})\n\n}", "async function changeDoing(_id) {\n await axios.put('http://localhost:3000/task', { _id });\n print();\n}", "function changeTask(event) {\n event.preventDefault();\n const key = Number(event.target.getAttribute(\"data-id\"));\n const title = document.querySelector(\"#editTitle\").value;\n const description = document.querySelector(\"#editDescription\").value;\n const task = {title, description, key};\n const form = document.querySelector(\"#task-edit\")\n const transaction = database.saveChanges(task, () => form.reset());\n transaction.oncomplete = () => {\n closeModal();\n console.log(\"Task edited successfully!\");\n showTasks();\n }\n }", "editTask({ commit }, newTask) {\n db.collection('tasks')\n .doc({ id: newTask.id })\n .update({ title: newTask.title, date: newTask.date })\n .then(() => commit('getTasks'))\n }", "function editTask(id, url){\n\t\t\t\n\t\t\t//CHECK IF EMPTY, DONT PROCEED\n\t\t\tif(id === '' || url === ''){\n\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\treturn;\n\t\t\t}\t\n\t\t\t\n\t\t\t$( \"#load\" ).show();\n\n\t\t\tvar dataString = { \n\t\t\t\tid : id\n\t\t\t};\t\t\t\t\n\t\t\t$.ajax({\n\t\t\t\t\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: baseurl+\"\"+url,\n\t\t\t\tdata: dataString,\n\t\t\t\tdataType: \"json\",\n\t\t\t\tcache : false,\n\t\t\t\tsuccess: function(data){\n\n\t\t\t\t\tif(data.success == true){\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\n\t\t\t\t\t\t//populate the hidden fields\n\t\t\t\t\t\t$(\"#taskID\").val(data.id);\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(\"#task_name\").val(data.name);\n\t\t\t\t\t\t$(\"#task_description\").val(data.description);\n\t\t\t\t\t\t$(\"#task_completed\").val(data.completed);\n\t\t\t\t\t\t$(\"#date_due\").val(data.edit_date_due);\n\t\t\t\t\t\t$(\"#category\").val(data.category);\n\t\t\t\t\t\t$(\"#updateURL\").val(data.edit_url);\n\t\t\t\t\t\t$(\".btn-add\").addClass('hidden');\n\t\t\t\t\t\t$(\".btn-update\").removeClass('hidden');\n\t\t\t\t\t\t\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\"#errors\").html('Errors!');\n\t\t\t\t\t} \t \n\t \n\t\t\t\t},error: function(xhr, status, error) {\n\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\talert(error);\n\t\t\t\t},\n\n\t\t\t});\t\t\t\t\t\t\t\t\n\t\t}", "async function updateToDo(req, res) {\n await Todo.findByIdAndUpdate(req.params.id, req.body, {\n new: true\n }, function (err, todo) {\n res.json(todo);\n\n })\n}", "function updateTask(success, error, communitySlug, taskId, updateData) {\n\tdebug('update task');\n\n\tvar taskDao = getTaskDao.call(this)\n\t\t, eventbus = this.app.get('eventbus')\n\t\t, self = this\n\t\t, taskIsFulfilled\n\t\t, updatedTaskIsFulfilled\n\n\t\t/* AnonymousFunction: forwardError\n\t\t * Forwards an error object using the error callback argument\n\t\t */\n\t\t, forwardError = function forwardError(err) {\n\t\t\tdebug('forward error');\n\t\t\treturn error(err);\n\t\t}\n\n\t\t/* AnonymousFunction: forwardError\n\t\t * After searching the task matching the one from the input parameter,\n\t\t * this function ensures that all necessary data is saved to the\n\t\t * database.\n\t\t */\n\t\t, afterTaskSearch = function afterTaskSearch(task) {\n\t\t\tdebug('after task search');\n\n\t\t\tif(!task) {\n\t\t\t\tforwardError(new errors.NotFoundError('Task with id ' + taskId +\n\t\t\t\t\t'does not exist.'));\n\t\t\t}\n\n\t\t\ttaskIsFulfilled = task.isFulfilled();\n\n\t\t\ttask.name = updateData.name || task.name;\n\t\t\ttask.description = updateData.description || task.description;\n\t\t\ttask.reward = updateData.reward || task.reward;\n\t\t\ttask.fulfilledAt = updateData.fulfilledAt || task.fulfilledAt;\n\t\t\ttask.dueDate = updateData.dueDate || task.dueDate;\n\t\t\ttask.updatedAt = new Date();\n\t\t\ttask.fulfillorId = updateData.fulfillorId || task.fulfillorId;\n\n\t\t\tupdatedTaskIsFulfilled = task.isFulfilled();\n\n\t\t\ttask.save()\n\t\t\t\t.success(afterTaskSave)\n\t\t\t\t.error(forwardError);\n\t\t}\n\n\t\t/* AnonymousFunction: afterTaskSave\n\t\t * Emits a \"task:updated\" event and calls the success callback argument.\n\t\t */\n\t\t, afterTaskSave = function afterTaskSave(task) {\n\t\t\tdebug('after task save');\n\n\t\t\tvar taskData = task.dataValues;\n\n\t\t\teventbus.emit('task:updated', taskData);\n\t\t\tif(!taskIsFulfilled && updatedTaskIsFulfilled) {\n\t\t\t\teventbus.emit('task:done', self.req.user, task);\n\t\t\t}\n\n\t\t\tsuccess(taskData);\n\t\t};\n\n\ttaskDao.find({ where: { id: taskId }})\n\t\t.success(afterTaskSearch)\n\t\t.error(forwardError);\n}", "function updateTask(){\n\t\t\t\n\t\t\tvar form = new FormData(document.getElementById('taskForm'));\n\t\t\t\n\t\t\t//var validate_url = $('#taskForm').attr('action');\n\t\t\tvar validate_url = $(\"#updateURL\").val();\n\t\t\t\n\t\t\t$.ajax({\n\t\t\t\ttype: \"POST\",\n\t\t\t\turl: validate_url,\n\t\t\t\t//data: form,\n\t\t\t\tdata: form,\n\t\t\t\t//data: dataString,\n\t\t\t\tdataType: \"json\",\n\t\t\t\tcache : false,\n\t\t\t\tcontentType: false,\n\t\t\t\tprocessData: false,\n\t\t\t\t\n\t\t\t\tsuccess: function(data){\n\t\t\t\t\t\n\t\t\t\t\tif(data.success == true){\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\"#taskModal\").modal('hide');\n\t\t\t\t\t\t\n\t\t\t\t\t\t//clear all fields\n\t\t\t\t\t\t$(\"#taskID\").val('');\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(\"#task_name\").val('');\n\t\t\t\t\t\t$(\"#task_description\").val('');\n\t\t\t\t\t\t$(\"#task_completed\").val('');\n\t\t\t\t\t\t$(\"#date_due\").val('');\n\t\t\t\t\t\t$(\"#category\").val('');\n\t\t\t\t\t\t$(\"#updateURL\").val('');\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(\".notif\").html(data.notif);\n\t\t\t\t\t\t\n\t\t\t\t\t\tsetTimeout(function() { \n\t\t\t\t\t\t\t$(\".notif\").slideUp({ opacity: \"hide\" }, \"slow\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\twindow.location.reload(true);\n\t\t\t\t\t\t}, 5000);\n\t\t\t\t\t\t\n\t\t\t\t\t}else if(data.success == false){\n\t\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t\t$(\".form_errors\").html(data.notif);\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t},error: function(xhr, status, error) {\n\t\t\t\t\t$( \"#load\" ).hide();\n\t\t\t\t\t$(\".form_errors\").html(error);\n\t\t\t\t},\n\t\t\t});\n\t\t\t\t\t\t\n\t\t}", "async function editTodo(req, res) {\n await Todo.findByIdAndUpdate(req.params.id, req.body);\n show(req, res);\n}", "function post_update_task ( name, description, finish_date, task_id ){\n\n $.ajax({\n url: \"/task/update/\"+task_id+\"/\",\n method:\"POST\",\n data: {\n 'name': name,\n 'description':description,\n 'finish_date':finish_date\n },\n dataType: 'json',\n success: function (data) {\n approve_appear(\"Changes saved \");\n }\n });\n\n\n\n}", "editTaskCaller(id) {\n fetch('http://localhost:9000/task/:id', {\n method: 'GET',\n headers: { \"Content-Type\": \"application/json\" }\n }).then(function (response) {\n return response.json()\n });\n }", "function editTask(id) {\n const updatedTasks = tasks.filter((task) => task.taskId !== id);\n const taskToEdit = tasks.filter((task) => task.taskId === id);\n\n setTaskContent(taskToEdit[0].content);\n setTasks(updatedTasks);\n }", "function updateTodo() {\n axios\n .patch(`https://jsonplaceholder.typicode.com/todos/1`, {\n title: \"Replacing Todo using PUT\",\n completed: true\n })\n .then(res => showOutput(res))\n .catch(err => console.error(err));\n}", "function edit_task(_task_id) {\n if(typeof(_task_id) != 'undefined'){\n taskid = _task_id;\n }\n\n $.get(admin_url + 'tasks/task/'+taskid,function(response){\n $('#_task').html(response)\n $('body').find('#_task_modal').modal('show');\n });\n}", "function editTask(id, newName) {\n const editedTaskList = tasks.map((task) => {\n // if this task has the same ID as the edited task\n if (id === task.id) {\n // Save the new name\n task.title = newName;\n // Update the DB\n todoListService\n .updateTask(id, task)\n .then((response) => console.log(response.data.message))\n .catch((error) => console.error(error));\n return { ...task, title: newName };\n }\n // Return the new updated task\n return task;\n });\n // Set the updated task\n setTasks(editedTaskList);\n }", "updateDB(task, newStatus) {\n const completedTaskKey = task.key;\n // Updated the task status property in that selected object\n task.taskStatus = newStatus;\n // Update that specific object in firebase\n const dbRefComplete = firebase.database().ref(`${this.props.userId}/${completedTaskKey}`);\n dbRefComplete.update(task);\n }", "static async updatePut(req, res, next) {\n try {\n const { title, description, status, due_date } = req.body\n const [count, data] = await ToDo.update(\n { title, description, status, due_date },\n {\n where: {\n id: +req.params.id,\n UserId: +req.decoded.id,\n },\n returning: true,\n }\n )\n if (count === 0) {\n throw { status: 404 }\n } else {\n res.status(200).json(data[0])\n }\n } catch (err) {\n next(err)\n }\n }", "function completedTask(e){\n const taskID = e.target.parentElement.id.split('-')[1];\n http\n .get(`http://localhost:3000/Tasks/${taskID}`)\n .then(data => {\n const updatedTask ={\n title : data.title,\n complete : !data.complete,\n }\n http\n .update(`http://localhost:3000/Tasks/${taskID}`, updatedTask)\n .then(task =>{\n if(task.complete === true){\n ui.showAlertMessage(`${task.title} completed`,'alert alert-info');\n }else{\n ui.showAlertMessage(`${task.title} is incomplete`,'alert alert-secondary');\n }\n getTasks();\n });\n });\n \n}", "updateMyTask(state, { id, taskData }) {\n const index = state.myTasks.findIndex(t => t.id === id);\n\n if (index > -1) {\n state.myTasks[index] = Object.assign({}, state.myTasks[index], taskData);\n }\n }", "function updateTodo(todo) {\n $.ajax({\n method: \"PUT\",\n url: \"/api/todos\",\n data: todo\n }).then(getTodos);\n }", "updateTask() { \r\n\r\n }", "function updateTask(taskid, current, time) {\n\tvar status = $('[name=\\\"'+taskid+'\\\"] > #task-do-form > #task-status');\n\tvar progressbar = $('[name=\\\"'+taskid+'\\\"] > #progressbar > #progressbar-percentage');\n\tvar remaintime = $('[name=\\\"'+taskid+'\\\"] > #remaining-time > #remain-time');\n\n\tif (time<=0) {\n\t\thideElement('[name=\\\"'+taskid+'\\\"]');\n\t}\n\n\tvar progress = Math.floor(current);\n\tif(progress<10) {\n\t\tstatus.html(\"0\"+progress+\"/100% \");\n\t} else {\n\t\tstatus.html(progress+\"/100% \");\n\t}\n\n\tprogressbar.css('width',current+'%');\n\tremaintime.html(time);\n\n}", "function editJson(){\r\n\t\t$http.post('http://localhost:8081/editTask', $scope.task);\r\n\t}", "function updateTask(newTask) {\n let shouldTaskBeDeleted = shouldDeleteTask(newTask);\n if (shouldTaskBeDeleted == false) {\n selectedTask.querySelector('.task-desc').innerHTML = newTask.description;\n\n let taskDueDate = selectedTask.querySelector('.task-dueDate');\n taskDueDate.innerHTML = getDisplayDate(newTask.dueDate);\n if (taskDueDate.innerHTML != \"\") {\n taskDueDate.classList.remove('hidden');\n }\n\n newTask.isToday == true ? selectedTask.dataset.isToday = true : selectedTask.dataset.isToday = false;\n\n let isImportant = selectedTask.querySelector('.important-star');\n newTask.isImportant == true ? isImportant.classList.add('important') : isImportant.classList.remove('important');\n } else {\n deleteTask(selectedTask.id);\n }\n}", "function updateTask(index, newDesc) {\n // gets todos from local storage\n const todos = _store__WEBPACK_IMPORTED_MODULE_0__.default.getTasks();\n // sets new description in respective index\n todos[index].description = newDesc;\n // sets new todos to storage\n _store__WEBPACK_IMPORTED_MODULE_0__.default.setTasks(todos);\n}", "function apiSaveTask(task, successCallBack) {\n var taskForApi = {\n description: task.description,\n task_type: task.task_type,\n supplier: task.supplier,\n date_scheduled: task.date_scheduled,\n slot_order: task.slot_order,\n job: task.job\n };\n\n\n if (task.id) {\n taskForApi.id = task.id;\n dataAPIService.getDataApi(\"/api/\", \"tasks\").updateItem(task.id, taskForApi, function(savedTask) {\n task.id = savedTask.id;\n\n successCallBack(savedTask);\n }, apiError);\n }\n else {\n dataAPIService.getDataApi(\"/api/\", \"tasks\").createItem(taskForApi, function (savedTask) {\n task.id = savedTask.id;\n\n successCallBack(savedTask);\n }, apiError);\n }\n }", "function updateAppointment(id) {\n\tconst url = baseURL + \"/appointment/\" + id;\n\t\t\n\t$.ajax({\n\t\ttype: 'PUT',\n\t\turl: url,\n\t\tcontentType: 'application/json',\n\t\tdata: formToJSON(),\n\t\tsuccess: function(data, textStatus, xhr) {\n\t\t\talert(xhr.responseText);\n\t\t},\n\t\terror: function(xhr, textStatus, errorThrown) {\n\t\t\talert('updateAppointment error: ' + xhr.responseText);\n\t\t}\n\t});\n}", "function updateTask(message) {\r\n\r\n var project = Y.postmile.gpostmile.projects[message.project];\r\n var task = project.tasks[message.task];\r\n Y.assert(task.id === message.task);\r\n\r\n function gotTask(response, myArg) {\r\n\r\n if (response && response._networkRequestStatusCode && response._networkRequestStatusCode === 200) {\r\n\r\n // can't wholesale replace task as there's other fields such as details\r\n // (or repoint task we'd have to go back and repoint other objects and arrays w refs)\r\n task.created = response.modified;\r\n task.modified = response.created;\r\n task.participants = response.participants || [];\r\n Y.assert(!task.project || task.project === response.project);\r\n task.status = response.status;\r\n task.title = response.title;\r\n Y.assert(task.id === response.id);\r\n // leave other fields alone, like task.details\r\n // got to process to get some fields that come with GET TASKS like participantCount and isParticipant\r\n task.participantsCount = task.participants.length;\r\n task.isParticipant = false;\r\n var c, l;\r\n for (/*var*/c = 0, l = task.participants.length; c < l; c++) {\r\n if (task.participants[c] === Y.postmile.gpostmile.profile.id) {\r\n task.isMe = true;\r\n break;\r\n }\r\n }\r\n\r\n if (project.id === Y.postmile.gpostmile.project.id) {\t// it's acticve on the UI\r\n\r\n var tasksNode = Y.one('#tasks');\r\n var taskNode = tasksNode.one('.task[task=\"' + task.id + '\"]');\r\n var html = Y.postmile.templates.taskListHtml(task, taskNode);\r\n taskNode.replace(html);\r\n taskNode = tasksNode.one('.task[task=\"' + task.id + '\"]'); // need to reget the node after replace\r\n Y.postmile.tasklist.showUpdatedAgo(taskNode, true);\r\n Y.fire('postmile:changedBy', 'Task changed', message.by, taskNode);\r\n }\r\n\r\n } else {\r\n\r\n Y.log('error getting task for stream update ' + JSON.stringify(response));\r\n\r\n }\r\n\r\n }\r\n\r\n getJson(\"/task/\" + task.id, gotTask);\r\n\r\n }", "function updateTodo() {\n // id of the todo task\n let id = $(this).closest('div').data('id');\n // This is the current completion status, which is stored as data in the button.\n let completion = $(this).data('completion');\n // If it's null, make it today's date to send over to server side, if it has a date, make it null so it will end up as null on server side.\n if (!completion) {\n completion = date;\n } else {\n completion = null;\n }\n // Route to change the completion status.\n $.ajax({\n method: 'PUT',\n url: `/todos/${id}`,\n data: {\n completion: completion\n }\n }).then(function (response) {\n getTodos();\n console.log('Succesfully Changed Completion Status');\n }).catch(function (error) {\n console.log('Error', error);\n alert('Something bad happened. Try again later.');\n })\n}", "function toggleTaskDone (req, res) {\n const { completed } = req.body; \n \n Task.findByIdAndUpdate(\n req.params.uid,\n { $set: { completed: !completed }},\n { new: true })\n .exec((err, task) => {\n if (err) {\n return res.send(`Task wasn\\'t updated`);\n }\n\n\n\n res.json({\n message: !completed ? `Task marked as completed` : `Task marked as incompleted`,\n task\n });\n });\n}", "function completeTask(task)\n{\n\tvar rel_contacts = [];\n\t$.each(task.contacts, function(index, contact)\n\t{\n\t\tif(contact.id)\n\t\t\trel_contacts.push(contact.id);\n\t\telse\n\t\t\trel_contacts.push(contact);\n\t\t//console.log(contact.id);\n\t});\n\ttask.contacts = rel_contacts;\n\ttask.owner_id = task.taskOwner.id;\n\t//console.log(\"Completed Task\",task);\n\tcrm.updateTask(task, \n\t\tfunction(resp)\n\t\t{\n\t\t\t//console.log(resp);\n\t\t\t$(\"#\"+task.id).css('text-decoration: line-through;');\n\t\t\t$(\"#\"+task.id).data(resp)\n\t\t},\n\t\tfunction(err)\n\t\t{\n\t\t\t//console.log(err);\n\t\t\t//$(\"#task_form\").append('<p class=\"bg-danger\">'+err.responseText+'</p>');\n\t\t});\n}", "function deleteTask(task) {\n const params = new URLSearchParams();\n params.append('id', task.id);\n fetch('/delete-task', {method: 'POST', body: params});\n}", "applyEditTask() {\n let task = get(this, 'task');\n\n get(this, 'saveTask')(task).then((task) => {\n set(this, 'isEditingBody', false);\n this._fetchMentions(task);\n });\n }", "addTask(task, callback) {\n var response;\n var newId = uuid.v1();\n task.taskId = newId;\n\n var validateMsg = validateTask(task);\n\n if (validateMsg) {\n response = {\n statusCode: 405,\n body: validateMsg\n };\n callback(null, response);\n return;\n }\n\n task = sanitizeTask(task);\n\n var params = {\n Item: task,\n TableName: this.tableName\n };\n console.log(JSON.stringify(task));\n this.db.putItem(params, function (err, data) {\n if (err) {\n callback(err, null);\n } else {\n response = {\n statusCode: 200,\n body: JSON.stringify({\n message: task\n }),\n };\n callback(null, response);\n }\n });\n }", "update(TaskItem) {\n let sqlRequest = \"UPDATE taskItem SET \" +\n \"taskId=$taskId, \" +\n \"stateName=$stateName, \" +\n \"dbName=$dbName, \" +\n \"fileName=$fileName \" +\n \"fileSize=$fileSize \" +\n \"status=$status, \" +\n \"startTime=$startTime, \" +\n \"allcount=$allcount, \" +\n \"downloadCount=$downloadCount, \" +\n \"source=$source, \" +\n \"msg=$msg \" +\n \"WHERE id=$id\";\n\n let sqlParams = {\n $taskId: TaskItem.taskId,\n $stateName: TaskItem.stateName,\n $dbName: TaskItem.dbName,\n $fileName: TaskItem.fileName,\n $fileSize: TaskItem.fileSize,\n $status: TaskItem.status,\n $startTime: TaskItem.startTime,\n $allcount: TaskItem.allcount,\n $downloadCount: TaskItem.downloadCount,\n $source: TaskItem.source,\n $msg: TaskItem.msg,\n $id: TaskItem.id\n };\n return this.common.run(sqlRequest, sqlParams);\n }", "async put(req, res) {\n try {\n await Iem.update(req.body, {\n where: { id: req.params.iemId }\n })\n res.send(req.body)\n } catch (err) {\n res.status(500).send({\n error: 'Error updating IEM info'\n })\n }\n }", "function updateTodo(todo) {\n const id = todo.data('id');\n const isDone = !todo.data('completed') ? 1 : 0;\n const updateData = {completed: isDone};\n $.ajax({\n method: 'PUT',\n url: '/api/todos/' + id,\n data: updateData\n })\n .then((updatedTodo) => {\n todo.toggleClass('done');\n todo.data('completed', isDone);\n })\n .catch((err) => {\n console.log(err);\n })\n}", "edit_apply(task_id, taskNewTitle) {\n Tasks\n .update({\n '_id': task_id\n }, {\n $set: {text: taskNewTitle},\n });\n\n\n this.task_to_change = \"\"; // reset input clicked (close input edit)\n }", "function updateTodo(todo) {\n\t//build url for API request\n\tvar updateUrl = '/api/todos/' + todo.data('id');\n\t//pull completed data from jQuery data store and\n\t//negate it (the completed property is added based\n\t//on what's in the db when it's created in the addTodo method)\n\tvar isCompleted = !todo.data('completed');\n\t//package the data for sending the put request\n\tvar updateData = {completed: isCompleted};\n\t$.ajax({\n\t\tmethod: \"PUT\",\n\t\turl: updateUrl,\n\t\tdata: updateData\n\t})\n\t//API sends back updated data on put\n\t.then(function(updateTodo){\n\t\t//toggle whether it's crossed out\n\t\ttodo.toggleClass(\"done\");\n\t\t//the jQuery data store needs to be updated with the negated value\n\t\t//since we're toggling completion\n\t\ttodo.data('completed', isCompleted);\n\t})\n}", "function updateTodo() {\n db.todoList.update(editTodoId, { todo: todoInput.value });\n}", "updateAppointment(id) {\n return axios.put(`/api/appointments/${id}`);\n }", "function updateTaskStatus(src, status) {\n\n // console.log(src.id)\n // console.log(status)\n // console.log(taskid)\n var urlString = window.location.search\n var projectId = window.location.search.slice(1, urlString.length).split('&')[0].split('=')[1]\n\n \n if(!src) {\n console.log(\"Src taskbox not set correctly\")\n return\n }\n \n if(!status) {\n console.log(\"Status was not set correctly\")\n return \n }\n \n var taskid = src.id.split(\"-\")[1]\n\n if(!projectId) {\n console.log(\"ID was not set correctly\")\n return \n }\n\n $.ajax({\n type: 'POST', \n data: {\n 'projectid': projectId, \n 'taskStatus': status,\n 'taskID': taskid\n }, \n url: '../includes/update-task.php' \n })\n .done(function(data) {\n console.log(data)\n })\n .fail(function(data) {\n console.log(data)\n })\n}", "function editTask() {\n vm.task = {};\n jQuery('#editTaskModal').modal('hide');\n }", "function updateTask(row, task)\n{\n // recalculate the task difficulty\n let spoonValList = []\n let spoonKeys = Object.keys(task.spoons);\n for (let i = 0; i < spoonKeys.length; i++)\n {\n spoonValList.push(task.spoons[spoonKeys[i]]);\n }\n const difficulty = setTaskDifficulty(spoonValList);\n task.difficulty = difficulty;\n // recalculate and update points\n const points = assignPoints(spoonValList);\n task.points = points;\n // update the task difficulty box\n const difficultyBox = getDifficultyBox(row);\n const difficultySpan = $(difficultyBox.children()[1]);\n setText(difficultySpan, reverseSpoon(task.difficulty));\n difficultyBox.css(\"background-color\", setSpoonColour(task.difficulty));\n // close the task\n closeTask(row, task);\n}", "function updateTask(taskId, taskStatus) {\n let allTasks = JSON.parse(localStorage.getItem(KEY_TASKS) || \"[]\").map(\n (task) => {\n if (task.id === taskId) {\n console.log(\"found\");\n return { ...task, done: taskStatus };\n }\n return task;\n }\n );\n localStorage.setItem(KEY_TASKS, JSON.stringify(allTasks));\n}", "update(id, title, description) {\n TaskApi.update(id, title, description)\n .then((response) => {\n if (response.data && response.data._id) {\n this.setState((state) => ({\n ...state, todos: state.todos.map(todo =>\n todo._id === response.data._id ?\n { ...response.data, title, description }\n : todo\n )\n }));\n }\n })\n .catch(error => {\n this.setState((state) => ({ ...state, error }));\n });\n }", "async editEmployee(id, newName){\n await axios.put(`http://localhost:3000/employees/${id}`,{name: newName})\n .then((response) => {\n alert(`${newName} updated successfully`);\n }, (error) => {\n console.log(error);\n });\n this.getEmployees();\n }", "async function updateJob(context) {\r\n // Grab the id from the URL (stored in bindingData)\r\n const id = context.bindingData.id;\r\n // Get the task from the body\r\n const package = context.req.body;\r\n const params = id.split(\":\");\r\n if (params[0] === \"jobUserUpdate\") {\r\n // Update the item in the database\r\n const result = await JobModel.updateOne(\r\n { _id: params[1] },\r\n { $set: { users: package } }\r\n );\r\n // Check to ensure an item was modified\r\n if (result.nModified === 1) {\r\n // Updated an item, status 204 (empty update)\r\n context.res.status = 204;\r\n } else {\r\n // Item not found, status 404\r\n context.res.status = 404;\r\n }\r\n } else {\r\n }\r\n}", "async function updateTaskNote(pNote) {\r\n await taskRef.update({note: pNote});\r\n console.log(\"Note of \" + task + \"updated to \" + pNote + \".\");\r\n}", "function editItem(id) {\n\t\t[...todo].map((item) => {\n\t\t\tif (item.id === id) {\n\t\t\t\tfetch(`http://127.0.0.1:3010/tasks/${id}`, {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({ id: item.id, text: editText, completed: item.completed, tag: item.tag, lastMod: new Date().getTime(), displayDate: new Date().toLocaleString(), outOfTime: item.outOfTime, alarm: item.alarm })\n\t\t\t\t}).then((resp) => resp.json())\n\t\t\t\t\t.then((data) => { console.log(data) });\n\t\t\t\twindow.location.reload()\n\n\t\t\t}\n\t\t\treturn item\n\t\t})\n\t\tsetEdit(null)\n\t\tsetEditText('')\n\t}", "async put(req, res) {\n try {\n await Order.update(req.body, {\n where: {\n id: req.params.orderId\n }\n })\n res.send(req.body)\n } catch (err) {\n res.status(500).send({\n error: 'Update order incorrect'\n })\n }\n }", "function editTask(event){\n const header = event.target.parentElement;\n const task = header.parentElement;\n const id = Number(task.getAttribute(\"data-id\"));\n const val = database.getField(id);\n val.onsuccess = () => {\n const {key, title, description} = val.result;\n var editTitle = document.getElementById(\"editTitle\");\n editTitle.setAttribute(\"value\",title);\n\n var editDescription = document.getElementById(\"editDescription\");\n editDescription.innerHTML = description;\n }\n modal.style.display = \"block\";\n var saveChange = document.querySelector(\"#btnsave\");\n saveChange.setAttribute(\"data-id\",id);\n saveChange.onclick = changeTask;\n }", "function updateTodos(){\n axios.patch('https://jsonplaceholder.typicode.com/todos/1',{\n title: 'Updated Todo',\n completed: true\n })\n .then(res => showOutput(res))\n .catch(err => console.error(err));\n}", "function editTask(e) {\n\n // const projectid = document.querySelector('.edit_task_wrapper').getAttribute('data-id');\n const projectid = e.target.closest('.parent_wrapper').getAttribute('data-id');\n const taskid = document.querySelector('.edit_task_wrapper').getAttribute('data-taskid');\n\n\n const task_name = document.querySelector('.edit_name').value;\n const task_description = document.querySelector('.edit_description').value;\n const task_date = document.querySelector('.edit_date').value;\n let edited_priority = '';\n\n if (document.querySelector('.edit_priority1').checked)\n edited_priority = '1';\n else if (document.querySelector('.edit_priority2').checked)\n edited_priority = '2';\n else if (document.querySelector('.edit_priority3').checked)\n edited_priority = '3';\n else if (document.querySelector('.edit_priority4').checked)\n edited_priority = '4';\n\n if (task_name == '' || task_description == '' || task_date == '' || edited_priority == '')\n return;\n\n data.projects[projectid].tasks[taskid]._priority = edited_priority;\n data.projects[projectid].tasks[taskid]._title = task_name\n data.projects[projectid].tasks[taskid]._description = task_description\n data.projects[projectid].tasks[taskid]._date = task_date\n\n\n }", "function modifyTask(bot, message, short_id, commandline, annotate) {\n // add a reaction so the user knows we're working on it\n bot.addReaction(message, 'thinking_face')\n\n const tokens = commandline.split(' ')\n tokens.splice(0, 2)\n const text = tokens.join(' ')\n\n // get a list of all pending tasks\n getTasks(bot, message, message.user, short_id, (err, response, tasks) => {\n // loop over all tasks...\n for (let i = 0; i < tasks.length; i++) {\n const task = tasks[i];\n\n // if this is the task to start/stop\n if (String(task.short_id) === String(short_id)) {\n // create a task object from old task and the user input\n const oldStatus = task.status\n const newTask = taskFunctions.cl2task(text, task, annotate)\n const newStatus = newTask.status\n if (oldStatus !== 'completed' && newStatus === 'completed') {\n completeTask(bot, message, task.short_id)\n } else {\n // get the token for the user\n getIntheamToken(bot, message, message.user, (token) => {\n const settings = prepareAPI(`tasks/${task.id}`, 'PUT', token);\n\n settings.body = newTask;\n\n // call the inthe.am API to add the new task\n apiRequest(bot, message, settings, (apiErr, apiResponse, body) => {\n // remove the reaction again\n bot.removeReaction(message, 'thinking_face')\n\n bot.botkit.log('changed task', message.user);\n const link = `<https://inthe.am/tasks/${body.id}|${body.short_id}>`\n const answerText = `Alright, I've changed task ${link} for you.`\n\n const answer = {\n channel: message.channel,\n as_user: true,\n }\n\n const attachment = {}\n attachment.title = answerText\n attachment.callback_id = task.short_id\n\n const actions = [\n {\n name: 'done',\n text: ':white_check_mark: Done',\n value: 'done',\n type: 'button',\n style: 'primary',\n },\n ]\n\n const startStopButton = {\n type: 'button',\n }\n if (task.start) {\n startStopButton.name = 'stop'\n startStopButton.value = 'stop'\n startStopButton.text = ':stopwatch: Stop'\n } else {\n startStopButton.name = 'start'\n startStopButton.value = 'start'\n startStopButton.text = ':stopwatch: Start'\n }\n actions.push(startStopButton)\n\n actions.push({\n name: 'details',\n text: ':information_source: Details',\n value: 'details',\n type: 'button',\n })\n\n actions.push({\n type: 'button',\n name: 'task',\n value: 'task',\n text: ':exclamation: Top 3',\n })\n\n actions.push({\n type: 'button',\n name: 'list',\n value: 'list',\n text: ':notebook: List',\n })\n\n attachment.actions = actions;\n\n answer.attachments = [attachment];\n\n bot.api.chat.postMessage(answer, (postErr, postResponse) => {\n if (!postErr) {\n // bot.botkit.log('task details sent');\n } else {\n bot.botkit.log('error sending task added message', postResponse, postErr);\n }\n })\n })\n })\n }\n }\n }\n })\n}", "function putUpdate(data){\n $.ajax({\n url: location+'/'+$id,\n type: 'PUT',\n data: data,\n success: function(_data) {\n clearForm();\n updateTableUpdate(_data);\n }\n });\n }", "static async updatePatch(req, res, next) {\n try {\n const { status } = req.body\n const [count, data] = await ToDo.update(\n { status },\n {\n where: {\n id: +req.params.id,\n UserId: +req.decoded.id,\n },\n returning: true,\n }\n )\n if (count === 0) {\n throw { status: 404 }\n } else {\n res.status(200).json(data[0])\n }\n } catch (err) {\n next(err)\n }\n }", "updateinfo(event){\n const url = `http://localhost:3000/update/${this.props.params.id}`\n Axios.put(url, {\n name: this.state.name,\n lsname: this.state.lastname,\n sal: this.state.salary\n })\n .then(res =>{\n console.log(res)})\n .catch(err => {\n console.log(err);\n });\n }", "function changeTaskIsDone(value, category) {\n const {\n id,\n description\n } = value;\n\n switch (category) {\n case \"todo\":\n value.category = \"done\";\n break;\n case \"done\":\n value.category = \"todo\";\n break;\n }\n\n\n $.ajax({\n url: 'api/tasks/' + id,\n dataType: 'json',\n type: 'put',\n contentType: 'application/json',\n data: JSON.stringify({\n \"description\": description,\n \"category\": value.category\n }),\n processData: false,\n success: function (data, textStatus, jQxhr) {\n const {\n id\n } = data;\n $('#taskDiv' + id).remove();\n appendTask(value);\n\n },\n error: function (jqXhr, textStatus, errorThrown) {\n if ('serviceWorker' in navigator && 'SyncManager' in window) {\n navigator.serviceWorker.getRegistration().then(registration => {\n registration.sync.register('newTask');\n idbKeyval.set(`updateTask${id}`, value);\n $('#taskDiv' + id).remove();\n appendTask(value);\n });\n\n notification(successHTML);\n\n } else {\n console.log(errorThrown);\n notification(networkErrorHTML);\n }\n }\n });\n}", "function updateTaskInDatabase (taskKey, complete) {\n firebase.database().ref('tasks/' + taskKey + '/complete/').set('' + complete)\n}", "function editTaskForm(id_task)\n{\n $.ajax({\n type: 'GET',\n url: '/ajaxTest/' + id_task,\n success: function(data) {\n $('#edit-error-bag').hide();\n $('#frmEditTask input[name=edit-task]').val(data.data.task); // data kedua diambil dari response controller\n $('#frmEditTask input[name=edit-description]').val(data.data.description);\n $(\"#frmEditTask input[name=edit-task-id]\").val(data.data.id);\n $('#editTaskModal').modal('show');\n },\n error: function(data) {\n console.log(data);\n }\n });\n}", "function updateTaskDataset(task) {\n\n // Return a Promise to indicate success / failure\n return new Promise((resolve, reject) => {\n let taskGetParams = {\n TableName: 'unfinished_task',\n Key: {\n 'taskId': task.taskId\n }\n }\n docClient.get(taskGetParams, (error, data) => {\n if (!error) {\n \n // Use task and data to update class and progress\n Object.keys(task.class).forEach((className) => {\n data.Item.class[className]++;\n // If class is finished, update task progress\n if (data.Item.class[className] == maxOccurrences) {\n // Update progress\n data.Item.progress.current++;\n }\n });\n \n // TODO: This should never be '>', but what if it is?\n \n // If task is finished, move task from 'unfinished_task' table to 'finished_task' table,\n // and update both 'dataset' tables\n if (data.Item.progress.current == data.Item.progress.total) {\n \n // Create new item in 'finished_task' table\n data.TableName = 'finished_task';\n docClient.put(data, (error, _) => {\n if (error) {\n error.note = 'The put operation for the \\'finished_task\\' table failed.';\n reject(error);\n }\n });\n \n // Remove item in 'unfinished_task' table\n let finishedTaskParams = {\n TableName: 'unfinished_task',\n Key: {\n 'taskId': task.taskId\n }\n }\n docClient.delete(finishedTaskParams, (error, _) => {\n if (error) {\n error.note = 'The delete operation for the \\'unfinished_task\\' table failed.';\n reject(error);\n }\n });\n \n // Update 'finished' status of the 'taskId' in 'dataset_<DATASETID>' table\n let datasetFinishedTaskParams = {\n TableName: 'dataset_' + data.Item.datasetId,\n Key: {\n 'taskId': task.taskId\n },\n UpdateExpression: 'SET #finished = :true',\n ExpressionAttributeNames: {\n '#finished': 'finished'\n },\n ExpressionAttributeValues: {\n ':true': true\n },\n ReturnValues: 'UPDATED_NEW'\n }\n docClient.update(datasetFinishedTaskParams, (error, _) => {\n if (error) {\n error.note = 'The update operation for the \\'dataset_' + data.Item.datasetId \n + '\\' table failed.';\n reject(error);\n }\n });\n \n // Update current 'progress' counter in 'dataset' table\n let datasetProgressParams = {\n TableName: 'dataset',\n Key: {\n 'datasetId': '4898691044887699'\n },\n UpdateExpression: 'SET #progress.#current = #progress.#current + :one',\n ExpressionAttributeNames: {\n '#progress': 'progress',\n '#current': 'current'\n },\n ExpressionAttributeValues: {\n ':one': 1\n },\n ReturnValues: 'UPDATED_NEW'\n }\n docClient.update(datasetProgressParams, (error, data) => {\n if (!error && data.Item.progress.current == data.Item.progress.total) {\n // Conditionally update 'finished' status in 'dataset' table\n let datasetFinishedParams = {\n TableName: 'dataset',\n Key: {\n 'datasetId': '4898691044887699'\n },\n UpdateExpression: 'SET #finished = :true',\n ExpressionAttributeNames: {\n '#finished': 'finished',\n '#total': 'total'\n },\n ExpressionAttributeValues: {\n ':true': true\n },\n ReturnValues: 'UPDATED_NEW'\n }\n docClient.update(datasetFinishedParams, (error, _) => {\n if (error) {\n error.note = 'The second update operation for the \\'dataset\\' table failed.';\n reject(error);\n } else {\n // Resolve to indicate finished function\n resolve();\n }\n });\n } else if (!error) {\n // Resolve to indicate finished function\n resolve();\n } else {\n error.note = 'The second update operation for the \\'dataset\\' table failed.';\n reject(error);\n }\n });\n \n } else {\n \n // Update 'unfinished_task' table\n let taskUpdateParams = {\n TableName: 'unfinished_task',\n Key: {\n 'taskId': task.taskId\n },\n UpdateExpression: 'SET #class = :class, #progress = :progress',\n ExpressionAttributeNames: {\n '#class': 'class',\n '#progress': 'progress'\n },\n ExpressionAttributeValues: {\n ':class': data.Item.class,\n ':progress': data.Item.progress\n },\n ReturnValues: 'UPDATED_NEW'\n }\n docClient.update(taskUpdateParams, (error, data) => {\n if (error) {\n error.note = 'The put operation for the \\'unfinished_task\\' table failed.';\n reject(error);\n } else {\n // Resolve to indicate finished function\n resolve();\n }\n });\n \n }\n \n } else {\n error.note = 'The get operation for the \\'unfinished_task\\' table failed.';\n reject(error);\n }\n });\n });\n \n}", "function updateTaskID() {\n for (let i = 0; i < tasks.length; i++) {\n tasks[i].id = i;\n }\n}", "function markTask(id, status){\r\n let dataSend = \"updateTask=exec&method=2&id=\" + id + \"&complete=\" + status;\r\n return apiReq(dataSend, 3);\r\n}", "async doTask(task) {\n task.status = 'success'\n task.result = 'done'\n }", "async function updateTaskDesc(pDesc) {\r\n await taskRef.update({description: pDesc});\r\n console.log(\"Description of \" + task + \"updated to \" + pDesc + \".\");\r\n}", "updateTodoItem(todoId){\n\t\t//Remember we are working with an array and not an object\n\t\t//so it's different than how it was in class.\n\t\tconst oldTodo = this.state.todos[todoId];\n\t\tconst newTodo = {...oldTodo, done: !oldTodo.done}\n\t\tconst newTodos = this.state.todos;\n\t\tnewTodos[todoId] = newTodo;\n\t\tfetch(`${API_URL}/${newTodo._id}`, \n \t\t\t{ \n \t\t\t\tmethod: 'PATCH', \n \t\t\t\tbody: JSON.stringify(newTodo),\n \t\t\t\theaders: new Headers({\n \t\t\t'Content-Type': 'application/json'\n \t\t\t\t})\n \t\t\t})\n \t\t.then(\n \t\tthis.setState( {todos: newTodos} )\n \t\t\t)\n \t.catch(err => err);\n\t}", "function update(req, res) {\n if (req.body._id) {\n delete req.body._id;\n }\n PlanSection.findByIdAsync({ _plan_id: req.params.plan_id, _id: req.params.id }).then(handleEntityNotFound(res)).then(saveUpdates(req.body)).then(responseWithResult(res))['catch'](handleError(res));\n}", "async function updateRemote() {\n var bodyFormData = new FormData();\n\n bodyFormData.append(\"message\", name);\n bodyFormData.append(\"assigned_to\", selectedUser);\n //2020-09-18 12:12:12\n bodyFormData.append(\n \"due_date\",\n due &&\n `${new Date(due).getFullYear()}-${new Date(\n due\n ).getMonth()}-${new Date(due).getDate()} ${\n new Date(due).getHours() +\n \":\" +\n new Date(due).getMinutes() +\n \":\" +\n new Date(due).getSeconds()\n }`\n );\n bodyFormData.append(\"priority\", priority);\n bodyFormData.append(\"taskid\", id);\n\n try {\n const r = await axios({\n method: \"post\",\n url: \"https://devza.com/tests/tasks/update\",\n data: bodyFormData,\n\n headers: {\n \"Content-Type\": \"multipart/form-data\",\n AuthToken: \"FFasjYZoJtXc8sX7TzdIvk7YhA9n5AJv\",\n },\n });\n return r.status;\n } catch (e) {\n if (e.response && e.response.data) {\n console.error(e.response.data);\n }\n }\n }", "function updateOneFieldTask(id, field, data){\n $cordovaSQLite.execute(db,\n 'UPDATE tasks SET '+ field +' = ? WHERE id = ?',\n [data, id])\n .then(function(result) {}, function(error) {\n console.error('updateOneFieldTask(): ' + error);\n });\n }" ]
[ "0.7913674", "0.7887277", "0.7760899", "0.77257484", "0.76326853", "0.7603241", "0.76024693", "0.756114", "0.7524053", "0.7464032", "0.73855394", "0.7315477", "0.73001415", "0.7216512", "0.7185507", "0.71413505", "0.7102072", "0.70453495", "0.70008284", "0.69985676", "0.6909495", "0.6815428", "0.6767114", "0.67130584", "0.6667141", "0.6666362", "0.6665448", "0.6663279", "0.6624788", "0.6613898", "0.6595252", "0.65608007", "0.6525184", "0.6449234", "0.64361924", "0.6433813", "0.63919735", "0.6391101", "0.6390122", "0.6372302", "0.6368648", "0.6362245", "0.63254344", "0.63175976", "0.6308589", "0.62886536", "0.6252026", "0.624755", "0.6232376", "0.6226188", "0.6220746", "0.6153901", "0.6142905", "0.6115108", "0.61000293", "0.6079408", "0.6071273", "0.60599935", "0.60364205", "0.6024483", "0.6023906", "0.59865814", "0.5983565", "0.59765106", "0.59644026", "0.59444535", "0.5937435", "0.5909526", "0.59032685", "0.5869564", "0.5862469", "0.5851474", "0.5848081", "0.582445", "0.5822041", "0.581079", "0.5803875", "0.5800206", "0.5777602", "0.577022", "0.5762501", "0.57446337", "0.5736551", "0.5718298", "0.5717195", "0.5708702", "0.57072216", "0.57059205", "0.56834173", "0.56736016", "0.566432", "0.56636536", "0.5663647", "0.56618905", "0.56453156", "0.56428385", "0.5641271", "0.5619142", "0.561829", "0.5605247" ]
0.5803597
77
this is the fractiondigits attribute noinspection JSUnusedLocalSymbols
function theDecimalPlaces(num) { var match = (''+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); if (!match) { return 0; } return Math.max( 0, // Number of digits right of decimal point. (match[1] ? match[1].length : 0) // Adjust for scientific notation. - (match[2] ? +match[2] : 0)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fractionPeriod() {\n return Geometry_1.Geometry.safeDivideFraction(Math.PI * 2.0, Math.abs(this._radians1 - this._radians0), 1.0);\n }", "function fraction(section) {\n\tthis.numerator = section.numerator;\n\tthis.denominator = section.denominator;\n}", "function fraction(decimal){\n if(!decimal){\n decimal=this;\n }\n let whole = String(decimal).split('.')[0];\n decimal = parseFloat(\".\"+String(decimal).split('.')[1]);\n let num = \"1\";\n for(let z=0; z<String(decimal).length-2; z++){\n num += \"0\";\n }\n decimal = decimal*num;\n num = parseInt(num);\n for(let z=2; z<decimal+1; z++){\n if(decimal%z==0 && num%z==0){\n decimal = decimal/z;\n num = num/z;\n z=2;\n }\n }\n //if format of fraction is xx/xxx\n if (decimal.toString().length == 2 && \n num.toString().length == 3) {\n //reduce by removing trailing 0's\n decimal = Math.round(Math.round(decimal)/10);\n num = Math.round(Math.round(num)/10);\n }\n //if format of fraction is xx/xx\n else if (decimal.toString().length == 2 && \n num.toString().length == 2) {\n decimal = Math.round(decimal/10);\n num = Math.round(num/10);\n }\n //get highest common factor to simplify\n var t = HCF(decimal, num);\n\n //return the fraction after simplifying it\n return ((whole==0)?\"\" : whole+\" \")+decimal/t+\"/\"+num/t;\n }", "function fraction_part(dividendo, divisor) {\n resDiv = dividendo / divisor;\n f_part = Math.floor(resDiv);\n return f_part;\n} // Fin de función fraction_part", "function fraction_part(dividendo, divisor) {\n resDiv = dividendo / divisor;\n f_part = Math.floor(resDiv);\n return f_part;\n} // Fin de función fraction_part", "function validateInitialFractions(fractions){\n\tvar f = fractions;\n\tvar length = f.length;\n\tvar fractionSign = /((\\d*)\\/(\\d*))/g;\n\tvar intRegex = /^\\d+$/;\n\tfor(var i = 0; i < length; i++){\n\t\tconsole.log(i, f[i]);\n\t\tvar member = $.trim(f[i]);\n\t\tif ( !member.match(fractionSign)) {\n\t\t\treturn false;\n\t\t} else if(divisionByZero(member)){\n\t\t\tthrow new Error(\"Division by zero: \" + member);\n\t\t}\n\t}\n\treturn true;\n }", "function fracify(x) {\n if (Math.abs(x- 0/12) < 1e-12) return \"0\"\n if (Math.abs(x- 1/12) < 1e-12) return \"1/12\"\n if (Math.abs(x- 2/12) < 1e-12) return \"1/6\"\n if (Math.abs(x- 3/12) < 1e-12) return \"1/4\"\n if (Math.abs(x- 4/12) < 1e-12) return \"1/3\"\n if (Math.abs(x- 5/12) < 1e-12) return \"5/12\"\n if (Math.abs(x- 6/12) < 1e-12) return \"1/2\"\n if (Math.abs(x- 7/12) < 1e-12) return \"7/12\"\n if (Math.abs(x- 8/12) < 1e-12) return \"2/3\"\n if (Math.abs(x- 9/12) < 1e-12) return \"3/4\"\n if (Math.abs(x-10/12) < 1e-12) return \"5/6\"\n if (Math.abs(x-11/12) < 1e-12) return \"11/12\"\n if (Math.abs(x-12/12) < 1e-12) return \"1\"\n if (Math.abs(x-1/PHI) < 1e-12) return \"1/phi\"\n if (Math.abs(x- LN2) < 1e-12) return \"log2\"\n if (Math.abs(x- .692) < 1e-12) return \".692\"\n return \"???\"\n}", "function split_fraction(fraction)\n{\n // numerator\n numerator[input_index] = fraction.split(\"/\")[0];\n console.log(\"numerator: \"+numerator[input_index]);\n \n // denominator\n denominator[input_index] = fraction.split(\"/\")[1];\n console.log(\"denominator: \"+denominator[input_index]);\n}", "function FractionRenderer (opts) {\n FractionRenderer.superclass.constructor.call(this);\n \n //Set properties from the option object\n var i = -1;\n while(++i < FractionRenderer.params.length) {\n if (opts[FractionRenderer.params[i]]) {\n this[FractionRenderer.params[i]] = opts[FractionRenderer.params[i]];\n }\n }\n \n this.bgShow = true;\n if(opts.hasOwnProperty('bgShow')) {\n if(!opts['bgShow'] || opts['bgShow'] == \"false\") {\n this.bgShow = false;\n }\n }\n \n // Create the numerical labels for the numerator and denominator\n var opts = Object();\n opts['string'] = this.numerator;\n opts['fontName'] = this.fontName;\n opts['fontColor'] = this.fontColor;\n opts['fontSize'] = this.fontSize;\n \n this.n = new cocos.nodes.Label(opts);\n this.n.anchorPoint = new geom.Point(0.5, 0.5);\n this.addChild({child: this.n});\n \n opts['string'] = this.denominator;\n this.d = new cocos.nodes.Label(opts);\n this.d.anchorPoint = new geom.Point(0.5, 0.5);\n this.addChild({child: this.d});\n \n // Figuring out combined content size\n var v = this.n.contentSize.height / 2 + this.d.contentSize.height / 2 + 36;\n var h = Math.max(this.n.contentSize.width, this.d.contentSize.width) + 10;\n \n // Regular fraction defaults\n if(this.whole == null) {\n //TODO: Position based on font size instead of magic number\n this.n.position = new geom.Point(0, 12);\n this.d.position = new geom.Point(0, -12);\n \n this.contentSize = new geom.Size(h, v);\n \n this.strRep = this.numerator + ' / ' + this.denominator;\n }\n // Account for the inclusion of a mixed number\n else {\n opts[\"string\"] = this.whole;\n opts[\"fontSize\"] *= 2;\n \n this.w = new cocos.nodes.Label(opts);\n this.addChild({child: this.w});\n \n this.n.anchorPoint = new geom.Point(1, 0.5);\n this.n.position = new geom.Point(h / 2 + 2, 15);\n \n this.d.anchorPoint = new geom.Point(1, 0.5);\n this.d.position = new geom.Point(h / 2 + 2, -15);\n \n this.w.anchorPoint = new geom.Point(0, 0.5);\n this.w.position = new geom.Point(h / -2 - 2, 0);\n \n h += this.w.contentSize.width;\n \n this.contentSize = new geom.Size(h, v);\n \n this.strRep = this.whole + ' ' + this.numerator + ' / ' + this.denominator;\n }\n}", "function Fraction(numerator, denominator)\n{\n /* double argument invocation */\n if (numerator && denominator) {\n if (typeof(numerator) === 'number' && typeof(denominator) === 'number') {\n this.numerator = numerator;\n this.denominator = denominator;\n } else if (typeof(numerator) === 'string' && typeof(denominator) === 'string') {\n // what are they?\n // hmm....\n // assume they are ints?\n this.numerator = parseInt(numerator);\n this.denominator = parseInt(denominator);\n }\n /* single-argument invocation */\n } else if (!denominator) {\n num = numerator; // swap variable names for legibility\n if (typeof(num) === 'number') { // just a straight number init\n this.numerator = num;\n this.denominator = 1;\n } else if (typeof(num) == 'string') {\n var a, b; // hold the first and second part of the fraction, e.g. a = '1' and b = '2/3' in 1 2/3\n // or a = '2/3' and b = undefined if we are just passed a single-part number\n [a, b] = num.split(' ');\n /* compound fraction e.g. 'A B/C' */\n if (isInteger(a) && b && b.match('/')) {\n return (new Fraction(a)).add(new Fraction(b));\n } else if (a && !b) {\n /* simple fraction e.g. 'A/B' */\n if (typeof(a) == 'string' && a.match('/')) {\n // it's not a whole number... it's actually a fraction without a whole part written\n var f = a.split('/');\n this.numerator = f[0]; this.denominator = f[1];\n /* string floating point */\n } else if (typeof(a) == 'string' && a.match('\\.')) {\n return new Fraction(parseFloat(a));\n /* whole number e.g. 'A' */\n } else { // just passed a whole number as a string\n this.numerator = parseInt(a);\n this.denominator = 1;\n }\n } else {\n return undefined; // could not parse\n }\n }\n }\n this.normalize();\n}", "function fractionConverter (number) {\n // convert number to a string\n let stringNumber = number.toString();\n // set truty value to keep track of numbers before or after decimal\n let beforeDecimal = true;\n let result = \"\";\n let count = 0;\n // if string number does not include a decimal\n if (!stringNumber.include('.')) {\n // return the string with a concatted forward slash and one\n return stringNumber.concat('/1');\n }\n // while stringNumber length is less than 4\n while (stringNumber.length < 4) {\n // concat a 0\n stringNumber.concat('0');\n }\n // loop through string\n // for(let i = 0; i < stringNumber.length; i++) {\n // // convert number string to a proper function\n // // if you hit a decimal, change truthy value to false\n // if(stringNumber[i] === '.') {\n // beforeDecimal = false;\n // }\n // // if number is before decimal\n // if (beforeDecimal === true) {\n // // add to result\n // result.concat(stringNumber[i]);\n // } else if (beforeDecimal === false && count < 1) {\n // count++;\n // result.concat('.', stringNumber[i])\n // } else {\n // result.concat(stringNumber[i]);\n // }\n // }\n stringNumber.concat('/100');\n // after all this, the string number should be something like \n // 2.75/100\n let whole = [];\n // create top of fraction holder\n let top = [];\n // create bottom of fraction holder\n let bottom = [];\n // create truthy value\n let afterDecimal = false;\n // create second truthy value\n let topTruthy = true;\n // loop through stringNumber\n for (let i = 0; i < stringNumber.length; i++) {\n if (afterDecimal === false) {\n whole.push(stringNumber[i]);\n }\n if (stringNumber[i] === '.') {\n afterDecimal = true;\n }\n // if after decimal is true and top truthy is true\n if (afterDecimal === true && topTruthy === true) {\n // push element to top fraction holder\n top.push(stringNumber[i]);\n } else {\n // else\n // push to bottom fraction\n bottom.push(stringNumber[i]);\n }\n if (stringNumber[i] === '/') {\n topTruthy = false;\n }\n }\n // in example, at this point, whole should be [2], top should be [75], and bottom should be [100]\n // next we need to look at top and bottom to find the greatest common divisor\n // then we can create the calculations of converting from proper to improper fraction\n\n\n // calculate from example above to convert to improper fraction\n}", "get decimals() { return this.#format.decimals; }", "function getFrac(line) {\n\tvar exp = new RegExp(\"[1-9]+/[1-9]+|[\\u00BC-\\u00BE]|[\\u2150-\\u215E]\");\n\tvar result = exp.exec(line);\n\tvar ans = null;\n\t// does fraction exist?\n\tif(result !== null) {\n\t\tvar text = result[0];\n\t\tconsole.log(text)\n\t\tvar startIndex = result.index;\n\t\tvar lastindex = startIndex + text.length - 1;\n\t\t// single char means it is a UNICODE Char\n\t\tvar fracInfo = (text.length === 1) ? convertUnicodeFraction(text) : splitTextFraction(text);\n\t\tvar num = fracInfo.num;\n\t\tvar den = fracInfo.den;\n\t\t// ans = {\"value\": (num/den) ,\"num\": num, \"den\": den, \"text\": text, \"start\": startIndex, \"end\": lastindex};\n\t\tans = {\"num\": num, \"den\": den, \"text\": text, \"start\": startIndex, \"end\": lastindex};\n\t}\n\treturn ans;\n}", "function _exactFraction(n) {\n if (isFinite(n)) {\n var f = math.fraction(n);\n if (f.valueOf() === n) {\n return f;\n }\n }\n return n;\n }", "function _exactFraction(n) {\n if (isFinite(n)) {\n var f = math.fraction(n);\n if (f.valueOf() === n) {\n return f;\n }\n }\n return n;\n }", "function greedy(num, den) {\n /*\n if (num >= den) {\n console.log(\"This is not a proper fraction, please choose a numerator smaller than the denominator\");\n return false;\n }\n if (num < 0 || den < 0) {\n console.log(\"Please use positive integers for both the numerators and denominators\");\n return false;\n }\n */\n if (num === 0) {\n console.log(\" \");\n return 0;\n } else { //always possible when numerator is not 0\n //only integer values w/o division and w/o math lib funcs\n //int division func + remainder func\n const unit_fraction_den = Math.ceil(den/num); //func for int div or directly here\n // next step of greedy is not necessarily the next unit fraction,\n // but the next step for int div\n console.log(unit_fraction_den); //just output result\n //fractions explanation\n greedy(num * unit_fraction_den - den, den * unit_fraction_den);\n }\n}", "get denominator () {\r\n\t\treturn this._denominator;\r\n\t}", "findFrac() {\n var result = this.expression.search('\\frac')\n\n var frac_found = 0;\n // while (result >= 0) {\n if (result >= 0) {\n var slice = this.expression.slice(result, this.expression.length)\n\n var count = 0;\n var start1 = 0;\n var start2 = 0;\n var endIndex;\n var pairFound = 0\n for (var i = result; i < this.expression.length; i++) {\n if (this.expression[i] == '{') {\n if (start1 == 0) {\n start1 = 1;\n // startIndex = i + 1;\n }\n if ((start1 == 1) && (count == 0) && (pairFound == 1)) {\n start2 = 1\n }\n count = count + 1;\n }\n if (this.expression[i] == '}') {\n count = count - 1;\n }\n if ((start1 == 1) && (count == 0)) {\n pairFound = 1\n }\n if ((start2 == 1) && (count == 0)) {\n endIndex = i;\n frac_found = 1;\n break;\n }\n }\n } else {\n // We are now at bottom of tree where we know the length of the final term. Traverse up the tree to define lenght of all upper branches.\n // this.traverseUpTreeToFindLenghts()\n }\n\n if (frac_found == 1) {\n //console.log('full', this.expression)\n //console.log('omega', this.expression.slice(0,result) + 'child' + this.expression.slice(endIndex+1,this.expression.length))\n // adjust original expression to include 'child', this tells us index position of child in the orginal expression\n var fraction_term = this.expression.slice(result, endIndex + 1)\n this.expression = this.expression.slice(0, result) + '\\\\\\\\' + this.expression.slice(endIndex + 1, this.expression.length)\n this.child.push(new EquationTerms(fraction_term, this, 'fraction'))\n\n this.child[this.child.length - 1].findFracChild()\n\n\n // check if the main expression have remaining fraction terms\n result = this.expression.search('\\frac')\n if (result >= 0) {\n this.findFrac();\n }\n } else {\n result = -1;\n }\n\n }", "formatAsFraction(number, format) {\n const that = this,\n formatParts = format.split('/');\n\n if (number === 0) {\n if (format.indexOf('0') === -1) {\n return '';\n }\n\n return that.formatNumber(0, formatParts[0], undefined, true) + '/' + that.formatNumber(1, formatParts[1], undefined, true);\n }\n\n if (number % 1 === 0) {\n return that.formatNumber(number, formatParts[0], undefined, true) + '/' + that.formatNumber(1, formatParts[1], undefined, true);\n }\n\n const approximations = [];\n\n that.approximateFractions(number, approximations);\n\n const length = formatParts[1].length >= 2 ? 2 : 1;\n let bestApproximationDifference = [], bestApproximationIndex = [];\n\n approximations.forEach(function (approximation, index) {\n const length = approximation.denominator.toString().length,\n currentDifference = Math.abs(number - approximation.numerator / approximation.denominator);\n\n if (bestApproximationDifference[length] === undefined) {\n bestApproximationIndex[length] = index;\n bestApproximationDifference[length] = currentDifference;\n return;\n }\n\n if (currentDifference < bestApproximationDifference[length]) {\n bestApproximationIndex[length] = index;\n bestApproximationDifference[length] = currentDifference;\n }\n });\n\n let bestApproximation = bestApproximationIndex[length] ? approximations[bestApproximationIndex[length]] : approximations[bestApproximationIndex[1]];\n\n return that.formatNumber(bestApproximation.numerator, formatParts[0], undefined, true) + '/' + that.formatNumber(bestApproximation.denominator, formatParts[1], undefined, true);\n }", "function FractionEstimator_() { // constructor\n this.fracList = {}; // Object holds lists of acceptable fractions\n}", "function genFraction() {\n var a = Math.floor((Math.random() * maxNumber) + baseNumber);\n var b = Math.floor((Math.random() * maxNumber) + baseNumber);\n return (a + \"/\" + b);\n }", "findFracChild() {\n var result = this.expression.search('\\frac')\n\n\n var top = '';\n var bot = '';\n var frac_found = 0;\n if (result >= 0) {\n var slice = this.expression.slice(result, this.expression.length)\n var remainder;\n\n [top, remainder] = this.findCurlyBracketPair(slice);\n [bot, remainder] = this.findCurlyBracketPair(remainder);\n\n frac_found = 1;\n }\n if (frac_found == 1) {\n console.log('this', this)\n this.expression = '\\\\\\\\'\n this.child.push(new EquationTerms(top, this, 'fractiontop'))\n this.child.push(new EquationTerms(bot, this, 'fractionbot'))\n\n this.child[0].findFrac()\n this.child[1].findFrac()\n }\n // return [frac_found, top,bot]\n }", "function testingFrac(testobj)\n {\n if (/^(\\d{1,10}[.,]\\d{1,5})$/.test(testobj) && !/^(\\d{1,10}[.,][0])$/.test(testobj)\n && !/^(\\d{1,10}[.,][0][0])$/.test(testobj) && !/^(\\d{1,10}[.,][0][0][0])$/.test(testobj) \n && !/^(\\d{1,10}[.,][0][0][0][0])$/.test(testobj) && !/^(\\d{1,10}[.,][0][0][0][0][0])$/.test(testobj))\n {\n return \"It's a fraction!\";\n \n }\n else {\n\n return \"It's not a fraction!\";\n \n }\n }", "static get decimal() {\n return /^[\\+\\-]?\\d*\\.\\d+$/;\n }", "function _properFraction(x) {\n\n if(isNaN(x)) return NaN;\n\n var sign = Math.sign(x), abs_x = Math.abs(x);\n\n var str_x = abs_x+'';\n\n if(!_.contains(str_x,'.')){\n return new T.Tuple(sign*parseInt(str_x),0.0);\n }\n else {\n if(str_x[0] === '.') {\n str_x = '0'+str_x;\n return new T.Tuple(0,sign*parseFloat(str_x));\n }\n\n var splt = str_x.split('.'),\n intpart = parseInt(splt[0]),\n fractpart = parseFloat('0.'+splt[1]),\n intres = intpart === 0 ? 0 : sign*intpart,\n fracres = fractpart === 0 ? 0 : sign*fractpart;\n\n return new T.Tuple(intres,fracres);\n }\n}", "_simplify() {\n let mcd = Fraction.mcd(this.numerator, this.denominator);\n this.numerator = this.numerator / mcd;\n this.denominator = this.denominator / mcd;\n }", "num_decimals(num) {\n if (!this.is_numeric(num)) return false;\n let text = num.toString()\n if (text.indexOf('e-') > -1) {\n let [base, trail] = text.split('e-')\n let elen = parseInt(trail, 10)\n let idx = base.indexOf(\".\")\n return idx == -1 ? 0 + elen : (base.length - idx - 1) + elen\n }\n let index = text.indexOf(\".\")\n return index == -1 ? 0 : (text.length - index - 1)\n }", "function testFrac()\n {\n var test00 = testO.value;\n verifyFrac(test00);\n }", "fractionate(val, minVal, maxVal) {\n return (val - minVal) / (maxVal - minVal);\n }", "function randomFraction() {\n\tvar fraction = 0;\n\twhile (fraction === 0) {\n\t\tfraction = Math.random();\n\t}\n\treturn fraction;\n}", "function toFraction(number) {\n\n\t//Step 1: Rewrite the decimal number as a fraction with 1 in the denominator\n\t//initialize variables\n\tlet top = number;\n let bottom = 1;\n\tlet isTopNegative = false;\n\n\t//check if number is negative\n\tif (number < 0) {\n\t\tisTopNegative = true;\n\t\ttop = Math.abs(number);\n\t}\n\n\t//Step 2: Multiply to remove x(1) decimal places. Here, you multiply top and bottom by 103 = 1000\n\t//detrmine amount of decimals needed\n\tlet decimalsNeeded = findDecimalPlaces(top);\n top = top * Math.pow(10, decimalsNeeded);\n bottom = bottom * Math.pow(10, decimalsNeeded);\n\n //Step 3: find greatest common factor (new function?)\n let GCF = findGreatestCommonFactor(top, bottom);\n\n //Step 4: divide numerator and demomintor with divisor\n top = top / GCF;\n bottom = bottom / GCF;\n\n //Step 5: output string of simplified fraction, check if it was negative\n\tif (isTopNegative) {\n\t\treturn \"-\"+top+\"/\"+bottom+\"\";\n\t}\n return \"\"+top+\"/\"+bottom+\"\";\n\n}", "function _exactFraction(n, options) {\n var exactFractions = options && options.exactFractions !== false;\n\n if (exactFractions && isFinite(n) && fraction) {\n var f = fraction(n);\n\n if (f.valueOf() === n) {\n return f;\n }\n }\n\n return n;\n } // Convert numbers to a preferred number type in preference order: Fraction, number, Complex", "function toFract(decimal) \n {\n // Round to the nearest 1/16\n var rounded = (Math.round(decimal * 16) / 16);\n var f = new Fraction(rounded);\n var newVal = f.toFraction(true);\n return newVal;\n}", "function asPercent(fraction) {\n return Math.ceil(fraction * 100)\n}", "function simplifyFraction(num, den)\n{\n\twhile (num && den && (num & 1) === 0 && (den & 1) === 0) {\n\t\tnum >>= 1; den >>= 1;\n\t}\n\twhile (num && den && (num % 3) === 0 && (den % 3) === 0) {\n\t\tnum /= 3; den /= 3;\n\t}\n\tif(num === den) return \"1\";\n\n\tif(den === 1) return num.toString();\n\n\treturn num.toString() + '/' + den.toString();\n}", "function _exactFraction(n, options) {\n var exactFractions = options && options.exactFractions !== false;\n\n if (exactFractions && isFinite(n)) {\n var f = math.fraction(n);\n\n if (f.valueOf() === n) {\n return f;\n }\n }\n\n return n;\n } // Convert numbers to a preferred number type in preference order: Fraction, number, Complex", "function parseFraction(term, origin, control,node) {\n\tvar fractionQuery = \"\";\n\tvar valid = false;\n\tvar operator = \"=\";\n\tvar url = /\\d+\\.?\\d*/;\n\n\tif( term.indexOf(\"<\")>-1){\n\t\tterm=term.substr(1,term.length);\n\t\toperator=\"<\";\n\t}\n\tif( term.indexOf(\"=\")>-1){\n\t\tterm=term.substr(1,term.length);\n\t\toperator=\"=\";\n\t}\n\tif( term.indexOf(\">\")>-1){\n\t\tterm=term.substr(1,term.length);\n\t\toperator=\">\";\n\t}\n\n\tif( term.match(url)!=null){\n \t\tvalid=true; \n\t\tfractionQuery=fractionQuery+\"remakes/remake[\"+node+operator+term+\"] \" + $('input[name=refine]:radio:checked')[0].value +\" \"; \n\t\t\n\t\t//for now\n\t\tglobalQuery = globalQuery + fractionQuery;\n\t} \n\t\t\t\t\t\t \n\treturn fractionQuery; \n}", "get numerator () {\r\n\t\treturn this._numerator;\r\n\t}", "function restrictFractionalPart(val, n) {\n\t\tn = n || 1;\n\t\t\n\t\tif (val >= Math.pow(10, n)) {\n\t\t\treturn Math.round(val);\n\t\t} else {\n\t\t\treturn val.toPrecision(n);\n\t\t}\n\t}", "static get floatingPointNumber() {\n return /([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[eE]([+-]?\\d+))?/;\n }", "function verifyFrac(test00)\n {\n \n if (/^(\\d{1,10}[.,]\\d{1,5})$/.test(test00) && !/^(\\d{1,10}[.,][0])$/.test(test00)\n && !/^(\\d{1,10}[.,][0][0])$/.test(test00) && !/^(\\d{1,10}[.,][0][0][0])$/.test(test00) \n && !/^(\\d{1,10}[.,][0][0][0][0])$/.test(test00) && !/^(\\d{1,10}[.,][0][0][0][0][0])$/.test(test00))\n {\n var msg0 = \"It's a fraction!\";\n \n message(msg0);\n return msg0; \n \n }\n else {\n var msg0 = \"It's not a fraction!\";\n \n message(msg0);\n return msg0;\n \n }\n\n }", "function convertFraction_(num,precision) {\n if (!thisInstance_.fracEst) thisInstance_.fracEst = new FractionEstimator_(); \n var sign = (num < 0) ? -1 : 1;\n num = sign * num;\n var whole = Math.floor(num);\n// var whole = String(num).match(/(.*?)\\./)[1]+' ';\n var frac = num%1; // introduces small rounding errors\n var result = ((whole === 0) ? '' : String(sign*whole) + ' ') + thisInstance_.fracEst.estimate(frac,precision);\n return result \n}", "function wholeNumber(fraction) {\n assert.equal(typeof fraction, 'number');\n\n return Math.abs(Math.round(fraction));\n}", "static get wholeNumberDecimal() {\n return /^\\+?\\d*\\.\\d+$/;\n }", "function randomFraction() {\n return Math.random();\n}", "constructor(digits) {\n this.digits = digits;\n }", "constructor(digits) {\n this.digits = digits;\n }", "function Diversion(isNumeric) \n{\n this._buffer = '';\n this._isNumeric = isNumeric;\n}", "applyCustomFractionalFormat(numericObject, textParts, numericProcessor) {\n const that = this,\n regex = /^([0#,]+[ ]+)?([0#,]+\\/[0#,]+)$/;\n let format = textParts.main.trim(),\n result;\n\n if (!regex.test(format)) {\n return numericObject.toString();\n }\n\n const formatParts = regex.exec(format);\n\n formatParts[2] = formatParts[2].replace(/,/g, '');\n\n if (that.inputFormat === 'integer') {\n const fractionFormatParts = formatParts[2].split('/');\n\n if (formatParts[1] === undefined) {\n result = that.formatNumber(numericObject, fractionFormatParts[0], undefined, true) + '/' + that.formatNumber(1, fractionFormatParts[1], undefined, true);\n }\n else {\n result = that.formatNumber(numericObject, formatParts[1].trim(), undefined, true);\n\n if (formatParts[2].indexOf('0') !== -1) {\n result += ' ' + that.formatNumber(0, fractionFormatParts[0], undefined, true) + '/' + that.formatNumber(1, fractionFormatParts[1], undefined, true);\n }\n }\n\n return that.setTextParts(result, textParts);\n }\n\n if (formatParts[1] === undefined) {\n result = (numericObject < 0 ? '-' : '') + that.formatAsFraction(Math.abs(numericObject), formatParts[2]);\n }\n else {\n const wholePartFormat = formatParts[1].trim(),\n decimalPartFormat = formatParts[2];\n\n result = that.formatNumber(parseInt(numericObject, 10), wholePartFormat, undefined, true) + ' ' +\n that.formatAsFraction(numericProcessor.getPreciseModulo(Math.abs(numericObject), 1), decimalPartFormat);\n }\n\n return that.setTextParts(result.trim(), textParts);\n }", "fracToPixel(frac){\n return frac*c.width\n }", "function fractionate(val, minVal, maxVal) {\n return (val - minVal)/(maxVal - minVal);\n}", "function normalizePlaceholders() {\n var i, found;\n for (i = fmt.fraction.length - 1; i >= 0; i--) {\n if (fmt.fraction[i].type === 'placeholder') {\n if (found) {\n fmt.fraction[i].value = '0';\n } else if (fmt.fraction[i].value === '0') {\n found = true;\n }\n }\n }\n }", "function normalizePlaceholders() {\n var i, found;\n for (i = fmt.fraction.length - 1; i >= 0; i--) {\n if (fmt.fraction[i].type === 'placeholder') {\n if (found) {\n fmt.fraction[i].value = '0';\n } else if (fmt.fraction[i].value === '0') {\n found = true;\n }\n }\n }\n }", "toFraction(a, b) {\n var r = Fraction(a, b);\n if (algebraicMode && r.den == 1)\n return r.num;\n else\n return r;\n }", "function cutNumber() {\n if (isFloat()) {\n var numerator = parseFloat(cutFloat());\n\n if (str[0] === '/') {\n // rational real part\n str = str.slice(1);\n\n if (isFloat()) {\n var denominator = parseFloat(cutFloat());\n return self.$Rational(numerator, denominator);\n } else {\n // reverting '/'\n str = '/' + str;\n return numerator;\n }\n } else {\n // float real part, no denominator\n return numerator;\n }\n } else {\n return null;\n }\n }", "function randomFraction(){\n return Math.random();\n}", "function percentage() {\r\r\n if (isPercentage === false && lastButton === \"num\") {\r\r\n var indexPerc = currentNum.indexOf(\".\");\r\r\n if (indexPerc !== -1) {\r\r\n if (indexPerc === 0) {\r\r\n currentNum = \".00\" + currentNum.slice(1); \r\r\n } else if (indexPerc === 1) {\r\r\n currentNum = \".0\" + currentNum.slice(0, indexPerc) + currentNum.slice(indexPerc + 1);\r\r\n } else if (indexPerc === 2) {\r\r\n currentNum = \".\" + currentNum.slice(0, indexPerc) + currentNum.slice(indexPerc + 1);\r\r\n } else {\r\r\n currentNum = currentNum.slice(0, indexPerc - 2) + \".\" + currentNum.slice(indexPerc - 2, indexPerc) + currentNum.slice(indexPerc + 1);\r\r\n }\r\r\n } else {\r\r\n if (currentNum.length === 1) {\r\r\n currentNum = \".0\" + currentNum;\r\r\n } else if (currentNum.length === 2) {\r\r\n currentNum = \".\" + currentNum;\r\r\n } else {\r\r\n currentNum = currentNum.slice(0, currentNum.length - 2) + \".\" + currentNum.slice(currentNum.length - 2);\r\r\n }\r\r\n }\r\r\n isPercentage = true;\r\r\n isDecimal = true;\r\r\n }\r\r\n}", "function StarRating(str) { \n\n // split string into whole number and decimal\n let arr = str.split('.');\n \n\n let whole = arr[0];\n //capture decimal and use to calculate the half\n let decimal = Number(\"0.\" + arr[1]);\n let half = 0;\n let empty = 0;\n \n if(decimal < .25){\n half = 0;\n } else if (decimal >= .75){\n whole++;\n } else {\n half = 1\n }\n // calculate number of emptys by subtracting whole and half from 5\n empty = 5 - whole - half;\n\n // use .repeat method to repeat the correct # of times easily\n\n return `${\"full \".repeat(whole) + \"half \".repeat(half) + \"empty \".repeat(empty)}`.trim();\n\n \n\n \n\n \n \n\n}", "function randomFraction() {\n\n // Only change code below this line\n\n return Math.random();\n\n // Only change code above this line\n}", "function MixedFractionFactory() {}", "function randomFraction() {\n // Only change code below this line.\nvar result = 0;\n while (result === 0) {\n result = Math.random();\n }\n return result; \n // Only change code above this line.\n}", "constructor(props) {\n super(props);\n this.state = { fraction: 0 };\n }", "calculateFractions(e) {\n e.preventDefault();\n\n let userInput = this.textInput.current.value;\n let result = Fractions(userInput);\n\n this.props.onSubmit(result);\n }", "get decimals() {\n return this.getDecimals();\n }", "function checkFraction(){\r\n var newValue = parseInt(d3.select(\"#fractionSlider\").attr(\"value\"))\r\n if(newValue===21){\r\n d3.select(\"div.question\").html(\"Correct ! Switzerland's market share in global gold trade is <span class=highlight>21%</span>.<br> Which makes Switzerland the biggest gold trading hub in the world.\")\r\n fractionConclusion()\r\n }\r\n else{\r\n d3.select(\"div.question\").html(\"Not quite. Switzerland's market share in global gold trade is <span class=highlight>21%</span>.<br> Which makes Switzerland the biggest gold trading hub in the world. \")\r\n fractionConclusion()\r\n }\r\n }", "function getFraction(decimal) {\n\tvar str = decimal + '',\n\t\tparts = [],\n\t\twhole, partial, factor,\n\t\tresult = {\n\t\t\tnumerator: 0,\n\t\t\tdenominator: 1\n\t\t};\n\t\t\n\tif (str.indexOf('.') != -1) {\n\t\tparts = str.split('.');\n\t\twhole = parts[0];\n\t\tpartial = parts[1];\n\t\tresult.numerator = whole + partial;\n\t\tresult.denominator = Math.pow(10, partial.length); // 100\n\t\tfactor = highestCommonFactor(result.numerator, result.denominator);\n\t\tresult.numerator /= factor;\n\t\tresult.denominator /= factor;\n\t}\n\treturn result;\n}", "function s$1(t){const n=2,i=Math.floor(Math.log10(Math.abs(t)))+1,e=i<4||i>6?4:i,r=1e6,a=Math.abs(t)>=r?\"compact\":\"standard\";return m$2(t,{notation:a,minimumSignificantDigits:n,maximumSignificantDigits:e})}", "function uint16_to_fraction(uint16) {\n return (uint16 / UInt16Max) * 2 - 1\n}", "function PWM_Func_GetReducedFraction(Numerator, Denominator) {\n try {\n //int\n var i = 0;\n for (i = Denominator; i >= 1; i--) {\n if (Numerator % i == 0 && Denominator % i == 0) {\n break;\n }\n }\n Numerator = Numerator / i;\n Denominator = Denominator / i;\n return Numerator + \"/\" + Denominator;\n }\n catch (err) {\n PWM_Func_HandleJsError(\"PWM_Func_GetReducedFraction\", err);\n }\n}", "function floatingPoints(n)\n{\n var d = n.toString().split('.')[1]\n return (d) ? d.length : 0;\n}", "function isUnicodeFraction(character) {\n\tvar unicode = character.charCodeAt(0);\n\treturn ((unicode >= 188 && unicode <= 190) || (unicode >= 8531 && unicode <= 8542));\n}", "function digitHandler() {\n\tif (nextValue == null) {\n\t\tnextValue = 0;\n\t}\n\tif (decimal && $(this).text() == \".\") {\n\t\treturn;\n\t}\n\n\tif ($(this).text() == \".\") {\n\t\tdecimal = true;\n\t}\n\n\tnextValue = nextValue + $(this).text();\n\n\tupdateDisplay();\n}", "function main() {\r\n var n = parseInt(readLine());\r\n arr = readLine().split(' ');\r\n arr = arr.map(Number);\r\n fraction(arr);\r\n}", "function sigFig(num, digits) {\n\tif (num==0) return 0;\n\t/// Get a multiplier based on the log position of most sig digit (add 1 to avoid 100...0 not being rounded up)\n\tvar mul = Math.pow(10,Math.floor(Math.log10(num)));\n\tvar sigPow = Math.pow(10,digits-1);\n\t/// XXX: I need to work this out properly at some point\n\tvar v = Math.round((num/mul)*sigPow);\n\tif ((mul/sigPow) < 1) {\n\t\tvar d = Math.round(1/(mul/sigPow));\n\t\tv = v/d;\n\t}\n\telse {\n\t\tvar d = Math.round(mul/sigPow);\n\t\tv = v*d;\n\t}\n\n\treturn v;\n}", "function getNumDecimalPlaces(n) {\n // Pull out the fraction and the exponent.\n var match = /(?:\\.(\\d+))?(?:[eE]([+\\-]?\\d+))?$/.exec(String(n));\n // NaN or Infinity or integer.\n // We arbitrarily decide that Infinity is integral.\n if (!match)\n return 0;\n var fraction = match[1] || ''; // E.g. 1.234e-2 => 234\n var exponent = match[2] || 0; // E.g. 1.234e-2 => -2\n // Count the number of digits in the fraction and subtract the\n // exponent to simulate moving the decimal point left by exponent places.\n // 1.234e+2 has 1 fraction digit and '234'.length - 2 == 1\n // 1.234e-2 has 5 fraction digit and '234'.length - -2 == 5\n return Math.max(0, // lower limit\n (fraction === '0' ? 0 : fraction.length) - Number(exponent));\n }", "findFraction() {\n let $outputEl = document.getElementById(this.$outputElSelector);\n\n let fractionDetectRegEx = /\\d+([\\/.]\\d+)?/g;\n console.log('REG EX IS: ', fractionDetectRegEx);\n console.log('User input is: ', this.userInput);\n let matchedFractionArray = this.userInput.match(fractionDetectRegEx);\n if (!matchedFractionArray) {\n $outputEl.value = this.userInput;\n return;\n }\n console.log('Match is ', matchedFractionArray);\n // set input matched currencies\n let convertedBases = [];\n matchedFractionArray.forEach((match) => {\n let split = match.split('/');\n //TODO: bugfix calculation\n convertedBases.push(parseInt(split[0], this.numberBase) / parseInt(split[1], this.numberBase));\n });\n console.log('Converted Matches in base: : ', this.numberBase, ' are ', convertedBases);\n let convertedString = this.userInput;\n // replace converted currency into original string\n matchedFractionArray.forEach((matchedEl, index) => {\n if (convertedString.includes(matchedEl)) {\n convertedString = convertedString.replace(matchedEl, convertedBases[index]);\n }\n });\n console.log('Final output string is: ', convertedString);\n // return convertedString;\n $outputEl.value = convertedString;\n }", "getAtFraction(frac) {\n let ix = floor(this.buffer.length * frac);\n return this.get(ix);\n }", "function divide(num, den) {\n return num / den;\n}", "function divi() {\r\n return 6 / 7\r\n}", "function rdi(nutrient, value) {\n var fraction = nutrient.amount/recommendations[nutrient.id]['rdi'];\n return Math.round(fraction*1000)/10\n }", "function rdi(nutrient, value) {\n var fraction = nutrient.amount/recommendations[nutrient.id]['rdi'];\n return Math.round(fraction*1000)/10\n }", "function fractionToRGB(part, total) {\n\tvar i = Math.floor( Math.log(part / total * 100) * 100);\n\tvar n = 255 - Math.floor(part / total * 255);\n\tvar hex = n.toString(16);\n\tvar rgb = '';\n\t\n\t// less than 1 is red\n\tif (i < Math.log(Math.sqrt(total))) {\n\t\trgb = \"#\" + hex + \"0000\";\n\t}\n\t// less than 3 is green\n\telse if (i < Math.log(Math.sqrt(total)/10)) { // this is meaningless what is maths\n\t\trgb = \"#\" + \"00\" + hex + \"00\";\n\t}\n\t// greater than 3 is blue\n\telse {\n\t\trgb = \"#0000\" + hex;\n\t}\n\n\treturn rgb;\n}", "function percentage (value_numerator, value__denominator, decimals) {\n if (typeof (value__denominator) === \"object\" && value__denominator === null) {\n null;\n } else {\n if (typeof (value_numerator) === \"object\" && value_numerator === null) {\n null;\n } else {\n try {\n return parseFloat( (parseFloat(value_numerator) / parseFloat(value__denominator)) * 100).toFixed(decimals);\n } catch (e) {\n null;\n }\n }\n }\n return '';\n}", "function digitGroup(price, id,unit) {\n var value = price.value;\n var output = \"\";\n try {\n value = value.replace(/[^0-9]/g, \"\"); // remove all chars including spaces, except digits.\n var totalSize = value.length;\n for (var i = totalSize - 1; i > -1; i--) {\n output = value.charAt(i) + output;\n var cnt = totalSize - i;\n if (cnt % 3 === 0 && i !== 0) {\n output = \"/\" + output; // seperator is \" \"\n }\n }\n } catch (err) {\n output = value; // it won't happen, but it's sweet to catch exceptions.\n }\n document.getElementById(id).innerHTML = output + ' '+ unit;\n}", "function digitGroup(price, id,unit) {\n var value = price.value;\n var output = \"\";\n try {\n value = value.replace(/[^0-9]/g, \"\"); // remove all chars including spaces, except digits.\n var totalSize = value.length;\n for (var i = totalSize - 1; i > -1; i--) {\n output = value.charAt(i) + output;\n var cnt = totalSize - i;\n if (cnt % 3 === 0 && i !== 0) {\n output = \"/\" + output; // seperator is \" \"\n }\n }\n } catch (err) {\n output = value; // it won't happen, but it's sweet to catch exceptions.\n }\n document.getElementById(id).innerHTML = output + ' '+ unit;\n}", "applyPrecisionDigits(precisionDigits) {\n const that = this;\n\n precisionDigits = Math.max(0, Math.min(precisionDigits, 20));\n\n let renderedValue = parseFloat(that.numericValue).toFixed(precisionDigits);\n\n if (that.isENotation(renderedValue)) {\n renderedValue = that.largeExponentialToDecimal(renderedValue) + '.' + '0'.repeat(precisionDigits);\n }\n\n return renderedValue;\n }", "function toPercent(parsedNumber) {\n // if the number is 0, don't do anything\n if (parsedNumber.digits[0] === 0) {\n return parsedNumber;\n }\n // Getting the current number of decimals\n var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;\n if (parsedNumber.exponent) {\n parsedNumber.exponent += 2;\n }\n else {\n if (fractionLen === 0) {\n parsedNumber.digits.push(0, 0);\n }\n else if (fractionLen === 1) {\n parsedNumber.digits.push(0);\n }\n parsedNumber.integerLen += 2;\n }\n return parsedNumber;\n}", "function toPercent(parsedNumber) {\n // if the number is 0, don't do anything\n if (parsedNumber.digits[0] === 0) {\n return parsedNumber;\n }\n // Getting the current number of decimals\n var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;\n if (parsedNumber.exponent) {\n parsedNumber.exponent += 2;\n }\n else {\n if (fractionLen === 0) {\n parsedNumber.digits.push(0, 0);\n }\n else if (fractionLen === 1) {\n parsedNumber.digits.push(0);\n }\n parsedNumber.integerLen += 2;\n }\n return parsedNumber;\n}", "function toPercent(parsedNumber) {\n // if the number is 0, don't do anything\n if (parsedNumber.digits[0] === 0) {\n return parsedNumber;\n }\n // Getting the current number of decimals\n var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;\n if (parsedNumber.exponent) {\n parsedNumber.exponent += 2;\n }\n else {\n if (fractionLen === 0) {\n parsedNumber.digits.push(0, 0);\n }\n else if (fractionLen === 1) {\n parsedNumber.digits.push(0);\n }\n parsedNumber.integerLen += 2;\n }\n return parsedNumber;\n}", "function toPercent(parsedNumber) {\n // if the number is 0, don't do anything\n if (parsedNumber.digits[0] === 0) {\n return parsedNumber;\n }\n // Getting the current number of decimals\n var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;\n if (parsedNumber.exponent) {\n parsedNumber.exponent += 2;\n }\n else {\n if (fractionLen === 0) {\n parsedNumber.digits.push(0, 0);\n }\n else if (fractionLen === 1) {\n parsedNumber.digits.push(0);\n }\n parsedNumber.integerLen += 2;\n }\n return parsedNumber;\n}", "parseDecimalDigits() {\n let n = '';\n while (isDecimalDigit(this.peek())) {\n n += this.next();\n }\n return n;\n }", "get conversion() {\n return (5/9) * (this._Fahrenheit - 32);\n }", "static nFormatter(num, digits) {\r\n var si = [\r\n { value: 1, symbol: \"\" },\r\n { value: 1E3, symbol: \"k\" },\r\n { value: 1E6, symbol: \"M\" },\r\n { value: 1E9, symbol: \"G\" },\r\n { value: 1E12, symbol: \"T\" },\r\n { value: 1E15, symbol: \"P\" },\r\n { value: 1E18, symbol: \"E\" }\r\n ];\r\n var rx = /\\.0+$|(\\.[0-9]*[1-9])0+$/;\r\n var i;\r\n for (i = si.length - 1; i > 0; i--) {\r\n if (num >= si[i].value) {\r\n break;\r\n }\r\n }\r\n\r\n return \"$\" + (num / si[i].value).toFixed(digits).replace(rx, \"$1\") + si[i].symbol;\r\n }", "getFractionsOfSecondStamp() {\n const that = this;\n\n return that._microsecond.toString() + that._nanosecond + that._picosecond + that._femtosecond + that._attosecond + that._zeptosecond + that._yoctosecond;\n }", "function floatStep(input){\n let value = Number(input.getAttribute('step'));\n if(Math.floor(value) === value) return 0; //no decimal portion\n \n return 1; //has decimal portion keep 1 number after decimal\n}", "function fraction(a, b) {\n var k = a / (a + b);\n if (k > 0 && k < 1) {\n var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3);\n for (var i = 0; i < 10; ++i) { // Solve for theta numerically.\n t0 = t1;\n t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0));\n }\n k = (1 - Math.cos(t1 / 2)) / 2;\n }\n return k;\n}", "function fraction(a, b) {\n var k = a / (a + b);\n if (k > 0 && k < 1) {\n var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3);\n for (var i = 0; i < 10; ++i) { // Solve for theta numerically.\n t0 = t1;\n t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0));\n }\n k = (1 - Math.cos(t1 / 2)) / 2;\n }\n return k;\n}", "function fraction(a, b) {\n var k = a / (a + b);\n if (k > 0 && k < 1) {\n var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3);\n for (var i = 0; i < 10; ++i) { // Solve for theta numerically.\n t0 = t1;\n t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0));\n }\n k = (1 - Math.cos(t1 / 2)) / 2;\n }\n return k;\n}", "function fraction(a, b) {\n var k = a / (a + b);\n if (k > 0 && k < 1) {\n var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3);\n for (var i = 0; i < 10; ++i) { // Solve for theta numerically.\n t0 = t1;\n t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0));\n }\n k = (1 - Math.cos(t1 / 2)) / 2;\n }\n return k;\n}", "function fraction(a, b) {\n var k = a / (a + b);\n if (k > 0 && k < 1) {\n var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3);\n for (var i = 0; i < 10; ++i) { // Solve for theta numerically.\n t0 = t1;\n t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0));\n }\n k = (1 - Math.cos(t1 / 2)) / 2;\n }\n return k;\n}", "function fraction(a, b) {\n var k = a / (a + b);\n if (k > 0 && k < 1) {\n var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3);\n for (var i = 0; i < 10; ++i) { // Solve for theta numerically.\n t0 = t1;\n t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0));\n }\n k = (1 - Math.cos(t1 / 2)) / 2;\n }\n return k;\n}" ]
[ "0.67163837", "0.6652015", "0.6647443", "0.6353788", "0.6353788", "0.63366884", "0.63165545", "0.6196444", "0.6166887", "0.61573476", "0.6144105", "0.6087061", "0.6049235", "0.6035746", "0.6035746", "0.60167223", "0.5988215", "0.5985931", "0.59669214", "0.5956704", "0.5902046", "0.5902003", "0.5893774", "0.5855155", "0.58163583", "0.5803142", "0.57876706", "0.5754727", "0.57329154", "0.572512", "0.5718512", "0.5706", "0.5704686", "0.5696647", "0.5691121", "0.56698966", "0.5669087", "0.5663039", "0.5652777", "0.5649408", "0.56254077", "0.56213534", "0.5593226", "0.5587885", "0.5581115", "0.5579648", "0.5579648", "0.5561462", "0.55516994", "0.55494815", "0.5545433", "0.5544464", "0.5544464", "0.55437434", "0.55415684", "0.55208975", "0.5516102", "0.54932815", "0.5485537", "0.5470405", "0.5461663", "0.544656", "0.5424732", "0.5414964", "0.54126376", "0.5411319", "0.5410651", "0.5404158", "0.5381069", "0.53692734", "0.536407", "0.53628296", "0.5361315", "0.5361037", "0.535736", "0.5353393", "0.5338887", "0.5336672", "0.53087187", "0.52909935", "0.52909935", "0.5284228", "0.5274093", "0.5261809", "0.5261809", "0.525928", "0.5257094", "0.5257094", "0.5257094", "0.5257094", "0.52489775", "0.5237832", "0.5216379", "0.5216246", "0.5209031", "0.52078503", "0.52078503", "0.52078503", "0.52078503", "0.52078503", "0.52078503" ]
0.0
-1
TODO Accept arbitrary length newValues
insertBefore(value, newValue) { let prev = null; let link = this.head; while (link !== this.tail && link.value !== value) { prev = link; link = link.next; } if (!link || link.value !== value) { throw `No element exists with value: ${value}`; } const newLink = new Link(newValue); newLink.next = link; if (prev) { prev.next = newLink; } if (link === this.head) { this.head = newLink; } this.size++; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newValues() {\n\tvalues = [];\n\tfor (var i = 0, t = 14; i < 4; i++) {\n\t\tvalues.push(Math.round(Math.random() * t) + (i + 1));\n\t}\n}", "function setOptionsValues(newValues) {\n for(var key in newValues) {\n options[key] = newValues[key];\n }\n }", "handleNewValues () {\n const newValue = this.get(`value.${this.get('bunsenId')}`) || []\n const oldValue = this.get('items')\n\n if (!_.isEqual(newValue, oldValue)) {\n this.set('items', A(newValue))\n }\n }", "function giveBackNewArray(userNames, newKeys) {\n const keyValues = Object.keys(userNames).map(key => {\n const newKey = newKeys[key] || key;\n return { [newKey]: userNames[key] };\n }\n );\n return Object.assign({}, ...keyValues);\n }", "setValues(newVals) {\r\n this.printStorage.clearPrints();\r\n this.values = JSON.parse(JSON.stringify(newVals));\r\n this.printStorage.pushTimedPrint(this.values);\r\n }", "function extendAttributeValues(existingValues, newValues) {\n for (var key in newValues) {\n if (!existingValues[key]) {\n existingValues[key] = newValues[key]\n } else{\n throw new Error('Attribute value conflict ' + key)\n }\n }\n}", "function updateSimple(newList, oldList, rawNewValue ){\n\n\t var nlen = newList.length;\n\t var olen = oldList.length;\n\t var mlen = Math.min(nlen, olen);\n\n\t updateRange(0, mlen, newList, rawNewValue)\n\t if(nlen < olen){ //need add\n\t removeRange(nlen, olen-nlen);\n\t }else if(nlen > olen){\n\t addRange(olen, nlen, newList, rawNewValue);\n\t }\n\t }", "function appendValues(arr, values, n) {\n\tif(n === 0) { return arr; }\n\telse {\n\t\tvar result = [];\n\t\tfor(var i = 0; i < arr.length; i++) {\n\t\t\tvar thisArr = arr[i];\n\t\t\tfor(var j = 0; j < values.length; j++) {\n\t\t\t\tvar copy = thisArr.slice();\n\t\t\t\tcopy.push(values[j]);\n\t\t\t\tresult.push(copy);\n\t\t\t}\n\t\t}\n\t\treturn appendValues(result, values, n - 1);\n\t}\n}", "function add(newValues, newIndex, n0, n1) {\n\t var oldGroups = groups,\n\t reIndex = crossfilter_index(k, groupCapacity),\n\t add = reduceAdd,\n\t initial = reduceInitial,\n\t k0 = k, // old cardinality\n\t i0 = 0, // index of old group\n\t i1 = 0, // index of new record\n\t j, // object id\n\t g0, // old group\n\t x0, // old key\n\t x1, // new key\n\t g, // group to add\n\t x; // key of group to add\n\n\t // If a reset is needed, we don't need to update the reduce values.\n\t if (resetNeeded) add = initial = crossfilter_null;\n\n\t // Reset the new groups (k is a lower bound).\n\t // Also, make sure that groupIndex exists and is long enough.\n\t groups = new Array(k), k = 0;\n\t groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n\n\t // Get the first old key (x0 of g0), if it exists.\n\t if (k0) x0 = (g0 = oldGroups[0]).key;\n\n\t // Find the first new key (x1), skipping NaN keys.\n\t while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n\t // While new keys remain…\n\t while (i1 < n1) {\n\n\t // Determine the lesser of the two current keys; new and old.\n\t // If there are no old keys remaining, then always add the new key.\n\t if (g0 && x0 <= x1) {\n\t g = g0, x = x0;\n\n\t // Record the new index of the old group.\n\t reIndex[i0] = k;\n\n\t // Retrieve the next old key.\n\t if (g0 = oldGroups[++i0]) x0 = g0.key;\n\t } else {\n\t g = {key: x1, value: initial()}, x = x1;\n\t }\n\n\t // Add the lesser group.\n\t groups[k] = g;\n\n\t // Add any selected records belonging to the added group, while\n\t // advancing the new key and populating the associated group index.\n\t while (!(x1 > x)) {\n\t groupIndex[j = newIndex[i1] + n0] = k;\n\t if (!(filters[j] & zero)) g.value = add(g.value, data[j]);\n\t if (++i1 >= n1) break;\n\t x1 = key(newValues[i1]);\n\t }\n\n\t groupIncrement();\n\t }\n\n\t // Add any remaining old groups that were greater than all new keys.\n\t // No incremental reduce is needed; these groups have no new records.\n\t // Also record the new index of the old group.\n\t while (i0 < k0) {\n\t groups[reIndex[i0] = k] = oldGroups[i0++];\n\t groupIncrement();\n\t }\n\n\t // If we added any new groups before any old groups,\n\t // update the group index of all the old records.\n\t if (k > i0) for (i0 = 0; i0 < n0; ++i0) {\n\t groupIndex[i0] = reIndex[groupIndex[i0]];\n\t }\n\n\t // Modify the update and reset behavior based on the cardinality.\n\t // If the cardinality is less than or equal to one, then the groupIndex\n\t // is not needed. If the cardinality is zero, then there are no records\n\t // and therefore no groups to update or reset. Note that we also must\n\t // change the registered listener to point to the new method.\n\t j = filterListeners.indexOf(update);\n\t if (k > 1) {\n\t update = updateMany;\n\t reset = resetMany;\n\t } else {\n\t if (!k && groupAll) {\n\t k = 1;\n\t groups = [{key: null, value: initial()}];\n\t }\n\t if (k === 1) {\n\t update = updateOne;\n\t reset = resetOne;\n\t } else {\n\t update = crossfilter_null;\n\t reset = crossfilter_null;\n\t }\n\t groupIndex = null;\n\t }\n\t filterListeners[j] = update;\n\n\t // Count the number of added groups,\n\t // and widen the group index as needed.\n\t function groupIncrement() {\n\t if (++k === groupCapacity) {\n\t reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);\n\t groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);\n\t groupCapacity = crossfilter_capacity(groupWidth);\n\t }\n\t }\n\t }", "[SWAP_OLD_LENGTH](newLength) {\n const result = this[OLD_LENGTH];\n this[OLD_LENGTH] = newLength;\n return result;\n }", "function postAdd(newData, n0, n1) {\n indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });\n newValues = newIndex = null;\n }", "function add(newValues, newIndex, n0, n1) {\n var oldGroups = groups,\n reIndex = crossfilter_index(k, groupCapacity),\n add = reduceAdd,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = crossfilter_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1).\n x1 = key(newValues[i1]);\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n if (g0 = oldGroups[++i0]) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n while (x1 <= x || !(x1 <= x1) && !(x <= x)) {\n groupIndex[j = newIndex[i1] + n0] = k;\n if (!(filters[j] & zero)) g.value = add(g.value, data[j]);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater than all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if (k > i0) for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = crossfilter_null;\n reset = crossfilter_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if (++k === groupCapacity) {\n reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);\n groupCapacity = crossfilter_capacity(groupWidth);\n }\n }\n }", "function postAdd(newData, n0, n1) {\n\t indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });\n\t newValues = newIndex = null;\n\t }", "valueIntoHash(values) {\n var newArr = [];\n var _this = this;\n if ($.isArray(values)) {\n values.map((value) => {\n newArr.push(_this.getHash(value));\n });\n };\n return newArr;\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "function pyListRepeat(value, numValues) {\n if (Array.isArray(value)) {\n // tslint:disable-next-line:no-any\n var newArray = [];\n for (var i = 0; i < numValues; i++) {\n newArray = newArray.concat(value);\n }\n return newArray;\n }\n else {\n var newArray = new Array(numValues);\n newArray.fill(value);\n return newArray;\n }\n}", "function pyListRepeat(value, numValues) {\n if (Array.isArray(value)) {\n // tslint:disable-next-line:no-any\n var newArray = [];\n for (var i = 0; i < numValues; i++) {\n newArray = newArray.concat(value);\n }\n return newArray;\n }\n else {\n var newArray = new Array(numValues);\n newArray.fill(value);\n return newArray;\n }\n}", "function recClone(oldObject, newObject) {\n Object.keys(oldObject).forEach(function forCurrentParam(key) {\n if (typeof oldObject[key] !== 'function') {\n if (Array.isArray(oldObject[key])) {\n newObject[key] = [];\n recClone(oldObject[key], newObject[key]);\n } else {\n newObject[key] = oldObject[key];\n }\n }\n });\n\n return newObject;\n }", "modify(index, v) { // index is already multiplied by values_per_entry\n if (this.values_per_entry > 1) {\n console.assert(v.length == this.values_per_entry, \"Unexpected number of values\")\n let vindex = index * this.values_per_entry\n console.assert(vindex < this.lst.length, \"modify out of range\")\n for(let vi = 0; vi < v.length; ++vi)\n this.lst[vindex + vi] = v[vi]\n this.reprint_line(vindex, v)\n }\n else {\n console.assert(v.length === undefined, \"Unexpected list\")\n this.lst[index] = v\n this.reprint_line(index, this.lst[index])\n } \n this.pset_dirty()\n }", "function update_array()\n{\n array_size=inp_as.value;\n generate_array();\n}", "function preAdd(newData, n0, n1) {\n\n\t // Permute new values into natural order using a sorted index.\n\t newValues = newData.map(value);\n\t newIndex = sort(crossfilter_range(n1), 0, n1);\n\t newValues = permute(newValues, newIndex);\n\n\t // Bisect newValues to determine which new records are selected.\n\t var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;\n\t if (refilterFunction) {\n\t for (i = 0; i < n1; ++i) {\n\t if (!refilterFunction(newValues[i], i)) filters[newIndex[i] + n0] |= one;\n\t }\n\t } else {\n\t for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;\n\t for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;\n\t }\n\n\t // If this dimension previously had no data, then we don't need to do the\n\t // more expensive merge operation; use the new values and index as-is.\n\t if (!n0) {\n\t values = newValues;\n\t index = newIndex;\n\t lo0 = lo1;\n\t hi0 = hi1;\n\t return;\n\t }\n\n\t var oldValues = values,\n\t oldIndex = index,\n\t i0 = 0,\n\t i1 = 0;\n\n\t // Otherwise, create new arrays into which to merge new and old.\n\t values = new Array(n);\n\t index = crossfilter_index(n, n);\n\n\t // Merge the old and new sorted values, and old and new index.\n\t for (i = 0; i0 < n0 && i1 < n1; ++i) {\n\t if (oldValues[i0] < newValues[i1]) {\n\t values[i] = oldValues[i0];\n\t index[i] = oldIndex[i0++];\n\t } else {\n\t values[i] = newValues[i1];\n\t index[i] = newIndex[i1++] + n0;\n\t }\n\t }\n\n\t // Add any remaining old values.\n\t for (; i0 < n0; ++i0, ++i) {\n\t values[i] = oldValues[i0];\n\t index[i] = oldIndex[i0];\n\t }\n\n\t // Add any remaining new values.\n\t for (; i1 < n1; ++i1, ++i) {\n\t values[i] = newValues[i1];\n\t index[i] = newIndex[i1] + n0;\n\t }\n\n\t // Bisect again to recompute lo0 and hi0.\n\t bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];\n\t }", "replace(existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing];\n }\n\n if (!Array.isArray(fresh)) {\n fresh = [fresh];\n }\n\n existing.forEach(m => this.delete(m));\n fresh.forEach(m => this.add(m));\n }", "function setValues(values) {\n\n }", "function valuesChanged(oldValue, newValue) {\n\treturn !(0, _deepEqual2.default)(oldValue, newValue);\n}", "if (value.constructor != Array){\n value = [value, value];\n }", "function valuesChanged(oldValue, newValue) {\n return !deepEqual(oldValue, newValue);\n}", "populateLinkedList(keys, values) {\n if (keys.length === values.length) {\n for (let i = 0; i < keys.length; i++) {\n this.pushNode(keys[i], values[i]);\n }\n } else {\n console.log(\"Data provided is not correct i.e send keys and values array of equal length !\");\n }\n }", "function preAdd(newData, n0, n1) {\n\n // Permute new values into natural order using a sorted index.\n newValues = newData.map(value);\n newIndex = sort(crossfilter_range(n1), 0, n1);\n newValues = permute(newValues, newIndex);\n\n // Bisect newValues to determine which new records are selected.\n var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;\n for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;\n for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;\n\n // If this dimension previously had no data, then we don't need to do the\n // more expensive merge operation; use the new values and index as-is.\n if (!n0) {\n values = newValues;\n index = newIndex;\n lo0 = lo1;\n hi0 = hi1;\n return;\n }\n\n var oldValues = values,\n oldIndex = index,\n i0 = 0,\n i1 = 0;\n\n // Otherwise, create new arrays into which to merge new and old.\n values = new Array(n);\n index = crossfilter_index(n, n);\n\n // Merge the old and new sorted values, and old and new index.\n for (i = 0; i0 < n0 && i1 < n1; ++i) {\n if (oldValues[i0] < newValues[i1]) {\n values[i] = oldValues[i0];\n index[i] = oldIndex[i0++];\n } else {\n values[i] = newValues[i1];\n index[i] = newIndex[i1++] + n0;\n }\n }\n\n // Add any remaining old values.\n for (; i0 < n0; ++i0, ++i) {\n values[i] = oldValues[i0];\n index[i] = oldIndex[i0];\n }\n\n // Add any remaining new values.\n for (; i1 < n1; ++i1, ++i) {\n values[i] = newValues[i1];\n index[i] = newIndex[i1] + n0;\n }\n\n // Bisect again to recompute lo0 and hi0.\n bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];\n }", "function addFive() {\n\tfor (i = 0; i < oldArray.length; i++) {\n\t\tnewArray.push(oldArray[i] + 5);\n}\n}", "function changeIndexValues(array) {\n var newArray = [];\n for(var i = 0; i < array.length; i++) {\n newArray.push([i, Number(array[i])]);\n }\n return newArray;\n}", "function init(len, val, v) {\n\t\t\tv = v || [];\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tv[i] = val;\n\t\t\t}return v;\n\t\t}", "function hzNewArgs(name, argsArray) {\n\t\tconst seqExp = hzNew(name);\n\t\tseqExp.expressions[0].argument.arguments.push(t.arrayExpression(argsArray));\n\t\tseqExp.expressions[0].argument.callee.property.name = \"newArgs\";\n\t\treturn seqExp;\n\t}", "extendTypedArray (array, deltaSize) {\n const ta = new array.constructor(array.length + deltaSize) // make new array\n ta.set(array) // fill it with old array\n return ta\n }", "function getValues(curvename, newtotalenergy, currentvalues) {\n let values = [];\n let scale = newtotalenergy;\n const currenttotalenergy = currentvalues.reduce((a, b) => a + b, 0);\n const numsteps = currentvalues.length;\n\n if (currenttotalenergy === 0) {\n const val = newtotalenergy / numsteps;\n values = currentvalues.map(_ => val);\n } else if (curvename === \"ACTUAL\") {\n if (currenttotalenergy !== newtotalenergy) {\n scale = newtotalenergy === 0 ? 0 : newtotalenergy / currenttotalenergy;\n } else {\n return currentvalues;\n }\n values = currentvalues.map(value => value * scale);\n } else {\n let coefs = getcoefs(curvename, numsteps);\n values = coefs.map(value => value * scale);\n }\n return values;\n}", "function valuesChanged(oldValue, newValue) {\n return !(0, _deepEqual2.default)(oldValue, newValue);\n}", "function ui_changeValueList(int_groupIndex, id_targetList, arr_values){\n \tvar _list = ui_getObjById(id_targetList);\n\n\t//clear the items from the list\n \tfor (var i=_list.options.length-1; i>-1; i--){\n \t\t_list.options[i] = null;\n \t}\n\n \t//sort the values in Alphanumeric and populate the list\n \t(arr_values[int_groupIndex]).sort();\n \tfor (var i=0; i<(arr_values[int_groupIndex]).length; i++){\n \t\tvar _newOption = new Option(arr_values[int_groupIndex][i],arr_values[int_groupIndex][i], false, false);\n \t\t_list.options[_list.options.length] = _newOption;\n \t}\n\n\n}", "function newSize(newSize){\n\t\n\t// Set global size to new size\n\tsize = newSize;\n\t\n\t// Init a new temp vatiable for new field array\n\tvar temp = [];\n\t\n\t// For every x (maximum x = size)\n\tfor(var x = 0; x < size; x++){\n\t\t\n\t\t// Init empty x into temp array\n\t\ttemp[x] = [];\n\t\t\n\t\t// For every y (maximum y = size)\n\t\tfor(var y = 0; y < size; y++){\n\t\t\t\n\t\t\t// Check if actual x is in field-array\n\t\t\tif(field.length > x){\n\t\t\t\t\n\t\t\t\t// Check if actual y is in field-array\n\t\t\t\tif(field[x].length > y){\n\t\t\t\t\t\n\t\t\t\t\t// Check if actual field object has a status\n\t\t\t\t\tif(field[x][y].status != 'undefined'){\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Write actual field array object into temp array object\n\t\t\t\t\t\ttemp[x][y] = {\n\t\t\t\t\t\t\tstatus: field[x][y].status\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Go to next for-step\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Initialize temp field object with status as 'dead'\n\t\t\ttemp[x][y] = {\n\t\t\t\tstatus: 'dead'\n\t\t\t};\n\t\t}\n\t}\n\t\n\t// Override field array with temp array\n\tfield = temp;\n\t\n\t// Draw the new field\n\tdrawField();\n}", "splice(start, howmany, ...newItems) {\n // tried to define length and splice so that this is seen as an Array-like object, \n // but it doesn't work on properties. length needs to be a field.\n return this.take(start).concat(newItems).concat(this.skip(start + howmany));\n }", "function fill(value, length) {\n var newArray = [];\n\n for (var i = 0; i < length; i++) {\n var valueToPush = isPlainObject(value) ? deepClone(value) : value;\n newArray.push(valueToPush);\n }\n\n return newArray;\n}", "valueSeq() {\n var valuesSequence = super.valueSeq();\n valuesSequence.length = undefined;\n return valuesSequence;\n }", "function array_push(a, values)\n{\n\tfor (var i = 1; i < arguments.length; i++)\n\t{\n\t\ta[a.length] = arguments[i];\n\t}\n\treturn a.length;\n}", "function update(array, args) {\n\t\t var arrayLength = array.length, length = args.length;\n\t\t while (length--) array[arrayLength + length] = args[length];\n\t\t return array;\n\t\t}", "function createArray(args) {\n let oldLength = 0;\n const array = new DeltaArray();\n const values = new Array();\n const container = new delta_mergeable_1.DeltaMergeable({\n key: args.key,\n parent: args.parent,\n initialValue: array,\n transform: (newArray, currentValue) => {\n const copyFrom = newArray || [];\n // We won't allow people to re-set this array,\n // instead we will mutate the current array to match `newArray`\n for (let i = 0; i < copyFrom.length; i++) {\n currentValue[i] = copyFrom[i];\n }\n currentValue.length = copyFrom.length;\n return currentValue;\n },\n });\n const lengthDeltaMergeable = new delta_mergeable_1.DeltaMergeable({\n key: constants_1.SHARED_CONSTANTS.DELTA_LIST_LENGTH,\n parent: container,\n initialValue: 0,\n });\n function checkIfUpdated(index, value) {\n let newLength = array.length;\n if (index !== undefined\n && (index >= oldLength || index >= array.length)) {\n newLength = index + 1;\n }\n if (newLength !== oldLength) {\n if (newLength > oldLength) {\n // The array grew in size, so we need some new delta mergeables\n for (let i = oldLength; i < newLength; i++) {\n const currentValue = i === index ? value : undefined;\n if (values[i]) {\n container.adopt(values[i]);\n values[i].set(currentValue, true);\n }\n else {\n values[i] = create_delta_mergeable_1.createDeltaMergeable({\n key: String(i),\n parent: container,\n type: args.childType,\n initialValue: currentValue,\n });\n }\n array[i] = values[i].get();\n }\n }\n else { // newLength < oldLength\n for (let i = newLength; i < oldLength; i++) {\n values[i].delete();\n }\n }\n }\n oldLength = array.length;\n lengthDeltaMergeable.set(oldLength);\n }\n const proxyArray = new Proxy(array, {\n set(target, property, value) {\n const index = Number(property);\n if (isNaN(index)) {\n if (property === \"length\") {\n Reflect.set(target, property, value);\n checkIfUpdated();\n return true;\n }\n // All other strings are not able to be set on arrays\n return false;\n }\n // If we got here, we know that the property being set is an index\n checkIfUpdated(index, value);\n values[index].set(value);\n Reflect.set(target, property, values[index].get());\n return true;\n },\n deleteProperty(target, property) {\n const index = Number(property);\n if (isNaN(index)) {\n return false; // arrays can only delete numbers, not strings\n }\n values[index].delete();\n Reflect.deleteProperty(target, property);\n return true;\n },\n });\n container.wrapper = proxyArray;\n return container;\n}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n //return original.push(newItem);\n return original.concat(newItem);\n // Add your code above this line\n }", "function push(arr, newItem){\n[arr.length] = newItem;\n console.log(arr)\n}", "addFields(newValues) {\n this.setFields(_objectSpread({}, this.getFields(), newValues));\n return this;\n }", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesAddedToEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n\n var valuesInOldEnum = Object.create(null);\n oldType.getValues().forEach(function (value) {\n valuesInOldEnum[value.name] = true;\n });\n newType.getValues().forEach(function (value) {\n if (!valuesInOldEnum[value.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: value.name + ' was added to enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesAddedToEnums;\n}", "restrictValue(values) {\n if (values[1].constructor === JQX.Utilities.BigNumber) {\n if (values[1].compare(values[0]) === -1) {\n values[1].set(values[0]);\n }\n }\n else {\n if (values[1] < values[0]) {\n values[1] = values[0];\n }\n }\n }", "function newLfuSet(values) {\n return new LfuSet(values);\n }", "push(value) {\n if (this.size + 1 > this.elements.length) {\n const newArray = new PlainArray(Math.max(this.size * 2, 3))\n for (let i = 0; i < this.size; i++) {\n newArray.set(i, this.elements.get(i))\n }\n this.elements = newArray\n }\n this.elements.set(this.size, value)\n this.size += 1\n }", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n \n // Add your code above this line\n }", "upsertColumn(columnName, arrayOfValues) {\n\n if (arrayOfValues.length != this.data.intervalls.length){\n throw new Error(\"New Column length is not equal to table column length: Length = \" + this.data.intervalls.length);\n }\n\n for( var i = 0; i < this.data.intervalls.length; ++i ) {\n this.data.intervalls[i][columnName] = arrayOfValues[i];\n }\n\n return this.data.intervalls;\n }", "function resize(newSize){\n // For general hash function the only thing to do is to iterate over \n //old hash table and add each entry \n // to a new table.\n var oldStorage = storage;\n resizing = true;\n storageLimit = newSize;\n //need to clear out old one to add entries to new one\n storage = [];\n size = 0;\n //iterate over old storage and insert tuples\n //into new storage\n oldStorage.forEach(function(tuple){\n tuple.forEach(function(item){\n result.insert(item[0],item[1]);\n });\n });\n }", "immutablePush(array, newItem){\n return [ ...array, newItem ]; \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 nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n // Add your code above this line\n}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n\n // Add your code above this line\n}", "set hasMultipleDifferentValues(value) {}", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({\n param,\n value: _value,\n op: 'a'\n });\n });\n } else {\n updates.push({\n param,\n value: value,\n op: 'a'\n });\n }\n });\n return this.clone(updates);\n }", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n console.log(original)\n\n\n // Add your code above this line\n}", "_fillValueArray(changedValueDimensions, skipOverride) {\n const that = this,\n dimensions = that.dimensions;\n\n if (that._filledUpTo !== undefined && skipOverride !== true) {\n let skipFill = true;\n\n for (let a = 0; a < changedValueDimensions.length; a++) {\n skipFill = skipFill && (that._filledUpTo[a] >= changedValueDimensions[a]);\n changedValueDimensions[a] = Math.max(changedValueDimensions[a], that._filledUpTo[a]);\n }\n\n if (skipFill === true) {\n that._scroll();\n return;\n }\n }\n\n that._filledUpTo = changedValueDimensions.slice(0);\n\n function recursion(arr, level) {\n for (let i = 0; i <= changedValueDimensions[level]; i++) {\n if (level !== dimensions - 1) {\n if (arr[i] === undefined) {\n arr[i] = [];\n }\n\n recursion(arr[i], level + 1);\n }\n else if (arr[i] === undefined) {\n arr[i] = that._getDefaultValue();\n }\n }\n }\n\n recursion(that.value, 0);\n\n that._scroll();\n that._setMaxValuesOfScrollBars();\n }", "function changeElementsOfTheArray(numArray, num1, num2){\r\n\tif(num1 > numArray.length - 1 || num2 > numArray.length -1){\r\n\t\tconsole.log(\"Provided index(es) is(are) not valid.\");\r\n\t}\r\n\tvar c = numArray[num1];\r\n\tnumArray[num1] = numArray[num2];\r\n\tnumArray[num2] = c;\r\n\tconsole.log(numArray);\r\n}", "constructor(x, y, newLength) {\n super(x, y);\n\n let _length;\n\n this.setLength = (length) => {\n _length = length > 0 ? length : 1\n };\n\n this.getLength = () => {\n return _length;\n };\n\n this.setLength(newLength);\n }", "function addNewPropertyValue(key, index)\n{\n var MainArray = getPropertyArrayToAlter(key);\n\n if (key == SEARCH_PROPERTY_KEY || key == CHECKOUT_PROPERTY_KEY)\n {\n MainArray[index].Values.push(new PropertyValue());\n }\n}", "attributeChange(e) {\n\n var values = this.state.values;\n var value = e.target.value;\n var name = e.target.name;\n var index = e.target.attributes.getNamedItem('index').value;\n\n var tmp = [name, value];\n\n for (var i in values) {\n\n if (tmp[0] !== values[i][0] && values.length >= i) {\n values[i][index] = tmp;\n break;\n }\n }\n }", "extendArrayOfTypedArrays (array, elements, deltaSize) {\n array.typedArray =\n this.extendTypedArray(array.typedArray, (deltaSize * elements))\n for (let i = array.length, len = i + deltaSize; i < len; i++) {\n const start = i * elements\n const end = start + elements\n array[i] = array.typedArray.subarray(start, end)\n }\n // No return needed, array is mutated instead.\n }", "function doubleValues(arr){\n let newArr = [];\n arr.forEach(function(value) {\n newArr.push(value * 2);\n });\n return newArr;\n }", "push(value) {\n //if the length is greater than the capacity currently then resize\n if (this.length >= this._capacity) {\n this._resize((this.length + 1) * Array.SIZE_RATIO);\n }\n //otherwise, set the new array length and the values\n newMem.set(this.ptr + this.length, value);\n //increase the length counter\n this.length++;\n }", "buildHashAndPreserve(newHash, oldHash, ...preservedKeys) {\n return this.buildHash(Object.assign(this.getSubsetOfHash(oldHash, preservedKeys), this.parseHash(newHash)));\n }", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function get_vectorlen(v, newLength){\n\tlet length = Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n\treturn [(v[0] / length) * newLength, (v[1] / length) * newLength];\n}", "function propagateGrowth(oldG, oldGrowth, newG, newGrowth) {\n const numNewNodes = newG.nodeCount;\n let index = 0;\n // We visit each new node at most once, forming an upper bound on the queue length.\n // Pre-allocate for better performance.\n let queue = new Uint32Array(numNewNodes << 1);\n // Stores the length of queue.\n let queueLength = 0;\n // Only store visit bits for the new graph.\n const visitBits = new util_1.OneBitArray(numNewNodes);\n // Enqueues the given node pairing (represented by their indices in their respective graphs)\n // into the queue. oldNodeIndex and newNodeIndex represent a node at the same edge shared between\n // the graphs.\n function enqueue(oldNodeIndex, newNodeIndex) {\n queue[queueLength++] = oldNodeIndex;\n queue[queueLength++] = newNodeIndex;\n }\n // Returns a single item from the queue. (Called twice to remove a pair.)\n function dequeue() {\n return queue[index++];\n }\n // 0 indicates the root node. Start at the root.\n const oldNode = new Node(0, oldG);\n const newNode = new Node(0, newG);\n const oldEdgeTmp = new Edge(0, oldG);\n {\n // Visit global roots by *node name*, not *edge name* as edges are arbitrarily numbered from the root node.\n // These global roots correspond to different JavaScript contexts (e.g. IFrames).\n const newUserRoots = newG.getGlobalRootIndices();\n const oldUserRoots = oldG.getGlobalRootIndices();\n const m = new Map();\n for (let i = 0; i < newUserRoots.length; i++) {\n newNode.nodeIndex = newUserRoots[i];\n const name = newNode.name;\n let a = m.get(name);\n if (!a) {\n a = { o: [], n: [] };\n m.set(name, a);\n }\n a.n.push(newUserRoots[i]);\n }\n for (let i = 0; i < oldUserRoots.length; i++) {\n oldNode.nodeIndex = oldUserRoots[i];\n const name = oldNode.name;\n let a = m.get(name);\n if (a) {\n a.o.push(oldUserRoots[i]);\n }\n }\n m.forEach((v) => {\n let num = Math.min(v.o.length, v.n.length);\n for (let i = 0; i < num; i++) {\n enqueue(v.o[i], v.n[i]);\n visitBits.set(v.n[i], true);\n }\n });\n }\n // The main loop, which is the essence of PropagateGrowth.\n while (index < queueLength) {\n const oldIndex = dequeue();\n const newIndex = dequeue();\n oldNode.nodeIndex = oldIndex;\n newNode.nodeIndex = newIndex;\n const oldNodeGrowthStatus = oldGrowth.get(oldIndex);\n // Nodes are either 'New', 'Growing', or 'Not Growing'.\n // Nodes begin as 'New', and transition to 'Growing' or 'Not Growing' after a snapshot.\n // So if a node is neither new nor consistently growing, we don't care about it.\n if ((oldNodeGrowthStatus === 0 /* NEW */ || oldNodeGrowthStatus === 2 /* GROWING */) && oldNode.numProperties() < newNode.numProperties()) {\n newGrowth.set(newIndex, 2 /* GROWING */);\n }\n // Visit shared children.\n const oldEdges = new Map();\n if (oldNode.hasChildren) {\n for (const it = oldNode.children; it.hasNext(); it.next()) {\n const oldChildEdge = it.item();\n oldEdges.set(hash(oldNode, oldChildEdge), oldChildEdge.edgeIndex);\n }\n }\n //Now this loop will take care for the memory leaks in which the object count is not increasing but the Retained Size will be increase certainly\n if ((oldNodeGrowthStatus === 1 /* NOT_GROWING */) && oldNode.numProperties() == newNode.numProperties()) {\n if (oldNode.getRetainedSize() < newNode.getRetainedSize()) {\n newGrowth.set(newIndex, 2 /* GROWING */);\n }\n }\n if (newNode.hasChildren) {\n for (const it = newNode.children; it.hasNext(); it.next()) {\n const newChildEdge = it.item();\n const oldEdge = oldEdges.get(hash(newNode, newChildEdge));\n oldEdgeTmp.edgeIndex = oldEdge;\n if (oldEdge !== undefined && !visitBits.get(newChildEdge.toIndex) &&\n shouldTraverse(oldEdgeTmp, false) && shouldTraverse(newChildEdge, false)) {\n visitBits.set(newChildEdge.toIndex, true);\n enqueue(oldEdgeTmp.toIndex, newChildEdge.toIndex);\n }\n }\n }\n }\n}", "replace( t, old_type, new_type ) {\n if(t.type==old_type) t.type = new_type\n if( Array.isArray(t.value) ) {\n var a = t.value\n for(var i=0; i<a.length; i++) a[i] = this.replace(a[i], old_type, new_type)\n } \n return t\n }", "function addData(newValue, data) {\n // Extract the values we need from the data and format them properly\n convertData(newValue);\n\n data.push(newValue);\n}", "function changeTheValue(arrInput, value) {\r\n var key = \"a\";\r\n var indexOfSubarray;\r\n console.log(this);\r\n for (let eachKey in this) {\r\n //when we pass a \"hello\" string into changeTheValue using .call()\r\n //it will be like calling new String(\"hello\"). when we save the returned value of new String(\"hello\"), it will return String(\"hello\");\r\n //each key will be str 0,1,2,3,4\r\n let eachStr = this[eachKey];\r\n console.log(eachStr);\r\n }\r\n arrInput.forEach(function findValue(subarray, index) {\r\n var eachKey = subarray[0];\r\n if (eachKey === key) {\r\n indexOfSubarray = index;\r\n }\r\n });\r\n var mutateSubarray = arrInput[indexOfSubarray];\r\n mutateSubarray[1] = value;\r\n // var [, ourValue] = arrInput[indexOfSubarray];\r\n // ourValue = value;\r\n console.log(arrInput);\r\n}", "Add(values) {\n let vec = new VecX(values);\n while (vec.size < this.size) {\n vec.values.push(vec.values[0]);\n }\n ;\n this.values = this.values.map((val, index) => val + vec.values[index]);\n return this;\n }", "getValues() {\n return [...this.values];\n }", "function addToEnd(arr,value){\r\n\tarr.splice(arr.length,0,value)\r\n\treturn arr\r\n}", "function addElements (new_elements, index) {\r\n\r\n\tvar arr_before = elements.slice(0, index);\r\n\tvar arr_after = elements.slice(index + 1);\r\n\telements.splice(index, 1);\r\n\telements = arr_before.concat(new_elements);\r\n\telements = elements.concat(arr_after);\r\n\r\n}", "mapVal(fn) {\n let val = this.values();\n return Array.from({\n length: this.size\n }, () => {\n let values = val.next();\n return fn(values.value);\n }).filter(item => item);\n }", "reinitializeArray() {\n const that = this;\n\n if (that.type === 'none') {\n return;\n }\n\n const dimensions = that.dimensions,\n oldValue = JSON.stringify(that.value);\n\n if (that.dimensions === 1) {\n that.value.fill(that._getDefaultValue());\n }\n else {\n const recursion = function (arr, level) {\n for (let i = 0; i < arr.length; i++) {\n if (level === dimensions) {\n arr[i] = that._getDefaultValue();\n }\n else {\n recursion(arr[i], level + 1);\n }\n }\n };\n\n recursion(that.value, 1);\n }\n\n if (oldValue !== JSON.stringify(that.value)) {\n that._scroll();\n that.$.fireEvent('change', { 'value': that.value, 'oldValue': JSON.parse(oldValue) });\n }\n }", "function watcher_params(new_val,old_val)\n\t\t{\n\t\tif (!new_val)\n\t\t\treturn false;\n\t\t//if changed only kind of aggregations\n\t\tif (new_val['aggregationsBy']!=old_val['aggregationsBy'])\n\t\t\t{\n\t\t\t$scope.prepare_for_chart(); //set array from DATA to DATA_AGR depends on key\n\t\t\treturn false;\t\n\t\t\t}\n\n\t\t\t//skip another one request, because only when watcher runs after changing total\n\t\t\t//request will be send\n\t\tif (new_val['type']=='total'&&new_val['value']!='all')\n\t\t\t{\n\t\t\t//if changed date or type (by mark)\n\t\t\t$scope.params['type'] = $scope.params['value']=='all'?'total':'mark';\n\t\t\treturn false;\t\t\t\n\t\t\t}\n\n\t\t\t//it is for fixing case when returns from mark to all marks\n\t\tif (new_val['type']!='total'&&new_val['value']=='all')\n\t\t\t{\n\t\t\t//if changed date or type (by mark)\n\t\t\t$scope.params['type'] = 'total';\n\t\t\treturn false;\t\t\t\n\t\t\t}\n\n\t\t$scope.myspinner.is = true;\n\t\t$scope.get_aggregations();\n\t\t}", "pushAll(values) {\n for (const value of values) {\n this.push(value);\n }\n }", "set keepHistory(keepHistory) {\n const prevKeepHistory = this[KEEP_HISTORY];\n this[KEEP_HISTORY] = typeof keepHistory === 'number'\n && keepHistory < 1 ? false : keepHistory;\n // Change does not require historical values modification nor epoch update.\n if (this[KEEP_HISTORY] === prevKeepHistory || this[KEEP_HISTORY] === true) {\n return;\n }\n if (typeof this[KEEP_HISTORY] === 'number') {\n // Sub 1 to keep history count to account for the current value\n let deleteCount = this[VALUES].length - this[KEEP_HISTORY] - 1;\n // Change require values modification and new epoch.\n if (deleteCount > 0) {\n // Remove items from the front of the values array until the delete\n // count is 0 or the current value index is 0.\n while (this[CUR_VALUE_INDEX] > 0 && deleteCount-- > 0) {\n this[VALUES].shift();\n this[CUR_VALUE_INDEX]--;\n }\n // Remove values from the end of the values array until delete \n // count is 0\n while (deleteCount-- > 0) {\n this[VALUES].pop();\n }\n this[HISTORY_EPOCH] = Symbol();\n }\n // this[KEEP_HISTORY] === false \n // If more than one value is being stored in values array Change require\n // values modification and new epoch.\n }\n else if (this[VALUES].length > 1) {\n this[VALUES][0] = this[VALUES][this[CUR_VALUE_INDEX]];\n this[CUR_VALUE_INDEX] = 0;\n this[VALUES].splice(1);\n this[HISTORY_EPOCH] = Symbol();\n }\n }", "function myArrayFunction(myPets) {\n var myNewPets = [...myPets];\n \n // Only change code below this line\n var myNewPets = [];\n myNewPets.push('Bird', 'Fish');\n \n var firstPet = [];\n firstPet = myNewPets[0];\n\n var lastPet = [];\n lastPet = myNewPets.length-1;\n\n myNewPets[0] = \"Lion\";\n\n return myNewPets;\n // Only change code abow this line\n}", "function reIndexArray(obj, newKeys) {\n const keyValues = Object.keys(obj).map(key => {\n const newKey = newKeys[key] || key;\n return { [newKey]: obj[key] };\n });\n return Object.assign({}, ...keyValues);\n }", "restrictValue(values) {\n if (values[1] < values[0]) {\n values[1] = values[0];\n }\n }", "function update(index, value, array) {\n // TODO return a new copy of the array with the given value at index\n var newArr = array.slice();\n newArr[index] = value;\n return newArr;\n}", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "repopulate () {\n const nbToGenerate = this.populationSize - this.currentPopulation.length\n const newGenomes = Array(nbToGenerate).fill('').map(genome => new Genome(this.nbInput, this.nbOutput))\n this.currentPopulation = [...this.currentPopulation, ...newGenomes]\n }", "function renameKeys(userNames, newKeys) {\n var newArrOfChngedKeys = [];\n for (var i in userNames) {\n newArrOfChngedKeys.push(giveBackNewArray(userNames[i], newKeys))\n }\n return newArrOfChngedKeys\n }", "function preProcessOriginalArray(allValues, arr){\n let previousHourWasMinus = false\n for(let element of allValues.values()){\n element = removeSpacesAndPutMinutesAndHoursInToOneString(element) \n arr.push(element)\n }\n return arr\n}", "function nextAssignmentDefault(oldAssignment, values) {\n let newAssignment = Object.assign({}, oldAssignment);\n let features = Object.keys(values);\n\n // try incrementing the value\n newAssignment.valueLearned = newAssignment.valueLearned + 1;\n\n // if we reached the last value for the feature than increment the feature\n if (newAssignment.valueLearned >= values[features[newAssignment.featureLearned]].length) {\n newAssignment.valueLearned = 0;\n newAssignment.featureLearned = newAssignment.featureLearned + 1;\n }\n\n // if we reached the last feature then reset to 0\n if (newAssignment.featureLearned >= features.length) {\n newAssignment.featureLearned = 0;\n }\n return newAssignment;\n}", "addOnIndex(index, value) {\n if (index < 0) {\n console.error(`Index must be greater than 0!`);\n return false;\n }\n\n index = Math.floor(index);\n\n if (this.length <= index) {\n this.add(value);\n } else {\n const temp = this.get(index);\n this.data[index] = value;\n\n for (let i = index + 1; i < this.length; i++) {\n this.data[i + 1] = this.data[i];\n }\n\n this.data[index + 1] = temp;\n this.length++;\n }\n }" ]
[ "0.5968423", "0.59483916", "0.5828773", "0.57990915", "0.5651268", "0.55895936", "0.5574767", "0.5463488", "0.54607844", "0.54592985", "0.5452371", "0.54036", "0.54028475", "0.5326634", "0.5278186", "0.5278186", "0.5278186", "0.5278186", "0.5251375", "0.5251375", "0.5234125", "0.52281207", "0.52099496", "0.51758295", "0.51729083", "0.51536727", "0.5153094", "0.5127034", "0.5120726", "0.51191366", "0.51161283", "0.51144356", "0.51104057", "0.5106595", "0.50891846", "0.5085919", "0.5083976", "0.5068806", "0.50515765", "0.50401545", "0.50262237", "0.50240135", "0.50206745", "0.5008447", "0.5002072", "0.5000574", "0.49931705", "0.49767685", "0.49761254", "0.49680218", "0.49635965", "0.49618104", "0.49546537", "0.49538842", "0.49521962", "0.49426547", "0.49317512", "0.49261925", "0.49242955", "0.4918176", "0.49160483", "0.48944947", "0.48893264", "0.4888409", "0.48862338", "0.4886075", "0.4876722", "0.48745346", "0.48737055", "0.48678038", "0.4867545", "0.48674434", "0.48642802", "0.48517597", "0.48511857", "0.48481643", "0.48448664", "0.4839904", "0.48382565", "0.48334876", "0.48334563", "0.48313934", "0.48308757", "0.4829004", "0.48287424", "0.48252752", "0.48213664", "0.48087496", "0.48026955", "0.47975183", "0.47931793", "0.478875", "0.47867408", "0.47867408", "0.47867408", "0.47867408", "0.47863892", "0.47770905", "0.4773772", "0.4773265", "0.4770445" ]
0.0
-1
TODO Accept arbitrary length newValues
insertAfter(value, newValue) { let link = this.head; while (link !== this.tail && link.value !== value) { // 1 2 3 link = link.next; } if (!link || link.value !== value) { throw `No element exists with value: ${value}`; } const newLink = new Link(newValue); newLink.next = link.next; link.next = newLink; if (link === this.tail) { this.tail === newLink; } this.size++; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newValues() {\n\tvalues = [];\n\tfor (var i = 0, t = 14; i < 4; i++) {\n\t\tvalues.push(Math.round(Math.random() * t) + (i + 1));\n\t}\n}", "function setOptionsValues(newValues) {\n for(var key in newValues) {\n options[key] = newValues[key];\n }\n }", "handleNewValues () {\n const newValue = this.get(`value.${this.get('bunsenId')}`) || []\n const oldValue = this.get('items')\n\n if (!_.isEqual(newValue, oldValue)) {\n this.set('items', A(newValue))\n }\n }", "function giveBackNewArray(userNames, newKeys) {\n const keyValues = Object.keys(userNames).map(key => {\n const newKey = newKeys[key] || key;\n return { [newKey]: userNames[key] };\n }\n );\n return Object.assign({}, ...keyValues);\n }", "setValues(newVals) {\r\n this.printStorage.clearPrints();\r\n this.values = JSON.parse(JSON.stringify(newVals));\r\n this.printStorage.pushTimedPrint(this.values);\r\n }", "function extendAttributeValues(existingValues, newValues) {\n for (var key in newValues) {\n if (!existingValues[key]) {\n existingValues[key] = newValues[key]\n } else{\n throw new Error('Attribute value conflict ' + key)\n }\n }\n}", "function updateSimple(newList, oldList, rawNewValue ){\n\n\t var nlen = newList.length;\n\t var olen = oldList.length;\n\t var mlen = Math.min(nlen, olen);\n\n\t updateRange(0, mlen, newList, rawNewValue)\n\t if(nlen < olen){ //need add\n\t removeRange(nlen, olen-nlen);\n\t }else if(nlen > olen){\n\t addRange(olen, nlen, newList, rawNewValue);\n\t }\n\t }", "function appendValues(arr, values, n) {\n\tif(n === 0) { return arr; }\n\telse {\n\t\tvar result = [];\n\t\tfor(var i = 0; i < arr.length; i++) {\n\t\t\tvar thisArr = arr[i];\n\t\t\tfor(var j = 0; j < values.length; j++) {\n\t\t\t\tvar copy = thisArr.slice();\n\t\t\t\tcopy.push(values[j]);\n\t\t\t\tresult.push(copy);\n\t\t\t}\n\t\t}\n\t\treturn appendValues(result, values, n - 1);\n\t}\n}", "function add(newValues, newIndex, n0, n1) {\n\t var oldGroups = groups,\n\t reIndex = crossfilter_index(k, groupCapacity),\n\t add = reduceAdd,\n\t initial = reduceInitial,\n\t k0 = k, // old cardinality\n\t i0 = 0, // index of old group\n\t i1 = 0, // index of new record\n\t j, // object id\n\t g0, // old group\n\t x0, // old key\n\t x1, // new key\n\t g, // group to add\n\t x; // key of group to add\n\n\t // If a reset is needed, we don't need to update the reduce values.\n\t if (resetNeeded) add = initial = crossfilter_null;\n\n\t // Reset the new groups (k is a lower bound).\n\t // Also, make sure that groupIndex exists and is long enough.\n\t groups = new Array(k), k = 0;\n\t groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n\n\t // Get the first old key (x0 of g0), if it exists.\n\t if (k0) x0 = (g0 = oldGroups[0]).key;\n\n\t // Find the first new key (x1), skipping NaN keys.\n\t while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n\t // While new keys remain…\n\t while (i1 < n1) {\n\n\t // Determine the lesser of the two current keys; new and old.\n\t // If there are no old keys remaining, then always add the new key.\n\t if (g0 && x0 <= x1) {\n\t g = g0, x = x0;\n\n\t // Record the new index of the old group.\n\t reIndex[i0] = k;\n\n\t // Retrieve the next old key.\n\t if (g0 = oldGroups[++i0]) x0 = g0.key;\n\t } else {\n\t g = {key: x1, value: initial()}, x = x1;\n\t }\n\n\t // Add the lesser group.\n\t groups[k] = g;\n\n\t // Add any selected records belonging to the added group, while\n\t // advancing the new key and populating the associated group index.\n\t while (!(x1 > x)) {\n\t groupIndex[j = newIndex[i1] + n0] = k;\n\t if (!(filters[j] & zero)) g.value = add(g.value, data[j]);\n\t if (++i1 >= n1) break;\n\t x1 = key(newValues[i1]);\n\t }\n\n\t groupIncrement();\n\t }\n\n\t // Add any remaining old groups that were greater than all new keys.\n\t // No incremental reduce is needed; these groups have no new records.\n\t // Also record the new index of the old group.\n\t while (i0 < k0) {\n\t groups[reIndex[i0] = k] = oldGroups[i0++];\n\t groupIncrement();\n\t }\n\n\t // If we added any new groups before any old groups,\n\t // update the group index of all the old records.\n\t if (k > i0) for (i0 = 0; i0 < n0; ++i0) {\n\t groupIndex[i0] = reIndex[groupIndex[i0]];\n\t }\n\n\t // Modify the update and reset behavior based on the cardinality.\n\t // If the cardinality is less than or equal to one, then the groupIndex\n\t // is not needed. If the cardinality is zero, then there are no records\n\t // and therefore no groups to update or reset. Note that we also must\n\t // change the registered listener to point to the new method.\n\t j = filterListeners.indexOf(update);\n\t if (k > 1) {\n\t update = updateMany;\n\t reset = resetMany;\n\t } else {\n\t if (!k && groupAll) {\n\t k = 1;\n\t groups = [{key: null, value: initial()}];\n\t }\n\t if (k === 1) {\n\t update = updateOne;\n\t reset = resetOne;\n\t } else {\n\t update = crossfilter_null;\n\t reset = crossfilter_null;\n\t }\n\t groupIndex = null;\n\t }\n\t filterListeners[j] = update;\n\n\t // Count the number of added groups,\n\t // and widen the group index as needed.\n\t function groupIncrement() {\n\t if (++k === groupCapacity) {\n\t reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);\n\t groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);\n\t groupCapacity = crossfilter_capacity(groupWidth);\n\t }\n\t }\n\t }", "[SWAP_OLD_LENGTH](newLength) {\n const result = this[OLD_LENGTH];\n this[OLD_LENGTH] = newLength;\n return result;\n }", "function postAdd(newData, n0, n1) {\n indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });\n newValues = newIndex = null;\n }", "function add(newValues, newIndex, n0, n1) {\n var oldGroups = groups,\n reIndex = crossfilter_index(k, groupCapacity),\n add = reduceAdd,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = crossfilter_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1).\n x1 = key(newValues[i1]);\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n if (g0 = oldGroups[++i0]) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n while (x1 <= x || !(x1 <= x1) && !(x <= x)) {\n groupIndex[j = newIndex[i1] + n0] = k;\n if (!(filters[j] & zero)) g.value = add(g.value, data[j]);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater than all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if (k > i0) for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = crossfilter_null;\n reset = crossfilter_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if (++k === groupCapacity) {\n reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);\n groupCapacity = crossfilter_capacity(groupWidth);\n }\n }\n }", "function postAdd(newData, n0, n1) {\n\t indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });\n\t newValues = newIndex = null;\n\t }", "valueIntoHash(values) {\n var newArr = [];\n var _this = this;\n if ($.isArray(values)) {\n values.map((value) => {\n newArr.push(_this.getHash(value));\n });\n };\n return newArr;\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "replace (existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing]\n }\n if (!Array.isArray(fresh)) {\n fresh = [fresh]\n }\n existing.forEach((m) => this.delete(m))\n fresh.forEach((m) => this.add(m))\n }", "function pyListRepeat(value, numValues) {\n if (Array.isArray(value)) {\n // tslint:disable-next-line:no-any\n var newArray = [];\n for (var i = 0; i < numValues; i++) {\n newArray = newArray.concat(value);\n }\n return newArray;\n }\n else {\n var newArray = new Array(numValues);\n newArray.fill(value);\n return newArray;\n }\n}", "function pyListRepeat(value, numValues) {\n if (Array.isArray(value)) {\n // tslint:disable-next-line:no-any\n var newArray = [];\n for (var i = 0; i < numValues; i++) {\n newArray = newArray.concat(value);\n }\n return newArray;\n }\n else {\n var newArray = new Array(numValues);\n newArray.fill(value);\n return newArray;\n }\n}", "function recClone(oldObject, newObject) {\n Object.keys(oldObject).forEach(function forCurrentParam(key) {\n if (typeof oldObject[key] !== 'function') {\n if (Array.isArray(oldObject[key])) {\n newObject[key] = [];\n recClone(oldObject[key], newObject[key]);\n } else {\n newObject[key] = oldObject[key];\n }\n }\n });\n\n return newObject;\n }", "modify(index, v) { // index is already multiplied by values_per_entry\n if (this.values_per_entry > 1) {\n console.assert(v.length == this.values_per_entry, \"Unexpected number of values\")\n let vindex = index * this.values_per_entry\n console.assert(vindex < this.lst.length, \"modify out of range\")\n for(let vi = 0; vi < v.length; ++vi)\n this.lst[vindex + vi] = v[vi]\n this.reprint_line(vindex, v)\n }\n else {\n console.assert(v.length === undefined, \"Unexpected list\")\n this.lst[index] = v\n this.reprint_line(index, this.lst[index])\n } \n this.pset_dirty()\n }", "function update_array()\n{\n array_size=inp_as.value;\n generate_array();\n}", "function preAdd(newData, n0, n1) {\n\n\t // Permute new values into natural order using a sorted index.\n\t newValues = newData.map(value);\n\t newIndex = sort(crossfilter_range(n1), 0, n1);\n\t newValues = permute(newValues, newIndex);\n\n\t // Bisect newValues to determine which new records are selected.\n\t var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;\n\t if (refilterFunction) {\n\t for (i = 0; i < n1; ++i) {\n\t if (!refilterFunction(newValues[i], i)) filters[newIndex[i] + n0] |= one;\n\t }\n\t } else {\n\t for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;\n\t for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;\n\t }\n\n\t // If this dimension previously had no data, then we don't need to do the\n\t // more expensive merge operation; use the new values and index as-is.\n\t if (!n0) {\n\t values = newValues;\n\t index = newIndex;\n\t lo0 = lo1;\n\t hi0 = hi1;\n\t return;\n\t }\n\n\t var oldValues = values,\n\t oldIndex = index,\n\t i0 = 0,\n\t i1 = 0;\n\n\t // Otherwise, create new arrays into which to merge new and old.\n\t values = new Array(n);\n\t index = crossfilter_index(n, n);\n\n\t // Merge the old and new sorted values, and old and new index.\n\t for (i = 0; i0 < n0 && i1 < n1; ++i) {\n\t if (oldValues[i0] < newValues[i1]) {\n\t values[i] = oldValues[i0];\n\t index[i] = oldIndex[i0++];\n\t } else {\n\t values[i] = newValues[i1];\n\t index[i] = newIndex[i1++] + n0;\n\t }\n\t }\n\n\t // Add any remaining old values.\n\t for (; i0 < n0; ++i0, ++i) {\n\t values[i] = oldValues[i0];\n\t index[i] = oldIndex[i0];\n\t }\n\n\t // Add any remaining new values.\n\t for (; i1 < n1; ++i1, ++i) {\n\t values[i] = newValues[i1];\n\t index[i] = newIndex[i1] + n0;\n\t }\n\n\t // Bisect again to recompute lo0 and hi0.\n\t bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];\n\t }", "replace(existing, fresh) {\n if (!Array.isArray(existing)) {\n existing = [existing];\n }\n\n if (!Array.isArray(fresh)) {\n fresh = [fresh];\n }\n\n existing.forEach(m => this.delete(m));\n fresh.forEach(m => this.add(m));\n }", "function setValues(values) {\n\n }", "function valuesChanged(oldValue, newValue) {\n\treturn !(0, _deepEqual2.default)(oldValue, newValue);\n}", "if (value.constructor != Array){\n value = [value, value];\n }", "function valuesChanged(oldValue, newValue) {\n return !deepEqual(oldValue, newValue);\n}", "populateLinkedList(keys, values) {\n if (keys.length === values.length) {\n for (let i = 0; i < keys.length; i++) {\n this.pushNode(keys[i], values[i]);\n }\n } else {\n console.log(\"Data provided is not correct i.e send keys and values array of equal length !\");\n }\n }", "function preAdd(newData, n0, n1) {\n\n // Permute new values into natural order using a sorted index.\n newValues = newData.map(value);\n newIndex = sort(crossfilter_range(n1), 0, n1);\n newValues = permute(newValues, newIndex);\n\n // Bisect newValues to determine which new records are selected.\n var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;\n for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;\n for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;\n\n // If this dimension previously had no data, then we don't need to do the\n // more expensive merge operation; use the new values and index as-is.\n if (!n0) {\n values = newValues;\n index = newIndex;\n lo0 = lo1;\n hi0 = hi1;\n return;\n }\n\n var oldValues = values,\n oldIndex = index,\n i0 = 0,\n i1 = 0;\n\n // Otherwise, create new arrays into which to merge new and old.\n values = new Array(n);\n index = crossfilter_index(n, n);\n\n // Merge the old and new sorted values, and old and new index.\n for (i = 0; i0 < n0 && i1 < n1; ++i) {\n if (oldValues[i0] < newValues[i1]) {\n values[i] = oldValues[i0];\n index[i] = oldIndex[i0++];\n } else {\n values[i] = newValues[i1];\n index[i] = newIndex[i1++] + n0;\n }\n }\n\n // Add any remaining old values.\n for (; i0 < n0; ++i0, ++i) {\n values[i] = oldValues[i0];\n index[i] = oldIndex[i0];\n }\n\n // Add any remaining new values.\n for (; i1 < n1; ++i1, ++i) {\n values[i] = newValues[i1];\n index[i] = newIndex[i1] + n0;\n }\n\n // Bisect again to recompute lo0 and hi0.\n bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];\n }", "function addFive() {\n\tfor (i = 0; i < oldArray.length; i++) {\n\t\tnewArray.push(oldArray[i] + 5);\n}\n}", "function changeIndexValues(array) {\n var newArray = [];\n for(var i = 0; i < array.length; i++) {\n newArray.push([i, Number(array[i])]);\n }\n return newArray;\n}", "function init(len, val, v) {\n\t\t\tv = v || [];\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tv[i] = val;\n\t\t\t}return v;\n\t\t}", "function hzNewArgs(name, argsArray) {\n\t\tconst seqExp = hzNew(name);\n\t\tseqExp.expressions[0].argument.arguments.push(t.arrayExpression(argsArray));\n\t\tseqExp.expressions[0].argument.callee.property.name = \"newArgs\";\n\t\treturn seqExp;\n\t}", "extendTypedArray (array, deltaSize) {\n const ta = new array.constructor(array.length + deltaSize) // make new array\n ta.set(array) // fill it with old array\n return ta\n }", "function getValues(curvename, newtotalenergy, currentvalues) {\n let values = [];\n let scale = newtotalenergy;\n const currenttotalenergy = currentvalues.reduce((a, b) => a + b, 0);\n const numsteps = currentvalues.length;\n\n if (currenttotalenergy === 0) {\n const val = newtotalenergy / numsteps;\n values = currentvalues.map(_ => val);\n } else if (curvename === \"ACTUAL\") {\n if (currenttotalenergy !== newtotalenergy) {\n scale = newtotalenergy === 0 ? 0 : newtotalenergy / currenttotalenergy;\n } else {\n return currentvalues;\n }\n values = currentvalues.map(value => value * scale);\n } else {\n let coefs = getcoefs(curvename, numsteps);\n values = coefs.map(value => value * scale);\n }\n return values;\n}", "function valuesChanged(oldValue, newValue) {\n return !(0, _deepEqual2.default)(oldValue, newValue);\n}", "function ui_changeValueList(int_groupIndex, id_targetList, arr_values){\n \tvar _list = ui_getObjById(id_targetList);\n\n\t//clear the items from the list\n \tfor (var i=_list.options.length-1; i>-1; i--){\n \t\t_list.options[i] = null;\n \t}\n\n \t//sort the values in Alphanumeric and populate the list\n \t(arr_values[int_groupIndex]).sort();\n \tfor (var i=0; i<(arr_values[int_groupIndex]).length; i++){\n \t\tvar _newOption = new Option(arr_values[int_groupIndex][i],arr_values[int_groupIndex][i], false, false);\n \t\t_list.options[_list.options.length] = _newOption;\n \t}\n\n\n}", "function newSize(newSize){\n\t\n\t// Set global size to new size\n\tsize = newSize;\n\t\n\t// Init a new temp vatiable for new field array\n\tvar temp = [];\n\t\n\t// For every x (maximum x = size)\n\tfor(var x = 0; x < size; x++){\n\t\t\n\t\t// Init empty x into temp array\n\t\ttemp[x] = [];\n\t\t\n\t\t// For every y (maximum y = size)\n\t\tfor(var y = 0; y < size; y++){\n\t\t\t\n\t\t\t// Check if actual x is in field-array\n\t\t\tif(field.length > x){\n\t\t\t\t\n\t\t\t\t// Check if actual y is in field-array\n\t\t\t\tif(field[x].length > y){\n\t\t\t\t\t\n\t\t\t\t\t// Check if actual field object has a status\n\t\t\t\t\tif(field[x][y].status != 'undefined'){\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Write actual field array object into temp array object\n\t\t\t\t\t\ttemp[x][y] = {\n\t\t\t\t\t\t\tstatus: field[x][y].status\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Go to next for-step\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Initialize temp field object with status as 'dead'\n\t\t\ttemp[x][y] = {\n\t\t\t\tstatus: 'dead'\n\t\t\t};\n\t\t}\n\t}\n\t\n\t// Override field array with temp array\n\tfield = temp;\n\t\n\t// Draw the new field\n\tdrawField();\n}", "splice(start, howmany, ...newItems) {\n // tried to define length and splice so that this is seen as an Array-like object, \n // but it doesn't work on properties. length needs to be a field.\n return this.take(start).concat(newItems).concat(this.skip(start + howmany));\n }", "function fill(value, length) {\n var newArray = [];\n\n for (var i = 0; i < length; i++) {\n var valueToPush = isPlainObject(value) ? deepClone(value) : value;\n newArray.push(valueToPush);\n }\n\n return newArray;\n}", "valueSeq() {\n var valuesSequence = super.valueSeq();\n valuesSequence.length = undefined;\n return valuesSequence;\n }", "function array_push(a, values)\n{\n\tfor (var i = 1; i < arguments.length; i++)\n\t{\n\t\ta[a.length] = arguments[i];\n\t}\n\treturn a.length;\n}", "function update(array, args) {\n\t\t var arrayLength = array.length, length = args.length;\n\t\t while (length--) array[arrayLength + length] = args[length];\n\t\t return array;\n\t\t}", "function createArray(args) {\n let oldLength = 0;\n const array = new DeltaArray();\n const values = new Array();\n const container = new delta_mergeable_1.DeltaMergeable({\n key: args.key,\n parent: args.parent,\n initialValue: array,\n transform: (newArray, currentValue) => {\n const copyFrom = newArray || [];\n // We won't allow people to re-set this array,\n // instead we will mutate the current array to match `newArray`\n for (let i = 0; i < copyFrom.length; i++) {\n currentValue[i] = copyFrom[i];\n }\n currentValue.length = copyFrom.length;\n return currentValue;\n },\n });\n const lengthDeltaMergeable = new delta_mergeable_1.DeltaMergeable({\n key: constants_1.SHARED_CONSTANTS.DELTA_LIST_LENGTH,\n parent: container,\n initialValue: 0,\n });\n function checkIfUpdated(index, value) {\n let newLength = array.length;\n if (index !== undefined\n && (index >= oldLength || index >= array.length)) {\n newLength = index + 1;\n }\n if (newLength !== oldLength) {\n if (newLength > oldLength) {\n // The array grew in size, so we need some new delta mergeables\n for (let i = oldLength; i < newLength; i++) {\n const currentValue = i === index ? value : undefined;\n if (values[i]) {\n container.adopt(values[i]);\n values[i].set(currentValue, true);\n }\n else {\n values[i] = create_delta_mergeable_1.createDeltaMergeable({\n key: String(i),\n parent: container,\n type: args.childType,\n initialValue: currentValue,\n });\n }\n array[i] = values[i].get();\n }\n }\n else { // newLength < oldLength\n for (let i = newLength; i < oldLength; i++) {\n values[i].delete();\n }\n }\n }\n oldLength = array.length;\n lengthDeltaMergeable.set(oldLength);\n }\n const proxyArray = new Proxy(array, {\n set(target, property, value) {\n const index = Number(property);\n if (isNaN(index)) {\n if (property === \"length\") {\n Reflect.set(target, property, value);\n checkIfUpdated();\n return true;\n }\n // All other strings are not able to be set on arrays\n return false;\n }\n // If we got here, we know that the property being set is an index\n checkIfUpdated(index, value);\n values[index].set(value);\n Reflect.set(target, property, values[index].get());\n return true;\n },\n deleteProperty(target, property) {\n const index = Number(property);\n if (isNaN(index)) {\n return false; // arrays can only delete numbers, not strings\n }\n values[index].delete();\n Reflect.deleteProperty(target, property);\n return true;\n },\n });\n container.wrapper = proxyArray;\n return container;\n}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n //return original.push(newItem);\n return original.concat(newItem);\n // Add your code above this line\n }", "function push(arr, newItem){\n[arr.length] = newItem;\n console.log(arr)\n}", "addFields(newValues) {\n this.setFields(_objectSpread({}, this.getFields(), newValues));\n return this;\n }", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var valuesAddedToEnums = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) {\n return;\n }\n\n var valuesInOldEnum = Object.create(null);\n oldType.getValues().forEach(function (value) {\n valuesInOldEnum[value.name] = true;\n });\n newType.getValues().forEach(function (value) {\n if (!valuesInOldEnum[value.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: value.name + ' was added to enum type ' + typeName + '.'\n });\n }\n });\n });\n return valuesAddedToEnums;\n}", "restrictValue(values) {\n if (values[1].constructor === JQX.Utilities.BigNumber) {\n if (values[1].compare(values[0]) === -1) {\n values[1].set(values[0]);\n }\n }\n else {\n if (values[1] < values[0]) {\n values[1] = values[0];\n }\n }\n }", "function newLfuSet(values) {\n return new LfuSet(values);\n }", "push(value) {\n if (this.size + 1 > this.elements.length) {\n const newArray = new PlainArray(Math.max(this.size * 2, 3))\n for (let i = 0; i < this.size; i++) {\n newArray.set(i, this.elements.get(i))\n }\n this.elements = newArray\n }\n this.elements.set(this.size, value)\n this.size += 1\n }", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n \n // Add your code above this line\n }", "upsertColumn(columnName, arrayOfValues) {\n\n if (arrayOfValues.length != this.data.intervalls.length){\n throw new Error(\"New Column length is not equal to table column length: Length = \" + this.data.intervalls.length);\n }\n\n for( var i = 0; i < this.data.intervalls.length; ++i ) {\n this.data.intervalls[i][columnName] = arrayOfValues[i];\n }\n\n return this.data.intervalls;\n }", "function resize(newSize){\n // For general hash function the only thing to do is to iterate over \n //old hash table and add each entry \n // to a new table.\n var oldStorage = storage;\n resizing = true;\n storageLimit = newSize;\n //need to clear out old one to add entries to new one\n storage = [];\n size = 0;\n //iterate over old storage and insert tuples\n //into new storage\n oldStorage.forEach(function(tuple){\n tuple.forEach(function(item){\n result.insert(item[0],item[1]);\n });\n });\n }", "immutablePush(array, newItem){\n return [ ...array, newItem ]; \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 nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n // Add your code above this line\n}", "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n var oldType = oldTypeMap[typeName];\n var newType = newTypeMap[typeName];\n\n if (!Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(oldType) || !Object(_type_definition__WEBPACK_IMPORTED_MODULE_1__[\"isEnumType\"])(newType)) {\n continue;\n }\n\n var valuesInOldEnum = Object.create(null);\n var _iteratorNormalCompletion9 = true;\n var _didIteratorError9 = false;\n var _iteratorError9 = undefined;\n\n try {\n for (var _iterator9 = oldType.getValues()[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {\n var value = _step9.value;\n valuesInOldEnum[value.name] = true;\n }\n } catch (err) {\n _didIteratorError9 = true;\n _iteratorError9 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion9 && _iterator9.return != null) {\n _iterator9.return();\n }\n } finally {\n if (_didIteratorError9) {\n throw _iteratorError9;\n }\n }\n }\n\n var _iteratorNormalCompletion10 = true;\n var _didIteratorError10 = false;\n var _iteratorError10 = undefined;\n\n try {\n for (var _iterator10 = newType.getValues()[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {\n var _value2 = _step10.value;\n\n if (!valuesInOldEnum[_value2.name]) {\n valuesAddedToEnums.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: \"\".concat(_value2.name, \" was added to enum type \").concat(typeName, \".\")\n });\n }\n }\n } catch (err) {\n _didIteratorError10 = true;\n _iteratorError10 = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion10 && _iterator10.return != null) {\n _iterator10.return();\n }\n } finally {\n if (_didIteratorError10) {\n throw _iteratorError10;\n }\n }\n }\n }\n\n return valuesAddedToEnums;\n}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n\n // Add your code above this line\n}", "set hasMultipleDifferentValues(value) {}", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({\n param,\n value: _value,\n op: 'a'\n });\n });\n } else {\n updates.push({\n param,\n value: value,\n op: 'a'\n });\n }\n });\n return this.clone(updates);\n }", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n console.log(original)\n\n\n // Add your code above this line\n}", "_fillValueArray(changedValueDimensions, skipOverride) {\n const that = this,\n dimensions = that.dimensions;\n\n if (that._filledUpTo !== undefined && skipOverride !== true) {\n let skipFill = true;\n\n for (let a = 0; a < changedValueDimensions.length; a++) {\n skipFill = skipFill && (that._filledUpTo[a] >= changedValueDimensions[a]);\n changedValueDimensions[a] = Math.max(changedValueDimensions[a], that._filledUpTo[a]);\n }\n\n if (skipFill === true) {\n that._scroll();\n return;\n }\n }\n\n that._filledUpTo = changedValueDimensions.slice(0);\n\n function recursion(arr, level) {\n for (let i = 0; i <= changedValueDimensions[level]; i++) {\n if (level !== dimensions - 1) {\n if (arr[i] === undefined) {\n arr[i] = [];\n }\n\n recursion(arr[i], level + 1);\n }\n else if (arr[i] === undefined) {\n arr[i] = that._getDefaultValue();\n }\n }\n }\n\n recursion(that.value, 0);\n\n that._scroll();\n that._setMaxValuesOfScrollBars();\n }", "function changeElementsOfTheArray(numArray, num1, num2){\r\n\tif(num1 > numArray.length - 1 || num2 > numArray.length -1){\r\n\t\tconsole.log(\"Provided index(es) is(are) not valid.\");\r\n\t}\r\n\tvar c = numArray[num1];\r\n\tnumArray[num1] = numArray[num2];\r\n\tnumArray[num2] = c;\r\n\tconsole.log(numArray);\r\n}", "constructor(x, y, newLength) {\n super(x, y);\n\n let _length;\n\n this.setLength = (length) => {\n _length = length > 0 ? length : 1\n };\n\n this.getLength = () => {\n return _length;\n };\n\n this.setLength(newLength);\n }", "function addNewPropertyValue(key, index)\n{\n var MainArray = getPropertyArrayToAlter(key);\n\n if (key == SEARCH_PROPERTY_KEY || key == CHECKOUT_PROPERTY_KEY)\n {\n MainArray[index].Values.push(new PropertyValue());\n }\n}", "attributeChange(e) {\n\n var values = this.state.values;\n var value = e.target.value;\n var name = e.target.name;\n var index = e.target.attributes.getNamedItem('index').value;\n\n var tmp = [name, value];\n\n for (var i in values) {\n\n if (tmp[0] !== values[i][0] && values.length >= i) {\n values[i][index] = tmp;\n break;\n }\n }\n }", "extendArrayOfTypedArrays (array, elements, deltaSize) {\n array.typedArray =\n this.extendTypedArray(array.typedArray, (deltaSize * elements))\n for (let i = array.length, len = i + deltaSize; i < len; i++) {\n const start = i * elements\n const end = start + elements\n array[i] = array.typedArray.subarray(start, end)\n }\n // No return needed, array is mutated instead.\n }", "function doubleValues(arr){\n let newArr = [];\n arr.forEach(function(value) {\n newArr.push(value * 2);\n });\n return newArr;\n }", "push(value) {\n //if the length is greater than the capacity currently then resize\n if (this.length >= this._capacity) {\n this._resize((this.length + 1) * Array.SIZE_RATIO);\n }\n //otherwise, set the new array length and the values\n newMem.set(this.ptr + this.length, value);\n //increase the length counter\n this.length++;\n }", "buildHashAndPreserve(newHash, oldHash, ...preservedKeys) {\n return this.buildHash(Object.assign(this.getSubsetOfHash(oldHash, preservedKeys), this.parseHash(newHash)));\n }", "function getNewTypes(oldTypes, newTypes) {\n\t\t\tvar tempTypes = [];\n\t\t\tfor( var i = 0; i < newTypes.length; i++) {\n\t\t\t\tif(oldTypes.indexOf(newTypes[i]) == -1) {\n\t\t\t\t\ttempTypes.push(newTypes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tempTypes;\n\t\t}", "function get_vectorlen(v, newLength){\n\tlet length = Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n\treturn [(v[0] / length) * newLength, (v[1] / length) * newLength];\n}", "function propagateGrowth(oldG, oldGrowth, newG, newGrowth) {\n const numNewNodes = newG.nodeCount;\n let index = 0;\n // We visit each new node at most once, forming an upper bound on the queue length.\n // Pre-allocate for better performance.\n let queue = new Uint32Array(numNewNodes << 1);\n // Stores the length of queue.\n let queueLength = 0;\n // Only store visit bits for the new graph.\n const visitBits = new util_1.OneBitArray(numNewNodes);\n // Enqueues the given node pairing (represented by their indices in their respective graphs)\n // into the queue. oldNodeIndex and newNodeIndex represent a node at the same edge shared between\n // the graphs.\n function enqueue(oldNodeIndex, newNodeIndex) {\n queue[queueLength++] = oldNodeIndex;\n queue[queueLength++] = newNodeIndex;\n }\n // Returns a single item from the queue. (Called twice to remove a pair.)\n function dequeue() {\n return queue[index++];\n }\n // 0 indicates the root node. Start at the root.\n const oldNode = new Node(0, oldG);\n const newNode = new Node(0, newG);\n const oldEdgeTmp = new Edge(0, oldG);\n {\n // Visit global roots by *node name*, not *edge name* as edges are arbitrarily numbered from the root node.\n // These global roots correspond to different JavaScript contexts (e.g. IFrames).\n const newUserRoots = newG.getGlobalRootIndices();\n const oldUserRoots = oldG.getGlobalRootIndices();\n const m = new Map();\n for (let i = 0; i < newUserRoots.length; i++) {\n newNode.nodeIndex = newUserRoots[i];\n const name = newNode.name;\n let a = m.get(name);\n if (!a) {\n a = { o: [], n: [] };\n m.set(name, a);\n }\n a.n.push(newUserRoots[i]);\n }\n for (let i = 0; i < oldUserRoots.length; i++) {\n oldNode.nodeIndex = oldUserRoots[i];\n const name = oldNode.name;\n let a = m.get(name);\n if (a) {\n a.o.push(oldUserRoots[i]);\n }\n }\n m.forEach((v) => {\n let num = Math.min(v.o.length, v.n.length);\n for (let i = 0; i < num; i++) {\n enqueue(v.o[i], v.n[i]);\n visitBits.set(v.n[i], true);\n }\n });\n }\n // The main loop, which is the essence of PropagateGrowth.\n while (index < queueLength) {\n const oldIndex = dequeue();\n const newIndex = dequeue();\n oldNode.nodeIndex = oldIndex;\n newNode.nodeIndex = newIndex;\n const oldNodeGrowthStatus = oldGrowth.get(oldIndex);\n // Nodes are either 'New', 'Growing', or 'Not Growing'.\n // Nodes begin as 'New', and transition to 'Growing' or 'Not Growing' after a snapshot.\n // So if a node is neither new nor consistently growing, we don't care about it.\n if ((oldNodeGrowthStatus === 0 /* NEW */ || oldNodeGrowthStatus === 2 /* GROWING */) && oldNode.numProperties() < newNode.numProperties()) {\n newGrowth.set(newIndex, 2 /* GROWING */);\n }\n // Visit shared children.\n const oldEdges = new Map();\n if (oldNode.hasChildren) {\n for (const it = oldNode.children; it.hasNext(); it.next()) {\n const oldChildEdge = it.item();\n oldEdges.set(hash(oldNode, oldChildEdge), oldChildEdge.edgeIndex);\n }\n }\n //Now this loop will take care for the memory leaks in which the object count is not increasing but the Retained Size will be increase certainly\n if ((oldNodeGrowthStatus === 1 /* NOT_GROWING */) && oldNode.numProperties() == newNode.numProperties()) {\n if (oldNode.getRetainedSize() < newNode.getRetainedSize()) {\n newGrowth.set(newIndex, 2 /* GROWING */);\n }\n }\n if (newNode.hasChildren) {\n for (const it = newNode.children; it.hasNext(); it.next()) {\n const newChildEdge = it.item();\n const oldEdge = oldEdges.get(hash(newNode, newChildEdge));\n oldEdgeTmp.edgeIndex = oldEdge;\n if (oldEdge !== undefined && !visitBits.get(newChildEdge.toIndex) &&\n shouldTraverse(oldEdgeTmp, false) && shouldTraverse(newChildEdge, false)) {\n visitBits.set(newChildEdge.toIndex, true);\n enqueue(oldEdgeTmp.toIndex, newChildEdge.toIndex);\n }\n }\n }\n }\n}", "replace( t, old_type, new_type ) {\n if(t.type==old_type) t.type = new_type\n if( Array.isArray(t.value) ) {\n var a = t.value\n for(var i=0; i<a.length; i++) a[i] = this.replace(a[i], old_type, new_type)\n } \n return t\n }", "function addData(newValue, data) {\n // Extract the values we need from the data and format them properly\n convertData(newValue);\n\n data.push(newValue);\n}", "function changeTheValue(arrInput, value) {\r\n var key = \"a\";\r\n var indexOfSubarray;\r\n console.log(this);\r\n for (let eachKey in this) {\r\n //when we pass a \"hello\" string into changeTheValue using .call()\r\n //it will be like calling new String(\"hello\"). when we save the returned value of new String(\"hello\"), it will return String(\"hello\");\r\n //each key will be str 0,1,2,3,4\r\n let eachStr = this[eachKey];\r\n console.log(eachStr);\r\n }\r\n arrInput.forEach(function findValue(subarray, index) {\r\n var eachKey = subarray[0];\r\n if (eachKey === key) {\r\n indexOfSubarray = index;\r\n }\r\n });\r\n var mutateSubarray = arrInput[indexOfSubarray];\r\n mutateSubarray[1] = value;\r\n // var [, ourValue] = arrInput[indexOfSubarray];\r\n // ourValue = value;\r\n console.log(arrInput);\r\n}", "Add(values) {\n let vec = new VecX(values);\n while (vec.size < this.size) {\n vec.values.push(vec.values[0]);\n }\n ;\n this.values = this.values.map((val, index) => val + vec.values[index]);\n return this;\n }", "getValues() {\n return [...this.values];\n }", "function addToEnd(arr,value){\r\n\tarr.splice(arr.length,0,value)\r\n\treturn arr\r\n}", "function addElements (new_elements, index) {\r\n\r\n\tvar arr_before = elements.slice(0, index);\r\n\tvar arr_after = elements.slice(index + 1);\r\n\telements.splice(index, 1);\r\n\telements = arr_before.concat(new_elements);\r\n\telements = elements.concat(arr_after);\r\n\r\n}", "mapVal(fn) {\n let val = this.values();\n return Array.from({\n length: this.size\n }, () => {\n let values = val.next();\n return fn(values.value);\n }).filter(item => item);\n }", "reinitializeArray() {\n const that = this;\n\n if (that.type === 'none') {\n return;\n }\n\n const dimensions = that.dimensions,\n oldValue = JSON.stringify(that.value);\n\n if (that.dimensions === 1) {\n that.value.fill(that._getDefaultValue());\n }\n else {\n const recursion = function (arr, level) {\n for (let i = 0; i < arr.length; i++) {\n if (level === dimensions) {\n arr[i] = that._getDefaultValue();\n }\n else {\n recursion(arr[i], level + 1);\n }\n }\n };\n\n recursion(that.value, 1);\n }\n\n if (oldValue !== JSON.stringify(that.value)) {\n that._scroll();\n that.$.fireEvent('change', { 'value': that.value, 'oldValue': JSON.parse(oldValue) });\n }\n }", "function watcher_params(new_val,old_val)\n\t\t{\n\t\tif (!new_val)\n\t\t\treturn false;\n\t\t//if changed only kind of aggregations\n\t\tif (new_val['aggregationsBy']!=old_val['aggregationsBy'])\n\t\t\t{\n\t\t\t$scope.prepare_for_chart(); //set array from DATA to DATA_AGR depends on key\n\t\t\treturn false;\t\n\t\t\t}\n\n\t\t\t//skip another one request, because only when watcher runs after changing total\n\t\t\t//request will be send\n\t\tif (new_val['type']=='total'&&new_val['value']!='all')\n\t\t\t{\n\t\t\t//if changed date or type (by mark)\n\t\t\t$scope.params['type'] = $scope.params['value']=='all'?'total':'mark';\n\t\t\treturn false;\t\t\t\n\t\t\t}\n\n\t\t\t//it is for fixing case when returns from mark to all marks\n\t\tif (new_val['type']!='total'&&new_val['value']=='all')\n\t\t\t{\n\t\t\t//if changed date or type (by mark)\n\t\t\t$scope.params['type'] = 'total';\n\t\t\treturn false;\t\t\t\n\t\t\t}\n\n\t\t$scope.myspinner.is = true;\n\t\t$scope.get_aggregations();\n\t\t}", "pushAll(values) {\n for (const value of values) {\n this.push(value);\n }\n }", "set keepHistory(keepHistory) {\n const prevKeepHistory = this[KEEP_HISTORY];\n this[KEEP_HISTORY] = typeof keepHistory === 'number'\n && keepHistory < 1 ? false : keepHistory;\n // Change does not require historical values modification nor epoch update.\n if (this[KEEP_HISTORY] === prevKeepHistory || this[KEEP_HISTORY] === true) {\n return;\n }\n if (typeof this[KEEP_HISTORY] === 'number') {\n // Sub 1 to keep history count to account for the current value\n let deleteCount = this[VALUES].length - this[KEEP_HISTORY] - 1;\n // Change require values modification and new epoch.\n if (deleteCount > 0) {\n // Remove items from the front of the values array until the delete\n // count is 0 or the current value index is 0.\n while (this[CUR_VALUE_INDEX] > 0 && deleteCount-- > 0) {\n this[VALUES].shift();\n this[CUR_VALUE_INDEX]--;\n }\n // Remove values from the end of the values array until delete \n // count is 0\n while (deleteCount-- > 0) {\n this[VALUES].pop();\n }\n this[HISTORY_EPOCH] = Symbol();\n }\n // this[KEEP_HISTORY] === false \n // If more than one value is being stored in values array Change require\n // values modification and new epoch.\n }\n else if (this[VALUES].length > 1) {\n this[VALUES][0] = this[VALUES][this[CUR_VALUE_INDEX]];\n this[CUR_VALUE_INDEX] = 0;\n this[VALUES].splice(1);\n this[HISTORY_EPOCH] = Symbol();\n }\n }", "function myArrayFunction(myPets) {\n var myNewPets = [...myPets];\n \n // Only change code below this line\n var myNewPets = [];\n myNewPets.push('Bird', 'Fish');\n \n var firstPet = [];\n firstPet = myNewPets[0];\n\n var lastPet = [];\n lastPet = myNewPets.length-1;\n\n myNewPets[0] = \"Lion\";\n\n return myNewPets;\n // Only change code abow this line\n}", "function reIndexArray(obj, newKeys) {\n const keyValues = Object.keys(obj).map(key => {\n const newKey = newKeys[key] || key;\n return { [newKey]: obj[key] };\n });\n return Object.assign({}, ...keyValues);\n }", "restrictValue(values) {\n if (values[1] < values[0]) {\n values[1] = values[0];\n }\n }", "function update(index, value, array) {\n // TODO return a new copy of the array with the given value at index\n var newArr = array.slice();\n newArr[index] = value;\n return newArr;\n}", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "appendAll(params) {\n const updates = [];\n Object.keys(params).forEach(param => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach(_value => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value, op: 'a' });\n }\n });\n return this.clone(updates);\n }", "repopulate () {\n const nbToGenerate = this.populationSize - this.currentPopulation.length\n const newGenomes = Array(nbToGenerate).fill('').map(genome => new Genome(this.nbInput, this.nbOutput))\n this.currentPopulation = [...this.currentPopulation, ...newGenomes]\n }", "function renameKeys(userNames, newKeys) {\n var newArrOfChngedKeys = [];\n for (var i in userNames) {\n newArrOfChngedKeys.push(giveBackNewArray(userNames[i], newKeys))\n }\n return newArrOfChngedKeys\n }", "function preProcessOriginalArray(allValues, arr){\n let previousHourWasMinus = false\n for(let element of allValues.values()){\n element = removeSpacesAndPutMinutesAndHoursInToOneString(element) \n arr.push(element)\n }\n return arr\n}", "function nextAssignmentDefault(oldAssignment, values) {\n let newAssignment = Object.assign({}, oldAssignment);\n let features = Object.keys(values);\n\n // try incrementing the value\n newAssignment.valueLearned = newAssignment.valueLearned + 1;\n\n // if we reached the last value for the feature than increment the feature\n if (newAssignment.valueLearned >= values[features[newAssignment.featureLearned]].length) {\n newAssignment.valueLearned = 0;\n newAssignment.featureLearned = newAssignment.featureLearned + 1;\n }\n\n // if we reached the last feature then reset to 0\n if (newAssignment.featureLearned >= features.length) {\n newAssignment.featureLearned = 0;\n }\n return newAssignment;\n}", "addOnIndex(index, value) {\n if (index < 0) {\n console.error(`Index must be greater than 0!`);\n return false;\n }\n\n index = Math.floor(index);\n\n if (this.length <= index) {\n this.add(value);\n } else {\n const temp = this.get(index);\n this.data[index] = value;\n\n for (let i = index + 1; i < this.length; i++) {\n this.data[i + 1] = this.data[i];\n }\n\n this.data[index + 1] = temp;\n this.length++;\n }\n }" ]
[ "0.5968423", "0.59483916", "0.5828773", "0.57990915", "0.5651268", "0.55895936", "0.5574767", "0.5463488", "0.54607844", "0.54592985", "0.5452371", "0.54036", "0.54028475", "0.5326634", "0.5278186", "0.5278186", "0.5278186", "0.5278186", "0.5251375", "0.5251375", "0.5234125", "0.52281207", "0.52099496", "0.51758295", "0.51729083", "0.51536727", "0.5153094", "0.5127034", "0.5120726", "0.51191366", "0.51161283", "0.51144356", "0.51104057", "0.5106595", "0.50891846", "0.5085919", "0.5083976", "0.5068806", "0.50515765", "0.50401545", "0.50262237", "0.50240135", "0.50206745", "0.5008447", "0.5002072", "0.5000574", "0.49931705", "0.49767685", "0.49761254", "0.49680218", "0.49635965", "0.49618104", "0.49546537", "0.49538842", "0.49521962", "0.49426547", "0.49317512", "0.49261925", "0.49242955", "0.4918176", "0.49160483", "0.48944947", "0.48893264", "0.4888409", "0.48862338", "0.4886075", "0.4876722", "0.48745346", "0.48737055", "0.48678038", "0.4867545", "0.48674434", "0.48642802", "0.48517597", "0.48511857", "0.48481643", "0.48448664", "0.4839904", "0.48382565", "0.48334876", "0.48334563", "0.48313934", "0.48308757", "0.4829004", "0.48287424", "0.48252752", "0.48213664", "0.48087496", "0.48026955", "0.47975183", "0.47931793", "0.478875", "0.47867408", "0.47867408", "0.47867408", "0.47867408", "0.47863892", "0.47770905", "0.4773772", "0.4773265", "0.4770445" ]
0.0
-1
This function will reposition search form to the left panel when viewed in screens smaller than 767px and will return to top when viewed higher than 767px
function reposition_searchform() { if(jQuery('.searchform').css('position') == 'relative') { jQuery('.searchform').insertBefore('.leftpanelinner .userlogged'); } else { jQuery('.searchform').insertBefore('.header-right'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reposition_searchform() {\n if (jQuery('.searchform').css('position') == 'relative') {\n jQuery('.searchform').insertBefore('.leftpanelinner .userlogged');\n } else {\n jQuery('.searchform').insertBefore('.header-right');\n }\n }", "function reposition_searchform() {\r\n if(jQuery('.searchform').css('position') == 'relative') {\r\n jQuery('.searchform').insertBefore('.leftpanelinner .userlogged');\r\n } else {\r\n jQuery('.searchform').insertBefore('.header-right');\r\n }\r\n }", "function moveSearchForm(mq) {\n var searchForm;\n\n if (mq.matches) {\n // move search form back into tools menu\n searchForm = $('#main-nav .search-form').detach();\n $('.heading-first .tools').append(searchForm);\n }\n else {\n // move search form into mobile menu\n searchForm = $('.heading-first .tools .search-form').detach();\n $('#nav').before(searchForm);\n }\n }", "function sbarp() {\n if($(document).width() > 990) {\n $('#search-container').css({top: 97});\n $('#search-container div').width(\"72.5%\");\n $('#search').removeClass('hidden');\n } else if($(document).width() > 767) {\n $('#search-container').css({top: 150});\n $('#search-container div').width(\"72.5%\");\n $('#search').removeClass('hidden');\n } else {\n $('#search-container').css({top: 50});\n $('#search-container div').width(\"90%\");\n makevisible();\n $('#search').addClass('hidden');\n }\n}", "function setTogglePosition() {\n var overviewPosition = requestFormOverview.position()\n if (window.matchMedia(\"(min-width: \"+laptopScreenWidth+\"px)\").matches) {\n requestFormToggle.css({\n 'left': overviewPosition.left+'px',\n 'width': requestFormOverview.width()+'px',\n 'opacity': '1'\n })\n } else if (window.matchMedia(\"(min-width: \"+tabletScreenWidth+\"px)\").matches) {\n requestFormToggle.css({\n 'left': '74px',\n 'width': 'auto',\n 'opacity': '1'\n })\n } else {\n requestFormToggle.css({\n 'left': '25px',\n 'width': 'auto',\n 'opacity': '1'\n })\n }\n }", "function processMoveSearchBar() {\n if($(window).width() >= 1270) {\n var element = $(\".SearchBar__root__2hIPj\").detach();\n element.addClass(\"floatLeft\");\n $(\"#bannerDesc\").after(element);\n } else {\n var element = $(\".SearchBar__root__2hIPj\").detach();\n element.removeClass(\"floatLeft\");\n $(\".Topbar__topbarMenuSpacer__3hqBi\").before(element);\n }\n}", "function moveUpSearch() {\r\n //moving of search bar\r\n$('#pllWelcomeContainer').hide();\r\n// $('#pllWelcomeContainer').css('margin-top', '-128px');\r\n $('#searchForm').css('margin-top', '1%');\r\n $('#backButtonContainer').show();\r\n // $('#backButtonContainer').css('opacity', '1');\r\n}", "function searchShow(){\n if ($(window).width() > 768) {\n $('.showSearch').on('click', function(){\n $(this).hide();\n $('.header__search').toggleClass('active');\n $(this).parent().find('.form-input').toggleClass('show');\n $('.header .bottomLinks .signIn').toggleClass('fixed');\n });\n }\n else {\n $('.open-popupSearch').on(\"click\",function(){\n $('.overlay-popupSearch').addClass('active');\n \n if($(window).width() < 768) { \n $.lockBody();\n }else{\n $('body').css('overflow', 'hidden');\n }\n });\n $('.overlay-popupSearch .close-popup, .overlay-popupSearch .close').on(\"click\",function(){\n $('.overlay-popupSearch').removeClass('active');\n if($(window).width() < 768) { \n $.unlockBody();\n }else{\n $('body').css('overflow', 'inherit');\n }\n });\n }\n }", "function updateSearchPanelOnResize() {\n $searchField.blur();\n removeMobileSearchPanelOnDesktop();\n}", "function reposition_topnav() {\n if(jQuery('.nav-horizontal').length > 0) {\n\n // top navigation move to left nav\n // .nav-horizontal will set position to relative when viewed in screen below 1024\n if(jQuery('.nav-horizontal').css('position') == 'relative') {\n\n if(jQuery('.leftpanel .nav-bracket').length == 2) {\n jQuery('.nav-horizontal').insertAfter('.nav-bracket:eq(1)');\n } else {\n // only add to bottom if .nav-horizontal is not yet in the left panel\n if(jQuery('.leftpanel .nav-horizontal').length == 0)\n jQuery('.nav-horizontal').appendTo('.leftpanelinner');\n }\n\n jQuery('.nav-horizontal').css({display: 'block'})\n .addClass('nav-pills nav-stacked nav-bracket');\n\n jQuery('.nav-horizontal .children').removeClass('dropdown-menu');\n jQuery('.nav-horizontal > li').each(function() {\n\n jQuery(this).removeClass('open');\n jQuery(this).find('a').removeAttr('class');\n jQuery(this).find('a').removeAttr('data-toggle');\n\n });\n\n if(jQuery('.nav-horizontal li:last-child').has('form')) {\n jQuery('.nav-horizontal li:last-child form').addClass('searchform').appendTo('.topnav');\n jQuery('.nav-horizontal li:last-child').hide();\n }\n\n } else {\n // move nav only when .nav-horizontal is currently from leftpanel\n // that is viewed from screen size above 1024\n if(jQuery('.leftpanel .nav-horizontal').length > 0) {\n\n jQuery('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket')\n .appendTo('.topnav');\n jQuery('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style');\n jQuery('.nav-horizontal li:last-child').show();\n jQuery('.searchform').removeClass('searchform').appendTo('.nav-horizontal li:last-child .dropdown-menu');\n jQuery('.nav-horizontal > li > a').each(function() {\n\n jQuery(this).parent().removeClass('nav-active');\n\n if(jQuery(this).parent().find('.dropdown-menu').length > 0) {\n jQuery(this).attr('class','dropdown-toggle');\n jQuery(this).attr('data-toggle','dropdown');\n }\n\n });\n }\n\n }\n\n }\n }", "function toggleSearchBox() {\n\n\tif (isMobile == 0 || 1) {\n\t\t$('header').toggleClass('display-searchbox');\n \n if ( $('header').is(':visible')) {\n document.getElementById(\"textfield\").focus(); \n\t}\n }\n}", "function reposition_topnav() {\r\n if(jQuery('.nav-horizontal').length > 0) {\r\n \r\n // top navigation move to left nav\r\n // .nav-horizontal will set position to relative when viewed in screen below 1024\r\n if(jQuery('.nav-horizontal').css('position') == 'relative') {\r\n \r\n if(jQuery('.leftpanel .nav-bracket').length == 2) {\r\n jQuery('.nav-horizontal').insertAfter('.nav-bracket:eq(1)');\r\n } else {\r\n // only add to bottom if .nav-horizontal is not yet in the left panel\r\n if(jQuery('.leftpanel .nav-horizontal').length == 0)\r\n jQuery('.nav-horizontal').appendTo('.leftpanelinner');\r\n }\r\n \r\n jQuery('.nav-horizontal').css({display: 'block'})\r\n .addClass('nav-pills nav-stacked nav-bracket');\r\n \r\n jQuery('.nav-horizontal .children').removeClass('dropdown-menu');\r\n jQuery('.nav-horizontal > li').each(function() { \r\n \r\n jQuery(this).removeClass('open');\r\n jQuery(this).find('a').removeAttr('class');\r\n jQuery(this).find('a').removeAttr('data-toggle');\r\n \r\n });\r\n \r\n if(jQuery('.nav-horizontal li:last-child').has('form')) {\r\n jQuery('.nav-horizontal li:last-child form').addClass('searchform').appendTo('.topnav');\r\n jQuery('.nav-horizontal li:last-child').hide();\r\n }\r\n \r\n } else {\r\n // move nav only when .nav-horizontal is currently from leftpanel\r\n // that is viewed from screen size above 1024\r\n if(jQuery('.leftpanel .nav-horizontal').length > 0) {\r\n \r\n jQuery('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket')\r\n .appendTo('.topnav');\r\n jQuery('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style');\r\n jQuery('.nav-horizontal li:last-child').show();\r\n jQuery('.searchform').removeClass('searchform').appendTo('.nav-horizontal li:last-child .dropdown-menu');\r\n jQuery('.nav-horizontal > li > a').each(function() {\r\n \r\n jQuery(this).parent().removeClass('nav-active');\r\n \r\n if(jQuery(this).parent().find('.dropdown-menu').length > 0) {\r\n jQuery(this).attr('class','dropdown-toggle');\r\n jQuery(this).attr('data-toggle','dropdown'); \r\n }\r\n \r\n }); \r\n }\r\n \r\n }\r\n \r\n }\r\n }", "function openSearchPanelOnMobile() {\n $('.mobile-search-panel').click(function() {\n $body.addClass(mobileSearchOpenedClass);\n $searchField.focus();\n });\n}", "function initSearchButton(){\n\n\tif($j('.search_slides_from_window_top').length){\n\t\t$j('.search_slides_from_window_top').click(function(e){\n\t\t\te.preventDefault();\n\n\t\t\tif($j('html').hasClass('touch')){\n\t\t\t\tif ($j('.qode_search_form').height() == \"0\") {\n\t\t\t\t\t$j('.qode_search_form input[type=\"text\"]').onfocus = function () {\n\t\t\t\t\t\twindow.scrollTo(0, 0);\n\t\t\t\t\t\tdocument.body.scrollTop = 0;\n\t\t\t\t\t};\n\t\t\t\t\t$j('.qode_search_form input[type=\"text\"]').onclick = function () {\n\t\t\t\t\t\twindow.scrollTo(0, 0);\n\t\t\t\t\t\tdocument.body.scrollTop = 0;\n\t\t\t\t\t};\n\t\t\t\t\t$j('.header_top_bottom_holder').css('top','50px');\n\t\t\t\t\t$j('.qode_search_form').css('height','50px');\n\t\t\t\t\t$j('.content_inner').css('margin-top','50px');\n\t\t\t\t\tif($scroll < 34){ $j('header.page_header').css('top','0'); }\n\t\t\t\t} else {\n\t\t\t\t\t$j('.qode_search_form').css('height','0');\n\t\t\t\t\t$j('.header_top_bottom_holder').css('top','0');\n\t\t\t\t\t$j('.content_inner').css('margin-top','0');\n\t\t\t\t\tif($scroll < 34){ $j('header.page_header').css('top',-$scroll);}\n\t\t\t\t}\n\n\t\t\t\t$j(window).scroll(function() {\n\t\t\t\t\tif ($j('.qode_search_form').height() != \"0\" && $scroll > 50) {\n\t\t\t\t\t\t$j('.qode_search_form').css('height','0');\n\t\t\t\t\t\t$j('.header_top_bottom_holder').css('top','0');\n\t\t\t\t\t\t$j('.content_inner').css('margin-top','0');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t$j('.qode_search_close').click(function(e){\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\t$j('.qode_search_form').css('height','0');\n\t\t\t\t\t$j('.header_top_bottom_holder').css('top','0');\n\t\t\t\t\t$j('.content_inner').css('margin-top','0');\n\t\t\t\t\tif($scroll < 34){ $j('header.page_header').css('top',-$scroll);}\n\t\t\t\t});\n\n\t\t\t} else {\n\t\t\t\tif($j('.title').hasClass('has_fixed_background')){\n\t\t\t\t\tvar yPos = parseInt($j('.title.has_fixed_background').css('backgroundPosition').split(\" \")[1]);\n\t\t\t\t}else { \n\t\t\t\t\tvar yPos = 0;\n\t\t\t\t}\n\t\t\t\tif ($j('.qode_search_form').height() == \"0\") {\n\t\t\t\t\t$j('.qode_search_form input[type=\"text\"]').focus();\n\t\t\t\t\t$j('.header_top_bottom_holder').stop().animate({top:\"50px\"},150);\n\t\t\t\t\t$j('.qode_search_form').stop().animate({height:\"50px\"},150);\n\t\t\t\t\t$j('.content_inner').stop().animate({marginTop:\"50px\"},150);\n\t\t\t\t\tif($scroll < 34){ $j('header.page_header').stop().animate({top:0},150); }\n\t\t\t\t\t$j('.title.has_fixed_background').animate({\n\t\t\t\t\t\t'background-position-y': (yPos + 50)+'px'\n\t\t\t\t\t}, 150);\n\t\t\t\t} else {\n\t\t\t\t\t$j('.qode_search_form').stop().animate({height:\"0\"},150);\n\t\t\t\t\t$j('.header_top_bottom_holder').stop().animate({top:\"0px\"},150);\n\t\t\t\t\t$j('.content_inner').stop().animate({marginTop:\"0\"},150);\n\t\t\t\t\tif($scroll < 34){ $j('header.page_header').stop().animate({top:-$scroll},150);}\n\t\t\t\t\t$j('.title.has_fixed_background').animate({\n\t\t\t\t\t\t'background-position-y': (yPos - 50)+'px'\n\t\t\t\t\t}, 150);\n\t\t\t\t}\n\n\t\t\t\t$j(window).scroll(function() {\n\t\t\t\t\tif ($j('.qode_search_form').height() != \"0\" && $scroll > 50) {\n\t\t\t\t\t\t$j('.qode_search_form').stop().animate({height:\"0\"},150);\n\t\t\t\t\t\t$j('.header_top_bottom_holder').stop().animate({top:\"0px\"},150);\n\t\t\t\t\t\t$j('.content_inner').stop().animate({marginTop:\"0\"},150);\n\t\t\t\t\t\t$j('.title.has_fixed_background').css('backgroundPosition', 'center '+(yPos)+'px');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t$j('.qode_search_close').click(function(e){\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\t$j('.qode_search_form').stop().animate({height:\"0\"},150);\n\t\t\t\t\t$j('.content_inner').stop().animate({marginTop:\"0\"},150);\n\t\t\t\t\t$j('.header_top_bottom_holder').stop().animate({top:\"0px\"},150);\n\t\t\t\t\tif($scroll < 34){ $j('header.page_header').stop().animate({top:-$scroll},150);}\n\t\t\t\t\t$j('.title.has_fixed_background').animate({\n\t\t\t\t\t\t'background-position-y': (yPos)+'px'\n\t\t\t\t\t}, 150);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\t\n\t//search type - search_slides_from_header_bottom\n if($j('.search_slides_from_header_bottom').length){\n\n $j('.search_slides_from_header_bottom').click(function(e){\n\n e.preventDefault();\n\n if($j('.qode_search_form_2').hasClass('animated')) {\n $j('.qode_search_form_2').removeClass('animated');\n $j('.qode_search_form_2').css('bottom','0');\n } else {\n $j('.qode_search_form input[type=\"text\"]').focus();\n $j('.qode_search_form_2').addClass('animated');\n var search_form_height = $j('.qode_search_form_2').height();\n $j('.qode_search_form_2').css('bottom',-search_form_height);\n\n }\n\n $j('.qode_search_form_2').addClass('disabled');\n $j('.qode_search_form_2 input[type=\"submit\"]').attr('disabled','disabled');\n if(($j('.qode_search_form_2 .qode_search_field').val() !== '') && ($j('.qode_search_form_2 .qode_search_field').val() !== ' ')) {\n $j('.qode_search_form_2 input[type=\"submit\"]').removeAttr('disabled');\n $j('.qode_search_form_2').removeClass('disabled');\n }\n else {\n $j('.qode_search_form_2').addClass('disabled');\n $j('.qode_search_form_2 input[type=\"submit\"]').attr('disabled','disabled');\n }\n\n $j('.qode_search_form_2 .qode_search_field').keyup(function() {\n if(($j(this).val() !== '') && ($j(this).val() != ' ')) {\n $j('.qode_search_form_2 input[type=\"submit\"]').removeAttr('disabled');\n $j('.qode_search_form_2').removeClass('disabled');\n }\n else {\n $j('.qode_search_form_2 input[type=\"submit\"]').attr('disabled','disabled');\n $j('.qode_search_form_2').addClass('disabled');\n }\n });\n\n\n $j('.content, footer').click(function(e){\n e.preventDefault();\n $j('.qode_search_form_2').removeClass('animated');\n $j('.qode_search_form_2').css('bottom','0');\n });\n\n });\n }\n\n //search type - search covers header\n if($j('.search_covers_header').length){\n\n $j('.search_covers_header').click(function(e){\n\n e.preventDefault();\n if($j(\".search_covers_only_bottom\").length){\n var headerHeight = $j('.header_bottom').height();\n }\n else{\n if($j(\".fixed_top_header\").length){\n var headerHeight = $j('.top_header').height();\n }else{\n var headerHeight = $j('.header_top_bottom_holder').height();\n }\n }\n\n\t\t\t$j('.qode_search_form_3 .form_holder_outer').height(headerHeight);\n\n if($j(\".search_covers_only_bottom\").length){\n $j('.qode_search_form_3').css('bottom',0);\n $j('.qode_search_form_3').css('top','auto');\n }\n\t\t\t$j('.qode_search_form_3').stop(true).fadeIn(600,'easeOutExpo');\n\t\t\t$j('.qode_search_form_3 input[type=\"text\"]').focus();\n\n\n\t\t\t$j(window).scroll(function() {\n if($j(\".search_covers_only_bottom\").length){\n var headerHeight = $j('.header_bottom').height();\n }\n else{\n if($j(\".fixed_top_header\").length){\n var headerHeight = $j('.top_header').height();\n }else{\n var headerHeight = $j('.header_top_bottom_holder').height();\n }\n }\n\t\t\t\t$j('.qode_search_form_3 .form_holder_outer').height(headerHeight);\n\t\t\t});\n\n\t\t\t$j('.qode_search_close, .content, footer').click(function(e){\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\t$j('.qode_search_form_3').stop(true).fadeOut(450,'easeOutExpo');\n\t\t\t});\n\n\t\t\t$j('.qode_search_form_3').blur(function(e){\n\t\t\t\t\t$j('.qode_search_form_3').stop(true).fadeOut(450,'easeOutExpo');\n\t\t\t});\n });\n }\n\t\t\n//search type - fullscreen search\n if($j('.fullscreen_search').length){\n\t\t//search type Circle Appear\n\t\tif($j(\".fullscreen_search_holder.from_circle\").length){\n\t\t\t$j('.fullscreen_search').on('click',function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\tif($j('.fullscreen_search_overlay').hasClass('animate')){\n\t\t\t\t\t$j('.fullscreen_search_overlay').removeClass('animate');\n\t\t\t\t\t$j('.fullscreen_search_holder').css('opacity','0');\n\t\t\t\t\t$j('.fullscreen_search_close').css('opacity','0');\n\t\t\t\t\t$j('.fullscreen_search_close').css('visibility','hidden');\n\t\t\t\t\t$j('.fullscreen_search').css('opacity','1');\n\t\t\t\t\t$j('.fullscreen_search_holder').css('display','none');\n\t\t\t\t} else {\n\t\t\t\t\t$j('.fullscreen_search_overlay').addClass('animate');\n\t\t\t\t\t$j('.fullscreen_search_holder').css('display','block');\n\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t$j('.fullscreen_search_holder').css('opacity','1');\n\t\t\t\t\t\t$j('.fullscreen_search_close').css('opacity','1');\n\t\t\t\t\t\t$j('.fullscreen_search_close').css('visibility','visible');\n\t\t\t\t\t\t$j('.fullscreen_search').css('opacity','0');\n\t\t\t\t\t},200);\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t});\n\t\t\t$j('.fullscreen_search_close').on('click',function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\t$j('.fullscreen_search_overlay').removeClass('animate');\n\t\t\t\t$j('.fullscreen_search_holder').css('opacity','0');\n\t\t\t\t$j('.fullscreen_search_close').css('opacity','0');\n\t\t\t\t$j('.fullscreen_search_close').css('visibility','hidden');\n\t\t\t\t$j('.fullscreen_search').css('opacity','1');\n\t\t\t\t$j('.fullscreen_search_holder').css('display','none');\n\t\t\t\t\n\t\t\t});\n\t\t}\n\t\t//search type Fade Appear\n\t\tif($j(\".fullscreen_search_holder.fade\").length){\n\t\t\t$j('.fullscreen_search').on('click',function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\tif($j('.fullscreen_search_holder').hasClass('animate')) {\n\t\t\t\t\t$j('body').removeClass('fullscreen_search_opened');\n\t\t\t\t\t$j('.fullscreen_search_holder').removeClass('animate');\n\t\t\t\t\t$j('body').removeClass('search_fade_out');\n\t\t\t\t\t$j('body').removeClass('search_fade_in');\n\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\t$j('body').addClass('fullscreen_search_opened');\n\t\t\t\t\t$j('body').removeClass('search_fade_out');\n\t\t\t\t\t$j('body').addClass('search_fade_in');\n\t\t\t\t\t$j('.fullscreen_search_holder').addClass('animate');\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t});\n\t\t\t$j('.fullscreen_search_close').on('click',function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\t$j('body').removeClass('fullscreen_search_opened');\n\t\t\t\t$j('.fullscreen_search_holder').removeClass('animate');\n\t\t\t\t$j('body').removeClass('search_fade_in');\n\t\t\t\t$j('body').addClass('search_fade_out');\n\t\t\t\t\n\t\t\t});\n\t\t}\n\t\t\n\t\t//Text input focus change\n\t\t$j('.fullscreen_search_holder .search_field').focus(function(){\n\t\t\t$j('.fullscreen_search_holder .field_holder .line').css(\"width\",\"100%\");\n\t\t});\n\t\t\n\t\t$j('.fullscreen_search_holder .search_field').blur(function(){\n\t\t\t$j('.fullscreen_search_holder .field_holder .line').css(\"width\",\"0\");\n\t\t});\n\t\t\n\t\t//search close button - setting its position vertically\n\t\t$j(window).scroll(function() {\n\t\t\tvar bottom_height = $j(\".page_header .header_bottom\").height();\n\t\t\tif($j(\".page_header\").hasClass(\"sticky\")){\n\t\t\t\t$j(\".fullscreen_search_holder .side_menu_button\").css(\"height\",bottom_height);\n\t\t\t\t$j(\".fullscreen_search_holder .close_container\").css(\"top\",\"0\");\n\t\t\t} else if($j(\".page_header\").hasClass(\"fixed\")){ \n\t\t\t\t$j(\".fullscreen_search_holder .side_menu_button\").css(\"height\",bottom_height);\n\t\t\t} else {\n\t\t\t\t$j(\".fullscreen_search_holder .side_menu_button\").css(\"height\",\"\");\n\t\t\t\t$j(\".fullscreen_search_holder .close_container\").css(\"top\",\"\");\n\t\t\t}\n\t\t});\n }\n\n if($j('.qode_search_submit').length) {\n $j('.qode_search_submit').click(function(e) {\n e.preventDefault();\n e.stopPropagation();\n\n var searchForm = $j(this).parents('form').first();\n\n searchForm.submit();\n });\n }\n\t\n}", "function edgtfSearchWindowTop() {\n\n searchOpener.click( function(e) {\n e.preventDefault();\n\n var yPos = 0;\n if($('.title').hasClass('has_parallax_background')){\n yPos = parseInt($('.title.has_parallax_background').css('backgroundPosition').split(\" \")[1]);\n }\n\n if ( searchForm.height() == \"0\") {\n $('.edgtf-search-slide-window-top input[type=\"text\"]').focus();\n //Push header bottom\n edgtf.body.addClass('edgtf-search-open');\n $('.title.has_parallax_background').animate({\n 'background-position-y': (yPos + 50)+'px'\n }, 150);\n } else {\n edgtf.body.removeClass('edgtf-search-open');\n $('.title.has_parallax_background').animate({\n 'background-position-y': (yPos - 50)+'px'\n }, 150);\n }\n\n $(window).scroll(function() {\n if ( searchForm.height() != '0' && edgtf.scroll > 50 ) {\n edgtf.body.removeClass('edgtf-search-open');\n $('.title.has_parallax_background').css('backgroundPosition', 'center '+(yPos)+'px');\n }\n });\n\n searchClose.click(function(e){\n e.preventDefault();\n edgtf.body.removeClass('edgtf-search-open');\n $('.title.has_parallax_background').animate({\n 'background-position-y': (yPos)+'px'\n }, 150);\n });\n\n });\n }", "function viewSearch() {\n if(document.getElementsByClassName('search-form')[0]) {\n document.getElementsByClassName('search-form')[0].setAttribute('class', 'search-form-desktop');\n document.getElementsByClassName('search-form-icon-desktop')[0].style.cssText = 'display: none;';\n document.getElementsByClassName('search-form-icon-desktop-active')[0].style.cssText = 'display: inline-block;';\n }\n}", "function searchResponsive() {\n\n\tif(winWidth <= 1110){\n\t\t$('input[type=search]').css('width',0);\n\t\t$('input[type=search]').focusin(function(){\n\t\t\t$('.shadow').fadeIn();\n\t\t\t$(this).css('width',widthOfSearch);\n\t\t\t$('.burger').css('z-index','-1');\n\t\t\t$('input[type=search]').siblings().toggleClass('fa-search fa-close');\n\t\t\t$('input[type=search]').siblings().css('z-index','9');\n\t\t\t\n\t\t});\n\t\t$('input[type=search]').focusout(function(){\n\t\t\t$(this).css('width',0);\n\t\t\t$('.burger').css('z-index','2');\n\t\t\t$('.shadow').fadeOut();\n\t\t\t$('input[type=search]').siblings().toggleClass('fa-close fa-search');\n\t\t\t$('input[type=search]').siblings().css('z-index','-1');\n\t\t});\n\t} else {\n\t\t$('input[type=search]').css('width',150);\n\t\t$('input[type=search]').focusin(function(){\n\t\t\t$(this).css('width',200);\n\t\t});\n\t\t$('input[type=search]').focusout(function(){\n\t\t\t$(this).css('width',150);\n\t\t});\n\t}\n}", "function transformSearchField(isSearchFieldOpen) {\n var inputField = document.querySelector(\".search input\");\n var searchField = document.querySelector(\".search-field\");\n var headerNav = document.querySelector(\"#header-nav\");\n if (isSearchFieldOpen && window.innerWidth <= 480) {\n headerNav.style.opacity = \"0%\";\n headerNav.style.width = \"0%\";\n searchField.style.width = \"100%\";\n inputField.style.width = \"100%\";\n inputField.style.margin = \"0 0 0 0.5rem\";\n inputField.style.opacity = \"100%\";\n inputField.focus();\n }\n else if (!isSearchFieldOpen && window.innerWidth <= 480) {\n headerNav.style.opacity = \"100%\";\n headerNav.style.width = \"10rem\";\n searchField.style.width = \"2.4rem\";\n inputField.style.width = \"0%\";\n inputField.style.margin = \"0\";\n inputField.style.opacity = \"0%\";\n inputField.blur();\n }\n else if (!isSearchFieldOpen && window.innerWidth > 480) {\n headerNav.style.opacity = \"100%\";\n headerNav.style.width = \"8rem\";\n searchField.style.width = \"var(--search-bar-width)\";\n inputField.style.width = \"100%\";\n inputField.style.margin = \"0 0 0 0.5rem\";\n inputField.style.opacity = \"100%\";\n inputField.blur();\n }\n}", "function initSearchBar() {\n var category = $('select#search-category').val();\n var placeholder = CONFIG.search_placeholder[category];\n var search = $('input#mapsearch');\n var width = $(window).width();\n if (width < 768) {\n if (search.hasClass('collapsed')) return;\n search.addClass('collapsed');\n setTimeout(function() { search.attr('placeholder','') }, 300);\n search.siblings().find('span.glyphicon-search').on('click', function() {\n search.toggleClass('collapsed');\n if (search.hasClass('collapsed')) {\n setTimeout(function() {\n search.attr('placeholder','');\n search.val('');\n }, 300);\n } else {\n search.attr('placeholder',placeholder);\n // search.off('click');\n }\n });\n } else {\n search.removeClass('collapsed');\n search.attr('placeholder',placeholder);\n }\n}", "function advancedSearchSticky() {\n if(getWindowWidth() > 991){\n var search = $('.advance-search-header');\n var thisHeight = $('.advance-search-header').outerHeight();\n }else{\n var search = $('.advanced-search-mobile');\n var thisHeight = $('.advanced-search-mobile').outerHeight();\n }\n if (!search.data('sticky')) {\n return;\n }\n\n if( $(\".splash-search\")[0] ) {\n var sr_sticky_top = $('.splash-search').offset().top;\n sr_sticky_top = sr_sticky_top + 200;\n } else {\n if(getWindowWidth() > 991){\n var sr_sticky_top = $('.advance-search-header').offset().top + 65;\n }else{\n var sr_sticky_top = $('.advanced-search-mobile').offset().top;\n }\n }\n\n if( sr_sticky_top == 0 ) {\n sr_sticky_top = $('#header-section').height();\n }\n\n $(window).scroll(function() {\n var scroll = $(window).scrollTop();\n var admin_nav = $('#wpadminbar').height() + 'px';\n\n if( admin_nav == 'nullpx' ) { admin_nav = '0px'; }\n\n if (scroll >= sr_sticky_top ) {\n search.addClass(\"advanced-search-sticky\");\n search.css('top', admin_nav);\n $('#section-body').css('padding-top',thisHeight);\n } else {\n search.removeClass(\"advanced-search-sticky\");\n search.removeAttr(\"style\");\n $('#section-body').css('padding-top',0);\n }\n });\n }", "function cp_reposition_widgets() {\n\tif ( jQuery(window).width() > 800 ) {\n\t\tjQuery('.content_left #welcome_widget').prependTo('.content_right');\n\t\tjQuery('.content_left #refine_widget').prependTo('.content_right');\n\t} else {\n\t\tjQuery('.content_right #welcome_widget').prependTo('.content_left');\n\t\tjQuery('.content_right #refine_widget').prependTo('.content_left');\n\t}\n}", "function positionPopup(){\r\n if(!$(\"#overlay_form\").is(':visible')){\r\n return;\r\n }\r\n $(\"#overlay_form\").css({\r\n left: ($(window).width() - $('#overlay_form').width()) / 2,\r\n top: ($(window).width() - $('#overlay_form').width()) / 7,\r\n position:'absolute'\r\n });\r\n}", "function moveOverviewPriceDetails() {\n var priceDetails = $('.RequestForm-overviewPriceDetails')\n var priceContainer = $('.RequestForm-overviewHeader')\n var formContainer = $('.RequestForm-form')\n\n if (window.matchMedia(\"(min-width: \"+laptopScreenWidth+\"px)\").matches) {\n priceDetails.prependTo(formContainer);\n } else {\n priceDetails.appendTo(priceContainer);\n }\n }", "function toggleSearchField() {\n\t\t\tvar searchStreamDiv = jContainer.find(\".ASWidgetSearchStreamDiv\");\n\t\t\tsearchStreamDiv.toggle();\n\t\t\tjContainer.find(\".streamItems\").css(\"margin-top\", ((searchStreamDiv).is(\":visible\")) ? \"70px\" : \"12px\");\n\t\t}", "function reposition_topnav() {\r\n\t\t\t\t\t\tif (jQuery('.nav-horizontal').length > 0) {\r\n\r\n\t\t\t\t\t\t\t// top navigation move to left nav\r\n\t\t\t\t\t\t\t// .nav-horizontal will set position to relative\r\n\t\t\t\t\t\t\t// when viewed in screen below 1024\r\n\t\t\t\t\t\t\tif (jQuery('.nav-horizontal').css('position') == 'relative') {\r\n\t\t\t\t\t\t\t\tif (jQuery('.leftpanel .nav-bracket').length == 2) {\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal').insertAfter(\r\n\t\t\t\t\t\t\t\t\t\t\t'.nav-bracket:eq(1)');\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t// only add to bottom if .nav-horizontal is\r\n\t\t\t\t\t\t\t\t\t// not yet in the left panel\r\n\t\t\t\t\t\t\t\t\tif (jQuery('.leftpanel .nav-horizontal').length == 0)\r\n\t\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal').appendTo(\r\n\t\t\t\t\t\t\t\t\t\t\t\t'.leftpanelinner');\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tjQuery('.nav-horizontal')\r\n\t\t\t\t\t\t\t\t\t\t.css({\r\n\t\t\t\t\t\t\t\t\t\t\tdisplay : 'block'\r\n\t\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t\t\t.addClass(\r\n\t\t\t\t\t\t\t\t\t\t\t\t'nav-pills nav-stacked nav-bracket');\r\n\r\n\t\t\t\t\t\t\t\tjQuery('.nav-horizontal .children')\r\n\t\t\t\t\t\t\t\t\t\t.removeClass('dropdown-menu');\r\n\t\t\t\t\t\t\t\tjQuery('.nav-horizontal > li').each(\r\n\t\t\t\t\t\t\t\t\t\tfunction() {\r\n\t\t\t\t\t\t\t\t\t\t\tjQuery(this).removeClass('open');\r\n\t\t\t\t\t\t\t\t\t\t\tjQuery(this).find('a').removeAttr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'class');\r\n\t\t\t\t\t\t\t\t\t\t\tjQuery(this).find('a').removeAttr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'data-toggle');\r\n\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\t\tif (jQuery('.nav-horizontal li:last-child')\r\n\t\t\t\t\t\t\t\t\t\t.has('form')) {\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal li:last-child form')\r\n\t\t\t\t\t\t\t\t\t\t\t.addClass('searchform').appendTo(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'.topnav');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal li:last-child')\r\n\t\t\t\t\t\t\t\t\t\t\t.hide();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// move nav only when .nav-horizontal is\r\n\t\t\t\t\t\t\t\t// currently from leftpanel\r\n\t\t\t\t\t\t\t\t// that is viewed from screen size above 1024\r\n\t\t\t\t\t\t\t\tif (jQuery('.leftpanel .nav-horizontal').length > 0) {\r\n\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal')\r\n\t\t\t\t\t\t\t\t\t\t\t.removeClass(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'nav-pills nav-stacked nav-bracket')\r\n\t\t\t\t\t\t\t\t\t\t\t.appendTo('.topnav');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal .children')\r\n\t\t\t\t\t\t\t\t\t\t\t.addClass('dropdown-menu')\r\n\t\t\t\t\t\t\t\t\t\t\t.removeAttr('style');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal li:last-child')\r\n\t\t\t\t\t\t\t\t\t\t\t.show();\r\n\t\t\t\t\t\t\t\t\tjQuery('.searchform')\r\n\t\t\t\t\t\t\t\t\t\t\t.removeClass('searchform')\r\n\t\t\t\t\t\t\t\t\t\t\t.appendTo(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'.nav-horizontal li:last-child .dropdown-menu');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal > li > a')\r\n\t\t\t\t\t\t\t\t\t\t\t.each(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfunction() {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.parent()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.removeClass(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'nav-active');\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (jQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.parent()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.find(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'.dropdown-menu').length > 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'class',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'dropdown-toggle');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-toggle',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'dropdown');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\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}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}", "function removeMobileSearchPanelOnDesktop() {\n const mobileWindow = $(window).width() <= mobileSearchScreenSize;\n\n if (!mobileWindow) {\n $body.removeClass(mobileSearchOpenedClass);\n }\n}", "function edgtfSearchSlideFromHeaderBottom() {\n\t\n\t searchOpener.click( function(e) {\n\t\t e.preventDefault();\n\t\t\n\t\t var thisItem = $(this),\n\t\t\t searchIconPosition = parseInt(edgtf.windowWidth - thisItem.offset().left - thisItem.outerWidth());\n\n\t\t if(edgtf.body.hasClass('edgtf-boxed') && edgtf.windowWidth > 1024) {\n\t\t\t searchIconPosition -= parseInt((edgtf.windowWidth - $('.edgtf-boxed .edgtf-wrapper .edgtf-wrapper-inner').outerWidth()) / 2);\n\t\t }\n\t\t\n\t\t if(!edgtf.body.hasClass('edgtf-search-opened')){\n\t\t\t edgtf.body.addClass('edgtf-search-opened');\n\t\t\t if(thisItem.parents('.edgtf-fixed-wrapper').length) {\n\t\t\t\t thisItem.parents('.edgtf-fixed-wrapper').find('.edgtf-slide-from-header-bottom-holder').css('right', searchIconPosition).slideToggle(300, 'easeOutBack');\n\t\t\t } else if (thisItem.parents('.edgtf-sticky-header.header-appear').length) {\n\t\t\t\t thisItem.parents('.edgtf-sticky-header.header-appear').find('.edgtf-slide-from-header-bottom-holder').css('right', searchIconPosition).slideToggle(300, 'easeOutBack');\n\t\t\t } else if(thisItem.parents('.edgtf-logo-area').length) {\n\t\t\t\t thisItem.parents('.edgtf-page-header').find('.edgtf-slide-from-header-bottom-holder').css('right', searchIconPosition).slideToggle(300, 'easeOutBack');\n\t\t\t } else if (thisItem.parents('.edgtf-page-header').children('.edgtf-slide-from-header-bottom-holder').length) {\n\t\t\t\t thisItem.parents('.edgtf-page-header').children('.edgtf-slide-from-header-bottom-holder').css('right', searchIconPosition).slideToggle(300, 'easeOutBack');\n\t\t\t } else if (thisItem.parents('.edgtf-mobile-header').length) {\n\t\t\t\t thisItem.parents('.edgtf-mobile-header').find('.edgtf-slide-from-header-bottom-holder').css('right', searchIconPosition).slideToggle(300, 'easeOutBack');\n\t\t\t }\n\t\t\t setTimeout(function(){\n\t\t\t\t $('.edgtf-slide-from-header-bottom-holder input').focus();\n\t\t\t },400);\n\t\t } else {\n\t\t\t edgtf.body.removeClass('edgtf-search-opened');\n\t\t\t \n\t\t\t if (thisItem.parents('.edgtf-page-header').length) {\n\t\t\t\t thisItem.parents('.edgtf-page-header').find('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t } else if (thisItem.parents('.edgtf-mobile-header').length) {\n\t\t\t\t thisItem.parents('.edgtf-mobile-header').find('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t }\n\t\t }\n\t });\n\t\n\t //Close on escape\n\t $(document).keyup(function(e){\n\t\t if (e.keyCode == 27 ) { //KeyCode for ESC button is 27\n\t\t\t edgtf.body.removeClass('edgtf-search-opened');\n\t\t\t if(searchOpener.parents('.edgtf-fixed-wrapper').length) {\n\t\t\t\t searchOpener.parents('.edgtf-fixed-wrapper').find('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t } else if (searchOpener.parents('.edgtf-sticky-header.header-appear').length) {\n\t\t\t\t searchOpener.parents('.edgtf-sticky-header.header-appear').find('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t } else if(searchOpener.parents('.edgtf-logo-area').length) {\n\t\t\t\t searchOpener.parents('.edgtf-page-header').find('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t } else if (searchOpener.parents('.edgtf-page-header').children('.edgtf-slide-from-header-bottom-holder').length) {\n\t\t\t\t searchOpener.parents('.edgtf-page-header').children('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t } else if (searchOpener.parents('.edgtf-mobile-header').length) {\n\t\t\t\t searchOpener.parents('.edgtf-mobile-header').find('.edgtf-slide-from-header-bottom-holder').fadeOut(0);\n\t\t\t }\n\t\t }\n\t });\n }", "function showHideWhere() {\n if (!$('body.results .content.header').hasClass('stickyForm')) {\n if($('.header_forms .yp-what-where > li.where-wrap .input-label').css('display') == 'none') {\n if ($('#search-where-search-top').val() == '' && $('#search-what-search-top').val() != '') {\n $('#search-where-search-top').parents('li.where-wrap').hide();\n }\n }\n }\n }", "function contentMobile(){\n\t\tvar windowWidth = $(window).width();\n\n\t\t$('.overview').css({\n\t\t\tleft: -windowWidth\n\t\t});\n\t}", "function toggleCitySearch(){\n\tplaceArray([]);\n\tmap.setCenter(new google.maps.LatLng(37.1, -95.7));\n\tmap.setZoom(3);\n\t$('.csearch').toggleClass('hidden');\n\t$('.csearch input').val(\" \").focus();\n\tinfowindow.close();\n\tif (screen.width < 600) {\n\t\ttoggleMenu();\n\t}\n}", "function reposition_topnav() {\n if($('.nav-horizontal').length > 0) {\n\n // top navigation move to left nav\n // .nav-horizontal will set position to relative when viewed in screen below 1024\n if($('.nav-horizontal').css('position') == 'relative') {\n\n if($('.left-panel .nav-bracket').length == 2) {\n $('.nav-horizontal').insertAfter('.nav-bracket:eq(1)');\n } else {\n // only add to bottom if .nav-horizontal is not yet in the left panel\n if($('.left-panel .nav-horizontal').length == 0)\n $('.nav-horizontal').appendTo('.left-panelinner');\n }\n\n $('.nav-horizontal').css({display: 'block'})\n .addClass('nav-pills nav-stacked nav-bracket');\n\n $('.nav-horizontal .children').removeClass('dropdown-menu');\n $('.nav-horizontal > li').each(function() {\n\n $(this).removeClass('open');\n $(this).find('a').removeAttr('class');\n $(this).find('a').removeAttr('data-toggle');\n\n });\n\n if($('.nav-horizontal li:last-child').has('form')) {\n $('.nav-horizontal li:last-child').hide();\n }\n\n } else {\n // move nav only when .nav-horizontal is currently from left-panel\n // that is viewed from screen size above 1024\n if($('.left-panel .nav-horizontal').length > 0) {\n\n $('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket')\n .appendTo('.topnav');\n $('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style');\n $('.nav-horizontal li:last-child').show();\n $('.nav-horizontal > li > a').each(function() {\n\n $(this).parent().removeClass('nav-active');\n\n if($(this).parent().find('.dropdown-menu').length > 0) {\n $(this).attr('class','dropdown-toggle');\n $(this).attr('data-toggle','dropdown');\n }\n\n });\n }\n\n }\n\n }\n }", "function resetMobileNav() {\n $('#searchMobileContainer').removeClass('expanded');\n $(\"#predictive-container-small\").hide();\n $(\"#predictive-terms-small\").html(\"\");\n $(\"#mobileMenuList\").hide();\n }", "function setLeftPosition() {\n let leftPercentage = (-(initialSlideLengthQS - 1) * 100);\n initialLeftPercentage = leftPercentage;\n leftPercentage += '%';\n if ($(window).outerWidth() < 768) {\n $(sliderWrapperQS).css('left', leftPercentage);\n } else {\n // leftPercentage = (-(slides.length - 2) * ($(sliderWrapperQS + ' .slide').outerWidth() + tabMargin));\n // leftPercentage = 0;\n leftPercentage = -($(sliderWrapperQS + ' .slide').outerWidth() + tabMargin);\n initialLeftPercentage = leftPercentage;\n leftPercentage += 'px';\n $('#quickSwap .tabs-wrapper').css('left', leftPercentage);\n $('#quickSwap .slider-wrapper').css('left', '0%');\n }\n }", "function search_div(x){\n\t\tvar a=$(\"#main_search_div\");\n\t\tvar b=$(\"#search_icon_top\");\n\t\tif(a.width()==0){\n\t\t\ta.css(\"visibility\",\"visible\");\n\t\t\ta.css(\"width\",\"270\");\n\t\t\tb.css(\"right\",\"355\");\n\t\t}\n\t\telse if($(\".main_search_tb\").val()==\"\"){\n\t\t\ta.css(\"visibility\",\"hidden\");\n\t\t\ta.css(\"width\",\"0\");\n\t\t\tb.css(\"right\",\"85\");\n\t\t}\n\t}", "function responsive_autocomplete() {\n if(is_device.any()) {\n $('.search-bar input').on('focusin', function() {\n $('html, body').animate({ scrollTop: $('.search-bar').offset().top }, 'slow');\n });\n } else {\n $('.search-bar input').off('focusin');\n }\n}", "function updateForSearchVisible() {\n /* Prevent accidental scrolling of the body, prevent page layout jumps */\n let scrolledBodyWidth = document.body.offsetWidth;\n document.body.style.overflow = 'hidden';\n document.body.style.paddingRight = (document.body.offsetWidth - scrolledBodyWidth) + 'px';\n\n document.getElementById('search-input').value = '';\n document.getElementById('search-input').focus();\n document.getElementById('search-results').style.display = 'none';\n document.getElementById('search-notfound').style.display = 'none';\n document.getElementById('search-help').style.display = 'block';\n}", "function phoneLeftPos() {\n if (window.innerWidth < 767) {\n return \"2%\";\n }else{\n return \"5%\";\n }\n }", "function thememascot_topsearch_toggle() {\n $(document.body).on('click', '#top-search-toggle', function(e) {\n e.preventDefault();\n $('.search-form-wrapper.toggle').toggleClass('active');\n });\n }", "function menuMobile () {\n\t\tvar btnMenu = $('.site-header_menu-mob-nav');\n\t\tvar searchBtn = $('.site-header_menu-mob-search');\n\t\tvar searchForm = $('.site-header_search-wrap');\n\t\tvar body = $('body');\n\t\tvar viewport = $('.page-viewport');\n\t\tvar btnClose = $('.nav-close-mob');\n\t\tvar primaryNav = $('.primary-nav');\n\t\tvar aClass = 'active';\n\t\tvar oClass = 'open';\n\t\tvar oNavClass = 'primary-nav-open';\n\n\t\tfunction focusMenu () {\n\t\t\tif (body.hasClass(oNavClass)) {\n\t\t\t\t$('a', primaryNav).removeAttr('tabindex');\n\t\t\t\tprimaryNav.attr('tabindex', '-1').focus();\n\t\t\t} else {\n\t\t\t\t$('a', primaryNav).attr('tabindex', '-1');\n\t\t\t\tprimaryNav.removeAttr('tabindex');\n\t\t\t}\n\t\t}\n\n\t\tfunction focusSearch () {\n\t\t\tif (searchForm.hasClass(oClass)) {\n\t\t\t\t$('input', searchForm).focus();\n\t\t\t}\n\t\t}\n\n\t\tfunction openMenu () {\n\t\t\tprimaryNav.show();\n\t\t\tTM.to(viewport, 0.6, { easing: tmEasing, onComplete: focusMenu, x: '-70%' });\n\t\t\tbody.addClass(oNavClass);\n\t\t}\n\n\t\tfunction closeMenu () {\n\t\t\tTM.to(viewport, 0.6, { easing: tmEasing, onComplete: function () {\n\t\t\t\tfocusMenu();\n\t\t\t\tbody.removeClass(oNavClass);\n\t\t\t\tprimaryNav.hide();\n\t\t\t}, x: '0%' });\n\t\t}\n\n\t\tfunction toggleMenu (e) {\n\t\t\te.preventDefault();\n\t\t\tif (window.matchMedia(mq.xs).matches) {\n\t\t\t\tif (body.hasClass(oNavClass)) {\n\t\t\t\t\tcloseMenu();\n\t\t\t\t} else {\n\t\t\t\t\topenMenu();\n\t\t\t\t}\n\n\t\t\t\t$(this).toggleClass(aClass);\n\t\t\t}\n\t\t}\n\n\t\tfunction toggleSearch (e) {\n\t\t\te.preventDefault();\n\t\t\tif (window.matchMedia(mq.xs).matches) {\n\t\t\t\tif (searchForm.hasClass(oClass)) {\n\t\t\t\t\tTM.to(searchForm, 0.45, { easing: tmEasing, height: 0 });\n\t\t\t\t} else {\n\t\t\t\t\tTM.set(searchForm, { height: 'auto' });\n\t\t\t\t\tTM.from(searchForm, 0.45, { easing: tmEasing, onComplete: focusSearch, height: 0 });\n\t\t\t\t}\n\t\t\t\tsearchForm.toggleClass(oClass);\n\n\t\t\t\t$(this).toggleClass(aClass);\n\t\t\t}\n\t\t}\n\n\t\tfunction closeMenuBtn (e) {\n\t\t\te.preventDefault();\n\t\t\tif (window.matchMedia(mq.xs).matches) {\n\t\t\t\tbtnMenu.removeClass(aClass);\n\t\t\t\tcloseMenu();\n\t\t\t}\n\t\t}\n\n\t\t// do responsive things to primary-nav\n\t\tenquire.register(mq.xs, {\n\t\t\tsetup: function () {\n\t\t\t\tif (window.matchMedia(mq.xs).matches) {\n\t\t\t\t\tprimaryNav.hide();\n\t\t\t\t} else {\n\t\t\t\t\tprimaryNav.show();\n\t\t\t\t}\n\t\t\t},\n\t\t\tmatch: function () {\n\t\t\t\tprimaryNav.hide();\n\t\t\t},\n\t\t\tunmatch: function () {\n\t\t\t\tprimaryNav.show();\n\t\t\t}\n\t\t});\n\n\t\tbtnMenu.on('click', toggleMenu);\n\t\tbtnClose.on('click', closeMenuBtn);\n\n\t\tsearchBtn.on('click', toggleSearch);\n\n\t\t$('.primary-nav a').attr('tabindex', '-1');\n\t}", "function resizeFormBox() {\n\t\tif ( $('.fullscreen-wrap .puma-form-box').length > 0 ) {\n\t\t\tif ( $(window).height() <= 768 ) {\n\t\t\t\t$('.fullscreen-wrap .puma-form-box').css('margin-right', 0);\n\t\t\t\t$('.fullscreen-wrap .puma-form-box').stop(true).transition({ scale: 0.75 },700,'easeInOutCubic');\n\t\t\t}\n\t\t}\n\t}", "function setSidebarPos() {\n var detach = $('body').find(\".main-sidebar\").detach();\n if (window.matchMedia('(min-width: 992px)').matches) {\n $(detach).appendTo($('body').find(\"#sidebarStatic\"));\n $('.slideout-panel').css({'transform':'translateX(0)'});\n } else {\n $(detach).appendTo($('body').find(\"#sidebarSlidout\"));\n }\n}", "function moveEditModal(){\n if($(\".edit\").length != 0){\n var top_of_window = $(window).scrollTop();\n var bottom_of_edit = $(\".edit\").offset().top + $(\".edit\").outerHeight() - 0;\n if($( window ).width() < 990){\n var left_of_edit = $(\".edit\").offset().left - 260;\n }\n else{\n var left_of_edit = $(\".edit\").offset().left - 150;\n }\n\n $(\"#edit-carpeta .modal-body\").css('top', bottom_of_edit - top_of_window);\n $(\"#edit-carpeta .modal-body\").css('left', left_of_edit);\n }\n }", "function fix_position() {\n var uwidth = $('#user-nav > ul').width();\n $('#user-nav > ul').css({ width: uwidth, 'margin-left': '-' + uwidth / 2 + 'px' });\n\n var cwidth = $('#content-header .btn-group').width();\n $('#content-header .btn-group').css({ width: cwidth, 'margin-left': '-' + uwidth / 2 + 'px' });\n }", "function showSearch() {\n var search = document.getElementById(\"topSearch\").style;\n if (search.display === \"block\") {\n search.display = \"none\";\n }\n else {\n search.display = \"block\";\n }\n}", "function ancho_pagina(){\n if(window.innerWidth > 850){\n caja_trasera_login.style.display = \"block\";\n caja_trasera_register.style.display = \"block\";\n }else{\n \n caja_trasera_register.style.display = \"block\";\n caja_trasera_register.style.opacity = \"1\";\n caja_trasera_login.style.display = \"none\";\n formulario_login.style.display = \"block\";\n formulario_register.style.display = \"none\";\n contenedor_login_register.style.left=\"0px\";\n }\n}", "function scrollForm(position) {\n\t\tlet windowTop = $(window).scrollTop()\n\n\t\tif (windowTop > position) {\n\t\t\t$('html, body').animate({ 'scrollTop': position })\n\t\t}\n\t}", "function showSearchForm() {\n\n\n if (windowWidth <= 600) {\n\n if (document.getElementById('search-form__pop-up-input').classList.contains('visible')) {\n\n hideSearchForm();\n } else {\n\n\n document.getElementById('search-form__pop-up-input').style.animation = 'popUpSearchAppears 300ms, fadeIn 300ms';\n document.getElementById('dark-layer').style.animation = 'darkFadeIn 300ms';\n\n displayPopUpSearch();\n displayDarkLayer();\n }\n }\n\n}", "function navigationSearchInit() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : '';\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Material skin add search BG markup.\r\n\t\t\t\t\tif ($body.hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) {\r\n\t\t\t\t\t\t$headerOuterEl.append('<div class=\"bg-color-stripe\" />');\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Prevent jumping on click.\r\n\t\t\t\t\t$body.on('click', '#search-btn a', function () {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Open search on mouseup.\r\n\t\t\t\t\t$body.on('click', '#search-btn a:not(.inactive), #header-outer .mobile-search', function () {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($(this).hasClass('open-search')) {\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Close menu on original skin.\r\n\t\t\t\t\t\tif( $body.hasClass('original') &&\t$('.slide-out-widget-area-toggle.mobile-icon a.open').length > 0 ) {\r\n\t\t\t\t\t\t\t$('.slide-out-widget-area-toggle.mobile-icon a')\r\n\t\t\t\t\t\t\t\t.addClass('non-human-allowed')\r\n\t\t\t\t\t\t\t\t.trigger('click');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\t\t$('.slide-out-widget-area-toggle.mobile-icon a').removeClass('non-human-allowed');\r\n\t\t\t\t\t\t\t\t}, 100);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($body.hasClass('ascend') || \r\n\t\t\t\t\t\t$('body[data-header-format=\"left-header\"]').length > 0 && $('body.material').length == 0) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Ascend theme skin.\r\n\t\t\t\t\t\t\t$('#search-outer > #search form, #search-outer #search .span_12 span, #search-outer #search #close').css('opacity', 0);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$('#search-outer > #search form').css('transform', 'translateY(-30px)');\r\n\t\t\t\t\t\t\t$('#search-outer #search .span_12 span').css('transform', 'translateY(20px)');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$('#search-outer').show();\r\n\t\t\t\t\t\t\t$('#search-outer').stop().transition({\r\n\t\t\t\t\t\t\t\tscale: '1,0',\r\n\t\t\t\t\t\t\t\t'opacity': 1\r\n\t\t\t\t\t\t\t}, 0).transition({\r\n\t\t\t\t\t\t\t\tscale: '1,1'\r\n\t\t\t\t\t\t\t}, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$('#search-outer > #search form').delay(350).transition({\r\n\t\t\t\t\t\t\t\t'opacity': 1,\r\n\t\t\t\t\t\t\t\t'transform': 'translateY(0)'\r\n\t\t\t\t\t\t\t}, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$('#search-outer #search #close').delay(500).transition({\r\n\t\t\t\t\t\t\t\t'opacity': 1\r\n\t\t\t\t\t\t\t}, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$('#search-outer #search .span_12 span').delay(450).transition({\r\n\t\t\t\t\t\t\t\t'opacity': 1,\r\n\t\t\t\t\t\t\t\t'transform': 'translateY(0)'\r\n\t\t\t\t\t\t\t}, 700, 'cubic-bezier(0.2, 1, 0.3, 1)');\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\r\n\t\t\t\t\t\telse if (!$body.hasClass('material')) {\r\n\t\t\t\t\t\t\t// Original theme skin.\r\n\t\t\t\t\t\t\t$('#search-outer').stop(true).fadeIn(600, 'easeOutExpo');\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Material theme skin.\r\n\t\t\t\t\t\t\t$('#header-outer[data-transparent-header=\"true\"] .bg-color-stripe').css('transition', '');\r\n\t\t\t\t\t\t\t$('#search-outer, #ajax-content-wrap').addClass('material-open');\r\n\t\t\t\t\t\t\t$headerOuterEl.addClass('material-search-open');\r\n\t\t\t\t\t\t\t$('#fp-nav').addClass('material-ocm-open');\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t$('#search input[type=text]').trigger('focus');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ($('#search input[type=text]').attr('value') == $placeholder) {\r\n\t\t\t\t\t\t\t\t$('#search input[type=text]').setCursorPosition(0);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}, 300);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$(this).toggleClass('open-search');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Close slide out widget area.\r\n\t\t\t\t\t\t$('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Handle the placeholder value.\r\n\t\t\t\t\t$('body:not(.material)').on('keydown', '#search input[type=text]', function () {\r\n\t\t\t\t\t\tif ($(this).attr('value') == $placeholder) {\r\n\t\t\t\t\t\t\t$(this).attr('value', '');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('body:not(.material)').on('keyup', '#search input[type=text]', function () {\r\n\t\t\t\t\t\tif ($(this).attr('value') == '') {\r\n\t\t\t\t\t\t\t$(this).attr('value', $placeholder);\r\n\t\t\t\t\t\t\t$(this).setCursorPosition(0);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Close search btn event.\r\n\t\t\t\t\t$body.on('click', '#close', function () {\r\n\t\t\t\t\t\tcloseSearch();\r\n\t\t\t\t\t\t$searchButtonEl.removeClass('open-search');\r\n\t\t\t\t\t\t$('#header-outer .mobile-search').removeClass('open-search');\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Original and Ascend skin close search when clicking off.\r\n\t\t\t\t\t$('body:not(.material)').on('blur', '#search-box input[type=text]', function () {\r\n\t\t\t\t\t\tcloseSearch();\r\n\t\t\t\t\t\t$searchButtonEl.removeClass('open-search');\r\n\t\t\t\t\t\t$('#header-outer .mobile-search').removeClass('open-search');\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Material skin close when clicking off the search.\r\n\t\t\t\t\t$('body.material').on('click', '#ajax-content-wrap', function (e) {\r\n\t\t\t\t\t\tif (e.originalEvent !== undefined) {\r\n\t\t\t\t\t\t\tcloseSearch();\r\n\t\t\t\t\t\t\t$searchButtonEl.removeClass('open-search');\r\n\t\t\t\t\t\t\t$('#header-outer .mobile-search').removeClass('open-search');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Material skin close on esc button event.\r\n\t\t\t\t\tif ($('body.material').length > 0) {\r\n\t\t\t\t\t\t$(document).on('keyup', function (e) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (e.keyCode == 27) {\r\n\t\t\t\t\t\t\t\tcloseSearch();\r\n\t\t\t\t\t\t\t\t$searchButtonEl.removeClass('open-search');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// Close ocm material\r\n\t\t\t\t\t\t\t\tif ($('.ocm-effect-wrap.material-ocm-open').length > 0) {\r\n\t\t\t\t\t\t\t\t\t$('.slide-out-widget-area-toggle.material-open a').trigger('click');\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\t\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\r\n\t\t\t\t\t// Called to hide the search bar.\r\n\t\t\t\t\tfunction closeSearch() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($body.hasClass('ascend') || $('body[data-header-format=\"left-header\"]').length > 0 && $('body.material').length == 0) {\r\n\t\t\t\t\t\t\t$('#search-outer').stop().transition({\r\n\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t}, 300, 'cubic-bezier(0.2, 1, 0.3, 1)');\r\n\t\t\t\t\t\t\t$searchButtonEl.addClass('inactive');\r\n\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t$('#search-outer').hide();\r\n\t\t\t\t\t\t\t\t$searchButtonEl.removeClass('inactive');\r\n\t\t\t\t\t\t\t}, 300);\r\n\t\t\t\t\t\t} else if ($('body.material').length == 0) {\r\n\t\t\t\t\t\t\t$('#search-outer').stop(true).fadeOut(450, 'easeOutExpo');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($body.hasClass('material')) {\r\n\t\t\t\t\t\t\t$('#ajax-content-wrap').removeClass('material-open');\r\n\t\t\t\t\t\t\t$headerOuterEl.removeClass('material-search-open');\r\n\t\t\t\t\t\t\t$('#search-outer').removeClass('material-open');\r\n\t\t\t\t\t\t\t$('#fp-nav').removeClass('material-ocm-open');\r\n\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\t}", "function fix_position()\n\t{\n\t\tvar uwidth = $('#user-nav > ul').width();\n\t\t$('#user-nav > ul').css({width:uwidth,'margin-left':'-' + uwidth / 2 + 'px'});\n \n var cwidth = $('#content-header .btn-group').width();\n $('#content-header .btn-group').css({width:cwidth,'margin-left':'-' + uwidth / 2 + 'px'});\n\t}", "function toggleResponsive() {\r\n\t// initial call\r\n\tif(!$(\"body\").hasClass(\"mobile-xs\") && !$(\"body\").hasClass(\"mobile\") && !$(\"body\").hasClass(\"desktop\")){\r\n\t\tif(window.innerWidth > 991) {\r\n\t\t\t$(\"body\").addClass(\"desktop\");\r\n\t\t} else if (window.innerWidth > 767) {\r\n\t\t\t$(\"body\").addClass(\"mobile\");\r\n\t\t} else {\r\n\t\t\t$(\"body\").addClass(\"mobile-xs\");\r\n\t\t}\r\n\t}\r\n\telse if(window.innerWidth > 991){\r\n\t\tif($(\"body\").hasClass(\"mobile\")){\r\n\t\t\t//size changed from mobile to desktop\r\n\t\t\t$(\"body\").removeClass(\"mobile\").addClass(\"desktop\");\r\n\t\t\tcloseMenu();\r\n\t\t\tif($(\".productfinder .filter\")[0]){\r\n\t\t\t\topenFilterBar();\r\n\t\t\t}\r\n\t\t} \r\n\t} else if(window.innerWidth > 767){\r\n\t\tif($(\"body\").hasClass(\"desktop\")){\r\n\t\t\t//size changed from desktop to mobile\r\n\t\t\t$(\"body\").removeClass(\"desktop\").addClass(\"mobile\");\r\n\t\t\tcloseMenu();\r\n\t\t\tif($(\".productfinder .filter\")[0]){\r\n\t\t\t\tcloseFilterBar();\r\n\t\t\t}\r\n\t\t} else if($(\"body\").hasClass(\"mobile-xs\")){\r\n\t\t\t//size changed from mobile-xs to mobile\r\n\t\t\t$(\"body\").removeClass(\"mobile-xs\").addClass(\"mobile\");\r\n\t\t\tcloseMenu();\r\n\t\t\tif($(\".productfinder .filter\")[0]){\r\n\t\t\t\topenFilterToggles();\r\n\t\t\t\topenFilterBar();\r\n\t\t\t}\r\n\t\t} \r\n\t} else {\t\r\n\t\tif($(\"body\").hasClass(\"mobile\")){\r\n\t\t\t//size changed from mobile to mobile-x\r\n\t\t\t$(\"body\").removeClass(\"mobile\").addClass(\"mobile-xs\");\r\n\t\t\tcloseMenu();\r\n\t\t\tif($(\".productfinder .filter\")[0]){\r\n\t\t\t\tcloseFilterBar();\r\n\t\t\t\tcloseFilterToggles();\r\n\t\t\t}\r\n\t\t}\r\n\t} \r\n}", "function search() {\n document.getElementById(\"secondform\").style.display = \"grid\";\n document.getElementById(\"secondform\").style.animation = \"fadeIn 1s\";\n\n document.getElementById(\"firstform\").style.display = \"none\";\n\n }", "function adaptContent() {\n if (desktopSite()) {\n // Position form submission status banner at top of container div\n $(\"#submitStatus\").css(\"top\", \"\");\n $(\"#submitStatus\").css(\"position\", \"absolute\");\n // Dark GitHub logo\n $(\"#githubDesktop\").css(\"display\", \"inline\");\n $(\"#githubMobile\").css(\"display\", \"none\");\n } else {\n // Position banner towards top of screen while in div, when above position at top of div\n if ($(window).scrollTop() + 40 > $(\"#contact\").offset().top) {\n $(\"#submitStatus\").css(\"top\", \"40px\");\n $(\"#submitStatus\").css(\"position\", \"fixed\");\n } else {\n $(\"#submitStatus\").css(\"top\", \"0px\");\n $(\"#submitStatus\").css(\"position\", \"relative\");\n }\n // Light GitHub logo\n $(\"#githubMobile\").css(\"display\", \"inline\");\n $(\"#githubDesktop\").css(\"display\", \"none\");\n }\n}", "function responsive () {\n\t\tvar toggleMobileEls = $('.site-header_search-wrap');\n\t\tenquire.register(mq.xs, {\n\t\t\tsetup: function () {\n\t\t\t\tif (window.matchMedia(mq.xs).matches) {\n\t\t\t\t\t// do mobile stuff\n\t\t\t\t\tTM.set(toggleMobileEls, { height: 0 });\n\t\t\t\t} else {\n\t\t\t\t\ttoggleMobileEls.removeAttr('style').removeClass('open');\n\t\t\t\t\t$('.primary-nav a').removeAttr('tabindex');\n\t\t\t\t}\n\t\t\t},\n\t\t\tmatch: function () {\n\t\t\t\tTM.set(toggleMobileEls, { height: 0 });\n\t\t\t},\n\t\t\tunmatch: function () {\n\t\t\t\ttoggleMobileEls.removeAttr('style').removeClass('open');\n\t\t\t\t$('.primary-nav a').removeAttr('tabindex');\n\t\t\t}\n\t\t});\n\t}", "function showNav() {\n $('.mobile-nav-button').removeClass('active');\n $('.mobile-search-button').removeClass('active');\n //if (($(window).width() >= MIN_NON_TABLET_SIZE && !Modernizr.ipad) || ($(window).width()<MIN_NON_TABLET_SIZE && $('header.ot, header.campaign').length==0)) {\n //if ($(window).width() > MIN_NON_TABLET_SIZE && !Modernizr.ipad) {\n if ($(window).width() > MIN_NON_MOBILE_SIZE) {\n $('.main-header-nav').show().css({'height':'', 'right':''});\n }\n else {\n $('.main-header-nav').hide().find('.active').removeClass('active');\n $('.main-header-nav > ul').css('left', '0px');\n }\n showDisplayName();\n}", "function HB_Element_SearchBox() {\n\n\t \t$( '.hb-search .open.show-full-screen' ).on( 'click', function() {\n\n\t \t\tvar _this = $( this );\n\t \t\tvar parent = _this.parents( '.hb-search' );\n\n\t\t\t/*******************************************************************\n\t\t\t * Render HTML for effect *\n\t\t\t ******************************************************************/\n\t\t\t var sidebar_content = parent.find( '.hb-search-fs' )[ 0 ].outerHTML;\n\t\t\t $( 'body' ).append( sidebar_content );\n\n\t\t\t var background_style = $( this ).attr( 'data-background-style' );\n\t\t\t var layout = $( this ).attr( 'data-layout' );\n\t\t\t var search_form = $( 'body > .hb-search-fs' );\n\n\t\t\t if ( layout == 'topbar' && $( this ).hasClass( 'active-topbar' ) ) {\n\t\t\t \tsearch_close();\n\t\t\t } else {\n\n\t\t\t \tswitch ( layout ) {\n\t\t\t \t\tcase 'full-screen':\n\t\t\t \t\tsearch_form.fadeIn( 300 );\n\t\t\t \t\t$( 'html' ).addClass( 'no-scroll' );\n\t\t\t \t\tbreak;\n\t\t\t \t\tcase 'topbar':\n\n\t\t\t \t\tvar admin_bar = $( '#wpadminbar' );\n\t\t\t \t\tvar margin_top = admin_bar.length ? admin_bar.height() : '0';\n\n\t\t\t \t\t$( this ).addClass( 'active-topbar' );\n\n\t\t\t \t\tsearch_form.css( {\n\t\t\t \t\t\t'display': 'block',\n\t\t\t \t\t\t'top': ( margin_top - 80 ) + 'px'\n\t\t\t \t\t} ).animate( {\n\t\t\t \t\t\t'top': margin_top + 'px'\n\t\t\t \t\t} );\n\t\t\t \t\t$( 'body > .wrapper-outer' ).css( {\n\t\t\t \t\t\t'position': 'relative',\n\t\t\t \t\t\t'top': '0px'\n\t\t\t \t\t} ).animate( {\n\t\t\t \t\t\t'top': '80px'\n\t\t\t \t\t} );\n\n\t\t\t \t\tbreak;\n\t\t\t \t}\n\n\t\t\t \tsearch_form.addClass( background_style + ' ' + layout );\n\t\t\t \tsearch_form.find( '.close' ).attr( 'data-layout', layout );\n\t\t\t \tsearch_form.find( 'form input' ).focus();\n\t\t\t }\n\n\t\t\t} );\n\n\t \tfunction search_close() {\n\t \t\tvar _this = $( 'body > .hb-search-fs .close' );\n\t \t\tvar layout = _this.attr( 'data-layout' );\n\n\t \t\tswitch ( layout ) {\n\t \t\t\tcase 'full-screen':\n\t \t\t\t$( 'body > .hb-search-fs' ).fadeOut( 300, function() {\n\t \t\t\t\t$( 'html' ).removeClass( 'no-scroll' );\n\t \t\t\t\t$( 'body > .hb-search-fs' ).remove();\n\t \t\t\t\t$( 'body > .wrapper-outer' ).removeAttr( 'style' );\n\t \t\t\t} );\n\t \t\t\tbreak;\n\t \t\t\tcase 'topbar':\n\t \t\t\tvar admin_bar = $( '#wpadminbar' );\n\t \t\t\tvar margin_top = admin_bar.length ? admin_bar.height() : '0';\n\n\t \t\t\t$( 'body > .hb-search-fs' ).animate( {\n\t \t\t\t\t'top': ( margin_top - 80 ) + 'px'\n\t \t\t\t}, function() {\n\t \t\t\t\t$( this ).remove();\n\t \t\t\t} );\n\n\t \t\t\t$( 'body > .wrapper-outer' ).animate( {\n\t \t\t\t\t'top': '0px'\n\t \t\t\t}, function() {\n\t \t\t\t\t$( this ).removeAttr( 'style' );\n\t \t\t\t} );\n\n\t \t\t\tbreak;\n\t \t\t}\n\n\t \t\t$( '.header .hb-search' ).find( '.open.active-topbar' ).removeClass( 'active-topbar' );\n\t \t}\n\n\t \t$( 'body' ).on( 'click', '.hb-search-fs .close', function() {\n\t \t\tsearch_close();\n\t \t} );\n\n\t \t$( '.header .hb-search.dropdown .open' ).click( function() {\n\t \t\tvar _this = $( this );\n\t \t\tvar parents = _this.closest( '.hb-search' );\n\t \t\tvar search_form = parents.find( '.search-form:first' );\n\t \t\tvar index_current = $( '.header .hb-search.dropdown' ).index( parents );\n\t \t\tvar parents_info = parents[ 0 ].getBoundingClientRect();\n\t \t\tvar border_top_width = parseInt( parents.css( 'borderTopWidth' ) );\n\t \t\tvar border_bottom_width = parseInt( parents.css( 'borderBottomWidth' ) );\n\n\t\t\t// Remove active element item more\n\t\t\t$( '.header .hb-search.dropdown:not(:eq(' + index_current + '))' ).removeClass( 'active-dropdown' );\n\n\t\t\tif ( parents.hasClass( 'active-dropdown' ) ) {\n\t\t\t\tparents.removeClass( 'active-dropdown' );\n\t\t\t\tsearch_form.removeClass( 'set-width' );\n\t\t\t} else {\n\t\t\t\tWR_Click_Outside( _this, '.hb-search', function( e ) {\n\t\t\t\t\tparents.removeClass( 'active-dropdown' );\n\t\t\t\t\tsearch_form.removeClass( 'set-width' );\n\t\t\t\t} );\n\n\t\t\t\t// Reset style\n\t\t\t\tsearch_form.removeAttr( 'style' );\n\n\t\t\t\tvar width_content_broswer = $( window ).width();\n\n\t\t\t\tif ( search_form.width() > ( width_content_broswer - 10 ) ) {\n\t\t\t\t\tsearch_form.css( 'width', ( width_content_broswer - 10 ) );\n\t\t\t\t\tsearch_form.addClass( 'set-width' );\n\t\t\t\t}\n\n\t\t\t\tvar width_content_broswer = $( window ).width();\n\t\t\t\tvar search_form_info = search_form[ 0 ].getBoundingClientRect();\n\t\t\t\tvar current_info = _this[ 0 ].getBoundingClientRect();\n\n\t\t\t\t// Get offset\n\t\t\t\tvar offset_option = ( width_content_broswer > 1024 ) ? parseInt( WR_Data_Js[ 'offset' ] ) : 0;\n\n\t\t\t\t// Set left search form if hide broswer because small\n\t\t\t\tif ( width_content_broswer < ( search_form_info.right + 5 ) ) {\n\t\t\t\t\tvar left_search_form = ( search_form_info.right + 5 + offset_option ) - width_content_broswer;\n\t\t\t\t\tsearch_form.css( 'left', -left_search_form + 'px' );\n\t\t\t\t} else if ( search_form_info.left < ( 5 + offset_option ) ) {\n\t\t\t\t\tsearch_form.css( 'left', '5px' );\n\t\t\t\t}\n\n\t\t\t\tvar margin_top = ( parents.attr( 'data-margin-top' ) == 'empty' ) ? parents.attr( 'data-margin-top' ) : parseInt( parents.attr( 'data-margin-top' ) );\n\n\t\t\t\t// Remove margin top when stick\n\t\t\t\tif ( _this.closest( '.sticky-row-scroll' ).length || margin_top == 'empty' ) {\n\t\t\t\t\tvar parent_sticky_info = _this.closest( ( _this.closest( '.sticky-row-scroll' ).length ? '.sticky-row' : '.hb-section-outer' ) )[ 0 ].getBoundingClientRect();\n\t\t\t\t\tvar offset_top = parseInt( ( parent_sticky_info.bottom - parents_info.bottom ) + ( parents_info.height - border_top_width ) );\n\n\t\t\t\t\tsearch_form.css( 'top', offset_top );\n\t\t\t\t} else if ( margin_top > 0 ) {\n\t\t\t\t\tsearch_form.css( 'top', ( margin_top + ( parents_info.height - ( border_top_width + border_bottom_width ) ) ) );\n\t\t\t\t}\n\n\t\t\t\tparents.addClass( 'active-dropdown' );\n\n\t\t\t\t// Set width input if overflow\n\t\t\t\tvar ls_form = parents.find( '.wrls-form' );\n\n\t\t\t\tif( ls_form.length ) {\n\t\t\t\t\tvar width_cate = parents.find( '.cate-search-outer' ).width();\n\t\t\t\t}\n\n\t\t\t\tsetTimeout( function() {\n\t\t\t\t\tparents.find( '.txt-search' ).focus();\n\t\t\t\t}, 300 );\n\t\t\t}\n\t\t} );\n\n\t \t/* Action for expand width */\n\t \t$( '.header .hb-search.expand-width .open' ).on( 'click', function( event ) {\n\t \t\tvar _this = $( this );\n\t \t\tvar parents = _this.closest( '.hb-search' );\n\t \t\tvar form_search = parents.find( '.search-form form' )\n\t \t\tvar info_form = form_search[ 0 ].getBoundingClientRect();\n\t \t\tvar width_form = info_form.width;\n\t \t\tvar header = _this.closest( '.header' );\n\t \t\tvar is_vertical = header.hasClass( 'vertical-layout' );\n\t \t\tvar is_expand_right = true;\n\n\t \t\tif ( parents.hasClass( 'expan-width-active' ) ) {\n\t \t\t\tform_search.stop( true, true ).css( {\n\t \t\t\t\toverflow: 'hidden'\n\t \t\t\t} ).animate( {\n\t \t\t\t\twidth: '0px'\n\t \t\t\t}, 200, function() {\n\t \t\t\t\tparents.removeClass( 'expan-width-active' );\n\t \t\t\t\tform_search.removeAttr( 'style' );\n\n\t \t\t\t\t/*** Show elements element current ***/\n\t \t\t\t\tvar parents_container = _this.closest( '.container' ).find( '.hide-expand-search' );\n\n\t \t\t\t\tparents_container.css( 'visibility', '' ).animate( {\n\t \t\t\t\t\topacity: 1\n\t \t\t\t\t}, 200, function() {\n\t \t\t\t\t\tparents_container.removeClass( 'hide-expand-search' );\n\t \t\t\t\t\t$( this ).css( 'opacity', '' );\n\t \t\t\t\t} );\n\t \t\t\t} );\n\t \t\t} else {\n\t \t\t\tWR_Click_Outside( _this, '.hb-search', function( e ) {\n\t \t\t\t\tform_search.stop( true, true ).css( {\n\t \t\t\t\t\toverflow: 'hidden'\n\t \t\t\t\t} ).animate( {\n\t \t\t\t\t\twidth: '0px'\n\t \t\t\t\t}, 200, function() {\n\t \t\t\t\t\tparents.removeClass( 'expan-width-active' );\n\t \t\t\t\t\tform_search.removeAttr( 'style' );\n\n\t \t\t\t\t\t/*** Show elements element current ***/\n\t \t\t\t\t\tvar parents_container = _this.closest( '.container' ).find( '.hide-expand-search' );\n\n\t \t\t\t\t\tparents_container.css( 'visibility', '' ).animate( {\n\t \t\t\t\t\t\topacity: 1\n\t \t\t\t\t\t}, 200, function() {\n\t \t\t\t\t\t\tparents_container.removeClass( 'hide-expand-search' );\n\t \t\t\t\t\t\t$( this ).css( 'opacity', '' );\n\t \t\t\t\t\t} );\n\t \t\t\t\t} );\n\t \t\t\t} );\n\n\t \t\t\tvar info_search_current = _this[ 0 ].getBoundingClientRect();\n\t \t\t\tvar width_ofset_left = info_search_current.left + info_search_current.width / 2;\n\t \t\t\tvar width_broswer = document.body.offsetWidth;\n\t \t\t\tvar width_open = parents.outerWidth();\n\n\t \t\t\tif ( is_vertical ) {\n\n\t \t\t\t\tvar info_parents = parents[ 0 ].getBoundingClientRect();\n\t \t\t\t\tvar info_header = header[ 0 ].getBoundingClientRect();\n\n\t\t\t\t\t// Left position\n\t\t\t\t\tif ( header.hasClass( 'left-position-vertical' ) ) {\n\t\t\t\t\t\tis_expand_right = ( info_parents.left - info_header.left - 10 ) >= info_form.width ? false : true;\n\n\t\t\t\t\t\t// Right position\n\t\t\t\t\t} else {\n\t\t\t\t\t\tis_expand_right = ( info_header.right - info_parents.right - 10 ) >= info_form.width ? true : false\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tis_expand_right = width_ofset_left * 2 < width_broswer;\n\t\t\t\t}\n\n\t\t\t\t// Expand right\n\t\t\t\tif ( is_expand_right ) {\n\n\t\t\t\t\t/** * Hide elements right element current ** */\n\t\t\t\t\tvar list_next_all = parents.nextUntil();\n\n\t\t\t\t\tif ( list_next_all.length ) { console.log( 'fasdf' );\n\t\t\t\t\tvar width_next = 0;\n\n\t\t\t\t\tvar handle_animate = function() {\n\t\t\t\t\t\tform_search.stop( true, true ).css( {\n\t\t\t\t\t\t\tleft: width_open + 5,\n\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tvisibility: 'initial'\n\t\t\t\t\t\t} ).animate( {\n\t\t\t\t\t\t\twidth: width_form\n\t\t\t\t\t\t}, 200, function() {\n\t\t\t\t\t\t\t$( this ).css( 'overflow', '' );\n\t\t\t\t\t\t} );\n\t\t\t\t\t};\n\n\t\t\t\t\tif ( !is_vertical ) {\n\t\t\t\t\t\tlist_next_all.each( function( key, val ) {\n\t\t\t\t\t\t\tif ( width_next < width_form ) {\n\t\t\t\t\t\t\t\t$( val ).animate( {\n\t\t\t\t\t\t\t\t\topacity: 0\n\t\t\t\t\t\t\t\t}, 200, function() {\n\t\t\t\t\t\t\t\t\t$( val ).css( 'visibility', 'hidden' )\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t$( val ).addClass( 'hide-expand-search' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\twidth_next += $( val ).outerWidth( true );\n\n\t\t\t\t\t\t\tif ( width_next > width_form )\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\tsetTimeout( handle_animate, 200 );\n\t\t\t\t\t} else {\n\t\t\t\t\t\thandle_animate();\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t\t// Expand width form search\n\t\t\t\t\t\tform_search.stop( true, true ).css( {\n\t\t\t\t\t\t\tleft: width_open + 5,\n\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tvisibility: 'initial'\n\t\t\t\t\t\t} ).animate( {\n\t\t\t\t\t\t\twidth: width_form\n\t\t\t\t\t\t}, 200, function() {\n\t\t\t\t\t\t\t$( this ).css( 'overflow', '' );\n\t\t\t\t\t\t} );\n\n\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Expand left\n\t\t\t\t} else {\n\n\t\t\t\t\t/*** Hide elements left near element current ***/\n\t\t\t\t\tvar list_prev_all = parents.prevUntil();\n\n\t\t\t\t\tif ( list_prev_all.length ) {\n\t\t\t\t\t\tvar width_prev = 0;\n\n\t\t\t\t\t\tvar handle_animate = function() {\n\t\t\t\t\t\t\tform_search.stop( true, true ).css( {\n\t\t\t\t\t\t\t\tright: width_open + 5,\n\t\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tvisibility: 'initial'\n\t\t\t\t\t\t\t} ).animate( {\n\t\t\t\t\t\t\t\twidth: width_form\n\t\t\t\t\t\t\t}, 200, function() {\n\t\t\t\t\t\t\t\t$( this ).css( 'overflow', '' );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif ( !is_vertical ) {\n\t\t\t\t\t\t\tlist_prev_all.each( function( key, val ) {\n\t\t\t\t\t\t\t\tif ( width_prev < width_form ) {\n\t\t\t\t\t\t\t\t\t$( val ).animate( {\n\t\t\t\t\t\t\t\t\t\topacity: 0\n\t\t\t\t\t\t\t\t\t}, 200, function() {\n\t\t\t\t\t\t\t\t\t\t$( val ).css( 'visibility', 'hidden' )\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t$( val ).addClass( 'hide-expand-search' );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\twidth_prev += $( val ).outerWidth( true );\n\n\t\t\t\t\t\t\t\tif ( width_prev > width_form )\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\tsetTimeout( handle_animate, 200 );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thandle_animate();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Expand width form search\n\t\t\t\t\t\tform_search.stop( true, true ).css( {\n\t\t\t\t\t\t\tright: width_open + 5,\n\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tvisibility: 'initial'\n\t\t\t\t\t\t} ).animate( {\n\t\t\t\t\t\t\twidth: width_form\n\t\t\t\t\t\t}, 200, function() {\n\t\t\t\t\t\t\t$( this ).css( 'overflow', '' );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tparents.addClass( 'expan-width-active' );\n\n\t\t\t\tsetTimeout( function() {\n\t\t\t\t\tparents.find( '.txt-search' ).focus();\n\t\t\t\t}, 300 );\n\t\t\t}\n\t\t} );\n\n/* Action for Boxed */\n$( '.header .hb-search.boxed .open' ).on( 'click', function() {\n\tvar _this = $( this );\n\tvar parents = _this.parents( '.hb-search' );\n\tparents.find( 'input[type=\"submit\"]' ).trigger( 'click' );\n} );\n}", "function backToVisible() {\n var w = document.documentElement.clientWidth;\n if(w>775) {\n navItems.style.display = \"flex\";\n usernameField.style.display = \"block\";\n }else {\n \n navItems.style.display = \"none\";\n usernameField.style.display = \"none\";\n }\n}", "function toggleSearch(){\n var x = document.getElementById(\"searchbar\");\n\n if (x.style.display === \"none\") {\n x.style.display = \"block\";\n document.getElementById(\"search-icon\").classList.remove(\"col-xs-offset-7\");\n document.getElementById(\"pac-input\").focus();\n;\n } else {\n x.style.display = \"none\";\n document.getElementById(\"search-icon\").classList.add(\"col-xs-offset-7\");\n }\n}", "function checkSize(){\n\t if ($(window).width() > 480) {\n\t \t// $(\"html, body\").animate({ scrollTop: 0 });\t\t\t\t \n\t } else { \n\t $(\"html, body\").animate({scrollTop:$('.widget-bar').offset().top - 150}, 'slow'); \n\t }\n\t}", "function mobileColumnLeft() {\n if (viewModel.mobileCurrentColumn() > 0) {\n viewModel.mobileCurrentColumn(viewModel.mobileCurrentColumn()-1);\n window.scrollTo(0, 0);\n }\n}", "function scrollForm(position) {\n let windowTop = $(window).scrollTop()\n\n if (windowTop > position) {\n $('html, body').animate({ 'scrollTop': position })\n }\n }", "function topNavSearch() {\n\n\t\tvar topNavSearch = $('.top-nav-search-wrap'),\n\t\t\ttopnavSearchX = topNavSearch.children('div').find('i');\n\n\t\tif ( topNavSearch.length > 0 ) {\n\n\t\t\ttopNavSearch.children('div').width( sidebarTop.children('div').outerWidth() );\n\t\t\ttopnavSearchX.attr( 'class', 'fa fa-times search-icon' );\n\n\t\t\ttopNavSearch.children('a').on('click', function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttopNavSearch.children('div').fadeIn();\n\t\t\t});\n\n\t\t\ttopnavSearchX.on('click', function() {\n\t\t\t\ttopNavSearch.children('div').fadeOut();\n\t\t\t});\n\n\t\t}\n\n\t}", "function getWidth() {\n if ($(window).width() < 730) {\n var content_width = $(\".wrap\").width();\n $(\".location-filter .row\").width(content_width);\n $(\".header-profile .profile-menu\").width(content_width);\n $(\".search-form\").width(content_width);\n $(\".filter-content-wrap\").width(content_width);\n } else {\n $(\".location-filter .row\").removeAttr(\"style\");\n $(\".header-profile .profile-menu\").removeAttr(\"style\");\n $(\".search-form\").removeAttr(\"style\");\n }\n\n}", "function positionDatasetEditMenu(){\n\t$('#dataSetEdit').css('position', 'absolute')\n\t\t\t\t\t\t\t\t\t\t .css('top', parseInt(window.innerHeight/2 - $('#dataSetEdit').height()/2)+\"px\")\n\t\t\t\t\t\t\t\t\t\t .css('left',parseInt(window.innerWidth/2 - $('#dataSetEdit').width()/2)+\"px\");\n}", "function mobile_menu_position() {\r\n\t\r\n var header_height = j$('header').height();\r\n if (!j$('header').hasClass('fixed_header_left')) {\r\n j$('#header_container').css('min-height', header_height);\r\n }\r\n\r\n if (j$(window).width() < 1018) {\r\n var mobilenav = 0;\r\n j$(\"header nav ul,.header_bottom_nav nav ul\").hide();\r\n j$(\"#nav_button\").show();\r\n }\r\n\r\n\r\n if (j$('header').hasClass('fixed_header_left')) {\r\n if (j$(window).width() < 1019) {\r\n var top_value = 0;\r\n if (j$('#wpadminbar').length >= 1) {\r\n top_value = j$('#wpadminbar').outerHeight() + \"px\";\r\n }\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'fixed',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '999'\r\n });\r\n } else {\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'absolute',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '-1'\r\n });\r\n }\r\n }\r\n else {\r\n if (j$(window).width() < 750) {\r\n var top_value = 0;\r\n if (j$('#wpadminbar').length >= 1) {\r\n top_value = j$('#wpadminbar').outerHeight() + \"px\";\r\n }\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'fixed',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '999'\r\n });\r\n } else {\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'absolute',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '-1'\r\n });\r\n }\r\n }\r\n\r\n}", "function resizeSearchBar() {\n $('.search')\n .addClass(\"search-small\")\n .removeClass(\"search\");\n $('.logo')\n .addClass(\"logo-small\")\n .removeClass(\"logo\");\n $('p').remove();\n $('fieldset').remove();\n }", "function control_omis_com_graph_form(ptr)\n {\n \n jQuery('#search_text').val('');\n jQuery('#report_of_br_ao_do_div_msg').html('<td COLSPAN=\"4\"><h6 style=\"color: red;\">Type on search box to get desired office </h6></td>');\n if(ptr>0)\n {\n jQuery('#search_form_table').show('slow');\n if(ptr==1 || ptr==5 || ptr==7)\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').hide('slow');\n }\n else\n {\n jQuery('#report_of_br_ao_do_div_box,#report_of_br_ao_do_div_msg').show('slow');\n \n }\n \n }\n else\n {\n jQuery('#search_form_table').hide('slow'); \n }\n }", "function openSearch() {\n // shows all levels - we want to show all the spaces for smaller screens\n showAllLevels();\n\n classie.add(spacesListEl, 'spaces-list--open');\n classie.add(containerEl, 'container--overflow');\n }", "changeFocusToLeft() {\n cadManager.setCurrentFoot(\"left\");\n this.forceUpdate();\n }", "function fix_position()\r\n\t{\r\n\t\tvar uwidth = $('#user-nav > ul').width();\r\n\t\t$('#user-nav > ul').css({width:uwidth,'margin-left':'-' + uwidth / 2 + 'px'});\r\n \r\n var cwidth = $('#content-header .btn-group').width();\r\n $('#content-header .btn-group').css({width:cwidth,'margin-left':'-' + uwidth / 2 + 'px'});\r\n\t}", "function showCustom () {\n $( '#mCSB_3_container' ).empty();\n $( '#searchWrapper' ).css( 'display', 'none' );\n\n $( 'form[id^=search]' ).css( 'display', 'none' );\n $( 'form[id^=custom]' ).css( 'display', 'block' );\n}", "function edgtfSearchCoversHeader() {\n\n searchOpener.click(function (e) {\n e.preventDefault();\n var searchFormHeight,\n\t adjsSearchFormHeight = 0,\n searchFormHolder = $('.edgtf-search-cover .edgtf-form-holder-outer'),\n searchForm,\n searchFormLandmark; // there is one more div element if header is in grid\n\n if ($(this).closest('.edgtf-grid').length) {\n searchForm = $(this).closest('.edgtf-grid').parent().children().first();\n searchFormLandmark = searchForm;\n }\n else {\n searchForm = $(this).closest('.edgtf-menu-area').children().first();\n searchFormLandmark = searchForm;\n }\n\n if ($(this).closest('.edgtf-sticky-header').length > 0) {\n searchForm = $(this).closest('.edgtf-sticky-header').children().first();\n searchFormLandmark = searchForm;\n }\n if ($(this).closest('.edgtf-mobile-header').length > 0) {\n searchForm = $(this).closest('.edgtf-mobile-header').children().children().first();\n searchFormLandmark = searchForm.parent();\n }\n\n //Find search form position in header and height\n if (searchFormLandmark.parent().hasClass('edgtf-logo-area')) {\n searchFormHeight = edgtfGlobalVars.vars.edgtfLogoAreaHeight;\n } else if (searchFormLandmark.parent().hasClass('edgtf-top-bar')) {\n searchFormHeight = edgtfGlobalVars.vars.edgtfTopBarHeight;\n } else if (searchFormLandmark.parent().hasClass('edgtf-menu-area')) {\n\t if(edgtf.body.find('.edgtf-top-bar').length) {\n\t\t adjsSearchFormHeight = edgtfGlobalVars.vars.edgtfTopBarHeight;\n\t }\n searchFormHeight = edgtfGlobalVars.vars.edgtfMenuAreaHeight;\n } else if (searchFormLandmark.parent().hasClass('edgtf-sticky-header')) {\n searchFormHeight = edgtfGlobalVars.vars.edgtfStickyHeaderTransparencyHeight;\n } else if (searchFormLandmark.parent().hasClass('edgtf-mobile-header')) {\n\t if(edgtf.body.find('.edgtf-top-bar').length) {\n\t\t adjsSearchFormHeight = edgtfGlobalVars.vars.edgtfTopBarHeight;\n\t }\n searchFormHeight = $('.edgtf-mobile-header-inner').height();\n }\n\n\t if(edgtf.body.hasClass('edgtf-header-elegant')) {\n\t\t adjsSearchFormHeight += 46; // 46 is top padding of header\n\t }\n\n\t searchFormHeight = searchFormHeight - adjsSearchFormHeight;\n\n searchFormHolder.height(searchFormHeight);\n searchForm.stop(true).fadeIn(600);\n $('.edgtf-search-cover input[type=\"text\"]').focus();\n $('.edgtf-search-close, .edgtf-content, footer').click(function (e) {\n e.preventDefault();\n searchForm.stop(true).fadeOut(450);\n });\n searchForm.blur(function () {\n searchForm.stop(true).fadeOut(450);\n });\n });\n\n }", "function menu_search_focus(f) {\n\tif (f) {\n\t\t// prevent focus on the menu search box when the search page is active\n\t\tif (current == \"Special::Search\") {\n//\t\tff_fix_focus();\n\t\t\td$('string_to_search').focus();\n\t\t} else {\n\t\t\twoas.ui.focus_textbox();\n\t\t}\n\t} else {\n\t\tif (current != \"Special::Search\")\n\t\t\twoas.ui.blur_textbox();\n\t}\n}", "function positionPopup()\n{\n if(!$(\"#overlay_form\").is(':visible'))\n {\n return;\n }\n}", "function slideLeftForMobile() {\n\t\tsliderContainer = \".mobile-menu-width\";\n\t\tremLength =\n\t\t\t$(sliderContainer)[0].scrollWidth - $(sliderContainer).width();\n\t\tscrollable = remLength - $(sliderContainer).scrollLeft();\n\t\t$(sliderContainer).animate(\n\t\t\t{\n\t\t\t\tscrollLeft: remLength,\n\t\t\t},\n\t\t\tspeed\n\t\t);\n\t}", "function openSearchForm() {\n spaceList.innerHTML = '';\n selectionHeading.innerText = '';\n searchWindow.classList.toggle('show');\n}", "function mobSearchFormContent(n){\n if( n === true ){\n mobileSearchFormWrapper.addClass('open-mob-search-form');\n mobileSearchFormWrapper.find('.mob-search__form').addClass('mob-search-in');\n }\n else{\n mobileSearchFormWrapper.removeClass('open-mob-search-form');\n mobileSearchFormWrapper.find('.mob-search__form').removeClass('mob-search-in');\n }\n \n \n }", "function openSearch() {\n hamburger.style.visibility = 'hidden';\n document.getElementById(\"search\").style.width = \"100%\";\n }", "function sticky_relocate() {\n var window_top = $(window).scrollTop();\n var div_top = $('#sticky-anchor').offset().top;\n if (window_top > div_top) {\n $('#div-msgs-input').addClass('stick');\n } else {\n $('#div-msgs-input').removeClass('stick');\n }\n}", "function topLeftAlign()\n\t{\n\t\tfw.dock(wid, fw.dockTo(that));\n\t}", "function positionPopup2()\n{\n if(!$(\"#overlay_form2\").is(':visible'))\n {\n return;\n }\n}", "function prepUIforSearch() {\n $(\".btn-secondary.nav.removable\").hide(400)\n $(\".nav-item.active.removable\").hide(400)\n}", "function update_position() {\n var dlgLeft = ($(document).width()/2) - ($('#dlg-box-content-container').width()/2) - 20;\n $('#dlg-box-content-container').css('left', dlgLeft);\n $('#dlg-box-content-container').css('top', '8%');\n }", "function forceMobile() {\n $('.case-left, .case-right').css('display', 'none');\n}", "function clearSearchInputMenuLeft(){\r\n dojo.byId('menuSearchDiv').value='';\r\n dojo.byId('clearSearchMenu').style.display='none';\r\n var menuLeftTop=dojo.byId('ml-menu');\r\n var currentDivMenu=menuLeftTop.querySelector('.menu__wrap');\r\n var menuSearchMenu=menuLeftTop.querySelector('.menu__searchMenuDiv ');\r\n menuSearchMenu.remove();\r\n var newMenuSearchMenu=document.createElement('div');\r\n newMenuSearchMenu.className='menu__searchMenuDiv ';\r\n newMenuSearchMenu.setAttribute('style','display:none');\r\n menuLeftTop.insertAdjacentElement('beforeEnd',newMenuSearchMenu );\r\n currentDivMenu.setAttribute('style','display:block;');\r\n}", "function navSearch() {\r\n var x = document.getElementById(\"find\");\r\n var y = document.getElementById(\"findstart\");\r\n var z = document.getElementById(\"findend\");\r\n if (x.style.display === \"none\") {\r\n x.style.display = \"flex\";\r\n\ty.style.display = \"none\";\r\n\tz.style.display = \"block\";\r\n } else {\r\n x.style.display = \"none\";\r\n\ty.style.display = \"block\";\r\n\tz.style.display = \"none\";\r\n }\r\n var a = document.getElementById(\"nav\");\r\n var b = document.getElementById(\"navstart\");\r\n var c = document.getElementById(\"navend\");\r\n var d = document.getElementById(\"qrview\");\r\n var e = document.getElementById(\"shareview\");\r\n a.style.display = \"none\";\r\n b.style.display = \"block\";\r\n c.style.display = \"none\";\r\n d.style.display = \"none\";\r\n e.style.display = \"none\";\r\n}", "function toggleSearchForm(table){\n\tvar obj = ge(table + \"_searchDiv\");\n\tvar display = obj.style.display;\n\tif( display == 'none'){\n\t\tobj.style.display = 'block';\n\t}else{\n\t\tobj.style.display = 'none';\n\t}\n}", "function showFormSearch(){\n\tvar $searchFormContainer = $('.search-form-js');\n\tif(!$searchFormContainer.length){ return; }\n\n\tvar $html = $('html');\n\tvar $searchField = $('.search-field-js');\n\tvar btnSearchCloseClass = 'btn-search-close-js';\n\tvar classFormIsOpen = 'form-is-open';\n\n\t$html.on('click', '.btn-search-open-js', function(e){\n\t\te.stopPropagation();\n\n\t\t// !important\n\t\t// var $searchForm = $searchFormContainer.find('form');\n\t\t// if ( $searchForm.find($searchField).val().length && $searchFormContainer.is(':visible') ){\n\t\t// \t$searchForm.submit();\n\t\t// \treturn;\n\t\t// }\n\n\t\tif ($html.hasClass(classFormIsOpen)){\n\t\t\tcloseSearchForm();\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimeout(function () {\n\t\t\t$searchField.trigger('focus');\n\n\t\t\t// close lang drop\n\t\t\tvar $choiceContainer = $('.js-choice-wrap');\n\t\t\tif($choiceContainer.hasClass('choice-opened')) {\n\t\t\t\t$choiceContainer.trigger('closeChoiceDrop');\n\t\t\t}\n\t\t}, 50);\n\n\t\t$html.addClass(classFormIsOpen);\n\n\t\te.preventDefault();\n\n\t});\n\n\t$html.on('click', '.' + btnSearchCloseClass, function(e){\n\t\te.stopPropagation();\n\t\te.preventDefault();\n\n\t\tcloseSearchForm();\n\t});\n\n\t$(document).on('click', function (e) {\n\t\tcloseSearchForm();\n\t});\n\n\t$(document).keyup(function(e) {\n\t\tif ($html.hasClass(classFormIsOpen) && e.keyCode === 27) {\n\t\t\tcloseSearchForm();\n\t\t}\n\t});\n\n\t$searchFormContainer.on('closeSearchForm', function () {\n\t\tcloseSearchForm();\n\t});\n\n\t$searchFormContainer.on('click', function (e) {\n\t\tif($(e.target).hasClass(btnSearchCloseClass)) {\n\t\t\treturn\n\t\t}\n\n\t\te.stopPropagation();\n\t});\n\n\tfunction closeSearchForm(){\n\t\t$('html').removeClass(classFormIsOpen)\n\t}\n}", "function showForm() {\n document.querySelector(\"#form_box\").classList.remove(\"hidden\");\n\n document.querySelector(\"#form_box\").scrollTop = 0;\n console.log('scroll back to top!');\n}", "function positionTextElements(){\r\n let numOfPanels = 3\r\n // find browser height and width.\r\n let browserHeight = $(window).height();\r\n // position map application\r\n let mapPosition = (numOfPanels + 2.3) * browserHeight\r\n if($(window).height() < 700){\r\n mapPosition = (numOfPanels + 2.7) * browserHeight\r\n }\r\n $('#mapPanel').css('top', mapPosition)\r\n\r\n // set height of static image panel\r\n let staticImageHeight = (numOfPanels + 2) * browserHeight;\r\n $('.sm-staticImagePanel').css('height', staticImageHeight);\r\n\r\n // position first floating text box\r\n let firstBox = parseInt((browserHeight * 1))\r\n $('.sm-floatingTextBox-1').css('top', firstBox)\r\n\r\n // position second floating text box\r\n let secondBox = parseInt((browserHeight * 2))\r\n $('.sm-floatingTextBox-2').css('top', secondBox)\r\n\r\n // position third floating text box\r\n let thirdBox = parseInt((browserHeight * 3))\r\n $('.sm-floatingTextBox-3').css('top', thirdBox)\r\n }", "function menuPosition() {\n\t\t\torg_menu_offset = $('#org-menu-toggle').position().left + ($('#org-menu-toggle').width() / 2) - 120; // 120 is half of the menu width of 240px\n\t\t\t$('#org-menu-toggle').next('ul').css('left',org_menu_offset+'px');\n\t\t}", "function shiftContainer() {\n SELECTORS.$slideWrapper.css('left', STATE.OFFSET + 'px');\n }", "function backtoTop() {\r\n var Hwith = window.innerWidth || document.documentElement && document.documentElement.clientWidth || 0;\r\n $(\".backtoTop\").removeClass(\"autohide\");\r\n if (Hwith >= 1339) {\r\n $(\".backtoTop\").removeClass(\"backfix-s\").addClass(\"backfix\");\r\n } else if (Hwith < 1339) {\r\n $(\".backtoTop\").removeClass(\"backfix\").addClass(\"backfix-s\");\r\n }\r\n }", "function resize_form_controls() {\n\tvar windowHeight = window.innerHeight;\n\tvar panelHeight = $(\"#right_panel\").height() + $(\".navbar\").height();\n\tlogger(\"Window Height: \" + windowHeight + \" vs. Panel Height: \" + panelHeight);\n\tif (windowHeight < panelHeight) {\n\t\t$(\"#right_panel\").css(\"width\", \"100%\");\n\t\t$(\"#right_panel\").removeClass(\"affix\");\n\t} else {\n\t\t$(\"#right_panel\").css(\"width\", \"auto\");\n\t\t$(\"#right_panel\").addClass(\"affix\");\n\t}\n}", "function readyToSearchScrollPosition() {\n window.scrollTo({\n top: scrollAnchor.offsetTop,\n left: 0,\n behavior: 'auto',\n });\n }", "function searchFormExpandable() {\n if (mq.end.matches) {\n $(selectors.searchForm).expandable('revive');\n $(selectors.advancedSearchForm).expandable('revive');\n }\n else {\n $(selectors.searchForm).expandable('kill');\n $(selectors.searchForm).children('div').removeAttr('style');\n $(selectors.advancedSearchForm).expandable('kill');\n $(selectors.advancedSearchForm).children('div').removeAttr('style');\n }\n return;\n }", "function setstickyNav()\r\n{\r\n var stickyNavTop = $(\"#flightSummary, .actionBar, .mapView .googleMap\").offset();\r\n $(window).scroll(function () \r\n { \r\n if ($(window).scrollTop() > stickyNavTop.top)\r\n $(\"#flightSummary, .actionBar, .mapView .googleMap\").addClass('sticky');\r\n else \r\n $(\"#flightSummary, .actionBar, .mapView .googleMap\").removeClass('sticky');\r\n $(\"#resultPanel\").each(function(){\r\n var minHeight = $(window).height(); \r\n minHeight -= 145;\r\n $(\".googleMap\").css(\"height\", minHeight );\r\n });\r\n });\r\n}", "function fixClear(){\n\t\tif((verify_device.detect() == 'desktop')){\n\n\t\t\tvar _win = $(window).width();\n\t\t\tif(_win < 1024){\n\t\t\t\t$('.header_w').css('position','absolute');\n\t\t\t}else{\n\t\t\t\t$('.header_w').css('position','fixed');\n\t\t\t}\n\t\t}\n\t}", "function searchFormExpandable() {\r\n if (mq.end.matches) {\r\n $(selectors.searchForm).expandable('revive');\r\n $(selectors.advancedSearchForm).expandable('revive');\r\n }\r\n else {\r\n $(selectors.searchForm).expandable('kill');\r\n $(selectors.searchForm).children('div').removeAttr('style');\r\n $(selectors.advancedSearchForm).expandable('kill');\r\n $(selectors.advancedSearchForm).children('div').removeAttr('style');\r\n }\r\n return;\r\n }", "function bindLeftPanelEvents() {\n //tap left to show/hide left panel\n bindTapEvtHandler(roleSelector(SWIPE_ELEM_CLASS_NAME), function () {\n var leftPanel = getLeftPanelScope(),\n searchEl = WM.element(roleSelector(HEADER_CLASS_NAME) + \" \" + classSelector(SEARCH_CONTAINER_CLASS_NAME)),\n leftPanelEl;\n leftPanel && leftPanel.toggle();\n leftPanelEl = WM.element(roleSelector(LEFT_PANEL_CLASS_NAME));\n //Hide search container when left panel is open\n if (leftPanelEl.length && leftPanelEl.hasClass('visible')) {\n if (searchEl.length) {\n searchEl.hide();\n }\n }\n });\n }", "function fnPluginTaskSearch_SetWidth() {\n\ttry {\n\t\t// Calculate the width of the search box\n\t\t$width = window.innerWidth - $(\".main-sidebar\").width();\n\t\t$width = $width - 500; // $('.navbar-custom-menu').width();\n\n\t\t// Get place for other DOM elements\n\t\t$width = $width - 100;\n\n\t\t// Not too big...\n\t\tif (parseInt($width) > 500) {\n\t\t\t$width = 500;\n\t\t}\n\n\t\t$(\"#divSearch\").css(\"max-width\", $width + \"px\");\n\t} catch (error) {}\n\n\treturn true;\n}" ]
[ "0.7524671", "0.74269164", "0.67864704", "0.67860675", "0.6615261", "0.6471397", "0.6462206", "0.645832", "0.6145061", "0.60218513", "0.60014117", "0.5995631", "0.593819", "0.58987504", "0.58893794", "0.5881661", "0.5858104", "0.5800459", "0.57922584", "0.57891536", "0.5775396", "0.5740156", "0.5738806", "0.5703825", "0.5649983", "0.56496334", "0.5579103", "0.55616766", "0.5553199", "0.55529046", "0.55524445", "0.552908", "0.54752815", "0.54736054", "0.5447755", "0.54212856", "0.5418012", "0.54110694", "0.53881365", "0.5386672", "0.5372324", "0.53593343", "0.534869", "0.5346199", "0.5332909", "0.5324463", "0.5320156", "0.5306452", "0.5301388", "0.5299797", "0.52946943", "0.52942836", "0.5286505", "0.5282969", "0.5282323", "0.5273866", "0.5270906", "0.5258313", "0.5257517", "0.5253995", "0.52534646", "0.5249955", "0.5245036", "0.524428", "0.5233297", "0.5223249", "0.5211648", "0.5210769", "0.52089643", "0.52072734", "0.5200198", "0.5197952", "0.5179979", "0.517758", "0.51710683", "0.51630497", "0.51628464", "0.5162496", "0.5156591", "0.51549524", "0.5154278", "0.5152494", "0.51512146", "0.5148917", "0.5141785", "0.5141322", "0.5131625", "0.5127268", "0.5123739", "0.51167697", "0.5116145", "0.5115324", "0.51142", "0.5102552", "0.5101549", "0.5100317", "0.5097745", "0.50902224", "0.5087974", "0.50836986" ]
0.74744433
1
This function allows top navigation menu to move to left navigation menu when viewed in screens lower than 1024px and will move it back when viewed higher than 1024px
function reposition_topnav() { if(jQuery('.nav-horizontal').length > 0) { // top navigation move to left nav // .nav-horizontal will set position to relative when viewed in screen below 1024 if(jQuery('.nav-horizontal').css('position') == 'relative') { if(jQuery('.leftpanel .nav-bracket').length == 2) { jQuery('.nav-horizontal').insertAfter('.nav-bracket:eq(1)'); } else { // only add to bottom if .nav-horizontal is not yet in the left panel if(jQuery('.leftpanel .nav-horizontal').length == 0) jQuery('.nav-horizontal').appendTo('.leftpanelinner'); } jQuery('.nav-horizontal').css({display: 'block'}) .addClass('nav-pills nav-stacked nav-bracket'); jQuery('.nav-horizontal .children').removeClass('dropdown-menu'); jQuery('.nav-horizontal > li').each(function() { jQuery(this).removeClass('open'); jQuery(this).find('a').removeAttr('class'); jQuery(this).find('a').removeAttr('data-toggle'); }); if(jQuery('.nav-horizontal li:last-child').has('form')) { jQuery('.nav-horizontal li:last-child form').addClass('searchform').appendTo('.topnav'); jQuery('.nav-horizontal li:last-child').hide(); } } else { // move nav only when .nav-horizontal is currently from leftpanel // that is viewed from screen size above 1024 if(jQuery('.leftpanel .nav-horizontal').length > 0) { jQuery('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket') .appendTo('.topnav'); jQuery('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style'); jQuery('.nav-horizontal li:last-child').show(); jQuery('.searchform').removeClass('searchform').appendTo('.nav-horizontal li:last-child .dropdown-menu'); jQuery('.nav-horizontal > li > a').each(function() { jQuery(this).parent().removeClass('nav-active'); if(jQuery(this).parent().find('.dropdown-menu').length > 0) { jQuery(this).attr('class','dropdown-toggle'); jQuery(this).attr('data-toggle','dropdown'); } }); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMenu() {\n\n\t\tvar w = parseInt($(\"nav\").css(\"width\"), 10);\n\n\t\tif (w < 1200) {\n\n\t\t\tif ($(\"#navigator2\").is(':empty')) {\n\t\t\t\t$(\"#navigator2\").prepend($(\"#IndexNav\"), $(\"#productsNav\"),$(\"#contactNav\"),$(\"#accountNav\"), $(\"#cartNav\"));\n\t\t\t\t$(\"#productsNavUl\").attr(\"class\", \"subNav2\");\n\t\t\t\t$(\"#accountNavUl\").attr(\"class\", \"subNav2\");\n\t\t\t\t$(\"#miniNavigator\").show();\n\t\t\t\t$(\"#miniNavigator\").effect(\"highlight\", { color: 'green' }, 500);\n\t\t\t\t$(\"#navigator2\").hide();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t$(\"#navigator\").prepend($(\"#IndexNav\"), $(\"#productsNav\"),$(\"#contactNav\"),$(\"#accountNav\"), $(\"#cartNav\"));\n\t\t\t$(\"#productsNavUl\").attr(\"class\", \"subNav\");\n\t\t\t$(\"#accountNavUl\").attr(\"class\", \"subNav\");\n\t\t\t$(\"#miniNavigator\").hide();\n\t\t\t}\n\t}", "function mobile_menu_position() {\r\n\t\r\n var header_height = j$('header').height();\r\n if (!j$('header').hasClass('fixed_header_left')) {\r\n j$('#header_container').css('min-height', header_height);\r\n }\r\n\r\n if (j$(window).width() < 1018) {\r\n var mobilenav = 0;\r\n j$(\"header nav ul,.header_bottom_nav nav ul\").hide();\r\n j$(\"#nav_button\").show();\r\n }\r\n\r\n\r\n if (j$('header').hasClass('fixed_header_left')) {\r\n if (j$(window).width() < 1019) {\r\n var top_value = 0;\r\n if (j$('#wpadminbar').length >= 1) {\r\n top_value = j$('#wpadminbar').outerHeight() + \"px\";\r\n }\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'fixed',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '999'\r\n });\r\n } else {\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'absolute',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '-1'\r\n });\r\n }\r\n }\r\n else {\r\n if (j$(window).width() < 750) {\r\n var top_value = 0;\r\n if (j$('#wpadminbar').length >= 1) {\r\n top_value = j$('#wpadminbar').outerHeight() + \"px\";\r\n }\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'fixed',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '999'\r\n });\r\n } else {\r\n j$('.mt_menu.sticky_header.menu_slide').css({\r\n 'position': 'absolute',\r\n 'top': top_value,\r\n 'left': 0,\r\n 'width': '100%',\r\n 'z-index': '-1'\r\n });\r\n }\r\n }\r\n\r\n}", "function jevelin_navigation_position() {\n var new_position, menu_status, menu_width, menu_offset, window_width;\n window_width = $(document).width();\n $('ul.sh-nav ul').mouseover(function() {\n\n menu_status = $(this).find('.sub-menu').length;\n if( menu_status > 0 ) {\n\n menu_width = $(this).find('.sub-menu').actual( 'outerWidth' );\n //console.log( menu_width );\n menu_offset = $(this).find('.sub-menu').parent().offset().left + menu_width;\n if( (menu_offset + menu_width) > window_width ) {\n\n if( $('.sh-header.sh-header-megamenu-style2').length ) {\n new_position = menu_width + 0 + 15;\n } else {\n new_position = menu_width + 0;\n }\n\n $(this).find('.sub-menu').css({\n left: -new_position-0,\n top: '0',\n });\n\n } else {\n\n $(this).find('.sub-menu').css({\n left: new_position+0,\n top: '0',\n });\n\n }\n\n }\n });\n }", "function reposition_topnav() {\r\n if(jQuery('.nav-horizontal').length > 0) {\r\n \r\n // top navigation move to left nav\r\n // .nav-horizontal will set position to relative when viewed in screen below 1024\r\n if(jQuery('.nav-horizontal').css('position') == 'relative') {\r\n \r\n if(jQuery('.leftpanel .nav-bracket').length == 2) {\r\n jQuery('.nav-horizontal').insertAfter('.nav-bracket:eq(1)');\r\n } else {\r\n // only add to bottom if .nav-horizontal is not yet in the left panel\r\n if(jQuery('.leftpanel .nav-horizontal').length == 0)\r\n jQuery('.nav-horizontal').appendTo('.leftpanelinner');\r\n }\r\n \r\n jQuery('.nav-horizontal').css({display: 'block'})\r\n .addClass('nav-pills nav-stacked nav-bracket');\r\n \r\n jQuery('.nav-horizontal .children').removeClass('dropdown-menu');\r\n jQuery('.nav-horizontal > li').each(function() { \r\n \r\n jQuery(this).removeClass('open');\r\n jQuery(this).find('a').removeAttr('class');\r\n jQuery(this).find('a').removeAttr('data-toggle');\r\n \r\n });\r\n \r\n if(jQuery('.nav-horizontal li:last-child').has('form')) {\r\n jQuery('.nav-horizontal li:last-child form').addClass('searchform').appendTo('.topnav');\r\n jQuery('.nav-horizontal li:last-child').hide();\r\n }\r\n \r\n } else {\r\n // move nav only when .nav-horizontal is currently from leftpanel\r\n // that is viewed from screen size above 1024\r\n if(jQuery('.leftpanel .nav-horizontal').length > 0) {\r\n \r\n jQuery('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket')\r\n .appendTo('.topnav');\r\n jQuery('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style');\r\n jQuery('.nav-horizontal li:last-child').show();\r\n jQuery('.searchform').removeClass('searchform').appendTo('.nav-horizontal li:last-child .dropdown-menu');\r\n jQuery('.nav-horizontal > li > a').each(function() {\r\n \r\n jQuery(this).parent().removeClass('nav-active');\r\n \r\n if(jQuery(this).parent().find('.dropdown-menu').length > 0) {\r\n jQuery(this).attr('class','dropdown-toggle');\r\n jQuery(this).attr('data-toggle','dropdown'); \r\n }\r\n \r\n }); \r\n }\r\n \r\n }\r\n \r\n }\r\n }", "function reposition_topnav() {\n if($('.nav-horizontal').length > 0) {\n\n // top navigation move to left nav\n // .nav-horizontal will set position to relative when viewed in screen below 1024\n if($('.nav-horizontal').css('position') == 'relative') {\n\n if($('.left-panel .nav-bracket').length == 2) {\n $('.nav-horizontal').insertAfter('.nav-bracket:eq(1)');\n } else {\n // only add to bottom if .nav-horizontal is not yet in the left panel\n if($('.left-panel .nav-horizontal').length == 0)\n $('.nav-horizontal').appendTo('.left-panelinner');\n }\n\n $('.nav-horizontal').css({display: 'block'})\n .addClass('nav-pills nav-stacked nav-bracket');\n\n $('.nav-horizontal .children').removeClass('dropdown-menu');\n $('.nav-horizontal > li').each(function() {\n\n $(this).removeClass('open');\n $(this).find('a').removeAttr('class');\n $(this).find('a').removeAttr('data-toggle');\n\n });\n\n if($('.nav-horizontal li:last-child').has('form')) {\n $('.nav-horizontal li:last-child').hide();\n }\n\n } else {\n // move nav only when .nav-horizontal is currently from left-panel\n // that is viewed from screen size above 1024\n if($('.left-panel .nav-horizontal').length > 0) {\n\n $('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket')\n .appendTo('.topnav');\n $('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style');\n $('.nav-horizontal li:last-child').show();\n $('.nav-horizontal > li > a').each(function() {\n\n $(this).parent().removeClass('nav-active');\n\n if($(this).parent().find('.dropdown-menu').length > 0) {\n $(this).attr('class','dropdown-toggle');\n $(this).attr('data-toggle','dropdown');\n }\n\n });\n }\n\n }\n\n }\n }", "function reposition_topnav() {\r\n\t\t\t\t\t\tif (jQuery('.nav-horizontal').length > 0) {\r\n\r\n\t\t\t\t\t\t\t// top navigation move to left nav\r\n\t\t\t\t\t\t\t// .nav-horizontal will set position to relative\r\n\t\t\t\t\t\t\t// when viewed in screen below 1024\r\n\t\t\t\t\t\t\tif (jQuery('.nav-horizontal').css('position') == 'relative') {\r\n\t\t\t\t\t\t\t\tif (jQuery('.leftpanel .nav-bracket').length == 2) {\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal').insertAfter(\r\n\t\t\t\t\t\t\t\t\t\t\t'.nav-bracket:eq(1)');\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t// only add to bottom if .nav-horizontal is\r\n\t\t\t\t\t\t\t\t\t// not yet in the left panel\r\n\t\t\t\t\t\t\t\t\tif (jQuery('.leftpanel .nav-horizontal').length == 0)\r\n\t\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal').appendTo(\r\n\t\t\t\t\t\t\t\t\t\t\t\t'.leftpanelinner');\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\tjQuery('.nav-horizontal')\r\n\t\t\t\t\t\t\t\t\t\t.css({\r\n\t\t\t\t\t\t\t\t\t\t\tdisplay : 'block'\r\n\t\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t\t\t.addClass(\r\n\t\t\t\t\t\t\t\t\t\t\t\t'nav-pills nav-stacked nav-bracket');\r\n\r\n\t\t\t\t\t\t\t\tjQuery('.nav-horizontal .children')\r\n\t\t\t\t\t\t\t\t\t\t.removeClass('dropdown-menu');\r\n\t\t\t\t\t\t\t\tjQuery('.nav-horizontal > li').each(\r\n\t\t\t\t\t\t\t\t\t\tfunction() {\r\n\t\t\t\t\t\t\t\t\t\t\tjQuery(this).removeClass('open');\r\n\t\t\t\t\t\t\t\t\t\t\tjQuery(this).find('a').removeAttr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'class');\r\n\t\t\t\t\t\t\t\t\t\t\tjQuery(this).find('a').removeAttr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'data-toggle');\r\n\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\t\tif (jQuery('.nav-horizontal li:last-child')\r\n\t\t\t\t\t\t\t\t\t\t.has('form')) {\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal li:last-child form')\r\n\t\t\t\t\t\t\t\t\t\t\t.addClass('searchform').appendTo(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'.topnav');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal li:last-child')\r\n\t\t\t\t\t\t\t\t\t\t\t.hide();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t// move nav only when .nav-horizontal is\r\n\t\t\t\t\t\t\t\t// currently from leftpanel\r\n\t\t\t\t\t\t\t\t// that is viewed from screen size above 1024\r\n\t\t\t\t\t\t\t\tif (jQuery('.leftpanel .nav-horizontal').length > 0) {\r\n\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal')\r\n\t\t\t\t\t\t\t\t\t\t\t.removeClass(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'nav-pills nav-stacked nav-bracket')\r\n\t\t\t\t\t\t\t\t\t\t\t.appendTo('.topnav');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal .children')\r\n\t\t\t\t\t\t\t\t\t\t\t.addClass('dropdown-menu')\r\n\t\t\t\t\t\t\t\t\t\t\t.removeAttr('style');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal li:last-child')\r\n\t\t\t\t\t\t\t\t\t\t\t.show();\r\n\t\t\t\t\t\t\t\t\tjQuery('.searchform')\r\n\t\t\t\t\t\t\t\t\t\t\t.removeClass('searchform')\r\n\t\t\t\t\t\t\t\t\t\t\t.appendTo(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'.nav-horizontal li:last-child .dropdown-menu');\r\n\t\t\t\t\t\t\t\t\tjQuery('.nav-horizontal > li > a')\r\n\t\t\t\t\t\t\t\t\t\t\t.each(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfunction() {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.parent()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.removeClass(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'nav-active');\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (jQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.parent()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.find(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'.dropdown-menu').length > 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'class',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'dropdown-toggle');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery(this)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'data-toggle',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'dropdown');\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\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}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}", "function wideMenuPos() {\n\tjQuery('.nav-container li.level-top').each(function(){\n\t\tvar menuItem = jQuery(this);\n\t\tif(jQuery(document.body).width() > 977 ){\n\t\t\titemHeight = jQuery(this).position().top + jQuery(this).outerHeight();\n\t\t\tmenuItem.find('.menu-wrapper:not(.default-menu)').css('top', itemHeight + 4);\n\t\t}\n\t});\n }", "function resizingNav() {\n // at1400();\n if ($(window).width() < 480) {\n $('#account-links').hide(100);\n $(' div.arrow-down').show(200);\n $('div#welcome-message p').first().prependTo('#page-top');\n $($(\"nav.secondary-nav a\").get().reverse()).each(function(index) {\n $(this).detach().prependTo(\".hidden-menu-s\");\n })\n $(\"nav.secondary-nav\").addClass('hidden');\n $(\".ham-menu-s\").removeClass('hidden');\n\n $(\"nav.MainNav a\").each(function(index) {\n $(this).detach().appendTo(\".hidden-menu-m\");\n })\n $(\"nav.MainNav\").addClass('hidden');\n $(\".ham-menu-m\").removeClass('hidden');\n }\n else {\n $('#page-top p').first().prependTo('#welcome-message');\n $(\"nav.secondary-nav\").removeClass('hidden');\n $(\"nav.MainNav\").removeClass('hidden');\n if ($(window).width() < 1024) {\n $('#account-links').hide(100);\n $(' div.arrow-down').show(200);\n }\n else {\n $(' div.arrow-down').hide('easing');\n $('#account-links').show('easing');\n if ($(window).width() > 1400) {\n $('.hidden-menu-s a').each(function(index) {\n $(this).detach().appendTo(\"nav.secondary-nav\");\n })\n $(\".hidden-menu-s\").addClass('hidden');\n $(\".ham-menu-s\").addClass('hidden');\n\n $($('.hidden-menu-m a').get().reverse()).each(function(index) {\n $(this).detach().prependTo(\"nav.MainNav\");\n })\n $(\".hidden-menu-m\").addClass('hidden');\n $(\".ham-menu-m\").addClass('hidden');\n }\n }\n }\n\n\n}", "function fixMenuBar(){\n\t\tvar scrolTop = $(window).scrollTop();\n\t\tvar width = $(window).width();\n\t\t\tif (width<1215){\n\t\t\t\tif(scrolTop>=123){\n\t\t\t\t\t$('body').addClass(\"scroll_padding-top\")\n\t\t\t\t\t$(\".main-menu\").addClass(\"fixed\");\n\t\t\t\t} else {\n\t\t\t\t\t\t$(\".main-menu\").removeClass(\"fixed\");\n\t\t\t\t\t\t$('body').removeClass(\"scroll_padding-top\")\n\t\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\n\t\t\t\tif(window.location.pathname== host_pathname || window.location.pathname== '/index.html'){\n\t\t\t\t\t//show-hide menu\n\t\t\t\t\tif(scrolTop>=645 && scrolTop<=860){\n\t\t\t\t\t\t$('.main-menu .catalog-list').removeClass('open')\n\t\t\t\t\t}\n\t\t\t\t\telse if(scrolTop<645) {\n\t\t\t\t\t\t$('.main-menu .catalog-list').addClass('open')\n\t\t\t\t\t}\n\n\t\t\t\t\t//fix menu\n\t\t\t\t\tif(scrolTop>=645){\n\t\t\t\t\t\t$('body').addClass(\"scroll_padding-top\");\n\t\t\t\t\t\t$(\".main-menu\").addClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$('body').removeClass(\"scroll_padding-top\")\n\t\t\t\t\t\t$(\".main-menu\").removeClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t//if we are not on index.html\n\t\t\t\t}else{\n\t\t\t\t\tif(scrolTop>=136){\n\t\t\t\t\t\t$('body').addClass(\"scroll_padding-top\");\n\t\t\t\t\t\t$(\".main-menu\").addClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\t$('body').removeClass(\"scroll_padding-top\")\n\t\t\t\t\t\t$(\".main-menu\").removeClass(\"fixed\");\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t\n\t\t\t}\n\n\t}", "function setMenuLeft() {\n removeMenuChanges();\n $('.menu').addClass('menu-left');\n }", "function menuScreen() {\n if (currentPage === 'highscorepage') {\n $box2.animate({left: $screenWidth}, 150); // slides highscorepage back to original location hidden offscreen - 150 is the speed in mlilliseconds\n } else if (currentPage === 'creditspage') {\n $box3.animate({left: $screenWidth}, 150); // slides creditspage back to original location hidden offscreen - 150 is the speed in mlilliseconds\n } else {\n $box1.animate({left: $screenWidth}, 150); // slides playpage back to original location hidden offscreen - 150 is the speed in mlilliseconds\n }\n currentPage = 'menupage';\n }", "function responsive_navigation() {\n\n\t\tvar e = window, a = 'inner';\n\n\t\tif ( ! ( 'innerWidth' in window ) ) {\n\t\t\ta = 'client';\n\t\t\te = document.documentElement || document.body;\n\t\t}\n\n\t\twindow_width = e[ a+'Width' ];\n\t\t\n\t\tmenu_toggle_width = menu_toggle.outerWidth();\n\n\t\t/* Reset menu_toggle DOM position */\n\t\tif ( $( 'body' ).hasClass( 'rtl' ) ) {\n\t\t\tmenu_toggle.appendTo( site_navigation ).css( 'margin-right', '' );\n\t\t} else {\n\t\t\tmenu_toggle.appendTo( site_navigation ).css( 'margin-left', '' );\n\t\t}\n\n\t\tif ( window_width < 1020 ) {\n\t\t\tclassic_secondary.appendTo( navigation_wrapper );\n\t\t\tclassic_primary.appendTo( navigation_wrapper );\n\t\t} else {\n\t\t\tclassic_secondary.insertBefore( header_wrapper );\n\t\t\tclassic_primary.insertAfter( header_wrapper );\n\t\t}\n\n\t\tif ( window_width < 1230 ) {\n\t\t\tnavigation_wrapper.insertBefore( header_wrapper );\n\t\t\tif ( $( 'body' ).hasClass( 'rtl' ) ) {\n\t\t\t\t$( '.menu-secondary' ).css( 'padding-left', '' );\n\t\t\t\tmenu_toggle.css( 'margin-right', '' );\n\t\t\t} else {\n\t\t\t\t$( '.menu-secondary' ).css( 'padding-right', '' );\n\t\t\t\tmenu_toggle.css( 'margin-left', '' );\n\t\t\t}\n\t\t} else {\n\t\t\tnavigation_wrapper.insertAfter( menu_toggle );\n\t\t\tif ( $( 'body' ).hasClass( 'rtl' ) ) {\n\t\t\t\t$( '.navigation-default .menu-secondary' ).css( 'padding-left', menu_toggle_width + 60 );\n\t\t\t} else {\n\t\t\t\t$( '.navigation-default .menu-secondary' ).css( 'padding-right', menu_toggle_width + 60 );\n\t\t\t}\n\t\t\tif ( menu_toggle.hasClass( 'open' ) ) {\n\t\t\t\t$( 'html, body' ).css( 'overflow-y', 'hidden' );\n\t\t\t\tmenu_toggle.appendTo( navigation_wrapper );\n\t\t\t\tif ( $( 'body' ).hasClass( 'rtl' ) ) {\n\t\t\t\t\tmenu_toggle.css( 'margin-right', 930 / 2 - menu_toggle_width );\n\t\t\t\t} else {\n\t\t\t\t\tmenu_toggle.css( 'margin-left', 930 / 2 - menu_toggle_width );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$( 'html, body' ).css( 'overflow-y', '' );\n\t\t\t\tif ( $( 'body' ).hasClass( 'rtl' ) ) {\n\t\t\t\t\tmenu_toggle.css( 'margin-right', '' );\n\t\t\t\t} else {\n\t\t\t\t\tmenu_toggle.css( 'margin-left', '' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/* Add a max-width to .site-branding */\n\t\tvar gap_icons = 0;\n\t\tif ( site_navigation.length ) {\n\t\t\tgap_icons += 16;\n\t\t}\n\t\tif ( header_search.length ) {\n\t\t\tgap_icons += 16;\n\t\t}\n\t\tif ( window_width < 768 ) {\n\t\t\tsite_branding.removeAttr( 'style' );\n\t\t} else {\n\t\t\tsite_branding.css( 'max-width', header_wrapper.outerWidth() - ( site_navigation.outerWidth() + header_search.outerWidth() + gap_icons ) );\n\t\t}\n\n\t\t$( '.menu-primary .dropdown-toggle' ).each( function() {\n\t\t\t$( this ).css( 'top', $( this ).prev( 'a' ).outerHeight() - $( this ).outerHeight() - 1 );\n\t\t} );\n\t}", "function Gmenu(rOrder)\r\n{\r\n\twindow.Max = 0; \r\n\twindow.UlMax = 0;\r\n\twindow.LiMax = 0;\r\n\twindow.first = 0;\r\n\t$('.Gmenu ul li').hover(\r\n\tfunction()\r\n\t{\r\n\t\tflag = left = 1;\r\n\t\tif(!$(this).find('.main_item').length && $(this).attr('class')!='hr')\r\n\t\t\t$(this).addClass('menu_active');\r\n\t\tul = $(this).find('ul:first:has(li)');\r\n\t\tif($(ul).length)\r\n\t\t{\r\n\t\t\twindow.UlMax=0;\r\n\t\t\tif($(this).attr('view')=='topitem')\r\n\t\t\t{\r\n\t\t\t\tel = getAbsolutePosition(this,1);\r\n\t\t\t\twindow.LiMax = el.w;\r\n\t\t\t\twindow.first = 0;\r\n\t\t\t}\r\n\t\t\t$(ul).css('display','block');\r\n\t\t\t$(ul).find('li[@parent='+($(ul).attr('id'))+'] a').each(function()\r\n\t\t\t{\r\n\t\t\t\tif(window.UlMax < $(this)[0].offsetWidth)\r\n\t\t\t\t\twindow.UlMax = $(this)[0].offsetWidth\r\n\t\t\t});\r\n\t\t\tif(!window.first && window.UlMax < window.LiMax)\r\n\t\t\t\twindow.Max = window.LiMax;\r\n\t\t\telse\r\n\t\t\t\twindow.Max = window.UlMax;\r\n\t\t\twindow.Max = window.Max + 20;\t\r\n\t\t\t$(ul).css('width',''+window.Max+'px');\r\n\t\t\tif(!window.first)\r\n\t\t\t{\r\n\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\t$(ul).css('left',''+(el.l + (el.w - $(ul)[0].offsetWidth))+'px');\r\n\t\t\t\telse\r\n\t\t\t\t\t$(ul).css('left',''+(el.l)+'px');\r\n\t\t\t\t$(ul).css('top',''+(el.t + el.h - 1)+'px');\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\t$(ul).css('top',''+$(this)[0].offsetTop+'px');\r\n\t\t\t$(ul).find('li[@parent='+($(ul).attr('id'))+']').each(function()\r\n\t\t\t{\r\n\t\t\t\t$(this).css('width',''+window.Max+'px');\r\n\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\t$(this).find('ul:first').css('right',''+window.Max+'px');\r\n\t\t\t\telse\r\n\t\t\t\t\t$(this).find('ul:first').css('left',''+window.Max+'px');\r\n\t\t\t});\r\n\t\t\tif(rOrder=='RTL')\r\n\t\t\t{\r\n\t\t\t\tif($.browser.msie && !window.first)\r\n\t\t\t\t\tleft = -21;\r\n\t\t\t\telse\r\n\t\t\t\t\tleft = -2;\r\n\t\t\t}\r\n\t\t\twindow.first = 1;\r\n\t\t\t$(ul).dropShadow({left: left, top: 2, blur: 2, opacity: 0.4});\r\n\t\t\tsetTimeout('if(flag) $(ul).redrawShadow()',150);\r\n\t\t\tif(IsIE6())\r\n\t\t\t\taddiframe($(this));\r\n\t\t}\t\r\n\t},\r\n\tfunction() \r\n\t{\r\n\t\tflag=0;\r\n\t\tif(!$(this).find('.main_item').length && $(this).attr('class')!='hr')\r\n\t\t\t$(this).removeClass('menu_active'); \r\n\t\t$(this).find('ul:first').css('display','none'); \r\n\t\t$(this).find('ul:first').removeShadow();\r\n\t\tvar id = $(this).attr('id');\r\n\t\tid = id.substr(2);\r\n\t\tif($('#ul'+id).length)\r\n\t\t\t$(\"#frame_menu\"+id).remove();\r\n\t});\t\r\n\t$('.Gmenu li:has(ul:has(li))').find('a:first').each(function()\r\n\t{\r\n\t\tif(!$('b',this).length)\r\n\t\t{\t\r\n\t\t\t$(this).after('<b class=\"bmenu bmenu_simple\">&nbsp;&raquo;</b>');\r\n\t\t\t$(\"b.bmenu_simple\").css(\"color\",$(this).css(\"color\"));\r\n\t\t}\r\n\t});\r\n\t$('.Gmenu li[@view=topitem]:has(ul:has(a.current))').find(\"b.bmenu:first\").append(\"&nbsp;<b class='bmenu_current'>\"+$(\"a.current\").attr('title')+\"</b>\");\r\n\t$(\"b.bmenu_current\").css(\"color\",$(\"a.current\").css(\"color\"));\r\n\tvar top=0;\r\n\tif($(\".Madrid\").length)\r\n\t{\r\n\t\tif(IsIE6())\r\n\t\t{\r\n\t\t\t$('.Madrid b.xtop').each(function()\r\n\t\t\t{\r\n\t\t\t\t$(this).attr(\"style\",\"height:1px;width:\"+($(this).parent()[0].offsetWidth)+\"px\");\r\n\t\t\t});\r\n\t\t\t$('.Gmenu').parent().append('&nbsp;');\r\n\t\t}\r\n\t}\r\n\telse if($(\".Paris\").length)\r\n\t{\r\n\t\t$('.Gmenu').parent().css('height','1px');\r\n\t\tif($.browser.msie)\r\n\t\t\t$('.Gmenu').parent().append('&nbsp;');\r\n\t}\r\n\telse if($('#menu_block>div.Gmenu').length)\r\n\t{\r\n\t\tvar h=0, w=0;\r\n\t\tvar mtW = $('div.Gmenu')[0].offsetWidth;\r\n\t\t$('div.Gmenu li[@view=topitem]').each(function()\r\n\t\t{\r\n\t\t\tw += $(this)[0].offsetWidth;\r\n\t\t\tif(w>mtW)\r\n\t\t\t{\r\n\t\t\t\th += $(this)[0].offsetHeight;\r\n\t\t\t\tw=$(this)[0].offsetWidth;\r\n\t\t\t}\r\n\t\t});\r\n\t\t$('#menu_block').css('height',''+(h+19)+'px');\r\n\t}\t\r\n\t$('.Gmenu ul li ul li ul').css('top','0px');\r\n}", "function updateTopMenu(){\n\t\t\t\t$('.date-menu li.current').removeClass('current');\n\t\t\t\tvar page = myScroll.currPageX;\n\t\t\t\tvar pos = $datemenu.find('li')\n\t\t\t\t\t.eq(page)\n\t\t\t\t\t.addClass('current')\n\t\t\t\t\t.position()\n\t\t\t\t\t.left;\n\n\t\t\t\t//TODO:put the right number to be always on the left\n\t\t\t\tpos-=100; //I want the menu to be on the left\n\t\t\t\tpos = pos>0? pos : 0;\n\t\t\t\t$datemenu.css('left',pos * -1);\n\t\t\t}", "function slideLeftForMobile() {\n\t\tsliderContainer = \".mobile-menu-width\";\n\t\tremLength =\n\t\t\t$(sliderContainer)[0].scrollWidth - $(sliderContainer).width();\n\t\tscrollable = remLength - $(sliderContainer).scrollLeft();\n\t\t$(sliderContainer).animate(\n\t\t\t{\n\t\t\t\tscrollLeft: remLength,\n\t\t\t},\n\t\t\tspeed\n\t\t);\n\t}", "function startRepositioningOnResize(){var repositionMenu=function(target,options){return $$rAF.throttle(function(){if(opts.isRemoved)return;var position=calculateMenuPosition(target,options);target.css(animator.toCss(position));});}(element,opts);$window.addEventListener('resize',repositionMenu);$window.addEventListener('orientationchange',repositionMenu);return function stopRepositioningOnResize(){// Disable resizing handlers\n\t$window.removeEventListener('resize',repositionMenu);$window.removeEventListener('orientationchange',repositionMenu);};}", "function mobileNavigation(){\n\n var base_url = window.location.origin;\n if( $(window).width() < 979 ){\n //$(\".main-navigation.navigation-top-header\").remove();\n $(\".main-navigation.navigation-top-header\").css(\"display\",\"none\");\n $(\".toggle-navigation\").css(\"display\",\"inline-block\");\n $(\".main-navigation.navigation-off-canvas\").load(base_url+\"/external/_navigation.html\");\n $(\"body\").removeClass(\"navigation-top-header\");\n $(\"body\").addClass(\"navigation-off-canvas\");\n }\n\telse {\n\t\tif( navigationStyle == \"topHeader\" ){\n\t\t\t$( \".main-navigation.navigation-top-header\" ).load(base_url+ \"/external/_navigation.html\" );\n\t\t\t$(\"body\").removeClass(\"navigation-off-canvas\");\n\t\t\t$(\"body\").addClass(\"navigation-top-header\");\n\t\t\t$(\".main-navigation.navigation-top-header\").css(\"display\",\"inline-block\");\n\t\t\t$(\".toggle-navigation\").css(\"display\",\"none\");\n\t\t}else {\n\t\t\t$( \".main-navigation.navigation-off-canvas\" ).load(base_url+ \"/external/_navigation.html\" );\n\t\t}\n\t}\n}", "function menuPosition() {\n\t\t\torg_menu_offset = $('#org-menu-toggle').position().left + ($('#org-menu-toggle').width() / 2) - 120; // 120 is half of the menu width of 240px\n\t\t\t$('#org-menu-toggle').next('ul').css('left',org_menu_offset+'px');\n\t\t}", "function showOnLeftSubMenu() {\r\n\t\t\t\r\n\t\t\t// Show on left class for minimal styling.\r\n\t\t\t$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function () {\r\n\t\t\t\t\r\n\t\t\t\t$(this).removeClass('on-left-side');\r\n\t\t\t\t\r\n\t\t\t\tif ($(this).offset().left + $(this).outerWidth() > $window.width()) {\r\n\t\t\t\t\t$(this).addClass('on-left-side');\r\n\t\t\t\t\t$(this).find('ul').addClass('on-left-side');\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(this).removeClass('on-left-side');\r\n\t\t\t\t\t$(this).find('ul').removeClass('on-left-side');\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t});\r\n\t\t}", "function moveNavigation(){\n\t\tvar $navigation = $('#au-site-nav'),\n $utility = $('.util-item'),\n \t\t desktop = checkWindowWidth();\n \n if(!$('body').hasClass('subsite')){\n //we are on the AU main site\n if ( desktop ) {\n //we are on a larger device\n $utility.detach();\n $navigation.detach();\n $navigation.insertAfter('#au-logo').removeClass('nav-panel');\n $utility.appendTo('#util-nav nav ul').removeClass('minor');\n } else {\n //we are on a smaller device\n $utility.detach();\n $navigation.detach();\n $navigation.appendTo('#au-site-nav-panel');\n $utility.appendTo($primaryNav).addClass('minor');\n }\n } else {\n //we are on a subsite\n if ( desktop ) {\n //we are on a larger device\n $utility.detach();\n $utility.appendTo('#util-nav nav ul').removeClass('minor');\n } else {\n //we are on a smaller device\n $utility.detach();\n $utility.appendTo($footerLinks)\n } \n }\n\t}", "function adjustNav() {\n\n\tif ($(document).width() < breakPoint) {\n\n\t\t$(\"nav.main-menu\").removeClass(\"full\").addClass(\"compact\");\n\t\t$(\"nav.main-menu ul\").hide();\n\t}\n\n\telse {\n\n\t\t$(\"nav.main-menu\").removeClass(\"compact\").addClass(\"full\");\n\t\t$(\"nav.main-menu ul\").show();\n\t}\n}", "function showLeftFunction() {\n if(hasClass(menuLeft, \"mob-menu-open\")) {\n menuLeft.className = \"mob-menu\";\n } else {\n menuLeft.className += \" mob-menu-open\";\n }\n}", "function settingsForScreens(){\n $(\"body\").css(\"visibility\", \"visible\" );\n var menuWidth = parseInt( $(\"#menu-container .menu-content-holder\").css(\"width\"), 10 );\n var menuHider = parseInt( $(\"#menu-container #menu-hider\").width(), 10 );\n var menuHiderIcon = parseInt( $(\"#menu-container #menu-hider #menu-hider-icon\").width(), 10 );\n var menuHeight = parseInt( $(\"#menu-container\").css(\"height\"), 10 );\n\n var menuHiderH = parseInt( $(\"#menu-container #menu-hider\").height(), 10 );\n var menuHiderIconH = parseInt( $(\"#menu-container #menu-hider #menu-hider-icon\").height(), 10 );\n templateMenuW = menuWidth + menuHider;\n $(\"#menu-hider-icon\").click(menuHideClick);\n $(\"#module-container\").css( \"width\", ($(window).width() - templateMenuW) + \"px\" );\n\n if( $(window).width() > 767){\n $(\"#menu-container\").css('left', -(menuWidth + menuHider + menuHiderIcon) + 'px');\n\t\t $(\"#menu-container\").css( 'visibility', 'visible' );\n\n $(\"#menu-hider\").css( 'display', 'inline' );\n $(\"#menu-hider\").css( 'visibility', 'visible' );\n\n /*start-up animation*/\n $(\"#module-container\").css( \"opacity\", 1 );\n \t\t$(\"#module-container\").css( \"left\", menuWidth + menuHider + \"px\" );\n\n $(\"footer\").css( 'display', 'inline' );\n\t\t TweenMax.to( $(\"#menu-container\"), .4, { css:{left: \"0px\"}, ease:Sine.easeInOut, delay: 0.5, onComplete: endStartupAnimation });\n /*end start-up animation*/\n }\n if( $(window).width() <= 767 ){\n templateMenuW = 0;\n var containerH = $(window).height() - (menuHeight + menuHiderH);\n $(\"#menu-container\").css(\"left\", \"0px\");\n $(\"#menu-container\").css(\"top\", -(menuHeight + menuHiderH + menuHiderIconH) + \"px\");\n\t\t $(\"#menu-container\").css( \"visibility\", \"visible\" );\n\n $(\"#menu-hider\").css( \"display\", \"inline\" );\n $(\"#menu-hider\").css( \"visibility\", \"visible\" );\n\n /*start-up animation*/\n $(\"#module-container\").css( \"opacity\", \"1\" );\n \t\t$(\"#module-container\").css( \"left\", \"0px\" );\n $(\"#module-container\").css( \"top\", (menuHeight + menuHiderH) + \"px\" );\n $(\"#module-container\").css( \"height\", containerH );\n\n\t\t TweenMax.to( $(\"#menu-container\"), .4, { css:{top: \"0px\"}, ease:Sine.easeInOut, delay: 0.5, onComplete: endStartupAnimation });\n /*end start-up animation*/\n }\n $(\"#template-smpartphone-menu select\").change(\n function(){\n var customURL = $(this).val();\n if( customURL.indexOf(\"http://\") != -1 ){\n //window.open( customURL, \"_blank\" );\n var custA = '<a id=\"mc-link\" href=\"' + customURL + '\" style=\"display:none;\" target=\"_blank\" />';\n $(\"#template-smpartphone-menu select\").append(custA);\n\n var theNode = document.getElementById('mc-link');\n fireClick(theNode);\n $(\"#template-smpartphone-menu select\").find(\"#mc-link\").remove();\n\n return;\n }\n if( $(this).val() != urlCharDeeplink){\n menuOptionOut(menuOptionID, submenuOptionID, undefined);\n var hashURL = updateMenu( $(this).val(), prevURL, undefined, false);\n window.location.hash = hashURL;\n }\n });\n function fireClick(node){\n \tif ( document.createEvent ) {\n \t\tvar evt = document.createEvent('MouseEvents');\n \t\tevt.initEvent('click', true, false);\n \t\tnode.dispatchEvent(evt);\n \t} else if( document.createEventObject ) {\n \t\tnode.fireEvent('onclick') ;\n \t} else if (typeof node.onclick == 'function' ) {\n \t\tnode.onclick();\n \t}\n }\n }", "function resMenu() {\n if ($(window).width() < 1023) {\n $('.main-menu ul li a').on(\"click\", function() {\n $(\".navbar-collapse\").removeClass(\"in\");\n $(\".navbar-toggle\").addClass(\"collapsed\").removeClass(\"active\");\n $(\"#header\").removeClass(\"headClr\");\n });\n }\n }", "function largerThan1200(e){\n if(waq.$intro.length) enableStickyNav();\n if(e=='init') return; // Exit here at init --------------------------\n waq.$menu.appendTo(waq.$header);\n waq.$logo.prependTo(waq.$menu);\n waq.$menu.$toggle.remove();\n }", "function openNav() {\r\n $('.hamburger_menu, .bannerContainer, .storiesContainer, footer').animate({\r\n marginLeft: \"250px\"\r\n });\r\n $('#mobile_menu').animate({\r\n marginLeft: \"0\"\r\n });\r\n}", "function fixNav() {\n\tif(width>900){\n\t\tif (window.pageYOffset > sticky) {\n\t\t fixedmenu.classList.add(\"fix-nav\");\n\t\t pagearea.classList.add(\"pad300\");\n\t\t} else {\n\t\t \tfixedmenu.classList.remove(\"fix-nav\");\n\t\t pagearea.classList.remove(\"pad300\");\n\t\t}\n\t}\n}", "function headerNavi() {\n if($(window).width()>720){\n var d=300;\n $('#navigation a').each(function(){\n $(this).stop().animate({\n 'margin-top':'-123px'\n },d+=150);\n });\n \n $('#navigation > li').hover(\n function () {\n $('a',$(this)).stop().animate({\n 'margin-top':'-80px'\n },200);\n },\n function () {\n $('a',$(this)).stop().animate({\n 'margin-top':'-123px'\n },200);\n }\n );\n }\n $(window).resize(function(){\n if($(window).width()>720){\n var d=300;\n $('#navigation a').each(function(){\n $(this).stop().animate({\n 'margin-top':'-123px'\n },d+=150);\n });\n \n $('#navigation > li').hover(\n function () {\n $('a',$(this)).stop().animate({\n 'margin-top':'-80px'\n },200);\n },\n function () {\n $('a',$(this)).stop().animate({\n 'margin-top':'-123px'\n },200);\n }\n );\n }\n });\n}", "function fixSubMenu(){\n\nj$('nav > .sf-js-enabled > li:not(.rd_megamenu)').mouseover(function(){\n\nvar wapoMainWindowWidth = j$(window).width();\n // checks if third level menu exist\n var subMenuExist = j$(this).children('.sub-menu').length;\n if( subMenuExist > 0){\n var subMenuWidth = j$(this).children('.sub-menu').width();\n var subMenuOffset = j$(this).children('.sub-menu').parent().offset().left + subMenuWidth;\n\n // if sub menu is off screen, give new position\n if((subMenuOffset + subMenuWidth) > wapoMainWindowWidth){\n var newSubMenuPosition = subMenuWidth ;\n\t\t\t j$(this).addClass('left_side_menu');\n\n }else{\n\t\t\t var newSubMenuPosition = subMenuWidth ;\n\n\t\t\t j$(this).removeClass('left_side_menu');\n\t\t}\n }\n });\n}", "function moveRight1() {\n const newLeftPX4 = window.getComputedStyle(leftUl).left;\n console.log(newLeftPX4);\n if (newLeftPX4 === \"-1500px\") {\n leftUl.style.left = \"-1200px\";\n leftUl.classList.add(\"transit\");\n //btn.style.visibility = \"hidden\";\n }\n}", "function reposition_topnav() {\n if ($('.nav-horizontal').length > 0) {\n topbarWidth = $('.topbar').width();\n headerRightWidth = $('.header-right').width();\n if ($('.header-left .nav-horizontal').length) headerLeftWidth = $('.header-left').width() + 40;\n else headerLeftWidth = $('.nav-sidebar.nav-horizontal > li').length * 140;\n var topbarSpace = topbarWidth - headerLeftWidth - headerRightWidth;\n // top navigation move to left nav if not enough space in topbar\n if ($('.nav-horizontal').css('position') == 'relative' || topbarSpace < 0) {\n if ($('.sidebar .nav-sidebar').length == 2) {\n $('.nav-horizontal').insertAfter('.nav-sidebar:eq(1)');\n } else {\n // only add to bottom if .nav-horizontal is not yet in the left panel\n if ($('.sidebar .nav-horizontal').length == 0) {\n $('.nav-horizontal').appendTo('.sidebar-inner');\n $('.sidebar-widgets').css('margin-bottom', 20);\n }\n }\n $('.nav-horizontal').css({\n display: 'block'\n }).addClass('nav-sidebar').css('margin-bottom', 100);\n createSideScroll();\n $('.nav-horizontal .children').removeClass('dropdown-menu');\n $('.nav-horizontal > li').each(function() {\n $(this).removeClass('open');\n $(this).find('a').removeAttr('class');\n $(this).find('a').removeAttr('data-toggle');\n });\n /* We hide mega menu in sidebar since video / images are too big and not adapted to sidebar */\n if ($('.nav-horizontal').hasClass('mmenu')) $('.nav-horizontal.mmenu').css('height', 0).css('overflow', 'hidden');\n } else {\n if ($('.sidebar .nav-horizontal').length > 0) {\n $('.sidebar-widgets').css('margin-bottom', 100);\n $('.nav-horizontal').removeClass('nav-sidebar').appendTo('.topnav');\n $('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style');\n $('.nav-horizontal li:last-child').show();\n $('.nav-horizontal > li > a').each(function() {\n $(this).parent().removeClass('active');\n if ($(this).parent().find('.dropdown-menu').length > 0) {\n $(this).attr('class', 'dropdown-toggle');\n $(this).attr('data-toggle', 'dropdown');\n }\n });\n }\n /* If mega menu, we make it visible */\n if ($('.nav-horizontal').hasClass('mmenu')) $('.nav-horizontal.mmenu').css('height', '').css('overflow', '');\n }\n }\n}", "function Vmenu1(rOrder)\r\n{\r\n\twindow.Max=0; \r\n\t$('.Vmenu1 ul li').hover(\r\n\tfunction()\r\n\t{\r\n\t\tflag = 1;\r\n\t\tvar left = 1, top = 2, vscroll = 0;\r\n\t\tif($(this).attr('class')!='hr')\r\n\t\t\t$(this).addClass('menu_active');\r\n\t\tul = $(this).find('ul:first:has(li)');\r\n\t\tif($(ul).length)\r\n\t\t{\r\n\t\t\t$(ul).css('display','block');\r\n\t\t\tif(rOrder=='RTL' && $.browser.msie)\r\n\t\t\t{\r\n\t\t\t\t$(ul).find('li[@class=hr][@parent='+$(ul).attr('id')+']').each(function()\r\n\t\t\t\t{\r\n\t\t\t\t\t$(this).hide();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tulW = $(ul)[0].offsetWidth;\r\n\t\t\tif($(this).attr('view')=='topitem')\r\n\t\t\t{\r\n\t\t\t\tel = getAbsolutePosition(this,1);\r\n\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\twindow.Max = el.l - ulW;\r\n\t\t\t\telse\r\n\t\t\t\t\twindow.Max = el.l + el.w;\r\n\t\t\t\tif(!$.browser.msie)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\t\twindow.Max = window.Max + 10;\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\twindow.Max = window.Max - 10;\r\n\t\t\t\t}\r\n\t\t\t\twindow.first = 0;\r\n\t\t\t}\r\n\t\t\tif(!$.browser.msie && ($(ul)[0].offsetHeight + el.t) > document.body.clientHeight)\r\n\t\t\t\tvscroll = 10;\r\n\t\t\tif(!window.first)\r\n\t\t\t{\r\n\t\t\t\t$(ul).css('left',''+(window.Max - vscroll)+'px');\t\r\n\t\t\t\t$(ul).css('top',''+(el.t)+'px');\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\t\t$(ul).css('top',''+$(this)[0].offsetTop+'px');\r\n\t\t\t\t\tif(rOrder=='RTL')\r\n\t\t\t\t\t\t$(ul).css('right',''+($(this)[0].offsetWidth - vscroll)+'px');\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\t$(ul).css('left',''+($(this)[0].offsetWidth - vscroll)+'px');\r\n\t\t\t\t}\r\n\t\t\tif(rOrder=='RTL')\r\n\t\t\t{\r\n\t\t\t\tleft = -2;\r\n\t\t\t\tif($.browser.msie)\r\n\t\t\t\t{\r\n\t\t\t\t\t$(ul).find('li[@class=hr][@parent='+$(ul).attr('id')+']').each(function()\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t$(this).css('width',''+ulW+'px');\r\n\t\t\t\t\t\t$(this).show();\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif(!window.first)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar idPar = $('div.Vmenu1').parent().parent().attr('id');\r\n\t\t\t\t\t\tif(!idPar || idPar.indexOf('left_block')==-1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tleft = -21;\r\n\t\t\t\t\t\t\ttop = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\twindow.first=1;\r\n\t\t\t$(ul).dropShadow({left: left, top: top, blur: 2, opacity: 0.4})\r\n\t\t\tsetTimeout('if(flag) $(ul).redrawShadow()',150);\r\n\t\t\tif(IsIE6())\r\n\t\t\t\taddiframe($(this));\r\n\t\t}\r\n\t},\r\n\tfunction()\r\n\t{ \r\n\t\tflag=0;\r\n\t\tif($(this).attr('class')!='hr')\r\n\t\t\t$(this).removeClass('menu_active'); \r\n\t\tul = $(this).find('ul:first:has(li)');\r\n\t\tif($(ul).length)\r\n\t\t{\r\n\t\t\t$(ul).css('display','none'); \r\n\t\t\t$(ul).removeShadow();\r\n\t\t\tvar id = $(this).attr('id');\r\n\t\t\tid = id.substr(2);\r\n\t\t\tif($('#ul'+id).length)\r\n\t\t\t\t$(\"#frame_menu\"+id).remove();\r\n\t\t}\r\n\t}); \r\n\t$('.Vmenu1 li:has(ul:has(li))').find('a:first').each(function()\r\n\t{\r\n\t\tif(!$('b',this).length)\r\n\t\t{\r\n\t\t\t$(this).after('<b class=\"bmenu bmenu_simple\">&nbsp;&raquo;</b>');\r\n\t\t\t$(\"b.bmenu_simple\").css(\"color\",$(this).css(\"color\"));\r\n\t\t}\t\r\n\t});\r\n\t$('.Vmenu1 li[@view=topitem]:has(ul:has(a.current))').find(\"b:first\").append(\"&nbsp;<b class='bmenu_current'>\"+$(\"a.current\").attr('title')+\"</b>\");\r\n\t$(\"b.bmenu_current\").css(\"color\",$(\"a.current\").css(\"color\"));\r\n\t$('.Vmenu1 ul li ul').addClass('submenu');\r\n}", "function handlePageLoadMenuFocus() {\n var targetMenu = $('.top-menu .nav');\n var targetList = $('.top-menu .nav > li');\n var targetActiveList = $('.top-menu .nav > li.active');\n var targetContainer = $('.top-menu');\n\n var marginLeft = parseInt($(targetMenu).css('margin-left'));\n var viewWidth = $(targetContainer).width() - 128;\n var prevWidth = $('.top-menu .nav > li.active').width();\n var speed = 0;\n var fullWidth = 0;\n\n $(targetActiveList).prevAll().each(function() {\n prevWidth += $(this).width();\n });\n\n $(targetList).each(function() {\n if (!$(this).hasClass('menu-control')) {\n fullWidth += $(this).width();\n }\n });\n\n if (prevWidth >= viewWidth) {\n var finalScrollWidth = prevWidth - viewWidth + 128;\n $(targetMenu).animate({ marginLeft: '-' + finalScrollWidth + 'px'}, speed);\n }\n\n if (prevWidth != fullWidth && fullWidth >= viewWidth) {\n $(targetMenu).find('.menu-control.menu-control-right').addClass('show');\n } else {\n $(targetMenu).find('.menu-control.menu-control-right').removeClass('show');\n }\n\n if (prevWidth >= viewWidth && fullWidth >= viewWidth) {\n $(targetMenu).find('.menu-control.menu-control-left').addClass('show');\n } else {\n $(targetMenu).find('.menu-control.menu-control-left').removeClass('show');\n }\n }", "function lrgMenu() {\n\t\n\t// Reset all menu items \n\t$('menu-toggle a').off('click');\n\t$('.menu h3').off('click');\n\t$('.menu > li').off('click');\n\t\n\t//remove any expanded menus\n\t$('#top-nav, #bottom-nav').find('*').removeClass('expand open focus');\n\t//remove the span tags inside\n\t$('.menu h3').find('span.indicator').remove();\n\t//remove menu toggle\n\t$('.menu-toggle').remove();\n\t//remove anchor tags from bottom navigation headings\n\t$('#bottom-nav h3 a').contents().unwrap();\n\t\n\t// --- end reset ---\n\n\t\n\t//MENUS - hide and show items when they get tab focus\n\t$('.menu > li').focusin(function () {\n\t\t$(this).addClass('focus');\n });\n\n\t$('.menu > li').focusout(function () {\n\t\t$(this).removeClass('focus');\n\t});\n\t\n\t//Toggle menu item open & closed\n\t$('#top-nav .menu > li').click(function() {\n\t\t//close other submenus by removing the expand class\n\t\t$('#top-nav .menu > li').removeClass('focus').not(this).removeClass('expand');\n\t\t//toggle this menu item\n\t\t$(this).toggleClass('expand');\n\t});\n\t\n\t// iPad workaround to get body element to recogize click event\n\tvar ua = navigator.userAgent,\n\tevent = (ua.match(/iPad/i)) ? \"touchstart\" : \"click\";\n\t\n\t//close submenus if users click outside the menu\n\t$('html').bind(event,function(e) {\n\t\t$('#top-nav .menu > li').removeClass('expand');\n\t});\n\t\n\t//stop clicks on the menu from bubbling up\n\t$('#top-nav').bind(event,function(e){\n\t\te.stopPropagation();\n\t});\n \n\t//set current window state\n\twindowState='large';\n}", "function openNav() {\n\t\tif (window.outerWidth ==768){\n\t\t\tdocument.getElementById(\"mySidenav\").style.width = \"220px\";\n\t\t\tdocument.getElementById(\"main\").style.marginLeft = \"210px\";\n\t\t}\n\t\telse if (window.outerWidth >480){\n\t\t\tdocument.getElementById(\"mySidenav\").style.width = \"250px\";\n\t\t\tdocument.getElementById(\"main\").style.marginLeft = \"250px\";\n\t\t}\n else{\n\t\t document.getElementById(\"mySidenav\").style.width = \"100%\";\n\t\t\tdocument.getElementById(\"main\").style.marginLeft = \"100%\";\n\t\t}\n \n\t}", "function menuSet(self){\n\t\tvar browserWidth = window.innerWidth;\n\t\tvar heightMenu = window.innerHeight - document.querySelector(\".main-menu\").getBoundingClientRect().bottom + \"px\";\n\t\tvar menuPosition = document.querySelector(\".main-menu\").getBoundingClientRect().bottom;\n\n\t\tif (browserWidth < 800 ) {\n\t\t\t$('.main-menu .catalog-list>ul').css({\n\t\t\t\t\"max-height\": heightMenu,\n\t\t\t\t\"position\": \"fixed\",\n\t\t\t\t\"top\": menuPosition +\"px\"\n\t\t\t});\n\n\t\t} else {\n\t\t\t$('.main-menu .catalog-list>ul').css({\n\t\t\t\t\"max-height\": \"\",\n\t\t\t\t\"top\": \"\",\n\t\t\t\t\"position\": \"\"\n\t\t\t});\n\t\t}\n\n\t}", "function checkStickMenu()\n {\n if($(window).width() > 943) {\n /* Sticky menu since it's gonna be so good on non-mobile devices */\n $(\".menu-container\").sticky({\n topSpacing: 0,\n zIndex: 10\n });\n }\n else\n {\n $(\".menu-container\").unstick(); /* DON'T Sticky menu to top since it would feel so weird on mobile devices. */\n }\n }", "function ctrl_rsz () {\r\n\t\tif ( $(window).width() < 768 ){\r\n\t\t\t$('#openMenu').click(function () { open_menu(); });\r\n\t\t\t$('#menuBG, .navigation-control a, #closeMenu').click( function () { close_menu(); });\r\n\t\t}\r\n\t}", "function smMenu(){\n\t\t// Clears out other menu setting from last resize\n\t\t$('.menu-toggle a').off('click')\n\t\t$('.expand').removeClass('expand');\n\t\t$('.menu-toggle').remove();\n\t\t// Displays new menu\n\t\t$('.main-nav').before(\"<div class='menu-toggle'><a href='#'>menu<span class='indicator'> +</span></a></div>\");\n\t\t// Add expand class for toggle menu and adds + or - symbol depending on nav bar toggle state\n\t\t$('.menu-toggle a').click(function() {\n\t\t\t$('.main-nav').toggleClass('expand');\n\t\t\tvar newValue = $(this).find('span.indicator').text() == ' -' ? ' +' : ' -';\n\t\t\t$(this).find('span.indicator').text(newValue);\n\t\t});\n\t\t// Set window state\n\t\tvar windowState = 'small';\n\t}", "function thememascot_navLocalScorll() {\n\t\tvar\tdata_offset = -60;\n $(\".menuzord-menu\").localScroll({\n target: \"body\",\n duration: 800,\n\t\t\toffset: data_offset,\n easing: \"easeInOutExpo\"\n });\n }", "function startRepositioningOnResize() {\n\n var repositionMenu = (function(target, options) {\n return $$rAF.throttle(function() {\n if (opts.isRemoved) return;\n var position = calculateMenuPosition(target, options);\n\n target.css(animator.toCss(position));\n });\n })(element, opts);\n\n $window.addEventListener('resize', repositionMenu);\n $window.addEventListener('orientationchange', repositionMenu);\n\n return function stopRepositioningOnResize() {\n\n // Disable resizing handlers\n $window.removeEventListener('resize', repositionMenu);\n $window.removeEventListener('orientationchange', repositionMenu);\n\n };\n }", "function startRepositioningOnResize() {\n\n var repositionMenu = (function(target, options) {\n return $$rAF.throttle(function() {\n if (opts.isRemoved) return;\n var position = calculateMenuPosition(target, options);\n\n target.css(animator.toCss(position));\n });\n })(element, opts);\n\n $window.addEventListener('resize', repositionMenu);\n $window.addEventListener('orientationchange', repositionMenu);\n\n return function stopRepositioningOnResize() {\n\n // Disable resizing handlers\n $window.removeEventListener('resize', repositionMenu);\n $window.removeEventListener('orientationchange', repositionMenu);\n\n };\n }", "function startRepositioningOnResize() {\n\n var repositionMenu = (function(target, options) {\n return $$rAF.throttle(function() {\n if (opts.isRemoved) return;\n var position = calculateMenuPosition(target, options);\n\n target.css(animator.toCss(position));\n });\n })(element, opts);\n\n $window.addEventListener('resize', repositionMenu);\n $window.addEventListener('orientationchange', repositionMenu);\n\n return function stopRepositioningOnResize() {\n\n // Disable resizing handlers\n $window.removeEventListener('resize', repositionMenu);\n $window.removeEventListener('orientationchange', repositionMenu);\n\n }\n }", "function startRepositioningOnResize() {\n\n var repositionMenu = (function(target, options) {\n return $$rAF.throttle(function() {\n if (opts.isRemoved) return;\n var position = calculateMenuPosition(target, options);\n\n target.css(animator.toCss(position));\n });\n })(element, opts);\n\n $window.addEventListener('resize', repositionMenu);\n $window.addEventListener('orientationchange', repositionMenu);\n\n return function stopRepositioningOnResize() {\n\n // Disable resizing handlers\n $window.removeEventListener('resize', repositionMenu);\n $window.removeEventListener('orientationchange', repositionMenu);\n\n }\n }", "function startRepositioningOnResize() {\n\n var repositionMenu = (function(target, options) {\n return $$rAF.throttle(function() {\n if (opts.isRemoved) return;\n var position = calculateMenuPosition(target, options);\n\n target.css(animator.toCss(position));\n });\n })(element, opts);\n\n $window.addEventListener('resize', repositionMenu);\n $window.addEventListener('orientationchange', repositionMenu);\n\n return function stopRepositioningOnResize() {\n\n // Disable resizing handlers\n $window.removeEventListener('resize', repositionMenu);\n $window.removeEventListener('orientationchange', repositionMenu);\n\n }\n }", "function leftMenuWidth(){\n\tif($(window).width() > 960){\n\t\ta = $(\"#content-wrap\").height();\n\t\t$(\"#header-wrap .fixedMenuBar\").height(a);\n\t\t$(\"#header-wrap .fixedMenuBar\").find('ul').height(a);\n\t}\n\tif($(window).width() < 960){\n\t\t$(\"#content-wrap .fixedMenuBar\").height(450);\n\t}\n}", "function pose_menu(){\r\n \r\n if($(window).width()<=760){\r\n $('.titre').css({\r\n //'margin':'0.1em 0.8em'\r\n });\r\n $('.sous-bloc').css({\r\n //'margin':'auto'\r\n });\r\n $('.reg').css({\r\n 'width':'100%'\r\n });\r\n $('.network').css({\r\n 'width':'70%'\r\n });\r\n $('.helico img').css({\r\n 'width':'100%'\r\n });\r\n $('.b-stock img').css({\r\n 'width':'100%'\r\n //'margin':'auto'\r\n });\r\n $('.libre img').css({\r\n 'width':'100%'\r\n //'margin':'auto'\r\n });\r\n xsmall=true;\r\n small=false;\r\n md=false;\r\n lg=false;\r\n }\r\n \r\n if($(window).width()>760){\r\n $('.reg').css({\r\n 'width':'40%'\r\n });\r\n $('.helico img').css({\r\n 'width':'96%'\r\n });\r\n $('.b-stock img').css({\r\n 'width':'95%'\r\n });\r\n \r\n $('.helico p').css({\r\n 'width':'96%'\r\n });\r\n $('.b-stock p').css({\r\n 'width':'95%'\r\n });\r\n\r\n if($(window).width()<1000){\r\n $('.titre').css({\r\n //'margin':'0.1em 0.8em'\r\n });\r\n $('.network').css({\r\n 'width':'57%'\r\n });\r\n $('.sous-bloc').css({\r\n //'margin':'auto'\r\n });\r\n $('.coment,.coment-slide').css({\r\n 'display':'none'\r\n });\r\n \r\n small=true;\r\n xsmall=false;\r\n md=false;\r\n lg=false;\r\n }else if($(window).width()<1200){\r\n $('.titre').css({\r\n //'margin':'0.1em 0.8em'\r\n });\r\n $('.network').css({\r\n 'width':'44%'\r\n });\r\n $('.coment,.coment-slide').css({\r\n 'display':'block'\r\n });\r\n md=true;\r\n xsmall=false;\r\n small=false;\r\n lg=false;\r\n \r\n }else{\r\n $('.titre').css({\r\n //'margin':'0.1em 20.8em'\r\n });\r\n $('.network').css({\r\n 'width':'37%'\r\n });\r\n $('.sous-bloc').css({\r\n //'margin':'auto'\r\n });\r\n lg=true;\r\n xsmall=false;\r\n small=false;\r\n md=false;\r\n }\r\n }\r\n }", "function cms_stiky_menu() {\n\n\t\tif (header_top < scroll_top) {\n\t\t\tswitch (true) {\n\t\t\t\tcase (window_width >= 992):\n\t\t\t\t\theader.addClass('header-fixed');\n\t\t\t\t\t$('body').addClass('fixed-margin-top');\n\t\t\t\t\tbreak;\n\t\t\t\tcase (window_width < 992):\n\t\t\t\t\theader.addClass('header-fixed');\n\t\t\t\t\t$('body').addClass('fixed-margin-top');\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\theader.removeClass('header-fixed');\n\t\t\t$('body').removeClass('fixed-margin-top');\n\t\t}\n\t}", "function toggleMenu(){\n var isDisplay = $j('.menu').css('display');\n\n if (isDisplay == 'none'){\n $j('.menu').show(500);\n }else if (isDisplay == 'block'){\n $j('.menu').hide(500);\n }\n\n if ($j(window).width() <= 720) {\n $j('nav').width($j('header').width());\n } else {\n $j('nav').css('width','');\n }\n}", "function mobileMenu() {\n \"use strict\";\n if (jQuery(window).width() < 768) {\n jQuery('.mega-menu .mega').attr('id', 'menu-menu');\n jQuery('#menu-all-pages').removeClass('mega');\n jQuery('.mega-menu > ul').removeClass('mega');\n } else {\n jQuery('.mega-menu .mega > ul').addClass('mega');\n jQuery('.mega-menu .mega > ul').attr('id', 'menu-menu');\n }\n jQuery(\".main-navigation\").addClass('toggled-on');\n jQuery('.menu-toggle').click(function() {\n if (jQuery(this).parent().hasClass('active')) {\n jQuery(this).parent().removeClass('active');\n } else {\n jQuery('.menu-toggle').parent().removeClass('active');\n jQuery(this).parent().addClass('active');\n }\n });\n}", "function RepositionNav(){\n\tvar windowHeight = $(window).height(); //get the height of the window\n\tvar navHeight = $('#nav').height() / 2;\n\tvar windowCenter = (windowHeight / 2); \n\tvar newtop = windowCenter - navHeight;\n\t$('#nav').css({\"top\": newtop}); //set the new top position of the navigation list\n}", "function cms_stiky_menu() {\r\n\t\tif (header_top < scroll_top && window_width > 992) {\r\n\t\t\tswitch (true) {\r\n\t\t\t\tcase (window_width > 0):\r\n\t\t\t\t\theader.addClass('header-fixed');\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\theader.removeClass('header-fixed');\r\n\t\t}\r\n\t}", "function reset(screenWidth) \n\t{\n\t\tif (screenWidth < 1024) {\n\t\t\t// scrolling menu is almost fullwidth. header is fixed in place on left side\n\t\t\twrapper = innerWrap;\n\t\t\t// left button should be to the right of the header\n\t\t\tleftBtn.style.left = header.clientWidth +'px';\n\t\t\t// scroll area is VISIBLE width of scrollable area (the \"window\" you can see)\n\t\t\tlimit = wrapper.scrollWidth - wrapper.clientWidth;\n\t\t\t// scroll by 300 every time button is pressed\n\t\t\tamount = 120;\n\t\t}\n\t\t// else if(screenWidth < 1200){\n\t\t// \t// scrolling menu is almost fullwidth. header is fixed in place on left side\n\t\t// \twrapper = innerWrap;\n\t\t// \t// left button should be to the right of the header\n\t\t// \tleftBtn.style.left = header.clientWidth +'px';\n\t\t// \t// scroll area is VISIBLE width of scrollable area (the \"window\" you can see)\n\t\t// \tlimit = wrapper.scrollWidth - wrapper.clientWidth;\n\t\t// \t// scroll by 300 every time button is pressed\n\t\t// \tamount = 120;\n\t\t// }\n\t\telse {\n\t\t\t// scrolling menu is almost fullwidth. header is fixed in place on left side\n\t\t\twrapper = innerWrap;\n\t\t\t// left button should be to the right of the header\n\t\t\tleftBtn.style.left = header.clientWidth +'px';\n\t\t\t// scroll area is VISIBLE width of scrollable area (the \"window\" you can see)\n\t\t\tlimit = wrapper.scrollWidth - wrapper.clientWidth;\n\t\t\t// scroll by 300 every time button is pressed\n\t\t\tamount = 950;\n\t\t}\n\n\t\t// show/hide spacer depending on whether scrolling is possible\n\t\tif (limit <= 0) {\n\t\t\t// no scrolling is possible. hide spacer\n\t\t\tcomponent.classList.remove('nav--scrollable');\n\t\t}\n\t\t// scrolling is possible. show spacer if hidden\n\t\telse {\n\t\t\tcomponent.classList.add('nav--scrollable');\n\t\t\t// adjust limit to take into account the spacer that was just added\n\t\t\tlimit += rightSpacerWidth;\n\t\t}\n\n\t\t// calculate which buttons should be visible\n\t\ttoggleButtons(wrapper.scrollLeft);\n\t}", "function onResize(){\n\tvar windowWidth = $(window).width();\n\t\n\tvar bigWidth = windowWidth - (33*2) - logoWidth - menuNotMobileWidth - 30;\n\t\n if(isTouch || normalMenuHeight >= bigWidth)\n smallMenu();\n else\n normalMenu();\n}", "function showNav() {\n $('.mobile-nav-button').removeClass('active');\n $('.mobile-search-button').removeClass('active');\n //if (($(window).width() >= MIN_NON_TABLET_SIZE && !Modernizr.ipad) || ($(window).width()<MIN_NON_TABLET_SIZE && $('header.ot, header.campaign').length==0)) {\n //if ($(window).width() > MIN_NON_TABLET_SIZE && !Modernizr.ipad) {\n if ($(window).width() > MIN_NON_MOBILE_SIZE) {\n $('.main-header-nav').show().css({'height':'', 'right':''});\n }\n else {\n $('.main-header-nav').hide().find('.active').removeClass('active');\n $('.main-header-nav > ul').css('left', '0px');\n }\n showDisplayName();\n}", "function mainNavigation() {\r\n $(\".hamb-menu\").off(\"click\");\r\n // $(\"#nav-main-mobile button\").off(\"click\");\r\n // $(\"#nav-main li\").off(\"mouseover\");\r\n // $(\"#nav-main li\").off(\"mouseleave\");\r\n // $_window.off('scroll.mainScroll');\r\n var tl = new TimelineMax({\r\n paused: !0\r\n }),\r\n speed = .2,\r\n $hambMenu = $(\".hamb-menu\"),\r\n $hambMenuTop = $(\".hamb-menu\").find(\".top\"),\r\n $hambMenuMiddle = $(\".hamb-menu\").find(\".middle\"),\r\n $hambMenuBottom = $(\".hamb-menu\").find(\".bottom\");\r\n tl.to($hambMenuTop, speed, {\r\n y: 6\r\n }).to($hambMenuBottom, speed, {\r\n y: -8\r\n }, \"-=.2\").to($hambMenu, speed, {\r\n rotation: 180,\r\n transformOrigin: \"center center\"\r\n }, .3).to($hambMenuMiddle, speed, {\r\n opacity: 0\r\n }, .3).to($hambMenuTop, speed, {\r\n rotation: 45,\r\n transformOrigin: \"center center\"\r\n }, .4).to($hambMenuBottom, speed, {\r\n rotation: -45,\r\n transformOrigin: \"center center\"\r\n }, .4), $(\".hamb-menu\").on(\"click\", function() {\r\n var $navMobile = $(\"#nav-main-mobile\");\r\n window.pageYOffset;\r\n $(\"#header-main\").toggleClass(\"opened\"), window.viewportUnitsBuggyfill.refresh(), TweenMax.set($navMobile.find(\".pressAnime\"), {\r\n opacity: 0,\r\n y: 40\r\n }), $_body.toggleClass(\"js-nav-mobile\"), $_body.hasClass(\"js-nav-mobile\") ? (tl.play(), TweenMax.to($navMobile, .1, {\r\n autoAlpha: 1\r\n }), TweenMax.staggerTo($navMobile.find(\".pressAnime\"), .8, {\r\n opacity: 1,\r\n y: 0,\r\n ease: Power2.easeOut\r\n }, .1), disableScroll()) : (enableScroll(), tl.reverse(), TweenMax.to($navMobile, .1, {\r\n autoAlpha: 0\r\n }), TweenMax.to($navMobile.find(\".pressAnime\"), 1, {\r\n opacity: 0,\r\n y: 40\r\n }))\r\n })\r\n}", "function menu () {\r\n var x = document.getElementById(\"menu\");\r\n if (x.className === \"topnav\") {\r\n x.className += \" responsive\";\r\n } else {\r\n x.className = \"topnav\";\r\n }\r\n }", "function ready(){\n $('#menu').click(function(){\n //console.log($('nav').offset().left);\n\n $('#navbar').toggle();\n // $('#menu').toggle(function(){$(this).css('color','blue')},function(){$(this).css('color','black')});\n\n });\n\n\n $(function(){\n // alert(window.location);\n $('.navbar ul li a').each(function(i){\n // alert($(this).attr('href'))\n if($(this).attr('href')==window.location){\n $(this).parent().closest('li').prop('class','active');\n }\n });\n\n });\n\n $(function(){\n var window_width = $(window).width();\n if(window_width<750){\n $('nav').css('width',window_width+\"px\");\n\n }\n });\n //\n // $(window).scroll(function(){\n // //$('nav').offset({top:0,left:$('nav').offset().left});\n // //console.log('scroolling');\n // // var window_width = $(window).width();\n // // if(window_width<750){\n // // $('nav').css('width',window_width+\"px\");\n // //\n // // }\n // var scrollVal = $(this).scrollTop();\n // if ( scrollVal > 750 ) {\n // $('nav').css({'position':'fixed','top' :'0px'});\n // }\n // });\n}", "function mobileMenuHide() {\r\n\t\tvar windowWidth = $(window).width();\r\n\t\tif (windowWidth < 1024) {\r\n\t\t\t$('#site_header').addClass('mobile-menu-hide');\r\n\t\t}\r\n\t}", "function mobileSideBar(media) {\n var sideMenu = document.getElementById('side-menu');\n\n if (media.matches) { // If media query matches.\n var items = document.getElementById('view-items');\n var current, cancelOpen = false, cancelClose = false;\n\n sideMenu.style.left = '-180px';\n\n sideMenu.addEventListener('touchend', function() { // End Touch event listener.\n cancelOpen = false, cancelClose = false;\n\n if (parseInt(sideMenu.style.left) > -90) // Over 50%.\n animateOpen();\n\n if (parseInt(sideMenu.style.left) <= -90) // Under 50%.\n animateClose();\n })\n\n sideMenu.addEventListener('touchmove', function(ev) { // Active Touch event listener.\n current = ev.targetTouches[0]; // Current Touch position.\n \n window.requestAnimationFrame(moveWith);\n cancelOpen = true, cancelClose = true;\n })\n\n items.addEventListener('click', function() { // Close Menu on item click.\n if (window.innerWidth <= 768)\n animateClose();\n })\n\n /*\n For when window is resized below threshold.\n Sidebar will collapse like in mobile.\n */\n sideMenu.addEventListener('mouseenter', function() { // Mouse enter event listener.\n if (window.innerWidth <= 768){\n cancelClose = true;\n animateOpen();\n }\n })\n\n sideMenu.addEventListener('mouseleave', function() { // Mouse leave event listener.\n if (window.innerWidth <= 768){\n cancelOpen = true;\n animateClose();\n }\n \n })\n\n /*\n JS animation functions.\n animateOpen(), animateClose(), moveWith()\n */\n function animateOpen() // Menu opening animation.\n {\n let pos = parseInt(sideMenu.style.left);\n let id = setInterval(frame, 10);\n\n function frame() { // Animate.\n for (let i = 0; i < 10; i++) {\n if (pos == 0) {\n clearInterval(id);\n cancelOpen = false, cancelClose = false;\n } else {\n if (cancelOpen) {\n clearInterval(id);\n cancelOpen = false, cancelClose = false;\n }\n pos++;\n sideMenu.style.left = pos + \"px\";\n }\n }\n }\n }\n\n function animateClose() // Menu closing animation.\n { \n let pos = parseInt(sideMenu.style.left);\n let id = setInterval(frame, 10);\n\n function frame() { // Animate.\n for (let i = 0; i < 10; i++) {\n if (pos == -180) {\n clearInterval(id);\n cancelOpen = false, cancelClose = false;\n } else {\n if (cancelClose) {\n clearInterval(id);\n cancelOpen = false, cancelClose = false;\n }\n pos--; \n sideMenu.style.left = pos + \"px\";\n }\n }\n }\n }\n\n function moveWith() // Moves the side menu with the finger.\n {\n if (parseInt(sideMenu.style.left) >= -180 && parseInt(sideMenu.style.left) <= 0)\n sideMenu.style.left = (current.clientX - sideMenu.offsetWidth) + 'px';\n\n if (parseInt(sideMenu.style.left) < -180) // Prevents over shoot.\n sideMenu.style.left = '-180px';\n\n if (parseInt(sideMenu.style.left) > 0) // Prevents over shoot.\n sideMenu.style.left = '0px';\n }\n\n } else {\n sideMenu.style.left = '0px';\n }\n }", "function showMenuBtn(){\n\t\tif($(window).width()<1199.98){\n\t\t\t$(\".open_menu\").addClass(\"d-block\");\n\t\t\t$(\"header nav\").addClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}else{\n\t\t\t$(\".open_menu\").removeClass(\"d-block\");\n\t\t\t$(\"header nav\").removeClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}\n\t}", "function showMenuBtn(){\n\t\tif($(window).width()<1199.98){\n\t\t\t$(\".open_menu\").addClass(\"d-block\");\n\t\t\t$(\"header nav\").addClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}else{\n\t\t\t$(\".open_menu\").removeClass(\"d-block\");\n\t\t\t$(\"header nav\").removeClass(\"d-none\");\n\t\t\t$(\".navigation_mobile\").removeClass(\"opened\");\n\t\t}\n\t}", "function menuLayout() {\n if (homepage.width() > homepage.height()) {\n mobMenuItem.addClass(\"mobile-menu-horizontal\");\n mobMenuItem.removeClass(\"mobile-menu-vertical\");\n } else {\n mobMenuItem.addClass(\"mobile-menu-vertical\");\n mobMenuItem.removeClass(\"mobile-menu-horizontal\");\n }\n }", "function preMenutoMainMenu() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'PRE_MENU' && store.getState().currentPage == 'MAIN_MENU') {\n mainSfxController(preloaderSfxSource);\n preloaderStarter();\n loadSavedMenuGameslotDisplayHandler();\n\n setTimeout(function(){\n preMenu.classList.add('pagehide');\n mainMenu.classList.remove('pagehide');\n }, 600);\n\n mainMenuPlayonmobileButtonid.classList.add('main-menu-playonmobile-button');\n mainMenuArmorgamesImageid.classList.add('main-menu-armorgames-image');\n mainMenuIronhideImageid.classList.add('main-menu-ironhide-image');\n mainMenuStartImageid.classList.add('main-menu-start-image');\n mainMenuCreditsImageid.classList.add('main-menu-credits-image');\n }\n }", "function toggleMenuLinks () {\n\t\tif (sitenavMinWidth < $(window).width()) {\n\t\t\t$(\"body\").removeClass(\"ibm-sitenav-menu-hide\");\n\t\t}\n\t\telse {\n\t\t\t$(\"body\").addClass(\"ibm-sitenav-menu-hide\");\n\t\t}\n\t}", "function cms_stiky_menu() {\r\n\t\tif (header_top <= scroll_top) {\r\n\t\t\tswitch (true) {\r\n\t\t\t\tcase (window_width > 992):\r\n\t\t\t\t\theader.addClass('header-fixed');\r\n\t\t\t\t\t$('body').css('margin-top', header.outerHeight(true)+'px');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ((window_width <= 992 && window_width >= 768) && (CMSOptions.menu_sticky_tablets == '1')):\r\n\t\t\t\t\theader.addClass('header-fixed');\r\n\t\t\t\t\t$('body').css('margin-top', header.outerHeight(true)+'px');\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase ((window_width <= 768) && (CMSOptions.menu_sticky_mobile == '1')):\r\n\t\t\t\t\theader.addClass('header-fixed');\r\n\t\t\t\t\t$('body').css('margin-top', header.outerHeight(true)+'px');\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\theader.removeClass('header-fixed');\r\n\t\t\t$('body').css('margin-top', '0');\r\n\t\t}\r\n\t}", "function show_menu_bars(){\n if(window.innerWidth <= 1000){\n setAct(true)\n setNavs(false)\n }\n else{\n setAct(false)\n setNavs(true)\n }\n }", "function leftMove() {\n if(current.attr(\"data-page\")<=(6-min)) {\n if(ellipse.children(\".ellipseFirst\").length>0) {\n ellipse.children(\".ellipseFirst\").parent().remove();\n }\n }\n if(current.attr(\"data-page\")>min) {\n current.removeClass(\"current\").parent().prev().children().addClass(\"current\");\n }\n //add elem\n if(current.attr(\"data-page\")>(5-min)) {\n current.parent().prev().prev().before($(\"<li class='lf' data-remove='t'><b class='page-link' data-page=\" + (parseInt(current.attr('data-page') )-3) + \">\" + (parseInt(current.attr('data-page')) - 3) + \"</b></li>\"));\n }\n if(current.attr(\"data-page\")<(max-2)&&current.attr(\"data-page\")!=min) {\n if(current.attr(\"data-page\")==(max-3)) {\n current.parent().next().next().after($(\"<li class='lf disabled' data-remove='t'><span class='ellipseLast'>...</span></li>\"))\n }\n current.parent().next().next().remove();\n }\n if(!(current.attr(\"data-page\")==min)) {\n news.page = parseInt(current.attr(\"data-page\"))-1;\n //console.log(news.page);\n //console.log(news);\n //$(window).scrollTop(0);\n get_data(news)\n }\n }", "function resize() {\n if ($window.width() < 600) {\n return $nav.addClass('mobile-nav');\n }\n\n $nav.removeClass('mobile-nav');\n }", "function menuState() {\n if ($(window).width() < 992) {\n\n if ($(window).scrollTop() >= 250) {\n $('.menu__btn').css({\n position: \"fixed\"\n });\n } else {\n $('.menu__btn').css({\n position: \"absolute\"\n })\n }\n } else {\n $('.menu__btn').css({\n position: \"fixed\"\n });\n }\n }", "function triBackHome() {\n\n\tpos = $('#navigation ul li a.current').position();\n\t\n\tif(pos) {\n\t\t$(\"#triSlideContainer img\").stop().animate({marginLeft:(pos.left+(widest/2+10))+\"px\"}, 1000);\n\t} else {\n\t\t$(\"#triSlideContainer img\").css(\"display\", \"none\");\n\t}\n\t\n}", "function handleTopNav() {\n\n\tvar $upperNav = $('.upper-nav-wrapper');\n\tvar upperNavHeight;\n\tvar classOut = 'nav-out';\n\t\n\tif ( $upperNav.length && $(window).width() > 768 ) {\n\t\t\t\n\t\tupperNavHeight = $upperNav.height();\n\t\t\n\t\tif ( scrollPos > 0 && scrollPos <= upperNavHeight ) {\n\t\t\t$upperNav.css( 'margin-top', - scrollPos );\n\t\t\t$upperNav.removeClass( classOut );\n\t\t\t//$('#main-navigation').css('top', 0);\n\t\t} else if ( scrollPos > topbarHeight ) {\n\t\t\t\n\t\t\tif ( !$upperNav.hasClass( classOut ) ) {\n\t\t\t\t$upperNav.addClass( classOut );\n\t\t\t\t$upperNav.css('margin-top', - upperNavHeight );\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\t$upperNav.removeClass( classOut );\n\t\t\t$upperNav.css('margin-top', 0);\n\t\t\t//$('#main-navigation').css('top', topbarHeight);\n\t\t}\n\t\t\n\t}\n\t\n}", "function toggleNav() {\n $('#show-menu').toggleClass(\"is-active\");\n if ($('#site').css('margin-left') == '-300px') {\n $('#site').css('margin-left', '0');\n } else {\n $('#site').css('margin-left', '-300px');\n }\n}", "function setHeader() {\n if (window.innerWidth < 992) {\n if ($(window).scrollTop() > 100) {\n header.css({ 'top': \"0\" });\n }\n else {\n header.css({ 'top': \"10\" });\n }\n }\n else {\n if ($(window).scrollTop() > 100) {\n header.css({ 'top': \"-15px\" });\n }\n else {\n header.css({ 'top': \"0\" });\n }\n }\n if (window.innerWidth > 991 && menuActive) {\n closeMenu();\n }\n }", "function Toggle_Menu()\n{\n// console.log( $( \"#deviceready\" ).css( \"left\" ) );\n if ( $( \"#deviceready\" ).css( \"left\" ) == \"0px\" )\n {\n\n $( \"#deviceready\" ).animate( { left : \"90%\" } );\n $( \"#Menu\" ).animate( { left : \"0%\"\n } , function ()\n {\n $( \"#closeMenu\" ).show();\n $( \"#openMenu\" ).hide();\n } );\n }\n else\n {\n $( \"#deviceready\" ).animate( { left : \"0\" } );\n $( \"#Menu\" ).animate( { left : \"-100%\" } , function ()\n {\n $( \"#closeMenu\" ).hide();\n $( \"#openMenu\" ).show();\n } );\n }\n\n}", "function menuhrres() {\n var vw = $(window)[0].innerWidth;\n if (vw < 992) {\n setTimeout(function() {\n $(\".sidenav-horizontal-wrapper\").addClass(\"sidenav-horizontal-wrapper-dis\").removeClass(\"sidenav-horizontal-wrapper\");\n $(\".theme-horizontal\").addClass(\"theme-horizontal-dis\").removeClass(\"theme-horizontal\");\n }, 400);\n } else {\n setTimeout(function() {\n $(\".sidenav-horizontal-wrapper-dis\").addClass(\"sidenav-horizontal-wrapper\").removeClass(\"sidenav-horizontal-wrapper-dis\");\n $(\".theme-horizontal-dis\").addClass(\"theme-horizontal\").removeClass(\"theme-horizontal-dis\");\n }, 400);\n }\n}", "function checkMenu() {\n\t\tif (window.innerWidth < min_width_menu && $rootScope.menu_opened) {\n\t\t\t$scope.toggleMenu();\n\t\t}\n\t}", "function FloatMenu(){\n\tvar animationSpeed=1500;\n\tvar animationEasing='easeOutQuint';\n\tvar scrollAmount=$(document).scrollTop();\n\tvar newPosition=menuPosition+scrollAmount;\n\tif($(window).height()<$('#menuJF').height()+$('#menuJF .menu-HT').height()){\n\t\t$('#menuJF').css('top',menuPosition);\n\t} else {\n\t\t$('#menuJF').stop().animate({top: newPosition}, animationSpeed, animationEasing);\n\t}\n}", "function checkPosition(menuStatus){\n var position = $(this).scrollTop(); //get page position\n if(position == 0){\n if(menuStatus)\n $(\".navbar-special\").addClass(\"navbarStateScrolled\");\n else\n $(\".navbar-special\").removeClass(\"navbarStateScrolled\");\n }\n else{\n $(\".navbar-special\").addClass(\"navbarStateScrolled\");\n }\n }", "function setLeftPosition() {\n let leftPercentage = (-(initialSlideLengthQS - 1) * 100);\n initialLeftPercentage = leftPercentage;\n leftPercentage += '%';\n if ($(window).outerWidth() < 768) {\n $(sliderWrapperQS).css('left', leftPercentage);\n } else {\n // leftPercentage = (-(slides.length - 2) * ($(sliderWrapperQS + ' .slide').outerWidth() + tabMargin));\n // leftPercentage = 0;\n leftPercentage = -($(sliderWrapperQS + ' .slide').outerWidth() + tabMargin);\n initialLeftPercentage = leftPercentage;\n leftPercentage += 'px';\n $('#quickSwap .tabs-wrapper').css('left', leftPercentage);\n $('#quickSwap .slider-wrapper').css('left', '0%');\n }\n }", "function leftMenuClick() {\r\n\t// 左边菜单添加click事件及样式\r\n\t$(\"#cntLeft .nav\").find(\"a\").bind('click', function() {\r\n\t\t$(\"#cntLeft .nav\").find(\"li\").removeClass(\"lon\");\r\n\t\t$(\"#cntLeft .nav\").find(\"a\").removeClass(\"on\");\r\n\t\t$(\"#cntLeft .nav\").find(\"i\").each(function() {\r\n\r\n\t\t\tvar i_class = $(this).attr(\"class\");\r\n\t\t\tvar i_on_class = \"on\" + $.trim(i_class).substring(\"i\");\r\n\t\t\t$(this).removeClass(i_on_class);\r\n\t\t});\r\n\t\t$(this).addClass(\"on\");\r\n\t\t$(this).parent().addClass(\"lon\");\r\n\t\tvar i_class = $(this).find(\"i\").attr(\"class\");\r\n\t\tvar i_on_num = $.trim(i_class).substring(1);\r\n\t\t$(this).find(\"i\").addClass(\"on\" + i_on_num);\r\n\t\t// 添加右边菜单\r\n\t\taddRightMenu(i_on_num);\r\n\t\t// 添加导航\r\n\t\tvar cntLeftText = $(this).text();\r\n\t\t$('#cTnav').html('<a href=\"javascript:void(0);\">' + cntLeftText + '</a>');\r\n\t\tcRTnavBindClick();\r\n\t});\r\n\tinitMenu();\r\n}", "function mediaQueryMenu(){\r\n\t\tif (window.matchMedia(\"(max-width:\"+change_menu_to_mobile_view+\")\").matches) {\r\n\t\t\t$(\".row_01\").addClass(\"hide\");\r\n\t\t\t$(\".row_01-content\").addClass(\"hide\");\r\n\t\t\t$(\"#burger_menu_icon\").removeClass(\"hide\");\r\n\t\t\t$(\".menu\").removeClass(\"fixed_menu\");\r\n\t\t\tmenuBottom();\r\n\t\t\tyoffset();\r\n\t\t\tburger_menu_active=true;\r\n\t\t} else {\r\n\t\t\t$(\".menu\").removeClass(\"fixed_menu\");\r\n\t\t\tburgerMenuUnactive();\r\n\t\t\t$(\".row_01\").removeClass(\"hide\");\r\n\t\t\t$(\"#burger_menu_icon\").addClass(\"hide\");\r\n\t\t\t$(\".menu_content\").css({\"display\":\"block\"});\r\n\t\t\tmenuBottom();\r\n\t\t\tyoffset();\r\n\t\t\tburger_menu_active=false;\r\n\t\t\tburger_menu_expanded=false;\r\n\t\t\t$(\".row_01\").removeClass(\"row_01-mouseover\");\r\n\t\t\t$(\".row_01 a\").removeClass(\"row_01-mouseover_nobackground\");\r\n\t\t}\r\n\t}", "function menuOpenClicked() {\n document.getElementById('leftSideBar').style.left = \"0\";\n document.getElementById('emptyPage').style.left = \"0\";\n }", "function reinitMenus(ulPath) { /* if(!jQueryBuddha(ulPath).is(\":visible\") && (typeof jQueryBuddha(ulPath).attr(\"style\")===typeof undefined || jQueryBuddha(ulPath).attr(\"style\").replace(/ /g, \"\").indexOf(\"display:none\")==-1 || (jQueryBuddha(ulPath).attr(\"style\").replace(/ /g, \"\").indexOf(\"display:none\")!=-1 && jQueryBuddha(ulPath).css(\"display\")==\"none\"))) { return; } */ jQueryBuddha(\".submenu-opened\").hide(); var previousItemTop; /* var horizontal = true; */ var verticalItemsNr = 1; jQueryBuddha(ulPath + \">.buddha-menu-item>a\").each(function () { /* .offset() is relative to document */ var currentItemTop = jQueryBuddha(this).offset().top; /* menuitems are positioned one below each other -> mobile rendering */ previousItemTop = (previousItemTop == undefined) ? currentItemTop : previousItemTop; if ((currentItemTop > (previousItemTop+5) ) || (currentItemTop < (previousItemTop-5))) { verticalItemsNr++; } previousItemTop = currentItemTop; }); /* var oldYPosition = 0; var oldXPosition = 0; var increment = 0; jQueryBuddha(ulPath+\">.buddha-menu-item\").each(function() { var positionY = jQueryBuddha(this).position().top; var positionX = jQueryBuddha(this).position().left; var differenceY = positionY - oldYPosition; var differenceX = positionX - oldXPosition; if(increment>0){ if(differenceY>3 || differenceX<3) { verticalItemsNr++; } } oldYPosition = positionY; oldXPosition = positionX; increment++; }); */ if ((verticalItemsNr != jQueryBuddha(ulPath + \">.buddha-menu-item\").length || (verticalItemsNr == 1 && jQueryBuddha(\"body\").width() > verticalMenuMaxWidth)) && forceMobile == false) { /* if ( verticalItemsNr==1 && forceMobile==false ) { */ jQueryBuddha(ulPath).addClass(\"horizontal-mega-menu\").removeClass(\"vertical-mega-menu\"); jQueryBuddha(ulPath + \" ul.mm-submenu\").removeAttr(\"style\"); jQueryBuddha(ulPath + \" .fa-minus-circle\").removeClass(\"fa-minus-circle\").addClass(\"fa-plus-circle\"); jQueryBuddha(ulPath + \" .submenu-opened\").removeClass(\"submenu-opened\"); jQueryBuddha(ulPath + \" .toggle-menu-btn\").hide(); jQueryBuddha(\".horizontal-mega-menu>li.buddha-menu-item\").off(); setTimeout(function () { jQueryBuddha(ulPath).find(\".buddha-menu-item\").each(function () { setSubmenuBoundries(jQueryBuddha(this)); setContactSubmenuBoundries(jQueryBuddha(this)); }); }, 1); jQueryBuddha(ulPath).find(\".buddha-menu-item\").unbind(\"onmouseover.simpleContactSubmenuResize\"); jQueryBuddha(ulPath).find(\".buddha-menu-item\").bind(\"onmouseover.simpleContactSubmenuResize\", function () { setSubmenuBoundries(jQueryBuddha(this)); setContactSubmenuBoundries(jQueryBuddha(this)); }); jQueryBuddha(ulPath).find(\"ul.mm-submenu.tabbed>li\").each(function () { if (jQueryBuddha(this).parent().find(\".tab-opened\").length == 0) { /* jQueryBuddha(this).parent().find(\".tab-opened\").removeClass(\"tab-opened\"); */ jQueryBuddha(this).addClass(\"tab-opened\"); setTabbedSubmenuBoundries(jQueryBuddha(this)); } else if (jQueryBuddha(this).hasClass(\"tab-opened\")) { setTabbedSubmenuBoundries(jQueryBuddha(this)); } }); jQueryBuddha(ulPath).find(\"ul.mm-submenu.tabbed>li\").unbind(); jQueryBuddha(ulPath).find(\"ul.mm-submenu.tabbed>li\").hover(function () { jQueryBuddha(this).parent().find(\".tab-opened\").removeClass(\"tab-opened\"); jQueryBuddha(this).addClass(\"tab-opened\"); setTabbedSubmenuBoundries(jQueryBuddha(this)); }); /* set first tab of every tabbed submenu be opened */ jQueryBuddha(ulPath).find(\"ul.mm-submenu.tabbed>li:first-child\").each(function () { if (jQueryBuddha(this).parent().find(\".tab-opened\").length == 0) { jQueryBuddha(this).addClass(\"tab-opened\"); setTabbedSubmenuBoundries(jQueryBuddha(this)); } }); jQueryBuddha(ulPath).find(\".buddha-menu-item\").unbind(\"mouseenter.resizeSubmenus\"); jQueryBuddha(ulPath).find(\".buddha-menu-item\").bind(\"mouseenter.resizeSubmenus\", function () { setSubmenuBoundries(jQueryBuddha(this)); setContactSubmenuBoundries(jQueryBuddha(this)); if (jQueryBuddha(this).find(\".tab-opened\").length > 0) { setTabbedSubmenuBoundries(jQueryBuddha(this).find(\".tab-opened\")); } }); } else { if (activateMegaMenu) { jQueryBuddha(\".mega-hover\").removeClass(\"mega-hover\"); jQueryBuddha(\".buddha-menu-item.disabled\").removeClass(\"disabled\"); jQueryBuddha(ulPath).addClass(\"vertical-mega-menu\").removeClass(\"horizontal-mega-menu\"); jQueryBuddha(ulPath + \" .toggle-menu-btn\").show(); jQueryBuddha(ulPath).find(\"li.buddha-menu-item\").off(); jQueryBuddha(ulPath).find(\"li.buddha-menu-item a\").off(); var iconDistance = parseInt(jQueryBuddha(ulPath + \">li>a\").css(\"font-size\")); var totalPaddingLeft = parseInt(jQueryBuddha(ulPath + \">li\").css(\"padding-left\")) + parseInt(jQueryBuddha(ulPath + \">li>a\").css(\"padding-left\")); var paddingLeftSubSubmenus = totalPaddingLeft; if (totalPaddingLeft > 15) { paddingLeftSubSubmenus = 15; } var totalPaddingTop = parseInt(jQueryBuddha(ulPath + \">li\").css(\"padding-top\")) + parseInt(jQueryBuddha(ulPath + \">li>a\").css(\"padding-top\")); jQueryBuddha(\"#verticalMenuSpacing\").remove(); var styleSheet = '<style id=\"verticalMenuSpacing\" type=\"text/css\">'; styleSheet += ulPath + '.vertical-mega-menu>li>ul.mm-submenu.tree>li{padding-left:' + totalPaddingLeft + 'px !important;padding-right:' + totalPaddingLeft + 'px !important;}'; styleSheet += ulPath + '.vertical-mega-menu>li>ul.mm-submenu.tree>li ul.mm-submenu li {padding-left:' + paddingLeftSubSubmenus + 'px !important;padding-right:' + paddingLeftSubSubmenus + 'px !important;}'; styleSheet += ulPath + '.vertical-mega-menu>li ul.mm-submenu.simple>li{padding-left:' + totalPaddingLeft + 'px !important;padding-right:' + totalPaddingLeft + 'px !important;}'; styleSheet += ulPath + '.vertical-mega-menu>li>ul.mm-submenu.tabbed>li{padding-left:' + totalPaddingLeft + 'px !important;padding-right:' + totalPaddingLeft + 'px !important;}'; styleSheet += ulPath + '.vertical-mega-menu>li>ul.mm-submenu.tabbed>li>ul.mm-submenu>li {padding-left:' + paddingLeftSubSubmenus + 'px !important;padding-right:' + paddingLeftSubSubmenus + 'px !important;}'; styleSheet += ulPath + '.vertical-mega-menu>li ul.mm-submenu.mm-contact>li{padding-left:' + totalPaddingLeft + 'px !important;padding-right:' + totalPaddingLeft + 'px !important;}'; styleSheet += \"</style>\"; jQueryBuddha(\"head\").append(styleSheet); /* remove tab-opened classes */ jQueryBuddha(ulPath).find(\".tab-opened\").removeClass(\"tab-opened\"); jQueryBuddha(ulPath).find(\".buddha-menu-item>a>.toggle-menu-btn\").unbind(\"click.resizeSubmenus\"); jQueryBuddha(ulPath).find(\".buddha-menu-item>a>.toggle-menu-btn\").bind(\"click.resizeSubmenus\", function () { setSubmenuBoundries(jQueryBuddha(this).parent().parent()); setContactSubmenuBoundries(jQueryBuddha(this).parent().parent()); }); jQueryBuddha(ulPath).find(\".buddha-menu-item>.mm-submenu>li>a>.toggle-menu-btn\").unbind(\"click.resizeTabbedSubmenu\"); jQueryBuddha(ulPath).find(\".buddha-menu-item>.mm-submenu>li>a>.toggle-menu-btn\").bind(\"click.resizeTabbedSubmenu\", function () { if (jQueryBuddha(this).parent().parent().hasClass(\"mm-hovering\")) { setTabbedSubmenuBoundries(jQueryBuddha(this).parent().parent()); } }); forceMobile = false; } } jQueryBuddha(\".submenu-opened\").show(); if (panelOpened) { jQueryBuddha(\".horizontal-mega-menu>.buddha-menu-item\").unbind(\"mouseenter.addMegaHoverClass\"); jQueryBuddha(\".horizontal-mega-menu>.buddha-menu-item\").bind(\"mouseenter.addMegaHoverClass\", function () { jQueryBuddha(\".mega-hover\").removeClass(\"mega-hover\"); if (panelOpened) { jQueryBuddha(this).addClass(\"mega-hover\"); } }); } else { jQueryBuddha(\".mega-hover\").removeClass(\"mega-hover\"); } }", "function hoverOnNav() {\n\t\t\n\t\tif ($(window).width() >= 600 && cssua.ua.desktop && !cssua.ua.trident) {\n\t\t\t//hover nav event\n\t\t\t$('.nav-icon, .left-menu').hover(function(){\n\t\t\t\tactiveNav = $(this);\n\t\t\t\topenSubNav($(this));\n\t\t\t}, function(){\n\t\t\t\tcloseSubNav();\n\t\t\t});\n\t\t\t\n\t\t\t//hover on sub nav\n\t\t\t$('.sub-nav-list').hover(function(){\n\t\t\t\tactiveNav.addClass('active');\n\t\t\t\t$(this).stop().show();\n\t\t\t}, function(){\n\t\t\t\tcloseSubNav();\n\t\t\t});\n\t\t} else {\n\t\t\t//small window size\n\t\t\t$('.nav-icon, .left-menu, .sub-nav-list').unbind('mouseenter mouseleave');\n\t\t}\n\t}", "function togglemenu() {\n var vw = $(window)[0].innerWidth;\n if ($(\".pcoded-navbar\").hasClass('theme-horizontal') == false) {\n if (vw <= 1200 && vw >= 992) {\n $(\".pcoded-navbar\").addClass(\"navbar-collapsed\");\n }\n if (vw < 992 || vw > 1200) {\n $(\".pcoded-navbar\").removeClass(\"navbar-collapsed\");\n }\n }\n}", "function fixPositionSubmenu() {\n var menu = $('#main-nav .navbar-nav .dropdown-menu > .dropdown-submenu > .dropdown-menu');\n\n menu.each(function (e) {\n\n var leftPos = $(this).parent().offset().left + $(this).parent().width();\n if (leftPos + $(this).width() > $(\"body\").width()) {\n $(this).addClass(\"left\");\n } else {\n $(this).removeClass(\"left\");\n }\n });\n }", "function handleMobileNav_desktop(item){\n\n\t\tvar page_prev = item.attr(\"href\").split(\"#\")[0];\n\t\tvar page_id = item.attr(\"href\").split(\"#\")[1];\n\n\t\t//its not a normal link like \"blog.html\"\n\t\tif (page_id != undefined && (page_prev == undefined || page_prev == \"\")){\n\n\t\t\tif (page_id != 'home'){\n\t\t\t\t$('body').animate({scrollTop:$('.page#' + page_id).offset().top}, 750);\n\t\t\t}else{\n\t\t\t\t$('body').animate({scrollTop:0}, 750);\n\t\t\t}\n\n\t\t\t//navigation classes swap\n\t\t\t$(\".navigation li.active\").removeClass(\"active\");\n\t\t\t$('.navigation li a[href=\"#'+page_id+'\"]').parent().addClass(\"active\");\n\n\n\t\t\treturn false;\n\t\t}\n\n\t}", "function toggle_onclick($win,$navbar,width){\n if($win.width() <= 768){\n $navbar.css({left:`-${width}px`});\n } else {\n $navbar.css({left:'0px'});\n }\n}", "function lgMenu() {\n\t\t// unbind click events\n\t\t$('.menu-toggle a').off('click');\n\n\t\t// remove dynamic classes and span tags\n\t\t$('.main-nav').find('span.indicator').remove();\n\t\t$('.menu-toggle a').remove();\n\n\t\t// return windowState\n\t\twindowState = 'large';\n\t}", "function menuFixo(){\n\tif (!isiPad && !isiPhone && !isiAndroid) {\n\t\tvar menuFixo = $('.menuFixo'),\n\t\t\tposInicialMenuFixo = $('.blocoBolhas').offset().top;\n\n\t\tif (windowWidth > 1023 ){ menuFixo.show(); } else { menuFixo.hide();}\n\n\t\t$(window).on('scroll',function() {\n\t\t\tvar scr = $(window).scrollTop();\n\t\t\tif (scr >= posInicialMenuFixo) {\n\t\t\t\tmenuFixo.addClass('menuFixoShow');\n\t\t\t} else {\n\t\t\t\tmenuFixo.removeClass('menuFixoShow');\n\t\t\t}\n\t\t});\n\n\t\t// var top = 0;\n\t\t// $window.on('scroll load', function() {\n\t\t// \tvar sections = [];\n\t\t// \tvar sectionsTop = [];\n\t\t// \t$('.sessao').each(function(i){\n\t\t// \t\tvar $ele = $(this);\n\t\t// \t\tsections.push('#'+$ele.attr('id'));\n\t\t// \t\tsectionsTop.push($ele.offset().top - 100);\n\t\t// \t});\n\n\t\t// \tsections.push('#');\n\t\t// \tsectionsTop.push($('#wrapper').height());\n\n\t\t// \ttop = $window.scrollTop();\n\n\t\t// \tfor (var i = 0; i < sections.length; i++) {\n\t\t// \t\tif(top>=sectionsTop[i] && top<sectionsTop[i+1]){\n\t\t// \t\t\t$('.menuFixo .menuLink').removeClass('menuLinkAtivo');\n\t\t// \t\t\t$('.menuFixo').find('.menuLink[href$=\"'+sections[i]+'\"]').addClass('menuLinkAtivo');\n\t\t// \t\t}\n\t\t// \t}\n\t\t// });\n\t};\n}", "function mainMenu() {\n // Variables\n var var_window = $(window),\n navContainer = $('.nav-container'),\n pushedWrap = $('.nav-pushed-item'),\n pushItem = $('.nav-push-item'),\n pushedHtml = pushItem.html(),\n pushBlank = '',\n navbarToggler = $('.navbar-toggler'),\n navMenu = $('.nav-menu'),\n navMenuLi = $('.nav-menu ul li ul li'),\n closeIcon = $('.navbar-close');\n // navbar toggler\n navbarToggler.on('click', function() {\n navbarToggler.toggleClass('active');\n navMenu.toggleClass('menu-on');\n });\n // close icon\n closeIcon.on('click', function() {\n navMenu.removeClass('menu-on');\n navbarToggler.removeClass('active');\n });\n\n // adds toggle button to li items that have children\n navMenu.find('li a').each(function() {\n if ($(this).next().length > 0) {\n $(this)\n .parent('li')\n .append(\n '<span class=\"dd-trigger\"><i class=\"flaticon-down-arrow\"></i></span>'\n );\n }\n });\n // expands the dropdown menu on each click\n navMenu.find('li .dd-trigger').on('click', function(e) {\n e.preventDefault();\n $(this)\n .parent('li')\n .children('ul')\n .stop(true, true)\n .slideToggle(350);\n $(this).parent('li').toggleClass('active');\n });\n\n // check browser width in real-time\n function breakpointCheck() {\n var windoWidth = window.innerWidth;\n if (windoWidth <= 1199) {\n navContainer.addClass('breakpoint-on');\n\n pushedWrap.html(pushedHtml);\n pushItem.hide();\n } else {\n navContainer.removeClass('breakpoint-on');\n\n pushedWrap.html(pushBlank);\n pushItem.show();\n }\n }\n\n breakpointCheck();\n var_window.on('resize', function() {\n breakpointCheck();\n });\n }", "function menuForSmallScreen() {\n navMenuList.hide();\n\n hideMenuBtn.addClass(ClassName.NONE);\n showMenuBtn.removeClass(ClassName.NONE);\n\n function toggleSmallMenu() {\n navMenuList.fadeToggle();\n toggleButtons();\n }\n\n function toggleMenuEventHandler(event) {\n event.preventDefault();\n toggleSmallMenu();\n }\n\n hideMenuBtn.click(toggleMenuEventHandler);\n showMenuBtn.click(toggleMenuEventHandler);\n menuEl.click(function () {\n setTimeout(toggleSmallMenu, 600);\n });\n }", "function togglemenu() {\r\n var vw = $(window)[0].innerWidth;\r\n if ($(\".pcoded-navbar\").hasClass('theme-horizontal') == false) {\r\n if (vw <= 1200 && vw >= 992) {\r\n $(\".pcoded-navbar\").addClass(\"navbar-collapsed\");\r\n }\r\n if (vw < 992) {\r\n $(\".pcoded-navbar\").removeClass(\"navbar-collapsed\");\r\n }\r\n }\r\n}", "function largeMenu() {\n $('#navigation-large').singlePageNav({\n offset: $('#navbar').outerHeight(),\n filter: ':not(.external)',\n speed: 750,\n currentClass: 'active',\n\n beforeStart: function() {},\n onComplete: function() {}\n });\n }", "function resizeMenu () {\n _sw = window.innerWidth ? window.innerWidth : $(window).width()\n\n if (_sw < 992) {\n $('.menu-subtitle').next('ul').addClass('hidden')\n $('.cities').addClass('hidden')\n $('.menu-subtitle').addClass('menumobile')\n $('.cities').addClass('hidden').removeClass('open')\n\n $('ul.navbar-nav').find('.nav-link').bind('touchstart touchend').on('click', function (e) {\n e.preventDefault()\n $('.nav-item').removeClass('active')\n if ($(this).parents('.nav-item').find('> .menu-option').hasClass('open-option')) {\n $(this).parents('.nav-item').removeClass('active').find('> .menu-option').removeClass('open-option').stop().slideUp('fast')\n } else {\n $('.menu-option').removeClass('open-option').stop().slideUp('fast')\n $(this).parents('.nav-item').addClass('active').find('> .menu-option').addClass('open-option').stop().slideDown()\n }\n })\n } else {\n $('.menu-subtitle').next('ul').removeClass('hidden')\n $('.cities').addClass('hidden')\n $('.menu-subtitle').removeClass('menumobile')\n $('.cities').eq(0).removeClass('hidden').addClass('open')\n\n $('ul.navbar-nav').find('li.nav-item').on('mouseenter', function () {\n $('.admin-vuelo').removeClass('active')\n $(this).addClass('active')\n if ($('.country-list').hasClass('open')) {\n $('.language').children('.country-list').slideUp('fast').removeClass('open').addClass('close')\n $('.language').children('.arrow').removeClass('up').addClass('down')\n // resizeMenu()\n\n }\n if ($(this).hasClass('open-option')) {\n $(this).find('> .menu-option').removeClass('open-option').stop().slideUp('fast')\n } else {\n $(this).find('> .menu-option').addClass('open-option').stop().slideDown()\n }\n\n // se oculta user\n $('.userWrp .arrow').removeClass('up')\n $('.user-menu').stop().slideUp('fast')\n }).on('mouseleave', function () {\n $(this).removeClass('active')\n $(this).find('> .menu-option').removeClass('open-option').stop().slideUp('fast')\n }).on('click', function (e) {\n // e.preventDefault() IJ MAX CHANGE menu links\n })\n }\n\n $('.menu-option').hide()\n }", "function hideMobileMenu() {\n if ($(window).width() > 699) {\n $(\"#mobile-menu\").css(\"display\", \"none\");\n $(\"body\").css(\"overflow\", \"auto\");\n }\n}", "if ($(window).width() < 768) {\n $(\"#nav ul\").addClass(\"hidden\");\n }", "function menuForLargeScreen() {\n navMenuList.show();\n\n timerObj = setTimeout(function () {\n menuPanel.addClass(ClassName.MENU_PANEL__COMPRESSED);\n hideMenuBtn.addClass(ClassName.NONE);\n showMenuBtn.removeClass(ClassName.NONE);\n }, 5000);\n\n function toggleMenuEventHandler(event) {\n event.preventDefault();\n toggleButtons();\n menuPanel.toggleClass(ClassName.MENU_PANEL__COMPRESSED);\n }\n\n hideMenuBtn.click(toggleMenuEventHandler);\n showMenuBtn.click(toggleMenuEventHandler);\n\n menuPanel.mouseenter(function () {\n clearTimeout(timerObj);\n menuPanel.removeClass(ClassName.MENU_PANEL__COMPRESSED);\n hideMenuBtn.removeClass(ClassName.NONE);\n showMenuBtn.addClass(ClassName.NONE);\n });\n menuPanel.mouseleave(function () {\n if (!menuPanel.hasClass(ClassName.MENU_PANEL__COMPRESSED)) {\n timerObj = setTimeout(function () {\n menuPanel.addClass(ClassName.MENU_PANEL__COMPRESSED);\n toggleButtons();\n }, 2000);\n }\n });\n }", "function responsive_menu() {\n if(is_tablet_and_down()) {\n $('.mobile-menu .lines-button').on('click', function() {\n $(this).toggleClass('active');\n $('.mobile-side-menu').toggleClass('open');\n $('.mobile-menu-push').toggleClass('mobile-menu-push-to-left');\n });\n } else {\n $('.mobile-menu .lines-button').off('click');\n $('.pill-container').off('click');\n $('.reaction-list li').off('click');\n }\n}" ]
[ "0.72082615", "0.7170672", "0.70101947", "0.6955174", "0.694356", "0.68662584", "0.6816386", "0.67965406", "0.6530324", "0.65302855", "0.6519954", "0.6510646", "0.64004153", "0.6387715", "0.63789433", "0.6367431", "0.63571006", "0.63373625", "0.632946", "0.6308267", "0.6267073", "0.62601376", "0.62526405", "0.62506896", "0.623767", "0.6227407", "0.6227339", "0.6225389", "0.6206071", "0.6200972", "0.61983585", "0.6187614", "0.61808753", "0.6173418", "0.61728907", "0.6168469", "0.61491525", "0.61443186", "0.6130118", "0.6121977", "0.61162484", "0.61162484", "0.61135966", "0.61135966", "0.61135966", "0.6108495", "0.6107296", "0.61022", "0.6101964", "0.6096527", "0.60904235", "0.6089508", "0.6083131", "0.60830677", "0.6069708", "0.6065891", "0.6058479", "0.60415787", "0.6030356", "0.6029197", "0.6021864", "0.6021864", "0.6017631", "0.6011441", "0.60021985", "0.59921604", "0.59853005", "0.5983853", "0.5978717", "0.5975436", "0.59659123", "0.5963436", "0.59369284", "0.592424", "0.5919197", "0.59150535", "0.5913416", "0.5899711", "0.5890469", "0.5887529", "0.5882885", "0.5878261", "0.58653885", "0.5856909", "0.58542365", "0.5852461", "0.5847836", "0.5840479", "0.58373946", "0.5835962", "0.5829714", "0.5816194", "0.58124876", "0.58101237", "0.58000666", "0.57945883", "0.57937294", "0.5792778", "0.5789012", "0.5784391" ]
0.6939183
5
remove container in window when it's smaller than 992px
function checkWindowSize() { if ($(window).width() < 990) { $("#body").removeClass("container"); } else $("#body").addClass("container") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addContainer(){\r\n if($(window).width() >= 992){\r\n containerer.addClass('container');\r\n } else if(containerer.hasClass('container') && $(window).width() < 992 ){\r\n containerer.removeClass('container');\r\n }\r\n}", "function resize() {\nif ( $(window).width() > 1370) { \n $(\"#main\").addClass('container');\n $(\"#main\").removeClass('container-fluid');\n}\nelse\n{\n $(\"#main\").addClass('container-fluid');\n $(\"#main\").removeClass('container');\n}\n}", "function toggle() {\n if (window.innerWidth < 751) {\n menuStyle.removeAttribute(\"class\", \"responsive-style\"); \n }\n}", "function panel_resize(){\n\t\tvar width = $(window).width();\n\t\tif( width > 991 ) {\n\t\t\tif($(\".header_s #slidepanel\").length ) {\n\t\t\t\t$(\".header_s #slidepanel\").removeAttr(\"style\");\n\t\t\t}\n\t\t}\n\t}", "function removeBreakMobile() {\n if ($(window).width() <= 768) {\n // console.log(\"mobile remove br\")\n $('.mobile-masthead').find('.masthead-title br').remove();\n }\n }", "function fullWidthMobileMenu(){\n\t\tif(jq(window).innerWidth() <= 768){\n\t\t\tjq(\"#mainMenu .container-fluid\").removeClass(\"container-fluid\");\n\t\t}\n\t\telse{\n\t\t\tjq(\"#mainMenu .container-fluid\").addClass(\"container-fluid\");\n\t\t}\n\t}", "function checkWidth() {\r\n if ($window.width() < 992) {\r\n $('.navbar .navbar-collapse > ul > li.dropdown > a').removeAttr('class');\r\n }\r\n }", "function windowResizing() {\n if ($(window).width() > 992) {\n $(\"body\").removeClass(\"menuExpanded\");\n } else if ($(window).width() < 992 && $(\"#mobile-nav\").hasClass('show')) {\n $(\"body\").addClass(\"menuExpanded\");\n }\n}", "function checkOnResize(){\r\n if(window.innerWidth > 1100){\r\n if(pJS.particles.nb != 150){\r\n console.log('desktop mode')\r\n pJS.fn.vendors.destroy();\r\n pJS_desktop();\r\n }\r\n }else{\r\n if(pJS.particles.nb == 150){\r\n console.log('mobile mode');\r\n pJS.fn.vendors.destroy();\r\n pJS_mobile();\r\n }\r\n }\r\n}", "resize () {\n if (window.innerWidth >= 992) {\n this.button.classList.remove('is-active')\n this.button.classList.add('collapsed')\n this.setOverlay(false)\n this.navbarCollapse.classList.remove('show')\n } else {\n this.setOverlay(true)\n }\n }", "function sticky(){\n if($( window ).width() >= 992){\n //$(\"#full_width div:first-child\").removeClass(\"container\");\n $(\"#sticker\").sticky({\n topSpacing:0,\n zIndex: 1,\n getWidthFrom: '#full_width',\n responsiveWidth: false\n });\n \n }else{\n //$(\"#full_width div:first-child\").addClass(\"container\");\n $(\"#sticker\").unstick();\n }\n}", "function hideMainArea(){\n if(window.screen){\n var width=screen.width;\n var height=screen.height;\n \n\n if(width<=992){\n mainArea.style=\"display:none\";\n }\n }\n}", "function breakpointCheck() {\n var windoWidth = window.innerWidth;\n if (windoWidth <= 991) {\n navContainer.addClass('breakpoint-on');\n\n pushedWrap.html(pushedHtml);\n pushItem.hide();\n } else {\n navContainer.removeClass('breakpoint-on');\n\n pushedWrap.html(pushBlank);\n pushItem.show();\n }\n }", "function mobile(){\n\t$(\".window-controls\").remove();\n}", "function deviceControll() {\n if( windowSize( 'width' ) < 768 ) {\n $('body').removeClass('desktop').removeClass('tablet').addClass('mobile');\n }\n else if( windowSize( 'width' ) < 992 ){\n $('body').removeClass('mobile').removeClass('desktop').addClass('tablet');\n }\n else {\n $('body').removeClass('mobile').removeClass('tablet').addClass('desktop');\n }\n }", "function onResize(){\n if(window.innerWidth >= 768){\n document.body.classList.remove('nav-open');\n };\n }", "function onResize() {\n if ($(window).width() < 751) {\n $('nav').removeClass('fixed-top');\n $('nav').addClass('fixed-bottom');\n $('#footer').removeClass('d-block');\n $('#footer').addClass('d-none');\n } else {\n $('nav').removeClass('fixed-bottom');\n $('nav').addClass('fixed-top');\n $('#footer').removeClass('d-none');\n $('#footer').addClass('d-block');\n }\n}", "function mediaQuery(){\r\n let screenWidth = $(document).width();\r\n if(screenWidth<=768 ){\r\n $('.resources').hide();\r\n $('.networks').hide();\r\n $('.main-nav').hide();\r\n $('.solutions').show();\r\n $('.solutions-content').hide();\r\n }\r\n else if(screenWidth<1280 && screenWidth>768){\r\n $('.main-nav').show();\r\n $('.solutions').show();\r\n $('.solutions-content').show();\r\n $('.resources').hide();\r\n $('.networks').hide();\r\n }\r\n }", "function isMobileResolution() {\n return $(window).width() < 992;\n}", "function resetBackground() {\n if (window.innerWidth >= 768) {\n filterBG_md.style.display = 'none';\n filterBG_lg.style.display = 'block';\n } else {\n filterBG_lg.style.display = 'none';\n filterBG_md.style.display = 'block';\n }\n }", "function responsive() {\n // Do these on every screen resize\n\n\n // Do these on certain widths\n if ( $(window).width() > 600 ) { // above mobile size\n $('#primary-navigation .menu').removeAttr('style');\n $('#mobile-menu-button').removeClass('has-open');\n } else { // mobile size\n\n }\n }", "function checkScreenSize() {\n var screen_width = $( window ).width();\n if(screen_width > 992) {\n $(\"#main\").addClass(\"sidebar-active\");\n $(\"#sidebarCollapseIcon\").removeClass(\"fa-times\");\n } else {\n $(\"#main\").removeClass(\"sidebar-active\");\n }\n }", "function windowChange (){\n if ($(window).width() >= 649) {\n $('.links').removeClass('show')\n }\n}", "function hideSidebar()\n{\n if(window.innerWidth <= 991)\n {\n $('body').removeClass('sidebar-open');\n $('body').addClass('sidebar-collapse');\n }\n}", "function breakpointCheck() {\n var windoWidth = window.innerWidth;\n if (windoWidth <= 1199) {\n navContainer.addClass('breakpoint-on');\n\n pushedWrap.html(pushedHtml);\n pushItem.hide();\n } else {\n navContainer.removeClass('breakpoint-on');\n\n pushedWrap.html(pushBlank);\n pushItem.show();\n }\n }", "function removeMobileSearchPanelOnDesktop() {\n const mobileWindow = $(window).width() <= mobileSearchScreenSize;\n\n if (!mobileWindow) {\n $body.removeClass(mobileSearchOpenedClass);\n }\n}", "function unresponsiveIt() {\n var w = window.innerWidth;\n var menu = document.getElementById('menu');\n if(w > 910) {\n menu.removeAttribute('style');\n }\n else {\n if(!menu.hasAttribute('style')) {\n menu.style.display = \"none\";\n }\n }\n\n}", "checkScreenSize() {\n if (window.innerWidth > 768) {\n this.navClose();\n }\n }", "function closeNav() {\r\n if ($(window).width() < 800) {\r\n $(\"#holder\").width('0');\r\n $(\"#closebtn\").css('display', 'none');\r\n }\r\n}", "function removeGridChilds() {\n while (sketchContainer.firstChild) {\n sketchContainer.removeChild(sketchContainer.lastChild);\n }\n}", "function onWindowResize()\n {\n if ($(window).innerWidth() < 752) {\n $('.collapse-control:not(.collapsed)').click();\n }\n }", "function removeOverlay(window) {\n var prebootOverlay = window.document.body.querySelector('#prebootOverlay');\n if (prebootOverlay) {\n prebootOverlay.style.display = 'none';\n }\n }", "dispose() {\n $(window).off(`resize.grid.${this._gridUid}`);\n }", "function autoMPC() {\n if($(document).width()<768) {\n $('.mpc_panel').addClass('hidden');\n $('body').css('height',$('body').height()+$('.mpc_panel').height()+'px');\n }\n else if($(document).width()>767){\n $('.mpc_panel').removeClass('hidden');\n }\n}", "function loading() {\n if (window.innerWidth < 992) {\n removeEvent()\n } else {\n setTimeout(() => loadingSlider(3, 0), 0);\n }\n}", "function unSlickSmall($slick, slickSettings) {\n $(window).on(\"resize\", function() {\n if (Foundation.MediaQuery.current == \"small\") {\n if ($slick.hasClass(\"slick-initialized\")) {\n $slick.slick(\"unslick\");\n }\n return;\n }\n\n if (!$slick.hasClass(\"slick-initialized\")) {\n return $slick.slick(slickSettings);\n }\n });\n }", "function maximizeMobile() {\n $(window).on(\"breakpoint-updated\", function () {\n if ($('.ls-window-xs').length) {\n maximizeSidebar();\n }\n });\n }", "function navFixResponsive() {\r\n // get window width\r\n let winWidth = window.innerWidth,\r\n navSettings = document.querySelector('nav .navbar-nav.settings'),\r\n navCollapse = document.querySelector('nav .navbar-collapse');\r\n \r\n if (winWidth <= 991) {\r\n // move notification and language outside the parent\r\n if (!navSettings.classList.contains('fix-responsize')) {\r\n // add class 'fix-responsive'\r\n navSettings.classList.add('fix-responsize');\r\n navSettings.closest('.container-fluid').insertBefore(navSettings, navSettings.parentElement);\r\n }\r\n } else {\r\n // check if class 'fix-responsive' exist.. if true .. inject the notification and language button to the 'navbar-collapse' in big screen\r\n if (navSettings.classList.contains('fix-responsize')) {\r\n navSettings.classList.remove('fix-responsize');\r\n navCollapse.insertAdjacentElement('beforeend', navSettings);\r\n navCollapse.style.opacity = 1;\r\n navCollapse.style.height = 'inherit';\r\n }\r\n }\r\n }", "function fixResponsiveArtifacts(evnt) {\n if ($(this).width() > options.params.responsiveWidth) {\n options.jq.contentWell.removeAttr('style');\n options.jq.navContainer.removeAttr('style');\n options.jq.navContent.removeAttr('style');\n options.jq.header.removeAttr('style');\n options.jq.navToggle.removeClass('open, closed');\n }\n }", "function togglemenu() {\n var vw = $(window)[0].innerWidth;\n if ($(\".pcoded-navbar\").hasClass('theme-horizontal') == false) {\n if (vw <= 1200 && vw >= 992) {\n $(\".pcoded-navbar\").addClass(\"navbar-collapsed\");\n }\n if (vw < 992 || vw > 1200) {\n $(\".pcoded-navbar\").removeClass(\"navbar-collapsed\");\n }\n }\n}", "function unSlickLarge($slick, slickSettings) {\n $(window).on(\"resize\", function() {\n if (Foundation.MediaQuery.atLeast(\"medium\")) {\n if ($slick.hasClass(\"slick-initialized\")) {\n $slick.slick(\"unslick\");\n }\n return;\n }\n\n if (!$slick.hasClass(\"slick-initialized\")) {\n return $slick.slick(slickSettings);\n }\n });\n }", "function priceOnMobile(){\n\tif ($(window).width() < 320){\n\t\t$(\".price\").removeClass(\"col-xs-2\").addClass(\"col-xs-12\");\n\t}\n}", "function hideMenuOnBigScreen() {\n if (window.innerWidth > 555) {\n closeSideNav();\n }\n}", "function togglemenu() {\r\n var vw = $(window)[0].innerWidth;\r\n if ($(\".pcoded-navbar\").hasClass('theme-horizontal') == false) {\r\n if (vw <= 1200 && vw >= 992) {\r\n $(\".pcoded-navbar\").addClass(\"navbar-collapsed\");\r\n }\r\n if (vw < 992) {\r\n $(\".pcoded-navbar\").removeClass(\"navbar-collapsed\");\r\n }\r\n }\r\n}", "function checkWow() {\n if ($(window).width() > '1000') {\n console.log('>1000');\n $('.work-desc:first').removeClass('wow slideInRight');\n } else {\n $('.work-desc:first').addClass('wow slideInRight');\n }\n}", "clearBoard () {\n $('.mushroom-container').empty();\n }", "function checkIfMobile() {\n if (!matchMedia(\"(min-width: 768px)\").matches) {\n Draggable.create(\".about__images__track\", {\n type: \"x\",\n bounds: {\n minX: -240,\n maxX: 0,\n },\n edgeResistance: 0.7,\n inertia: true,\n snap: [0, -240],\n });\n }\n}", "function remove() {\n\t\t\t\t\t$( self ).off( 'scroll.onScreen resize.onScreen' );\n\t\t\t\t\t$( window ).off( 'resize.onScreen' );\n\t\t\t\t}", "cleanSkeletonContainer() {\n const skeletonWrap = document.body.querySelector('#nozomi-skeleton-html-style-container');\n if (skeletonWrap) {\n removeElement(skeletonWrap);\n }\n }", "function removeResponsiveScrollOverflows(){\n var scrollOverflowHandler = self.options.scrollOverflowHandler;\n forEachSectionAndSlide(function(element){\n if(element.closest(SECTION_SEL).hasClass(AUTO_HEIGHT_RESPONSIVE)){\n scrollOverflowHandler.remove(element);\n }\n });\n }", "function replaceCardsMobile() {\n let mobileCards = document.getElementById('mobile-container');\n mobileCards.remove();\n}", "function setSidebarPos() {\n var detach = $('body').find(\".main-sidebar\").detach();\n if (window.matchMedia('(min-width: 992px)').matches) {\n $(detach).appendTo($('body').find(\"#sidebarStatic\"));\n $('.slideout-panel').css({'transform':'translateX(0)'});\n } else {\n $(detach).appendTo($('body').find(\"#sidebarSlidout\"));\n }\n}", "function resetContentResize() {\n $(window).off(\"resize\", contentResize);\n $(\"#music-content\").removeAttr(\"style\");\n }", "function removeResponsiveScrollOverflows() {\n var scrollOverflowHandler = self.options.scrollOverflowHandler;\n forEachSectionAndSlide(function(element) {\n if (element.closest(SECTION_SEL).hasClass(AUTO_HEIGHT_RESPONSIVE)) {\n scrollOverflowHandler.remove(element);\n }\n });\n }", "_removeContainersInBody() {\n const that = this;\n\n if (that.dropDownAppendTo !== null && !that._minimized) {\n for (let i = 0; i < that._containersInBody.length; i++) {\n that._dropDownParent.removeChild(that._containersInBody[i]);\n }\n }\n }", "function closeMenusOnResize() {\n\t\tif (window.innerWidth >= 768) {\n\t\t\tcloseMenus();\n\t\t\t// collapse.classList.add('mtn-navbar__collapse');\n\t\t\tcollapse.classList.remove('in');\n\t\t\ttoggle.classList.add('navbar-collapsed');\n\t\t}\n\t}", "function isMobile() { return $(window).width() < 768 }", "onResize() {\n let mobile = window.innerWidth < 800\n if (mobile !== this.isMobile) {\n this.isMobile = mobile\n }\n }", "function clearMinionEnvironment() {\n\n // Clear the frontend\n while (minionObject.div.firstChild) {\n minionObject.div.removeChild(minionObject.div.firstChild);\n }\n minionObject.div.style.width = '100%';\n\n // Clear the input data channels\n if (inputDataChannels){\n inputDataChannels.forEach(function (dataChannel) {\n if (dataChannel) {\n dataChannel.removeEventListener(divId);\n }\n });\n }\n\n // Clear the visualization\n if (d34){\n d34.select('#' + divId + ' svg').remove();\n }\n }", "function hideDetailsProject(){\n $.pageslide.close();\n $(\"#active_project_wrapper\").html('').hide();\n $('#content_projects').fadeIn();\n\n if($(window).width() > 768){\n $(\"#projects\").css(\"margin-left\",\"365px\");\n }\n $('#sidebar').animate({left:'0'});\n $(\"html\").css(\"overflow\", \"auto\");\n }", "function addWidth() {\n if (window.innerWidth <= 767) {\n $('.about-graph').width(window.innerWidth - 100);\n } else {\n $('.about-graph').removeAttr('style');\n }\n }", "function addWidth() {\n if (window.innerWidth <= 767) {\n $('.about-graph').width(window.innerWidth - 100);\n } else {\n $('.about-graph').removeAttr('style');\n }\n }", "fixHolder() {\n $(\"#img-holder\").removeProp(\"fluidRef\")\n $(\".holderjs-fluid\").remove()\n Holder.run()\n }", "function menuhrres() {\n var vw = $(window)[0].innerWidth;\n if (vw < 992) {\n setTimeout(function() {\n $(\".sidenav-horizontal-wrapper\").addClass(\"sidenav-horizontal-wrapper-dis\").removeClass(\"sidenav-horizontal-wrapper\");\n $(\".theme-horizontal\").addClass(\"theme-horizontal-dis\").removeClass(\"theme-horizontal\");\n }, 400);\n } else {\n setTimeout(function() {\n $(\".sidenav-horizontal-wrapper-dis\").addClass(\"sidenav-horizontal-wrapper\").removeClass(\"sidenav-horizontal-wrapper-dis\");\n $(\".theme-horizontal-dis\").addClass(\"theme-horizontal\").removeClass(\"theme-horizontal-dis\");\n }, 400);\n }\n}", "function fixClear(){\n\t\tif((verify_device.detect() == 'desktop')){\n\n\t\t\tvar _win = $(window).width();\n\t\t\tif(_win < 1024){\n\t\t\t\t$('.header_w').css('position','absolute');\n\t\t\t}else{\n\t\t\t\t$('.header_w').css('position','fixed');\n\t\t\t}\n\t\t}\n\t}", "if ($(window).width() < 768) {\n $(\"#nav ul\").addClass(\"hidden\");\n }", "function hidePageContainers() {\n var leftPanelScope = getLeftPanelScope();\n if (Utils.isMobile()) {\n leftPanelScope && leftPanelScope.collapse();\n WM.element(roleSelector(HEADER_CLASS_NAME) + \" \" + classSelector(SEARCH_CONTAINER_CLASS_NAME)).hide();\n $rootScope.sidebarCollapsed = true;\n }\n }", "_unsetBreakpoints() {\n window.dispatchEvent(\n new CustomEvent(\"responsive-element-deleted\", {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: this\n })\n );\n }", "function addWindowResizeListener() {\n $(window).resize(function() {\n if (isMobileView()) {\n addHamburgerClick();\n } else {\n if (!$('#toc-column').hasClass('in')) {\n $('.breadcrumb-hamburger-nav').trigger('click');\n }\n $('#breadcrumb-hamburger').hide();\n $('#breadcrumb-hamburger-title').hide();\n setContainerHeight();\n }\n });\n}", "function hideSidebar() {\n if (window.innerWidth <= smValue) {\n sidebar.classList.add(hideClass);\n } else {\n sidebar.classList.remove(hideClass);\n }\n}", "function hideNav() {\n\tif ($(window).width() <= 800){\n \t toggleNavElements();\n removeNavDropdownLinks();\n }\n}", "function checkWidth() {\n\tvar width = $(window).width();\n\t$(window).resize(function(){\n\t if($(this).width() != width){\n\t width = $(this).width();\n\t if (width < 1024) {\n\t \t$('div.hidden').css('display', 'none');\n\t }\n\t }\n\t});\n}", "function replaceDonate(){\n var wrap = $(\".event-money-wrap\");\n var eventInfo = $(\".event-info-top-replace\");\n if(viewportSize.getWidth() < 768){\n $(\".company-content .event-money-wrap\").remove();\n $(\".event-info-top-replace\").remove();\n $(\".spot-mobile-money\").before(wrap);\n $(\".col-left-campaing\").prepend(eventInfo);\n }else{\n $(\".company-content .event-money-wrap\").remove();\n $(\".event-info-top-replace\").remove();\n $(\".event-extra-info\").prepend(wrap);\n $(\".gradient-bg-replace\").prepend(eventInfo);\n }\n}", "function removeLogoGrid() {\n /* Remove max/min width styling to allow resize on draw */\n document.getElementById(\"logoContainer\").style.removeProperty(\"max-width\");\n document.getElementById(\"logoContainer\").style.removeProperty(\"min-width\");\n\n c4.logo.animState = false; //Set the global animState to false to stop any active animations\n\n dataGridDisplayRemove(\"logoGrid\"); //Remove the logoGrid dataGridDisplay\n}", "function heroContent() {\t\n var winHeight = $(window).innerHeight();\n\t\n // @screen width => 992px\n if ($(window).width() >= 992) {\n var heroContentMargin = -($('.hero-content').height() / 2);\n\t\t\t\n $('.hero-content').css('margin-top', heroContentMargin);\n }\n\t\n\t// @screen width => 768px and <= 991px\n\telse if ($(window).width() >= 768 && $(window).width() <= 991) {\n var heroContainerHeight = $('#hero > .container').height(); \n\t\t\n if ((winHeight - 100) <= heroContainerHeight) {\n $('#hero > .container').css('margin', '110px 0 60px');\n }\n\t\t\n else {\n var heroContainerMargin = (50 + ((winHeight - 100) - heroContainerHeight)) / 2;\n\t\t\n $('#hero > .container').css('margin-top', heroContainerMargin);\n }\n\t}\n\t\n\t// @screen width <= 767px\n\telse {\n var heroContainerHeight = $('#hero > .container').height(); \n\t\t\n if ((winHeight - 50) <= heroContainerHeight) {\n \n }\n\t\t\n else {\n var heroContainerMargin = (50 + (winHeight - heroContainerHeight)) / 2;\n\t\t\n $('#hero > .container').css('margin-top', heroContainerMargin);\n }\n\t};\n }", "closeMenusOnResize(collapse, dropdowns) {\n if (document.body.clientWidth >= 768) {\n this.closeMenus(dropdowns);\n collapse.classList.add('collapse');\n collapse.classList.remove('in');\n }\n }", "static responsiveness() {\n if (Game.mql.matches) { // min-width 768px\n Game.width = 720;\n } else {\n Game.width = window.innerWidth - 40;\n }\n // update width\n Game.canvas.width = Game.width;\n //! reset array\n Game.goldSectorsArr = [5];\n }", "function responsive(){\n \t \tif(options.responsive){\n \t \t\tvar isResponsive = container.hasClass('fp-responsive');\n \t \t\tif ($(window).width() < options.responsive ){\n \t \t\t\tif(!isResponsive){\n \t \t\t\t\t$.fn.fullpage.setAutoScrolling(false, 'internal');\n \t \t\t\t\t$('#fp-nav').hide();\n \t\t\t\t\t\tcontainer.addClass('fp-responsive');\n \t \t\t\t}\n \t \t\t}else if(isResponsive){\n \t \t\t\t$.fn.fullpage.setAutoScrolling(originals.autoScrolling, 'internal');\n \t \t\t\t$('#fp-nav').show();\n \t\t\t\t\tcontainer.removeClass('fp-responsive');\n \t \t\t}\n \t \t}\n \t }", "_showContainer() {\n this.$container.removeClass('d-none');\n }", "function adaptToScreenSize() {\n /* This function is a container for any changes that need to be made to the DOM\n When the DOM is ready or when the window resizes. */\n if (window.innerWidth <= 800) {\n $('.scroll-follow-breakpoint').append($('.more-then-flooring-right'));\n } else if (window.innerWidth > 800) {\n $($build.append($('.more-then-flooring-right')));\n }\n }", "function removeUnnecessaryScrollWindows() {\n if ($('.home-features-stories-cont .custom-scroll').length > 0) {\n $('.home-features-stories-cont .custom-scroll').removeClass('custom-scroll');\n }\n\n if ($('.todays-varian-item.referrals.auto-section .custom-scroll').length > 0) {\n $('.todays-varian-item.referrals.auto-section .custom-scroll').removeClass('custom-scroll');\n }\n\n if ($('.todays-varian-item.our-people-bg.auto-section .custom-scroll').length > 0) {\n $('.todays-varian-item.our-people-bg.auto-section .custom-scroll').removeClass('custom-scroll');\n }\n\n if ($('.todays-varian-item.our-location-bg.auto-section .custom-scroll').length > 0) {\n $('.todays-varian-item.our-location-bg.auto-section .custom-scroll').removeClass('custom-scroll');\n }\n\n if ($('.todays-varian-item.how-do-i.auto-section .custom-scroll').length > 0) {\n $('.todays-varian-item.how-do-i.auto-section .custom-scroll').removeClass('custom-scroll');\n }\n\n if ($('.Emergency-bg .custom-scroll').length > 0) {\n $('.Emergency-bg .custom-scroll').removeClass('custom-scroll');\n }\n }", "function cleanup () {\n angular.element($window).off('resize', positionDropdown);\n if ( elements ){\n var items = 'ul scroller scrollContainer input'.split(' ');\n angular.forEach(items, function(key){\n elements.$[key].remove();\n });\n }\n }", "function removeGrid() {\n console.log(\"REDRAW\");\n const list = document.getElementsByClassName(\"grid-row\");\n for (let i = list.length - 1; 0 <= i; i--)\n if (list[i] && list[i].parentElement)\n list[i].parentElement.removeChild(list[i]);\n gridSize();\n}", "function win_resize() {\n var win_resized_width = getViewport()[0];\n var win_resized_height = getViewport()[1];\n\n if (win_resized_width < 810) {\n $('.nav-level-2-menu').css('width',win_resized_width);\n if ($('#nav-mask').length < 1 ){\n $('body').append('<div id=\"nav-mask\"/>')\n }\n }\n}", "function removeBannerPadding() {\r\n\t\tif ($(window).width() < 1190) {\r\n\t\t\t$(\"#bannerwrapper\").css(\"padding-left\", \"0px\");\r\n\t\t}\r\n\t}", "function windowMobile() {\n\tvar size = $(window).width();\n\tif(size<768) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function removeDropDown(x) {\n if (x.matches) { // If media query matches\n document.getElementById('dropdown').style.display = \"none\"; // Remove DropDown\n } else {\n document.getElementById('dropdown').style.display = \"initial\"; //Bring DropDown back\n }\n}", "function postsCarousel() {\n var checkWidth = $(window).width();\n var owlPost = $(\"#counter_mobile_slider\");\n if (checkWidth > 768) {\n if (owlPost.length == 1) {\n if (typeof owlPost.data('owl.carousel') != 'undefined') {\n owlPost.data('owl.carousel').destroy();\n }\n }\n owlPost.removeClass('owl-carousel');\n } else if (checkWidth < 768) {\n owlPost.addClass('owl-carousel');\n owlPost.owlCarousel({\n items: 1,\n slideSpeed: 1000,\n touchDrag: true,\n mouseDrag: true,\n autoplay: true,\n autoplaySpeed: 1000,\n dots: true,\n loop: true\n });\n }\n }", "function InitWorksContHeight() {\n if ($(window).width() > 768) {\n var works_height = $(window).height() - 185;\n var item_margin = ($(window).height() - works_height) * 0.9;\n\n $('.works-container').height(works_height);\n $('.works-container .work').css({\n 'margin-top': item_margin,\n 'margin-bottom': item_margin\n });\n }\n }", "function mySetupFunctionX() {\n if ($(window).width() <= 767) {\n $('.specialDiv1').css('visibility', 'visible');\n $('.specialDiv2').css('visibility', 'hidden');\n }\n \n else {\n $('.specialDiv1').css('visibility', 'hidden');\n $('.specialDiv2').css('visibility', 'visible');\n }\n}", "remove() {\n this.$mainContainer.parentNode.removeChild(this.$mainContainer);\n }", "function mediaQueryRemove(object){\n resizableObjects.remove(object);\n }", "function checkWidth() {\n var windowsize = $(window).width();\n var testnow = $('#pagestyle').hasClass('test-now');\n var navstyle = $('.navbar').css('display');\n\n if (testnow == true && windowsize < 1200 && navstyle == 'flex') {\n $('.navbar').removeClass('fixed-top');\n $('.swap-style').addClass('swap-style-nav-on');\n $('body').css('overflow', 'visible');\n $('.footer-now').removeClass('fixed-bottom').css('position', 'relative');\n $('.cv-btn').attr('data-toggle', 'modal').attr('data-target', '#cvModal');\n\n\n }\n else {\n $('.navbar').addClass('fixed-top');\n $('.swap-style').removeClass('swap-style-nav-on');\n $('body').css('overflow', 'scroll');\n $('.footer-now').addClass('fixed-bottom').css('position', 'fixed');\n $('.cv-btn').attr('data-toggle', '').attr('data-target', '');\n }\n\n }", "function navResponsive() {\n \n if (screenWidth > 991) {\n \n $(\".main-nav .navbar-nav > .dropdown > a\").attr(\"data-toggle\", \"\");\n $(\".main-nav .navbar-nav.nav-search > .dropdown > a\").attr(\"data-toggle\", \"dropdown\");\n $('.main-nav .navbar-nav > .dropdown').removeClass('open');\n $('.main-nav .navbar-nav .dropdown-submenu').removeClass('open');\n $('.main-nav .navbar-nav > li').find(':focus').blur();\n if ( $('.main-nav .navbar-collapse').hasClass('in') ) {\n $('.main-nav .navbar-collapse').removeClass('in');\n }\n if($('.navbar-toggle').hasClass('active')){\n $('.navbar-toggle').removeClass('active');\n }\n \n }\n else if (screenWidth <= 991) {\n \n $(\".main-nav .navbar-nav > .dropdown > a\").attr(\"data-toggle\", \"dropdown\");\n $('.main-nav .nav > li .dropdown-menu').removeAttr('style');\n $('.main-nav .nav > li > .dropdown-menu').removeAttr('style');\n \n }\n}", "function cleanUp() {\n\t\t\t\tangular.element($window).off('resize', $scope.onWindowResizeDigest);\n\t\t\t}", "function checkSize(){\n if ($(window).width() <= 746){\n // your code here\n\t\t$('#greenheader').hide();\n }\n}", "function quotesSlider() {\n\tif ($(window).innerWidth() < 992 && $(\".js-quotes-slider\").length) {\n\t\t$(\".js-quotes-slider\").slick({\n\t\t\tarrows: false,\n\t\t\tdots: false,\n\t\t\tautoplay: true,\n\t\t\t// fade: true,\n\t\t\tautoPlaySpeed: 7000,\n\t\t\tmobileFirst: true,\n\t\t\tresponsive: [\n\t\t\t\t{\n\t\t\t\t\tbreakpoint: 992,\n\t\t\t\t\tsettings: \"unslick\"\n\t\t\t\t}\n\t\t\t]\n\t\t});\n\t}\n}", "removeContainer() {\n\t\t\tlet beatyboxContainer = document.querySelector('.beatybox-container');\n\t\t\tbeatyboxContainer.classList.add('beatybox-container-removed');\n\t\t\t$(beatyboxContainer).css('animationName', params.animationNameExit || \"fadeOut\");\n\t\t\tsetTimeout(() => {\n\t\t\t\tbeatyboxContainer.remove()\n\t\t\t}, params.animationDuration * 1000);\n\t\t}", "function initializeCategoryMobile(){\n var containerWidth = $(window).width();\n if(containerWidth < 992) {\n if($('#carouselCategoryMobile .owl-stage-outer').length <= 0){\n $('#carouselCategoryMobile').owlCarousel({\n autoWidth:true,\n center: true,\n dots: false,\n nav:false,\n responsive:{\n 480:{\n items:4\n },\n 768:{\n items:6\n }\n }\n });\n $('#carouselCategoryMobile').addClass('owl-carousel');\n calcML = $(window).width()/2 - 15 - $('#carouselCategoryMobile .owl-item:first-child').width()/2;\n $('#carouselCategoryMobile .owl-stage').css('margin-left', -Math.abs(calcML) );\n }\n } else {\n $('#carouselCategoryMobile').trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded');\n $('#carouselCategoryMobile').find('.owl-stage').children().unwrap();\n }\n }", "function cleanSectionData(container) {\n if (container.querySelector('.content-wrapper') != null) {\n container.querySelector('.content-wrapper').remove();\n }\n }" ]
[ "0.7315392", "0.6516453", "0.6421531", "0.6309711", "0.62484634", "0.6214436", "0.61990124", "0.61696285", "0.6073995", "0.60730827", "0.60689825", "0.6041196", "0.5968247", "0.59671843", "0.59578604", "0.59534", "0.5925579", "0.5878488", "0.5876563", "0.5855725", "0.5832292", "0.5821671", "0.58189046", "0.5786179", "0.5745112", "0.5732843", "0.5709416", "0.5696648", "0.5665027", "0.5661257", "0.5656717", "0.5636771", "0.56356096", "0.56149477", "0.5588923", "0.5578934", "0.5574314", "0.55565387", "0.5550596", "0.5541409", "0.5540082", "0.55377585", "0.5520839", "0.55177736", "0.55086726", "0.55070776", "0.5496602", "0.5493707", "0.549239", "0.54902905", "0.5488722", "0.54741967", "0.54712766", "0.5469328", "0.54689384", "0.546829", "0.5463293", "0.54522455", "0.54443306", "0.5442881", "0.5429448", "0.5429448", "0.5427401", "0.54211676", "0.54116684", "0.5373564", "0.53690094", "0.5351079", "0.5350442", "0.53487", "0.5344899", "0.53436524", "0.5334996", "0.5334168", "0.53315514", "0.5322628", "0.53194636", "0.5317627", "0.53167534", "0.5316058", "0.53111774", "0.52941924", "0.5289662", "0.52874655", "0.5282791", "0.5260265", "0.52592963", "0.52591825", "0.52525216", "0.5252088", "0.52484274", "0.5247264", "0.5242464", "0.52397674", "0.52368623", "0.52330804", "0.52302486", "0.5227929", "0.521952", "0.52179366" ]
0.65226847
1
change navbar, decktitle fontsize and image size according to screen size
function changeToFit() { //fix if (($(window).width() < 559)) { for (i = 0; i < trendingDecks.length; i++) { trendingDecks[i].parentElement.style.height = "134px"; } for (i = 0; i < authorDeck.length; i++) { // the carousel elements authorDeck[i].style.fontSize = "13px"; deckTitle[i].children[0].classList.add("h5"); deckTitle[i].style.maxWidth = "50%"; changeFlowItemToFitSmallWindow(i) } // nav bar removeAbsolutePosition(); userBar.style.width = "100%"; for (i = 0; i < userBar.children.length; i++) { userBar.children[i].style.width = String($(window).width() / 4) + "px"; } } else if (($(window).width() < 700)) { // nav bar spreadNavBar(); removeAbsolutePosition(); for (i = 0; i < trendingDecks.length; i++) { trendingDecks[i].parentElement.style.height = "134px"; } for (i = 0; i < userBar.children.length; i++) { userBar.children[i].style.width = ""; } // carousel for (i = 0; i < authorDeck.length; i++) { spreadCarousel(i); changeFlowItemToFitSmallWindow(i) } } else if ($(window).width() < 977) { for (i = 0; i < trendingDecks.length; i++) { trendingDecks[i].parentElement.style.height = "134px"; } // nav bar spreadNavBar(); userBar.classList.add("position-absolute"); userBar.style.right = "-80px"; // carousel for (i = 0; i < imageFlowCard.length; i++) { spreadCarousel(i); changeFlowItemToFitSmallWindow(i); } } else if ($(window).width() < 1200) { // trending decks for (i = 0; i < trendingDecks.length; i++) { trendingDecks[i].parentElement.style.height = "134px"; } // navbar spreadNavBar(); removeAbsolutePosition(); for (var i = 0; i < imageFlowCard.length; i++) { // carousel spreadCarousel(i); changeFlowItemToFitLargeWindow(i); } } else { // navbar spreadNavBar(); removeAbsolutePosition(); for (i = 0; i < trendingDecks.length; i++) { trendingDecks[i].parentElement.style.height = "166px"; } for (i = 0; i < imageFlowCard.length; i++) { // carousel spreadCarousel(i); changeFlowItemToFitLargeWindow(i); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeFontScreen(){\n changeSize(\"#content\", fontSizeStyle, fontSizeArr[zoomedIn]); \n changeSize(\"form\", fontSizeStyle, fontSizeArr[zoomedIn]);\n changeSize(\"h2\", fontSizeStyle, h2FontSizeArr[zoomedIn]);\n changeSize(\"#innerContent h3\", fontSizeStyle, h3FontSizeArr[zoomedIn]);\n changeSize(\":checkbox\", \"width\", checkBoxSizeArr[zoomedIn]);\n changeSize(\":checkbox\" , \"height\", checkBoxSizeArr[zoomedIn]);\n changeSize(\"form .btn-primary\", fontSizeStyle, formButtonFontSizeArr[zoomedIn]);\n}", "function setArea(){\r\n\tvar width = window.innerWidth;\r\n\t\r\n\t\r\n\t$(\".nav-desktop a\").css(\"font-size\", 21*width/1100);\r\n\t$(\".nav-desktop a span\").css(\"font-size\", 20*width/1100);\r\n\t\r\n\tif(320 <= width && width <= 1024)\r\n\t{\r\n\t\t$('#hamburger').css(\"display\", \"block\");\r\n\t\t$('.nav-desktop').css(\"display\", \"none\");\r\n\t}\r\n\telse\r\n\t{\r\n\t\t$('#hamburger').css(\"display\", \"none\");\r\n\t\t$('.nav-desktop').css(\"display\", \"block\");\r\n\t}\r\n}", "function calculateFonts() {\n //title font size calculations\n titleFont.fontSize =\n allDimensions.titleBarHeight * titleFont.fontSizeFactor\n\n //bottom font size calculations\n bottomFont.fontSize =\n allDimensions.bottomBarHeight / 3 * bottomFont.fontSizeFactor\n}", "function OnResize() {\n canvasWidth = stage.canvas.width;\n canvasHeight = canvas.scrollHeight;\n canvasHalfWidth = canvasWidth * 0.5;\n canvasHalfHeight = canvasHeight * 0.5;\n canvas.setAttribute(\"width\", canvasWidth.toString());\n canvas.setAttribute(\"height\", canvasHeight.toString());\n // check if app started then re-align the labels and buttons\n if (appStarted) {\n seeMore.x = canvasHalfWidth;\n seeMore.y = canvasHalfHeight + 200;\n treesharksLogo.x = canvasHalfWidth;\n treesharksLogo.y = canvasHalfHeight - 100;\n }\n }", "function view_home_resize() {\n\t\t\n\t}", "function logoSizeOnSmallScreens(){\n\t\"use strict\";\n\t// 100 is height of header on small screens\n\t\n\tif((100 - 20 < logo_height)){\n\t\t$j('.q_logo a').height(100 - 20);\n\t}else{\n\t\t$j('.q_logo a').height(logo_height);\n\t}\n\t$j('.q_logo a img').css('height','100%');\n\t\n\t$j('header.page_header').removeClass('sticky_animate sticky');\n\t$j('.content').css('padding-top','0px');\n\t\n}", "function jquery_set_headline_font_size(div_for_loading, page){\n\t\tvar screen_width = screen.width;\n\t\tif(screen_width > 768){\n\t\t\t$(div_for_loading).css(\"font-size\",\"<?php echo index_page::css(page,'first_div_font_weight'); ?>\");\n\t\t}\n\t\telse{\n\t\t\t$(div_for_loading).css(\"font-size\",\"24px\");\n\t\t}\n\t}", "function determineResolution() {\n // These dimensions will always be set on the fa-app via CSS, regardless \n // of the user's actual window dimensions\n\n var size_xs = !$media.$query('sm');\n\n if (size_xs) {\n // No navbar for mobile\n NAVBAR.HEIGHT = 0;\n\n\n _forcedResolution = {\n width: 768,\n height: 1366 - NAVBAR.HEIGHT\n\n // To match iOS 320 x 460, ~11.13:16\n //height: 1104 - NAVBAR.HEIGHT\n };\n } else {\n NAVBAR.HEIGHT = 100;\n\n _forcedResolution = {\n width: 1920,\n height: 1080 - NAVBAR.HEIGHT\n };\n }\n }", "function set_sizes() {\n tab_width = $nav_tab.outerWidth();\n list_width = $nav_list.outerWidth();\n tabs_displayed = list_width / tab_width;\n //recalculate height of the currently displayed slide\n var this_sectionHeight = $('.slick-active').outerHeight();\n $sections.css('height', this_sectionHeight + 'px');\n //use tab width and tab index to set horizontal spacing\n $nav_tab.each(function() {\n var index = $(this).index();\n var left_pos = (tab_width * (index - pos_counter)) + 'px';\n $(this).css('left', left_pos);\n });\n}", "function jquery_set_ptag_font_size(div_for_loading, page){\n\t\tvar screen_width = screen.width;\n\t\tif(screen_width > 768){\n\t\t\t$(div_for_loading).css(\"font-size\",\"<?php echo index_page::css(page,'first_div_font_weight'); ?>\");\n\t\t}\n\t\telse{\n\t\t\t$(div_for_loading).css(\"font-size\",\"15px\");\n\t\t}\n\t}", "function resize() {\n // $pages.find('.sc-slides').find('.infos').height(window.innerHeight);\n // _controller.update(true);\n}", "function Size() {\n if (992 <= body.width()) {\n Loading();\n } else if (1200 <= body.width()) {\n Loading();\n Loading();\n }\n }", "function window_resize() {\r\n\t\t// Die Schrift der gesamten Seite soll relativ zur hoehe des Scenecontainers sein.\r\n\t\tvar newFontSize = $(\"#sceneContainer\").height() * 0.03;\r\n\t\t$(\"body\").css(\"font-size\", newFontSize + \"px\");\r\n\t\t\r\n\t\t/* Browser Fix: Manche Browser (z.B. Firefox) scheinen Unterelemente nicht immer richtig Ausrichten zu koennen, wenn sich diese\r\n\t\t in einem Container mit position: fixed und 100% höhe befinden und diese mit Transform zentriert werden \r\n\t\t (siehe Szene 5 mit unterschiedlichen Seitenhoehen). */\r\n\t\t$(\"#intro1\").height($(\"#sceneContainer\").height() * 0.825);\r\n\t\t\r\n\t\t// Mit Aenderungen der Groesse veraendert sich auch die Scrollaenge.\r\n\t\tupdateScrollLength();\r\n\t}", "function change_font_size(){\n if(display_arr.length>8 || (display_arr[0].toString().length + display_arr.length)>9){\n $('.display').css('font-size', '2vh')\n }if(display_arr.length>14 || (display_arr[0].toString().length + display_arr.length)>15){\n $('.display').css('font-size', '1.5vh')\n }if(display_arr.length>18 || (display_arr[0].toString().length + display_arr.length)>19){\n $('.display').css('font-size', '1vh')\n }\n}", "function setTextSize() {\n css.header['font-size'] = (style.size + 2) + 'px';\n css.smallText['font-size'] = (style.size - 4) + 'px';\n css.main['font-size'] = style.size + 'px';\n css.listItem['font-size'] = style.size + 'px';\n css.button['font-size'] = style.size + 'px';\n css.verse.number['font-size'] = style.size + 'px';\n $rootScope.$broadcast('css:changed');//this lets all of the controllers know that the css object has changed\n }", "function mbnavresize(){\n\t\tvar browserHeight = $(window).height(); \n\t\t$('#mobile-nav').css(\"height\",browserHeight);\n\t}", "function resize(){\n var root = document.documentElement;\n var screen = window.screen.width;\n var width = window.innerWidth;\n var rem = (8 + width/200)+ \"px\";\n root.style.fontSize = rem;\n}", "function resize() {\n if ($(window).width() < 799) {\n $(\".logotype img\").attr(\"src\", \"./Assets/smallerLogo.png\");\n toggleOpen(\"burgerMenu\", \"mainNav\", true)\n $(\".mainNav\").attr(\"style\", \"opacity: 0;\")\n } else {\n $(\".logotype img\").attr(\"src\", \"./Assets/logo.png\");\n $(\".mainNav\").attr(\"style\", \"opacity: 1;\")\n }\n}", "function onWindowResize() {\n updateSizes();\n }", "function changeTxtSize(fontSize) {\n headerEl.style.fontSize = fontSize;\n // Set the selected font in local storage\n localStorage.setItem(\"font-size\", fontSize);\n}", "function view_careers_resize() {\n\t\t\n\t}", "function windowResized() {\n resizeCanvas(windowWidth,windowHeight*9);\n \n var multiplier = map(width,200,1800,0.25,1);\n var typesize = (map(width,300,1650,50,195));\n textSize (typesize*multiplier);\n spacesize = 50*multiplier; //width of space between letters\n linesize = 280*multiplier;\n}", "function resized(e){\n\t\tif(GLB._isMobile){\n\t\t\t// if(!_burger) _burger = new BurgerIcon(_topMenu);\n\t\t}\n\t}", "function adjustTextSize(){\n /* var size = 0;\n console.log(\"screen \" + screen.width());\n console.log(\"expre \" + screenExpression.width());\n if(screenExpression.width() > screen.width()){\n size = (screen.width()+40)/screenExpression.width();\n screenExpression.css(\"font-size\",size + \"rem\");\n }else{\n size = 1.5; */\n // console.log(\"expre \" + screenExpression.width());\n // screenExpression.css(\"font-size\",size + \"rem\");\n //}\n \n \n}", "function screenResizeHandler() {\n\n\t\t// resize the div by css, returns the new size\n\t\tgameDivSize = screenSize(gameDiv, Config.boardRatio);\n\n\t\t// change canvas size by pixels\n\t\tgameDiv.width = gameDivSize.x;\n\t\tgameDiv.height = gameDivSize.y;\n\n\t\t// resize the title div by css\n\t\tscreenSize(titleDiv, Config.boardRatio);\n\n\t\t// scale text\n\t\t$(titleDiv).css(\"font-size\", 52/500*gameDivSize.x+\"px\");\n\t\t$(\"#title button\").css(\"font-size\", 22/500*gameDivSize.x+\"px\");\n\t}", "function setupMainMenu() {\n mainMenuFontHeight = height;\n mainMenuFontAlpha = 0;\n}", "function resizeF()\n\t\t{\n\t\tvar scaleX = window.innerWidth / 782;\n\t\tvar scaleY = window.innerHeight / 440;\n\t\tvar scale = Math.min(scaleX, scaleY);\n\t\tgame.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;\n\t\tgame.scale.setUserScale(scale, scale);\n\t\tgame.scale.pageAlignHorizontally = true;\n\t\tgame.scale.pageAlignVertically = true;\n\t\tgame.scale.refresh();\n\t\t}", "function onMeasure() {\n viz_title.attr(\"x\", viz.width() / 2)\n .style(\"font-size\", function () {\n return viz.height() / 60\n })\n .style(\"fill\", function () {\n return theme.skin().labelColor;\n });\n\n viz_heading.attr(\"x\", viz.width() / 2)\n .style(\"font-size\", function () {\n return viz.height() / 65;\n })\n .style(\"fill\", function () {\n return theme.skin().labelColor;\n })\n .style(\"fill-opacity\", .7);\n}", "function change_bague_size(){\n\n if (orientation_value == \"paysage\"){\n // récupert la hauteur de la fenêtre\n var windows_height = $(window).height();\n\n // définit la taille (hauteur = largeur) des bagues\n var magic360size = 240;\n\n // si la fenêtre n'est pas assez grande, on réduit la taille des bagues\n if (windows_height < 400)\n magic360size = 183;\n\n $(\"div.Magic360Contener\").css({\n 'width': magic360size + 'px',\n 'height': magic360size + 'px'\n });\n\n // vérifie le type de configurateur\n var type_configurateur = $(\"select[name='type_configurateur']\").val();\n\n // définit la taille de l'élément qui contient les bagues selon si 1 ou 2 bagues sont affichées\n if (type_configurateur == 1 || type_configurateur == 2){\n $('.articles_pictures').css('width', (magic360size + 20) + 'px');\n }\n else if (type_configurateur == 3 || type_configurateur == 4){\n $('.articles_pictures').css('width', (magic360size * 2 + 40) + 'px');\n }\n }\n else if (orientation_value == \"portrait\"){\n $(\"div.Magic360Contener\").css({\n 'width': '240px',\n 'height': '240px'\n });\n\n $('.articles_pictures').css('width', '265px');\n }\n}", "function setsize() {\n gsap.to(indexbtnitemcontainer, { duration: 0.9, ease: \"expo.out\", y: -(current_index * 65) });\n // gsap.to(indexbtn, { duration: 1.5, ease: \"expo.out\", height: \"65px\" });\n gsap.to(indexbtn, { duration: 0.9, ease: \"expo.out\", width: indexbtnitem[current_index].offsetWidth + \"px\" });\n // gsap.to(indexbtn, { duration: 1.5, ease: \"expo.out\", borderRadius: \"50px\" });\n\n}", "function titleBar()\n{\n\tif(channel == \"tablet\"|| channel == \"desktopweb\")\n\t\tfrmTitlebarOptions.show();\n\telse\n\t\tfrmTtlbarOptions.show();\n}", "function resize() {\n if (pageIsOpen) {\n // update position of cover\n var cardPosition = currentCard.getBoundingClientRect();\n setCoverPosition(cardPosition);\n scaleCoverToFillWindow(cardPosition);\n }\n windowWidth = window.innerWidth;\n windowHeight = window.innerHeight;\n}", "function changeSize() {\n myh1.style.fontSize = (myh1.style.fontSize == \"24px\") ? \"20px\" : \"24px\"\n }", "function resize() {\n if (active_page == 'page-agree') {\n \t$('#scroller').css({height: window.innerHeight - 130 + 'px'});\n }\n if (active_page == 'page-signature') {\n var sig = api.getSignature();\n api.regenerate(sig);\n if ( $('#email').is(':focus') ) {\n \t$('.fixed').css('width', window.innerWidth + 'px');\n \t$('#email').autocomplete(\"close\").autocomplete(\"search\");\n }\n $('.page-signature #header').css({width: window.innerWidth + 'px'});\n }\n if (active_page == 'page-image-doc') {\n $('.page-image-doc .table').css({height: window.innerHeight});\n \t$('#imagepod').css('max-height', window.innerHeight + 'px');\n } \n if (active_page == 'page-image-box') {\n \t$('.page-image-box .table').css({height: window.innerHeight});\n \t$('#imagebox').css('max-height', window.innerHeight + 'px');\n }\n \n if (active_page == 'page-photo-preview' || \n \tactive_page == 'page-album') {\n \t $('.table').css({'height': window.innerHeight -44 + 'px'});\n\t $('#photo-preview').css({\n 'max-height': window.innerHeight - 44 + 'px',\n 'max-width': window.innerWidth + 'px'\n\t });\n\t $('.page-photo-preview #header').css('width', window.innerWidth + 'px');\n\t $('.page-album #header').css({width: window.innerWidth + 'px'});\n }\n if (active_page == 'page-ship-det') {\n \t$('.page-ship-det #header').css('width', window.innerWidth + 'px');\n }\n if (active_page == 'page-driver-act') {\n \t$('.page-driver-act #header').css('width', window.innerWidth + 'px');\n }\n if (active_page == 'page-complete') {\n \t$('.page-complete #header').css('width', window.innerWidth + 'px');\n }\n}", "function sizeContent() {\n\t\n\t\t'use strict';\n\t\n\t\tvar newHeight = jQuery(window).height(); \n\t\tvar wpadmin = jQuery('#wpadminbar').height();\n\t\tvar topbarHeight = jQuery(\"#top-bar\").height();\n\t\tvar windowWidth = jQuery(window).width();\n\t\t\n\t\t//home section height\n\t\tjQuery(\".home-section.slide.border\").css(\"height\", newHeight - wpadmin - topbarHeight - 48);\n\t\t\n\t\t//home section height and width no border\n\t\tjQuery(\".home-section.slide.no-border\").css(\"height\", newHeight - wpadmin - topbarHeight);\n\t\tjQuery(\".home-section.slide.no-border\").css(\"width\", windowWidth);\t\t\n\n\t\t//searchbar top offset\n jQuery(\"#searchbar\").css(\"top\", topbarHeight + wpadmin); \n \n //layerslider height\n jQuery(\".slider-section.slide\").css(\"height\", newHeight - wpadmin - topbarHeight - 48);\n \n //#offset for other slider\n jQuery(\"#offset\").css(\"height\", topbarHeight + wpadmin + 48);\n\n //container top margin\n var containerHeight = jQuery(\".home-section .container\").height();\n var newTopMargin = (newHeight - wpadmin - topbarHeight - containerHeight - 194) / 2;\n jQuery(\".top-space\").css(\"height\", newTopMargin);\n\n\t//logo max width \n if (jQuery(window).width() < 460) {\n jQuery(\".logo\").css(\"max-width\", windowWidth - 140);\n } \n\t\n}", "function setImageSize() {\n for (let i = 0; i < this.length; i++) {\n this[i].src = this[i].src.replace('small', screensize);\n }\n curSize = screensize;\n }", "function pose_menu(){\r\n \r\n if($(window).width()<=760){\r\n $('.titre').css({\r\n //'margin':'0.1em 0.8em'\r\n });\r\n $('.sous-bloc').css({\r\n //'margin':'auto'\r\n });\r\n $('.reg').css({\r\n 'width':'100%'\r\n });\r\n $('.network').css({\r\n 'width':'70%'\r\n });\r\n $('.helico img').css({\r\n 'width':'100%'\r\n });\r\n $('.b-stock img').css({\r\n 'width':'100%'\r\n //'margin':'auto'\r\n });\r\n $('.libre img').css({\r\n 'width':'100%'\r\n //'margin':'auto'\r\n });\r\n xsmall=true;\r\n small=false;\r\n md=false;\r\n lg=false;\r\n }\r\n \r\n if($(window).width()>760){\r\n $('.reg').css({\r\n 'width':'40%'\r\n });\r\n $('.helico img').css({\r\n 'width':'96%'\r\n });\r\n $('.b-stock img').css({\r\n 'width':'95%'\r\n });\r\n \r\n $('.helico p').css({\r\n 'width':'96%'\r\n });\r\n $('.b-stock p').css({\r\n 'width':'95%'\r\n });\r\n\r\n if($(window).width()<1000){\r\n $('.titre').css({\r\n //'margin':'0.1em 0.8em'\r\n });\r\n $('.network').css({\r\n 'width':'57%'\r\n });\r\n $('.sous-bloc').css({\r\n //'margin':'auto'\r\n });\r\n $('.coment,.coment-slide').css({\r\n 'display':'none'\r\n });\r\n \r\n small=true;\r\n xsmall=false;\r\n md=false;\r\n lg=false;\r\n }else if($(window).width()<1200){\r\n $('.titre').css({\r\n //'margin':'0.1em 0.8em'\r\n });\r\n $('.network').css({\r\n 'width':'44%'\r\n });\r\n $('.coment,.coment-slide').css({\r\n 'display':'block'\r\n });\r\n md=true;\r\n xsmall=false;\r\n small=false;\r\n lg=false;\r\n \r\n }else{\r\n $('.titre').css({\r\n //'margin':'0.1em 20.8em'\r\n });\r\n $('.network').css({\r\n 'width':'37%'\r\n });\r\n $('.sous-bloc').css({\r\n //'margin':'auto'\r\n });\r\n lg=true;\r\n xsmall=false;\r\n small=false;\r\n md=false;\r\n }\r\n }\r\n }", "function responsiveResize() {\n var leftMax = $('#bar-load').offset().left + 50;\n var rightMax = $('#bar-help').offset().left;\n var w = $(window).width();\n var $l = $('img.logo');\n var $v = $('span.version');\n\n // If the mode button pos is greater than half the width less 100px, adjust\n // the logo.\n if (leftMax > (w/2)-100) {\n if (rightMax < leftMax + 150) {\n // There's no room left for logo or version... goodbye!\n $l.add($v).css('opacity', 0);\n } else {\n // Squeeze logo and version together\n $l.css({\n left: leftMax + 100,\n width: 130,\n top: 0,\n opacity: 1\n });\n\n $v.css({\n left: (leftMax - 89) + 32,\n opacity: 1\n });\n }\n\n } else {\n $l.css({\n left: '',\n width: '',\n top: '',\n opacity: ''\n });\n\n $v.css({\n left: '',\n opacity: ''\n });\n }\n\n}", "function getSize() {\n setScreenHeight(window.innerHeight);\n setScreenWidth(window.innerWidth);\n }", "function scrollFunction() {\n if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {\n document.getElementById(\"menu\").style.padding = \"2px 2px\";\n //document.getElementById(\"navbar-brand\").style.fontSize = \"10px\";\n } else {\n document.getElementById(\"menu\").style.padding = \"10px 10px\";\n //document.getElementById(\"navbar-brand\").style.fontSize = \"35px\";\n }\n}", "function spSizeOnly(){\n changeImgSp();\n }", "refreshFontSize() {\n\t\tvar size = this.savedFontSize;\n\t\tsize = size * renko.getWindowScale();\n\t\tsize = size * (2 / window.devicePixelRatio);\n\t\tthis.style.fontSize = String(size) + \"px\";\n\t}", "function onResize() {\n\tfm.resize();\n}", "function ResizeMenu(){\n\tElemId(\"Menu\").style.height = (wHeight - CropPX(ElemId(\"Playbar\").style.height)) + \"px\";\n\tif(wHeight / wWidth > CRIT_RATIO){\n\t\tElemId(\"Menu\").style.width = sHeight * 0.0 / 100.0 + \"px\";\n\t\tElemId(\"Logo\").style.width = sHeight * 0.0 / 100.0 + \"px\";\n\t}\n\telse{\n\t\tElemId(\"Menu\").style.width = sHeight * 21.0 / 100.0 + \"px\";\n\t\tElemId(\"Logo\").style.width = sHeight * 15.0 / 100.0 + \"px\";\n\t\tElemId(\"Logo\").style.left = sHeight * 3.0 / 100.0 + \"px\";\n\t\tElemId(\"Logo\").style.top = sHeight * 1.5 / 100.0 + \"px\";\n\t}\n\t\n\tElemId(\"ArtistsButton\").style.top = sHeight * 12.0 / 100.0 + \"px\";\n\tElemId(\"ArtistsButton\").style.width = ElemId(\"Menu\").style.width;\n\tElemId(\"ArtistsButton\").style.height = sHeight * 4.0 / 100.0 + \"px\";\n\tElemId(\"ArtistsButtonBackground\").style.height = ElemId(\"ArtistsButton\").style.height;\n\tElemId(\"ArtistsButtonBackground\").style.width = ElemId(\"ArtistsButton\").style.width;\n\tElemId(\"ArtistsIcon\").style.height = sHeight * 1.5 / 100.0 + \"px\";\n\tElemId(\"ArtistsIcon\").style.top = sHeight * 1.3 / 100.0 + \"px\";\n\tElemId(\"ArtistsIcon\").style.left = sHeight * 1.3 / 100.0 + \"px\";\n\tElemId(\"ArtistsTextBox\").style.height = ElemId(\"ArtistsButton\").style.height;\n\tElemId(\"ArtistsTextBox\").style.left = sHeight * 4.0 / 100.0 + \"px\";\n\tElemId(\"ArtistsFileNameBox\").style.height = ElemId(\"ArtistsButton\").style.height;\n\tElemId(\"ArtistsFileNameBox\").style.width = sHeight * 10.0 / 100.0 + \"px\";\n\tElemId(\"ArtistsFileNameBox\").style.fontSize = sHeight * 1.5 / 100.0 + \"px\";\n\t\n\tElemId(\"AdhocButton\").style.top = sHeight * 16.0 / 100.0 + \"px\";\n\tElemId(\"AdhocButton\").style.width = ElemId(\"Menu\").style.width;\n\tElemId(\"AdhocButton\").style.height = sHeight * 4.0 / 100.0 + \"px\";\n\tElemId(\"AdhocButtonBackground\").style.height = ElemId(\"AdhocButton\").style.height;\n\tElemId(\"AdhocButtonBackground\").style.width = ElemId(\"AdhocButton\").style.width;\n\tElemId(\"AdhocIcon\").style.height = sHeight * 1.5 / 100.0 + \"px\";\n\tElemId(\"AdhocIcon\").style.top = sHeight * 1.3 / 100.0 + \"px\";\n\tElemId(\"AdhocIcon\").style.left = sHeight * 1.3 / 100.0 + \"px\";\n\tElemId(\"AdhocTextBox\").style.height = ElemId(\"AdhocButton\").style.height;\n\tElemId(\"AdhocTextBox\").style.left = sHeight * 4.0 / 100.0 + \"px\";\n\tElemId(\"AdhocFileNameBox\").style.height = ElemId(\"AdhocButton\").style.height;\n\tElemId(\"AdhocFileNameBox\").style.width = sHeight * 10.0 / 100.0 + \"px\";\n\tElemId(\"AdhocFileNameBox\").style.fontSize = sHeight * 1.5 / 100.0 + \"px\";\n\t\n\tElemId(\"SettingsButton\").style.top = sHeight * 25.0 / 100.0 + \"px\";\n\tElemId(\"SettingsButton\").style.width = ElemId(\"Menu\").style.width;\n\tElemId(\"SettingsButton\").style.height = sHeight * 4.0 / 100.0 + \"px\";\n\tElemId(\"SettingsButtonBackground\").style.height = ElemId(\"ArtistsButton\").style.height;\n\tElemId(\"SettingsButtonBackground\").style.width = ElemId(\"ArtistsButton\").style.width;\n\tElemId(\"SettingsIcon\").style.height = sHeight * 1.5 / 100.0 + \"px\";\n\tElemId(\"SettingsIcon\").style.top = sHeight * 1.3 / 100.0 + \"px\";\n\tElemId(\"SettingsIcon\").style.left = sHeight * 1.3 / 100.0 + \"px\";\n\tElemId(\"SettingsTextBox\").style.height = ElemId(\"ArtistsButton\").style.height;\n\tElemId(\"SettingsTextBox\").style.left = sHeight * 4.0 / 100.0 + \"px\";\n\tElemId(\"SettingsFileNameBox\").style.height = ElemId(\"ArtistsButton\").style.height;\n\tElemId(\"SettingsFileNameBox\").style.width = sHeight * 10.0 / 100.0 + \"px\";\n\tElemId(\"SettingsFileNameBox\").style.fontSize = sHeight * 1.5 / 100.0 + \"px\";\n}", "function setCanvasAndTextSize() {\n if (windowWidth > 1529) {\n canvasWidth = 1200;\n canvasHeight = 800;\n currTextSize = 64;\n offset = 100;\n } else if (windowWidth > 929) {\n canvasWidth = 900;\n canvasHeight = 600;\n currTextSize = 48;\n offset = 75;\n } else {\n canvasWidth = 600;\n canvasHeight = 400;\n currTextSize = 32;\n offset = 50;\n }\n}", "vehicleSize(size) {\n switch (size) {\n case \"small\":\n return \"https://png.icons8.com/dotty/40/000000/dirt-bike.png\";\n case \"medium\":\n return \"https://png.icons8.com/dotty/40/000000/fiat-500.png\";\n case \"large\":\n return \"https://png.icons8.com/dotty/40/000000/suv.png\";\n default:\n return \"https://png.icons8.com/dotty/40/000000/fiat-500.png\";\n }\n }", "function sizePage() {\n //Getting the height of the window and use it to define the other heights.\n var heightOfWindow = window.innerHeight;\n var heightOfHeader = heightOfWindow / 5;\n var heightOfNavbarNotRound = heightOfWindow * 0.1;\n var heightOfFooterNotRound = heightOfWindow * 0.1;\n var heightOfNavbar = Math.round(heightOfNavbarNotRound);\n var heightOfFooter = Math.round(heightOfFooterNotRound);\n /* sizing min-height property of main so when content is less than rest of page,\n otherwise height auto will take over */\n var minHeightOfmain = heightOfWindow - (heightOfHeader + heightOfNavbar + heightOfFooter + 78);\n // Return the height to elements\n document.getElementById(\"header\").style.height = heightOfHeader + \"px\";\n document.getElementById(\"navbar\").style.height = heightOfNavbar + \"px\";\n document.getElementById(\"footer\").style.height = heightOfNavbar + \"px\";\n document.getElementById(\"main\").style.minHeight = minHeightOfmain + \"px\";\n document.getElementById(\"navlist\").style.height = heightOfNavbar + \"px\";\n}", "function onResize(){\n\tvar windowWidth = $(window).width();\n\t\n\tvar bigWidth = windowWidth - (33*2) - logoWidth - menuNotMobileWidth - 30;\n\t\n if(isTouch || normalMenuHeight >= bigWidth)\n smallMenu();\n else\n normalMenu();\n}", "#size( user_resize = false ) \n {\n let pos = this.position = this.window.getBoundingClientRect();\n let tb_rect = this.title_bar.getBoundingClientRect();\n let wwidth = window.innerWidth;\n let wheight = window.innerHeight;\n \n if (this.state !== WINDOW_STATE_NORMAL &&\n this.state !== WINDOW_STATE_MINIMIZED)\n {\n return this;\n }\n\n /* Width of title bar is window width - ( (Width of control buttons + The ICON's width)) \n x the number of buttons ) */\n this.title_bar_text.style.width = \n (pos.width - ((this.#control_button_cx*this.#control_button_count)+this.icon_td.clientWidth) ).toString() + \"px\";\n\n this.#minimized_content.style.height = (pos.height - tb_rect.height).toString() + \"px\";\n\n this.#minimized_content.style.top = (tb_rect.height) + \"px\";\n\n if (this.#content_size_relative === false) {\n this.#content.style.top = (tb_rect.height) + \"px\";\n this.#content.style.height = (pos.height - tb_rect.height).toString() + \"px\";\n } else {\n this.svg_containter.style.top = (tb_rect.height) + \"px\";\n }\n\n\n /* If size relative to the browser's viewport was given, convert the dimensions to the browser still resizes them */\n if (user_resize === true || \n this.#vw_mult === -1.00) \n {\n this.#vw_mult = pos.width / wwidth;\n this.#vh_mult = pos.height / wheight;\n }\n /*******************************************************************************************************************/\n\n this.content_width = pos.width;\n this.content_height = pos.height - tb_rect.height;\n\n if (this.#onresize) {\n this.#onresize(this);\n }\n return this;\n }", "function fHeaderFonts(s1, s2, s3, s5){\n h1.css ({\"fontSize\": s1 + \"em\"});\n h2.css ({\"fontSize\": s2 + \"em\"});\n h3.css ({\"fontSize\": s3 + \"em\"});\n imgTitle.css ({\"fontSize\": s5 + \"em\"});\n }", "function utilSize () {\n var contentWidth = $('.poem-home').width();\n $('#utils').width(contentWidth + 10);\n }", "function getNavBarName() {\n return $(window).height() >= (55/67) * $(window).width() - (325/67) ? \"SARA GW\" : \"SARA GOLDSTEIN-WEISS\";\n}", "function sizer(){\n //update object\n å.screen.x = window.innerWidth;\n å.screen.y = window.innerHeight;\n //update canvas size\n canvas.width = å.screen.x;\n canvas.height = å.screen.y;\n}", "function pcSizeOnly(){\n changeImgPc();\n }", "function changeToSize(size) {\n setMedia();\n media.height = size;\n var ratio = media.videoWidth / media.videoHeight;\n $('#media-bench').width(media.height * ratio);\n trjs.editor.resizeTranscript();\n }", "function getSizes()\n {\n sizes.field.rows = 3;\n sizes.field.cols = 6;\n\n sizes.desk.height = DOM.parent.offsetHeight / 3;\n sizes.desk.width = properties.coverSize.width * sizes.desk.height / properties.coverSize.height;\n sizes.deskContainer.marginBottom = sizes.desk.width / 2;\n\n sizes.card.height = DOM.parent.offsetHeight / 4.5;\n sizes.card.width = properties.coverSize.width * sizes.card.height / properties.coverSize.height;\n }", "_size_elements () {\n\n\t\tvar w = this.context.canvas.width\n\t\tvar h = this.context.canvas.height\n\t\tvar cw = this._deck_blue ['musician']._face_img.width\n\t\tvar ch = this._deck_blue ['musician']._face_img.height\n\n\t\tvar scale_x = (w * 0.9 / 8.0) / cw\n\t\tvar scale_y = (h / 4.0) / ch\n\t\tvar scale = Math.min (scale_x, scale_y)\n\n\t\tfor (var name in this._deck_blue) {\n\t\t\tthis._deck_blue [name].set_size (cw * scale)\n\t\t}\n\t\tfor (var name in this._deck_red) {\n\t\t\tthis._deck_red [name].set_size (cw * scale)\n\t\t}\n\t}", "function pageTitle(){\n\t\tif ( $(window).width() >= 1000 && pageTitleResized == false ) {\n\t\t $('#ins-page-title').each(function() {\n\t\t \tvar marginTop = 55;\n\t\t \tvar extra = 0;\n\t\t \tvar titleInner = $(this).find( '.ins-page-title-inner' );\n\t\t \tvar titleInnerHeight = titleInner.height();\n\t\t \t\n\t\t \tif( $('#header').length ) {\n\t\t \t\textra = 80 / 2;\n\t\t \t}\n\t\t \tif( $('#topbar').length ) {\n\t\t \t\textra += $('#topbar').height() / 2;\n\t\t \t}\n\t\t \tif( $('.bottom-nav-wrapper').length ) {\n\t\t \t\textra += $('.bottom-nav-wrapper').height() / 2;\n\t\t \t}\n\n\t\t \tmarginTop = extra;\n\t\t $(this).find( '.ins-page-title-inner' ).css( 'margin-top', marginTop );\n\t\t \n\t\t pageTitleResized = true;\n\t\t });\n\t\t}\n\t}", "function setHeight() {\n var windowHeight = $(window).innerHeight();\n\n if (window.matchMedia('(min-width: 850px)').matches) {\n\n $('.site-header').css('height', windowHeight);\n $('.hero-title').css('paddingTop', windowHeight/2 - 130);\n }\n if (window.matchMedia('(max-width: 850px)').matches) {\n\n $('.site-header').css('height', 'auto');\n $('.hero-title').css('paddingTop', '3rem');\n }\n }", "function windowResized() {\n resizeCanvas(windowWidth,windowHeight*9.87);\n background(206, 193, 154);\n textFont(font);\n textSize (typesize);\n wx = margin;\n wy = 140;\n fill(25,7,8);\n makeCreep(); \n}", "function resizeLogoEvent() {\r\n let logos = document.querySelectorAll(\".logo\");\r\n let logosArr = Array.from(logos);\r\n let logoBrand = document.querySelector(\".logo_brands\");\r\n\r\n [\"resize\", \"load\"].forEach(function (event) {\r\n window.addEventListener(event, () => {\r\n // 2 logos will be shown if screen width is below 767\r\n if (screen.width <= 767) {\r\n if (logosArr.length > 2) {\r\n let twoLogos = logosArr.slice(0, 2);\r\n //this is an empty array to push new logos into\r\n let newLogosArr = [];\r\n // loop through 'twoLogos' and add each to newLogosArr\r\n twoLogos.forEach((el) => {\r\n newLogosArr.push(el.outerHTML);\r\n //remove comma from returned newLogosArr array and make logoBrand content equal to newLogosArr\r\n logoBrand.innerHTML = newLogosArr.join('');\r\n });\r\n }\r\n }else if (screen.width <= 961) {\r\n if (logosArr.length > 3) {\r\n let twoLogos = logosArr.slice(0, 3);\r\n //this is an empty array to push new logos into\r\n let newLogosArr = [];\r\n // loop through 'twoLogos' and add each to newLogosArr\r\n twoLogos.forEach((el) => {\r\n newLogosArr.push(el.outerHTML);\r\n //remove comma from returned newLogosArr array and make logoBrand content equal to newLogosArr\r\n logoBrand.innerHTML = newLogosArr.join('');\r\n });\r\n }\r\n } else {\r\n //revert all logos back on larger view\r\n\r\n //this is an empty array to push new logos into\r\n let newLogosArr = [];\r\n // loop through 'twoLogos' and add each to newLogosArr\r\n logosArr.forEach((logo)=>{\r\n logo.setAttribute('display','block')\r\n newLogosArr.push(logo.outerHTML)\r\n //remove comma from returned newLogosArr array and make logoBrand content equal to newLogosArr\r\n logoBrand.innerHTML = newLogosArr.join('');\r\n })\r\n\r\n //Remove 'mobileCartToggle' on larger screens\r\n let quickNav = document.getElementsByClassName(\"quickNav\")[0];\r\n quickNav.classList.remove(\"mobileCartToggle\");\r\n }\r\n });\r\n });\r\n}", "function commonPageHeaderBar(centeredText, pathToBase) {\n theDivWeWant = document.getElementById(\"headerTopBar\");\n theDivWeWant.style.position=\"absolute\";\n theDivWeWant.style.left=\"0px\";\n theDivWeWant.style.top=\"0px\";\n theDivWeWant.style.height =\"160px\";\n theDivWeWant.style.backgroundColor=\"#862507\";\n theDivWeWant.style.border=\"0px none\";\n deviceWidth = window.innerWidth - window.pageXOffset;\n if (deviceWidth < screen.width)\n deviceWidth = screen.width;\n //window.alert(\"width = \" + deviceWidth.toString());\n theDivWeWant.style.width=deviceWidth.toString() + \"px\";\n theDivWeWant.style.minWidth=\"1024px\";\n //theDivWeWant.style.minWidth=\"1200px\";\n theDivWeWant.innerHTML = '<a href=\"' + pathToBase + 'index.html\"> <p style=\"margin:0px 0px 0px 0px;position:absolute;left:20px;width:30%;top:20px;font-family:Georgia, serif;font-size: 40px;color:white\">THEMNMOORES.NET</p> </a><img src=\"' + pathToBase + 'pictures/familysmall2.jpg\" alt=\"Family\" height=\"160\" style=\"position:relative;left:85%;top:0px\"><p style=\"margin:0px 0px 0px 0px;position:relative;right;left:0%;width:100%;top:-60px;text-align: center;font-family:Georgia, serif;font-size: 40px;color:white\">' + centeredText +'</p>';\n theDivWeWant.innerHTML += '<link rel=\"icon\" type=\"image/x-icon\" href=\"data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA/v7+AP///wCXl5cAZmZmAJ2dnQB9fX0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgIAAgACAgICAgICAgIAIgICAgICAgACAAIEBAQCAgICAgAEAAIAAiIiRERCIiIiIiJEREIiIiIiIkREQiIiIiIiRERCIiIiIiJEREQSIiIiIkREREQiIiAjBAQAAiIiICUGAgIiIiIgIgACACIiIiAiAgICIiIiAAICAgACIiIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" >'\n}", "function resizeView() {\n\n navWidth = document.getElementById('vis').clientWidth;\n navHeight = document.getElementById('vis').clientHeight;\n\n}", "function resize() {\n var ps = ws.dom.size(parent),\n hs = ws.dom.size(topBar);\n //tb = ws.dom.size(toolbar.container);\n \n ws.dom.style(frame, {\n height: ps.h - hs.h - 55 - 17 + 'px' //55 is padding from top for data column and letter\n });\n\n ws.dom.style([container, gsheetFrame, liveDataFrame], {\n height: ps.h - hs.h - 22 /*- tb.h*/ + 'px'\n });\n\n\n ws.dom.style(table, {\n width: ps.w + 'px'\n });\n\n }", "function initLogo()\n {\n var $navbarBrand = $('.navbar-brand');\n \n $(document).scroll(function () {\n var scrollPosition = $(window).scrollTop();\n var logoPosition = $navbarBrand.offset().top;\n \n if(scrollPosition < logoPosition) {\n $navbarBrand.removeClass('small');\n } else {\n $navbarBrand.addClass('small');\n }\n });\n }", "setSmallWindowModeSize(keepWidth) {\n\t\tthis.removeStyles(keepWidth);\n\t\tif (this.barPosition === 'top') {\n\t\t\tthis.setTopColapsedMenuSize();\n\t\t} else if (this.barPosition === 'bottom') {\n\t\t\tthis.setBottomColapsedMenuSize();\n\t\t} else if (this.barPosition === 'left') {\n\t\t\tthis.setLeftColapsedMenuSize();\n\t\t} else if (this.barPosition === 'right') {\n\t\t\tthis.setRightColapsedMenuSize();\n\t\t}\n\t}", "function imageresize() {\r\n\tvar contentwidth = $('body').width();\r\n\tif ((contentwidth) < '981'){\r\n\t\tjQuery('#sp .content_wrapper, #sp .content_wrapper_sbr, #sp .content_wrapper_sbl').css('background','url(images/subpage_content_bg_dark_ipad.png) 0 0 no-repeat');\r\n\t\tjQuery('#sp .content_wrapper, #sp .content_wrapper_sbr, #sp .content_wrapper_sbl').css('margin','-82px auto 0');\r\n\t\tjQuery('#sp .content_wrapper, #sp .content_wrapper_sbr, #sp .content_wrapper_sbl').css('padding','20px 10px');\r\n\t\tjQuery('#fsb').css('padding','4.5em 10px');\r\n\t\tjQuery('#fsb').css('width','940px');\r\n\t\tjQuery('#footer').css('padding','30px 10px');\r\n\t\tjQuery('#footer').css('width','940px');\r\n\t} else {}\r\n\t}", "function sizeDetect() {\n if (window.innerWidth < 1036) { // if current window width is less than 1036\n // set the body to full screen\n if (menu_open) {\n menu.style.width = '100%';\n }\n\n } else {\n // set the body to default size\n if (menu_open) {\n menu.style.width = '20%';\n }\n }\n}", "function getSize() {\n var width = $('body').width() * window.devicePixelRatio;\n\n size = 'large';\n if (width < 800){\n size = 'small';\n } else if (width < 1800){\n size = 'medium';\n }\n return size;\n}", "function resizeMe(displayHeight, displayWidth) {\n \t\t\t//Standard dimensions, for which the body font size is correct\n \t\t\tvar preferredHeight = 825;\n \t\t\tvar preferredWidth = 900;\n\n \t\t\tif (displayHeight < preferredHeight || displayWidth < preferredWidth) {\n \t\t\t\tvar heightPercentage = (displayHeight * 100) / preferredHeight;\n \t\t\t\tvar widthPercentage = (displayWidth * 100) / preferredWidth;\n \t\t\t\tvar percentage = Math.min(heightPercentage, widthPercentage);\n \t\t\t\tvar newFontSize = percentage.toFixed(2);\n\n \t\t\t\t$(\"body\").css(\"font-size\", newFontSize + '%');\n \t\t\t} else {\n \t\t\t\t$(\"body\").css(\"font-size\", '100%');\n \t\t\t}\n \t\t}", "function resize() {\n\t\t// set new window dimensions\n\t\tjaws.width = jaws.canvas.width = window.innerWidth;\n\t\tjaws.height = jaws.canvas.height = window.innerHeight;\n\n\t\t// set new card length\n\t\tGame.CARD_LENGTH = window.innerHeight * 0.29;\n\n\t\t// resize all images\n\t\tfor (var i = 0, len = Game.deck.length; i < len; i++)\n\t\tGame.deck[i].resize();\n\t\tGame.Image.resize();\n\n\t\t// force text resize\n\t\ttext = undefined;\n\n\t\t// force full render\n\t\tforceRender = true;\n\t}", "function changeSize() {\n carouselWrapWidth = carouselWrap.offsetWidth;\n isResizing = true;\n carouselList.style.transition = \"\";\n moveCarousel();\n}", "function setTypeSize (el) {\n var size = window.innerHeight * 0.9 + \"px\";\n _.each(el.querySelectorAll(\".glyphicon\"), function (el) {\n el.style.fontSize = size;\n el.style.lineHeight = size;\n });\n }", "function sizeAdjustor()\n{\n if ($(\"#found-content-nav\").length)\n {\n document.getElementById(\"found-content-nav\").style.width = document.getElementById(\"found-content\").offsetWidth + \"px\";\n }\n if ($(\"#user-nav\").length)\n {\n document.getElementById(\"user-nav\").style.width = document.getElementById(\"user-container\").offsetWidth + \"px\";\n }\n if ($(\"#user-info-icon\").length)\n {\n document.getElementById(\"user-info-icon\").style.height = document.getElementById(\"user-info-icon\").offsetWidth + \"px\";\n }\n if ($(\"#user-post-ul\").length)\n {\n $(\"#user-post-ul\").css(\"padding-left\", $(\"#user-post\").width() * 0.015);\n }\n if ($(\".user-post-ul>li>div\").length)\n {\n $(\".user-post-ul>li>div\").css(\"height\", $(\".user-post-ul>li>div\").width());\n }\n if ($(\".photo-detail-photo\").length)\n {\n $(\".photo-detail-photo\").css(\"height\", $(\".photo-detail-photo\").width() * (9 / 16));\n }\n if ($(\".found-photo-content\").length)\n {\n $(\".found-photo-content\").css(\"height\", $(\".found-photo-content\").width() * (9 / 16));\n }\n}", "function setSize() {\r\n\t// VERSIONS AUTRES QUE PC\r\n\tif (window.innerWidth<=1110) {\r\n\t\tmainContent.classList.remove('fullscreen');\r\n\t\tshow(closeModalButton);\r\n\t\tif (!videoSearch.classList.contains('activated')) {\r\n\t\t\thide(videoSearch);\r\n\t\t\thide(backgroundModal);\r\n\t\t\tif (myChannel) {\r\n\t\t\t\tshow(addVideoButton);\r\n\t\t\t}\r\n\t\t}\r\n\t\t// VERSION MOBILE\r\n\t\tif (window.innerWidth<=850) {\r\n\t\t\t/*A COMPLETER POUR VERSION MOBILE*/\r\n\t\t} \r\n\t\t// VERSION TABLETTE\r\n\t\telse {\r\n\t\t\tleftAside.style.height = window.innerHeight + \"px\";\r\n\t\t\tmainContent.style.height = window.innerHeight + \"px\";\r\n\t\t\tvideoSearch.style.height = window.innerHeight + \"px\";\r\n\t\t\tvideoSearch.style.height = 80/100*window.innerHeight + \"px\";\r\n\t\t}\r\n\t} \r\n\t// VERSION PC\r\n\telse {\r\n\t\thide(closeModalButton);\r\n\t\tif (!myChannel) {\r\n\t\t\thide(videoSearch);\r\n\t\t\tmainContent.classList.add('fullscreen');\r\n\t\t}\r\n\t\tleftAside.style.height = window.innerHeight + \"px\";\r\n\t\tmainContent.style.height = window.innerHeight + \"px\";\r\n\t\tvideoSearch.style.height = window.innerHeight + \"px\";\r\n\t\tleftAside.classList.remove(\"filter\");\r\n\t\tmainContent.classList.remove(\"filter\");\r\n\t\tshow(videoSearch);\r\n\t}\r\n}", "function makeSizer(size) {\nreturn function() {\ndocument.body.style.fontSize= size + \"px\";\n};\n}", "function resizeScreen() {\n // If navbarMenu is Open, Close It\n if (navbarMenu.classList.contains('active')) {\n toggleMenu();\n }\n\n // If menuItemHasChildren is Expanded, Collapse It\n if (navbarMenu.querySelector('.menu-item-has-children.active')) {\n collapseSubMenu();\n }\n }", "function change_font_size() {\n $(\".font_size_input\").val(actual_font_size);\n global.app.settings.font_size = actual_font_size;\n ui.actions_change_font_size(actual_font_size);\n ui.action_save_default_settings();\n }", "function title() {\n\n push();\n imageMode(CORNER);\n image(titleImage,0,0,windowWidth,windowHeight);\n textFont(\"Times New Roman\");\n textSize(40);\n text(\"THE CODED \\nMULTIDISCIPLINARY GALLERY\",width*0.56,height*0.3);\n textSize(20);\n fill(0);\n text(\"Huyen Tran Pham\",width*0.56,height*0.6);\n text(\"Click to move around in the gallery\",width*0.56,height*0.65);\n pop();\n\n}", "function checkSize( )\n{\n\n\t$('#container').css(\"height\", ($(window).height()-$('#footer').height())+\"px\");\n\n\tif( $(window).width() < 1270 || onHomePage )\n\t{\n\t\t$('#right_content').detach().appendTo(\"#menu\").addClass(\"small_size\");\n\t}\n\telse\n\t{\n\t\t$('#right_content').detach().appendTo(\"#right_content_container\").removeClass(\"small_size\");\n\t}\n\n\tvar marge=47;\n\tif ($.browser.msie && $.browser.version.substr(0,1)<=7){marge=50;}\n\t$('#black_screen').css('height', Math.max($('#container').height(),$('#subcontainer').height()+marge) )\n\t\t.css('width', $('#container').width());\n\t\n\t\n\tpositionLogo();\n\t\n\tcheckContentHeight();\n}", "function setDeviceSize() {\n screenSizeHeight = screenSizeHeightPX.pinLastValue();\n screenScaleValue = screenScale.pinLastValue();\n}", "function setPanelHeight(size) {\n if (size === 'small') {\n var heightOffset = viewport.max - viewport.min;\n var navHeight = $('.nav-container').height();\n\n $('#hero').css('height', viewport.min - navHeight);\n $('article').css('height', viewport.max);\n } else {\n $('#hero').css('height', '');\n $('article').css('height', '');\n }\n }", "function setSizes()\n {\n if (DOM.container.offsetHeight > DOM.container.offsetWidth)\n {\n DOM.container.style.minWidth = DOM.container.offsetHeight + \"PX\";\n }\n\n desk.style.height = sizes.desk.height + \"PX\";\n desk.style.width = sizes.desk.width + \"PX\";\n desk.style.marginBottom = sizes.deskContainer.marginBottom + \"PX\";\n\n for (var counterRow = 0; counterRow < sizes.field.rows; counterRow++)\n {\n for (var counterCol = 0; counterCol < sizes.field.cols; counterCol++)\n {\n DOM.game.field.rows[counterRow].cells[counterCol].style.height = sizes.card.height + \"PX\";\n DOM.game.field.rows[counterRow].cells[counterCol].style.width = sizes.card.width + \"PX\";\n\n var card = cards[counterRow * sizes.field.cols + counterCol];\n if (card)\n {\n card.style.height = sizes.card.height + \"PX\";\n card.style.width = sizes.card.width + \"PX\";\n }\n }\n }\n }", "fitScreenSize() {\n const isDiplayNone = $('#side').css('display') === 'none';\n if (isDiplayNone) this.canvas.setWidth($('body').width());\n else this.canvas.setWidth($('body').width() - $('#side').width());\n this.canvas.setHeight(\n $('body').height() - $('#nav').height() - 50 - 70 - 30,\n );\n }", "function responsive(){\n var widthLimit = options.responsive || options.responsiveWidth; //backwards compatiblity\n var heightLimit = options.responsiveHeight;\n\n //only calculating what we need. Remember its called on the resize event.\n var isBreakingPointWidth = widthLimit && $window.outerWidth() < widthLimit;\n var isBreakingPointHeight = heightLimit && $window.height() < heightLimit;\n\n if(widthLimit && heightLimit){\n FP.setResponsive(isBreakingPointWidth || isBreakingPointHeight);\n }\n else if(widthLimit){\n FP.setResponsive(isBreakingPointWidth);\n }\n else if(heightLimit){\n FP.setResponsive(isBreakingPointHeight);\n }\n\n /* nectar addition */ \n $(SECTION_NAV_SEL).css('margin-top', '-' + (($(SECTION_NAV_SEL).height()/2) - $adminBar - $headerHeight/2) + 'px');\n }", "function onResize() {\n\n adjustForScreenSize();\n\n // size main container to viewport\n if ( !screenIsSmall ) {\n let headerHeight = screenIsSmall ? sassVars.ui.header[ 'height-small' ] : sassVars.ui.header.height;\n document.getElementById( 'main' ).style.height = (window.innerHeight - headerHeight) + 'px';\n }\n\n // update all sections\n let section,\n sectionContainer,\n containerIsHidden;\n for ( let sectionKey in sections ) {\n section = sections[ sectionKey ];\n if ( section.isInited ) {\n\n // un-hide section container as necessary\n // to get accurate measurements for resize\n sectionContainer = containers[ sectionKey ];\n containerIsHidden = sectionContainer.style.display === 'none';\n if ( containerIsHidden ) {\n sectionContainer.style.display = 'block';\n }\n\n section.onResize( screenIsSmall );\n\n if ( containerIsHidden ) {\n sectionContainer.style.display = 'none';\n }\n\n }\n }\n\n\t}", "function resize() {\r\n \t$(\".docInformation\").css(\"opacity\", 1);\r\n var targetWidth = parseInt(container.style(\"width\"));\r\n svg.attr(\"width\", targetWidth);\r\n svg.attr(\"height\", Math.round(targetWidth / aspect));\r\n }", "navbarResponsive() {\n let x = document.getElementById(\"myTopnav\");\n if (x.className === \"topnav\") {\n x.className += \" responsive\";\n } else {\n x.className = \"topnav\";\n }\n }", "static responsiveness() {\n if (Game.mql.matches) { // min-width 768px\n Game.width = 720;\n } else {\n Game.width = window.innerWidth - 40;\n }\n // update width\n Game.canvas.width = Game.width;\n //! reset array\n Game.goldSectorsArr = [5];\n }", "function setFontSize() {\n let accessibleText = \"a, button:not('.text-size-toggle'), h1, h2, h3, h4, h5, h6, li, p, th, tr, td, span\";\n\n switch(Cookies.get('fontSize')) {\n case \"sm\":\n $(\"#text-size-sm\").addClass(\"btn-primary\");\n $(\"#text-size-rg\").removeClass(\"btn-primary\");\n $(\"#text-size-lg\").removeClass(\"btn-primary\");\n\n $(\"#text-size-sm\").removeClass(\"btn-default\");\n $(\"#text-size-rg\").addClass(\"btn-default\");\n $(\"#text-size-lg\").addClass(\"btn-default\");\n\n $(accessibleText).addClass(\"font-size-sm\");\n $(accessibleText).removeClass(\"font-size-lg\");\n break;\n case \"lg\":\n $(\"#text-size-sm\").removeClass(\"btn-primary\");\n $(\"#text-size-rg\").removeClass(\"btn-primary\");\n $(\"#text-size-lg\").addClass(\"btn-primary\");\n\n $(\"#text-size-sm\").addClass(\"btn-default\");\n $(\"#text-size-rg\").addClass(\"btn-default\");\n $(\"#text-size-lg\").removeClass(\"btn-default\");\n\n $(accessibleText).removeClass(\"font-size-sm\");\n $(accessibleText).addClass(\"font-size-lg\");\n break;\n default:\n $(\"#text-size-sm\").removeClass(\"btn-primary\");\n $(\"#text-size-rg\").addClass(\"btn-primary\");\n $(\"#text-size-lg\").removeClass(\"btn-primary\");\n\n $(\"#text-size-sm\").addClass(\"btn-default\");\n $(\"#text-size-rg\").removeClass(\"btn-default\");\n $(\"#text-size-lg\").addClass(\"btn-default\");\n \n $(accessibleText).removeClass(\"font-size-sm\");\n $(accessibleText).removeClass(\"font-size-lg\");\n break;\n }\n}", "function texte() {\n if (fontSize == 30) {\n fontSize = 50;\n titre1.style.fontSize = fontSize + \"px\";\n }\n else if (fontSize == 50) {\n fontSize = 30;\n titre1.style.fontSize = fontSize + \"px\";\n }\n}", "function help_resize() {\n\t\tvar h_height = inner_size()[1];\n\t\tdocument.getElementById('general').style.height = h_height-45;\n\t\tdocument.getElementById('chat').style.height = h_height-45;\n\t\tdocument.getElementById('calendar').style.height = h_height-45;\n\t\tdocument.getElementById('inbox').style.height = h_height-45;\n\t\tdocument.getElementById('compose').style.height = h_height-45;\n\t\tdocument.getElementById('address').style.height = h_height-45;\n\t\tdocument.getElementById('folders').style.height = h_height-45;\n\t\tdocument.getElementById('search').style.height = h_height-45;\n\t\tdocument.getElementById('preferences').style.height = h_height-45;\n\t\tdocument.getElementById('credits').style.height = h_height-45;\n\t}", "function resizeCards() {\n $('.card').css('width', window.innerHeight * 0.8 / 3.1);\n $('.card').css('height', window.innerHeight * 0.8 / 3.1);\n }", "function updateSize(newSize) {\n // FINISH ME! Set the width of the MEET logo to be newSize in pixels.\n\t$(\"img\").eq(0).css(\"width\", newSize);\n}", "function ResizeHTMLContent(){\n\tElemId(\"HTMLContent\").style.top = ElemId(\"Header\").style.height;\n\tElemId(\"HTMLContent\").style.left = ElemId(\"Menu\").style.width;\n\tElemId(\"HTMLContent\").style.height = (wHeight - CropPX(ElemId(\"Header\").style.height) - CropPX(ElemId(\"Playbar\").style.height)) + \"px\";\n\tElemId(\"HTMLContent\").style.width = (wWidth - CropPX(ElemId(\"Menu\").style.width)) + \"px\";\n\t\n\tswitch(viewState.state){\n\t\tcase STATEARTISTS:\n\t\t\tResizeArtists();\n\t\t\tbreak;\n\t\tcase STATEALBUMS:\n\t\t\tResizeAlbums();\n\t\t\tbreak;\n\t\tcase STATEPLAYLIST:\n\t\t\tResizePlaylist();\n\t\t\tbreak;\n\t\tcase STATESETTINGS:\n\t\t\tResizeSettings();\n\t\t\tbreak;\n\t}\n}", "canvasResize()\n {\n View.canvas.setAttribute(\"width\", this.floatToInt(window.innerWidth*0.95));\n View.canvas.setAttribute(\"height\",this.floatToInt(window.innerHeight*0.95));\n\n //update objects with the new size\n this.updateCharacterDim();\n this.updateVirusDim();\n this.updateSyringesDim();\n this.background.resize();\n\n }", "function setUI() {\n $('.menu_options__psize .w').val(defPixelWidth);\n $('.menu_options__psize .h').val(defPixelWidth);\n $('.menu_options__ssize .w').val(defSceneWidth);\n $('.menu_options__ssize .h').val(defSceneHeight);\n $('button.s').data('size',`${defSceneWidth},${defSceneHeight}`);\n $('button.m').data('size',`${defSceneWidth * 1.5},${defSceneHeight * 1.5}`);\n $('button.l').data('size',`${defSceneWidth * 2},${defSceneHeight * 2}`);\n $('button.xl').data('size',`${defSceneWidth * 2.5},${defSceneHeight * 2.5}`);\n}", "function changeSize() {\r\n if (w3.matches) {\r\n canvas.setAttribute(\"width\", \"300\");\r\n canvas.setAttribute(\"height\", \"450\");\r\n h = 450;\r\n w = 300;\r\n if (window.matchMedia(\"(max-height: 700px)\").matches) {\r\n canvas.setAttribute(\"height\", \"375\");\r\n h = 375;\r\n }\r\n if (window.matchMedia(\"(max-height: 600px)\").matches) {\r\n canvas.setAttribute(\"height\", \"300\");\r\n h = 300;\r\n } \r\n unit = 15;\r\n space = unit * nSpace;\r\n clearCanvas();\r\n } else if (w2.matches) {\r\n canvas.setAttribute(\"width\", \"600\");\r\n canvas.setAttribute(\"height\", \"600\");\r\n h = 600;\r\n w = 600;\r\n clearCanvas();\r\n } else if (w1.matches) {\r\n canvas.setAttribute(\"width\", \"600\");\r\n canvas.setAttribute(\"height\", \"800\");\r\n h = 800;\r\n w = 600;\r\n clearCanvas();\r\n } else {\r\n canvas.setAttribute(\"width\", \"600\");\r\n canvas.setAttribute(\"height\", \"500\");\r\n h = 500;\r\n w = 600;\r\n clearCanvas();\r\n }\r\n}", "function ResizeTop50() {\n AlterRatingHeights(top50ArcadeRatings, \"\", \"rating\");\n AlterRatingHeights(top50PinballRatings, \"\", \"rating\");\n}", "function navbar_simple(pdiv,wrap)\n{\n//constructor:\n this.wrap=wrap;\n \n this.box=document.createElement(\"div\");\n this.box_inner=document.createElement(\"div\");\n this.box.className=\"elem_navbar_box\";\n this.box_inner.className=\"elem_navbar_box_inner\";\n this.box.appendChild(this.box_inner);\n pdiv.appendChild(this.box);\n\n \n this.content=\"\";\n this.cpage=currentpage;\n this.layout=\"standard\";\n\n//public:\n this.destroy=function()\n {\n \n pdiv.removeChild(this.box);\n }\n \n this.preset=function()\n {\n var o=\"\\\n <div align='center'>\\\n loading...\\\n </div>\";\n this.box.innerHTML=o;\n\n }\n /*\n this.mbox=function()\n {\n return this.d4;\n }\n */\n \n//private:\n \n this.onResize=function()\n {\n if(true)//this.layout==\"logo_layout\")\n {\n if(screenx<580 && this.layout==\"logo_layout\")\n {\n var o=\"\";\n var lines=this.content.split(\"\\n\");\n for(var i=0;i<lines.length;i++)\n {\n var a=lines[i].split(\"|\");\n if(a[2]==currentpage.substr(0,a[2].length))style=\"topnav2\";else style=\"topnav\";\n o+=\"<a href=\\\"\"+a[1]+\"\\\" class=\\\"\"+style+\"\\\">\"+a[0]+\"</a>\";\n if(i==0)o+=\"<br>\";\n if(i>0 && i+1<lines.length)o+=\"&nbsp;|&nbsp;\";\n }\n o+=\"</nobr>\";\n this.box_inner.innerHTML=o;\n }\n else\n {\n var o=\"\";\n var lines=this.content.split(\"\\n\");\n for(var i=0;i<lines.length;i++)\n {\n var a=lines[i].split(\"|\");\n if(a[2]==currentpage.substr(0,a[2].length))style=\"topnav2\";else style=\"topnav\";\n o+=\"<a href=\\\"\"+a[1]+\"\\\" class=\\\"\"+style+\"\\\">\"+a[0]+\"</a>\";\n if(i+1<lines.length)o+=\"&nbsp;|&nbsp;\";\n }\n o+=\"</nobr>\";\n this.box_inner.innerHTML=o;\n }\n }\n\n }\n \n this.setup=function(s)\n {\n elements_setup(s,this.wrap,\"simple\");\n }\n}" ]
[ "0.64910144", "0.62984633", "0.626563", "0.6264973", "0.6174927", "0.6148891", "0.59855944", "0.59722465", "0.5960034", "0.59187615", "0.58019626", "0.57855666", "0.5762473", "0.5759563", "0.5758983", "0.5747835", "0.57472754", "0.57418513", "0.57347995", "0.57338744", "0.57275593", "0.5723119", "0.57210034", "0.56859773", "0.5683247", "0.5666965", "0.56455934", "0.56442547", "0.5637744", "0.5597013", "0.559538", "0.5592077", "0.55897284", "0.5585649", "0.55856025", "0.55848634", "0.55727947", "0.5570127", "0.55616075", "0.5560161", "0.5558052", "0.55568105", "0.55426353", "0.5541601", "0.55415666", "0.5537604", "0.5527914", "0.5517675", "0.5515303", "0.55057675", "0.55049956", "0.5504369", "0.5495316", "0.5494746", "0.5493912", "0.5490817", "0.5473958", "0.5470915", "0.54609394", "0.54606354", "0.54536253", "0.5451361", "0.5448941", "0.54459876", "0.54402363", "0.5439841", "0.54391706", "0.5437473", "0.54213053", "0.5418648", "0.5412877", "0.5408759", "0.54061294", "0.54015756", "0.5396781", "0.5388332", "0.5386403", "0.53815913", "0.5377579", "0.5375771", "0.5374147", "0.53690267", "0.5363065", "0.5356301", "0.5350419", "0.5349594", "0.53488404", "0.53469014", "0.53407544", "0.5338967", "0.5336382", "0.53342545", "0.5334203", "0.5333217", "0.53330016", "0.5330404", "0.53298694", "0.5321948", "0.53159857", "0.53133106" ]
0.5650471
26
change the top carousel items to fit the small window size
function changeFlowItemToFitSmallWindow(i) { deckTitle[i].style.left = "40px"; deckTitle[i].style.maxWidth = "50%"; imageFlowCard[i].style.width = "116px"; imageFlowCard[i].style.height = "140px"; imageFlowCard[i].style.right = "25px"; imageFlowCard[i].style.top = "40px"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setHeightCarousel3() {\n $carousel3.each(function () {\n var $allImages = $(this).find('img');\n var size = $(this).attr('data-size') || 0.8;\n var resultH = wndH * size;\n var maxItemW = Math.min($(this).parent().width(), wndW) * size;\n $allImages.each(function () {\n if (this.naturalWidth && this.naturalHeight && resultH * this.naturalWidth / this.naturalHeight > maxItemW) {\n resultH = maxItemW * this.naturalHeight / this.naturalWidth;\n }\n });\n $allImages.css('height', resultH);\n $(this).children('.nk-carousel-inner').flickity('reposition');\n });\n }", "function adjustSize() {\n const childWidth = carousel.offsetWidth;\n carousel.style.height = childWidth + \"px\";\n carouselInner.style.height = childWidth + \"px\";\n const children = document.querySelectorAll(\".page-item\");\n children.forEach(child => {\n child.style.width = (childWidth / 2) * 0.96 + \"px\";\n });\n circle1.click();\n}", "function ResCarouselSize() {\n \n var incno = 0;\n var dataItems = (\"data-items\");\n var itemClass = ('.item');\n var id = 0;\n var btnParentSb = '';\n var itemsSplit = '';\n var sampwidth = $(itemsMainDiv).width();\n var bodyWidth = $('body').width();\n $(itemsDiv).each(function () {\n id = id + 1;\n var itemNumbers = $(this).find(itemClass).length;\n btnParentSb = $(this).parent().attr(dataItems);\n itemsSplit = btnParentSb.split(',');\n $(this).parent().attr(\"id\", \"MultiCarousel\" + id);\n\n\n if (bodyWidth >= 1200) {\n incno = itemsSplit[3];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 992) {\n incno = itemsSplit[2];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 768) {\n incno = itemsSplit[1];\n itemWidth = sampwidth / incno;\n }\n else {\n incno = itemsSplit[0];\n itemWidth = sampwidth / incno;\n }\n $(this).css({ 'transform': 'translateX(0px)', 'width': itemWidth * itemNumbers });\n $(this).find(itemClass).each(function () {\n $(this).outerWidth(itemWidth);\n });\n\n $(\".leftLst\").addClass(\"over\");\n $(\".rightLst\").removeClass(\"over\");\n\n });\n }", "function changeSize() {\n carouselWrapWidth = carouselWrap.offsetWidth;\n isResizing = true;\n carouselList.style.transition = \"\";\n moveCarousel();\n}", "function ResCarouselSize() {\n var incno = 0;\n var dataItems = (\"data-items\");\n var itemClass = ('.item');\n var id = 0;\n var btnParentSb = '';\n var itemsSplit = '';\n var sampwidth = $(itemsMainDiv).width();\n var bodyWidth = $('body').width();\n $(itemsDiv).each(function() {\n id = id + 1;\n var itemNumbers = $(this).find(itemClass).length;\n btnParentSb = $(this).parent().attr(dataItems);\n itemsSplit = btnParentSb.split(',');\n $(this).parent().attr(\"id\", \"MultiCarousel\" + id);\n\n\n if (bodyWidth >= 1200) {\n incno = itemsSplit[3];\n itemWidth = sampwidth / incno;\n } else if (bodyWidth >= 992) {\n incno = itemsSplit[2];\n itemWidth = sampwidth / incno;\n } else if (bodyWidth >= 768) {\n incno = itemsSplit[1];\n itemWidth = sampwidth / incno;\n } else {\n incno = itemsSplit[0];\n itemWidth = sampwidth / incno;\n }\n $(this).css({\n 'transform': 'translateX(0px)',\n 'width': itemWidth * itemNumbers\n });\n $(this).find(itemClass).each(function() {\n $(this).outerWidth(itemWidth);\n });\n\n $(\".leftLst\").addClass(\"over\");\n $(\".rightLst\").removeClass(\"over\");\n\n });\n }", "function ResCarouselSize() {\n var incno = 0;\n var dataItems = (\"data-items\");\n var itemClass = ('.item');\n var id = 0;\n var btnParentSb = '';\n var itemsSplit = '';\n var sampwidth = $(itemsMainDiv).width();\n var bodyWidth = $('body').width();\n $(itemsDiv).each(function () {\n id = id + 1;\n var itemNumbers = $(this).find(itemClass).length;\n btnParentSb = $(this).parent().attr(dataItems);\n itemsSplit = btnParentSb.split(',');\n $(this).parent().attr(\"id\", \"MultiCarousel\" + id);\n\n\n if (bodyWidth >= 1200) {\n incno = itemsSplit[3];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 992) {\n incno = itemsSplit[2];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 768) {\n incno = itemsSplit[1];\n itemWidth = sampwidth / incno;\n }\n else {\n incno = itemsSplit[0];\n itemWidth = sampwidth / incno;\n }\n $(this).css({ 'transform': 'translateX(0px)', 'width': itemWidth * itemNumbers });\n $(this).find(itemClass).each(function () {\n $(this).outerWidth(itemWidth);\n });\n\n $(\".leftLst\").addClass(\"over\");\n $(\".rightLst\").removeClass(\"over\");\n\n });\n }", "function ResCarouselSize() {\n var incno = 0;\n var dataItems = (\"data-items\");\n var itemClass = ('.item');\n var id = 0;\n var btnParentSb = '';\n var itemsSplit = '';\n var sampwidth = $(itemsMainDiv).width();\n var bodyWidth = $('body').width();\n $(itemsDiv).each(function () {\n id = id + 1;\n var itemNumbers = $(this).find(itemClass).length;\n btnParentSb = $(this).parent().attr(dataItems);\n itemsSplit = btnParentSb.split(',');\n $(this).parent().attr(\"id\", \"MultiCarousel\" + id);\n\n\n if (bodyWidth >= 1200) {\n incno = itemsSplit[3];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 992) {\n incno = itemsSplit[2];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 768) {\n incno = itemsSplit[1];\n itemWidth = sampwidth / incno;\n }\n else {\n incno = itemsSplit[0];\n itemWidth = sampwidth / incno;\n }\n $(this).css({ 'transform': 'translateX(0px)', 'width': itemWidth * itemNumbers });\n $(this).find(itemClass).each(function () {\n $(this).outerWidth(itemWidth);\n });\n\n $(\".leftLst\").addClass(\"over\");\n $(\".rightLst\").removeClass(\"over\");\n\n });\n }", "function ResCarouselSize() {\n var incno = 0;\n var dataItems = (\"data-items\");\n var itemClass = ('.item');\n var id = 0;\n var btnParentSb = '';\n var itemsSplit = '';\n var sampwidth = $(itemsMainDiv).width();\n var bodyWidth = $('body').width();\n $(itemsDiv).each(function () {\n id = id + 1;\n var itemNumbers = $(this).find(itemClass).length;\n btnParentSb = $(this).parent().attr(dataItems);\n itemsSplit = btnParentSb.split(',');\n $(this).parent().attr(\"id\", \"MultiCarousel\" + id);\n\n\n if (bodyWidth >= 1200) {\n incno = itemsSplit[3];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 992) {\n incno = itemsSplit[2];\n itemWidth = sampwidth / incno;\n }\n else if (bodyWidth >= 768) {\n incno = itemsSplit[1];\n itemWidth = sampwidth / incno;\n }\n else {\n incno = itemsSplit[0];\n itemWidth = sampwidth / incno;\n }\n $(this).css({ 'transform': 'translateX(0px)', 'width': itemWidth * itemNumbers });\n $(this).find(itemClass).each(function () {\n $(this).outerWidth(itemWidth);\n });\n\n $(\".leftLst\").addClass(\"over\");\n $(\".rightLst\").removeClass(\"over\");\n\n });\n }", "function ResCarouselSize() {\r\n var incno = 0;\r\n var dataItems = (\"data-items\");\r\n var itemClass = ('.item');\r\n var id = 0;\r\n var btnParentSb = '';\r\n var itemsSplit = '';\r\n var sampwidth = $(itemsMainDiv).width();\r\n var bodyWidth = $('body').width();\r\n $(itemsDiv).each(function () {\r\n id = id + 1;\r\n var itemNumbers = $(this).find(itemClass).length;\r\n btnParentSb = $(this).parent().attr(dataItems);\r\n itemsSplit = btnParentSb.split(',');\r\n $(this).parent().attr(\"id\", \"MultiCarousel\" + id);\r\n\r\n\r\n if (bodyWidth >= 1200) {\r\n incno = itemsSplit[7];\r\n itemWidth = sampwidth / 5;\r\n }\r\n else if (bodyWidth >= 992) {\r\n incno = itemsSplit[1];\r\n itemWidth = sampwidth / incno;\r\n }\r\n else if (bodyWidth >= 768) {\r\n incno = itemsSplit[1];\r\n itemWidth = sampwidth / incno;\r\n }\r\n else {\r\n incno = itemsSplit[0];\r\n itemWidth = sampwidth / incno;\r\n }\r\n $(this).css({ 'transform': 'translateX(0px)', 'width': itemWidth * 8 });\r\n $(this).find(itemClass).each(function () {\r\n $(this).outerWidth(itemWidth);\r\n });\r\n\r\n $(\".leftLst\").addClass(\"over\");\r\n $(\".rightLst\").removeClass(\"over\");\r\n\r\n });\r\n }", "function setHeightCarousel3() {\n $carousel3.each(function eachCarousel3() {\n var $allImages = (0, _utility.$)(this).find('img');\n var size = (0, _utility.$)(this).attr('data-size') || 0.8;\n var resultH = _utility.wndH * size;\n var maxItemW = Math.min((0, _utility.$)(this).parent().width(), _utility.wndW) * size;\n $allImages.each(function eachCarousel3Images() {\n if (this.naturalWidth && this.naturalHeight && resultH * this.naturalWidth / this.naturalHeight > maxItemW) {\n resultH = maxItemW * this.naturalHeight / this.naturalWidth;\n }\n });\n $allImages.css('height', resultH);\n (0, _utility.$)(this).children('.nk-carousel-inner').flickity('reposition');\n });\n }", "function onSizeChange(){\n\t\t\n\t\tvar galleryWidth = getGalleryWidth();\n\t\tg_carousel.setMaxWidth(galleryWidth);\n\t\tg_carousel.run();\n\t\t\t\n\t\tpositionElements();\n\t}", "function changeToFit() { //fix\n if (($(window).width() < 559)) {\n for (i = 0; i < trendingDecks.length; i++) {\n trendingDecks[i].parentElement.style.height = \"134px\";\n }\n for (i = 0; i < authorDeck.length; i++) {\n // the carousel elements\n authorDeck[i].style.fontSize = \"13px\";\n deckTitle[i].children[0].classList.add(\"h5\");\n deckTitle[i].style.maxWidth = \"50%\";\n changeFlowItemToFitSmallWindow(i)\n }\n // nav bar\n removeAbsolutePosition();\n userBar.style.width = \"100%\";\n for (i = 0; i < userBar.children.length; i++) {\n userBar.children[i].style.width = String($(window).width() / 4) + \"px\";\n }\n } else if (($(window).width() < 700)) {\n // nav bar\n spreadNavBar();\n removeAbsolutePosition();\n for (i = 0; i < trendingDecks.length; i++) {\n trendingDecks[i].parentElement.style.height = \"134px\";\n }\n for (i = 0; i < userBar.children.length; i++) {\n userBar.children[i].style.width = \"\";\n }\n // carousel\n for (i = 0; i < authorDeck.length; i++) {\n spreadCarousel(i);\n changeFlowItemToFitSmallWindow(i)\n }\n } else if ($(window).width() < 977) {\n for (i = 0; i < trendingDecks.length; i++) {\n trendingDecks[i].parentElement.style.height = \"134px\";\n }\n // nav bar\n spreadNavBar();\n userBar.classList.add(\"position-absolute\");\n userBar.style.right = \"-80px\";\n // carousel\n for (i = 0; i < imageFlowCard.length; i++) {\n spreadCarousel(i);\n changeFlowItemToFitSmallWindow(i);\n }\n } else if ($(window).width() < 1200) {\n // trending decks\n for (i = 0; i < trendingDecks.length; i++) {\n trendingDecks[i].parentElement.style.height = \"134px\";\n }\n // navbar\n spreadNavBar();\n removeAbsolutePosition();\n for (var i = 0; i < imageFlowCard.length; i++) {\n // carousel\n spreadCarousel(i);\n changeFlowItemToFitLargeWindow(i);\n }\n } else {\n // navbar\n spreadNavBar();\n removeAbsolutePosition();\n for (i = 0; i < trendingDecks.length; i++) {\n trendingDecks[i].parentElement.style.height = \"166px\";\n }\n for (i = 0; i < imageFlowCard.length; i++) {\n // carousel\n spreadCarousel(i);\n changeFlowItemToFitLargeWindow(i);\n }\n }\n}", "function resizeslider(){\n\t$(\".slider .items\").css({\"height\":$(window).height()});\n\t$(\".slider\").css({\"height\":$(window).height()});\n}", "function resizeCarousel(carousel) {\n const parentWidth = $(carousel).width();\n const Btns = $(carousel).find(\".btn-prev , .btn-next\");\n Btns.hide();\n let inner = $(carousel).find(\".CustomCarousel-inner\");\n const items = $(inner).find(\".item\");\n let pad = $(carousel).attr(\"data-padding\");\n if (pad == NaN) pad = 0;\n\n $(items).hide();\n let widthCount = 0;\n let visibleItems = 0;\n if ($(carousel).hasClass(\"spaced\")) {\n spaced(carousel, parentWidth, items, pad);\n }\n let last;\n let i = 0;\n let maxHeight = 200;\n $(items).each(function () {\n if ($(this).height() > maxHeight) maxHeight = $(this).height();\n if (i++ > 0) $(this).css(\"padding-left\", pad + \"px\");\n else $(this).css(\"padding-left\", 0);\n $(this).removeClass(\"Last\");\n widthCount += $(this).outerWidth();\n if (widthCount < parentWidth) {\n visibleItems++;\n $(this).show();\n $(this).addClass(\"Visib\");\n last = $(this);\n } else $(this).removeClass(\"Visib\");\n });\n $(carousel).height(maxHeight + \"px\");\n if (last) last.addClass(\"Last\");\n if (items.length > visibleItems) {\n Btns.height($(carousel).height());\n Btns.show();\n }\n}", "function changeSliderSize() {\n\t\t\twrapperA.css({\n\t\t\t\twidth: itemsA.length * (sliderWidth + 2 * sliderMargin) + \"vw\",\n\t\t\t\tmarginLeft: getWrapperMargin() + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsA.css({\n\t\t\t\twidth: sliderWidth + \"vw\",\n\t\t\t\theight: sliderHeight + \"em\",\n\t\t\t\tmargin: \"0 \" + sliderMargin + \"vw\"\n\t\t\t});\n\t\t}", "function qodeNumberOfTestimonialsItemsResize(){\n\n\n var testimonialsSlider = $j('.testimonials_carousel, .testimonials_c_carousel');\n\n if(testimonialsSlider.length){\n testimonialsSlider.each(function(){\n var thisSliderHolder = $j(this);\n\n var items = qodeNumberOfTestimonialsItems(thisSliderHolder);\n\n thisSliderHolder.data('flexslider').vars.minItems = items;\n thisSliderHolder.data('flexslider').vars.maxItems = items;\n });\n }\n}", "function setCarouselHeight() {\n setSingleCarouselHeight('testimonialCarousel');\n setSingleCarouselHeight('textCarousel');\n setSingleCarouselHeight('panelCarousel');\n}", "function resizeElements() {\n\t// Compute the max height so that the settings fit on the screen\n\t$('#song-list').height($(window).height() - $('#settings-container-inner').height() - 200);\n}", "function simpleLayoutChanges() {\n \"use strict\";\n var container = $('.container').width();\n $('.testimonial_carousel .item').each(function() {\n\n var self = $(this);\n var wpb_column = self.parents('.wpb_column').first().width();\n self.innerWidth(wpb_column + 'px');\n self.height(self.height() + 'px');\n self.parents('.caroufredsel_wrapper').first().height(self.height() + 'px');\n self.parents('.testimonial_carousel').first().height(self.height() + 'px');\n\n });\n\n $('.clients_caro .item').each(function() {\n var self = $(this);\n var wpb_column = self.parents('.vc_column-inner').width();\n\n if (container > 420 && container <= 724) {\n self.innerWidth((wpb_column / 3) + 'px');\n }\n if (container > 724 && container < 940) {\n self.innerWidth((wpb_column / 4) + 'px');\n }\n if (container > 940) {\n self.innerWidth((wpb_column / 6) + 'px');\n }\n });\n\n clientsCarousel();\n }", "function setSliderElementsSize($item,i){\n if($window_width > responsive_breakpoint_set[0]) {\n slider_graphic_coefficient = coefficients_graphic_array[0];\n slider_title_coefficient = coefficients_title_array[0];\n slider_subtitle_coefficient = coefficients_subtitle_array[0];\n slider_text_coefficient = coefficients_text_array[0];\n slider_button_coefficient = coefficients_button_array[0];\n }else if($window_width > responsive_breakpoint_set[1]){\n slider_graphic_coefficient = coefficients_graphic_array[1];\n slider_title_coefficient = coefficients_title_array[1];\n slider_subtitle_coefficient = coefficients_subtitle_array[1];\n slider_text_coefficient = coefficients_text_array[1];\n slider_button_coefficient = coefficients_button_array[1];\n }else if($window_width > responsive_breakpoint_set[2]){\n slider_graphic_coefficient = coefficients_graphic_array[2];\n slider_title_coefficient = coefficients_title_array[2];\n slider_subtitle_coefficient = coefficients_subtitle_array[2];\n slider_text_coefficient = coefficients_text_array[2];\n slider_button_coefficient = coefficients_button_array[2];\n }else if($window_width > responsive_breakpoint_set[3]){\n slider_graphic_coefficient = coefficients_graphic_array[3];\n slider_title_coefficient = coefficients_title_array[3];\n slider_subtitle_coefficient = coefficients_subtitle_array[3];\n slider_text_coefficient = coefficients_text_array[3];\n slider_button_coefficient = coefficients_button_array[3];\n }else if ($window_width > responsive_breakpoint_set[4]) {\n slider_graphic_coefficient = coefficients_graphic_array[4];\n slider_title_coefficient = coefficients_title_array[4];\n slider_subtitle_coefficient = coefficients_subtitle_array[4];\n slider_text_coefficient = coefficients_text_array[4];\n slider_button_coefficient = coefficients_button_array[4];\n }else if ($window_width > responsive_breakpoint_set[5]){\n slider_graphic_coefficient = coefficients_graphic_array[5];\n slider_title_coefficient = coefficients_title_array[5];\n slider_subtitle_coefficient = coefficients_subtitle_array[5];\n slider_text_coefficient = coefficients_text_array[5];\n slider_button_coefficient = coefficients_button_array[5];\n }\n else{\n slider_graphic_coefficient = coefficients_graphic_array[6];\n slider_title_coefficient = coefficients_title_array[6];\n slider_subtitle_coefficient = coefficients_subtitle_array[6];\n slider_text_coefficient = coefficients_text_array[6];\n slider_button_coefficient = coefficients_button_array[6];\n }\n\n // letter-spacing decrease quicker\n var slider_title_coefficient_letter_spacing = slider_title_coefficient;\n var slider_subtitle_coefficient_letter_spacing = slider_subtitle_coefficient;\n var slider_text_coefficient_letter_spacing = slider_text_coefficient;\n if($window_width <= responsive_breakpoint_set[0]) {\n slider_title_coefficient_letter_spacing = slider_title_coefficient/2;\n slider_subtitle_coefficient_letter_spacing = slider_subtitle_coefficient/2;\n slider_text_coefficient_letter_spacing = slider_text_coefficient/2;\n }\n\n $item.find('.thumb').css({\"width\": Math.round(window[\"slider_graphic_width_\" + i][0]*slider_graphic_coefficient) + 'px'}).css({\"height\": Math.round(window[\"slider_graphic_height_\" + i][0]*slider_graphic_coefficient) + 'px'});\n $item.find('.qode_slide-svg-holder svg').css({\"width\": Math.round(window[\"slider_svg_width_\" + i][0]*slider_graphic_coefficient) + 'px'}).css({\"height\": Math.round(window[\"slider_svg_height_\" + i][0]*slider_graphic_coefficient) + 'px'});\n\n $item.find('.q_slide_title').css({\"font-size\": Math.round(window[\"slider_title_\" + i][0]*slider_title_coefficient) + 'px'});\n $item.find('.q_slide_title').css({\"line-height\": Math.round(window[\"slider_title_\" + i][1]*slider_title_coefficient) + 'px'});\n $item.find('.q_slide_title').css({\"letter-spacing\": Math.round(window[\"slider_title_\" + i][2]*slider_title_coefficient_letter_spacing) + 'px'});\n $item.find('.q_slide_title').css({\"margin-bottom\": Math.round(window[\"slider_title_\" + i][3]*slider_title_coefficient) + 'px'});\n\n $item.find('.q_slide_subtitle').css({\"font-size\": Math.round(window[\"slider_subtitle_\" + i][0]*slider_subtitle_coefficient) + 'px'});\n $item.find('.q_slide_subtitle').css({\"line-height\": Math.round(window[\"slider_subtitle_\" + i][1]*slider_subtitle_coefficient) + 'px'});\n $item.find('.q_slide_subtitle').css({\"letter-spacing\": Math.round(window[\"slider_subtitle_\" + i][2]*slider_subtitle_coefficient_letter_spacing) + 'px'});\n $item.find('.q_slide_subtitle').css({\"margin-bottom\": Math.round(window[\"slider_subtitle_\" + i][3]*slider_subtitle_coefficient) + 'px'});\n\n $item.find('.q_slide_text').css({\"font-size\": Math.round(window[\"slider_text_\" + i][0]*slider_text_coefficient) + 'px'});\n $item.find('.q_slide_text').css({\"line-height\": Math.round(window[\"slider_text_\" + i][1]*slider_text_coefficient) + 'px'});\n $item.find('.q_slide_text').css({\"letter-spacing\": Math.round(window[\"slider_text_\" + i][2]*slider_text_coefficient_letter_spacing) + 'px'});\n\n $item.find('.qbutton:eq(0)').css({\"font-size\": Math.round(window[\"slider_button1_\" + i][0]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"font-size\": Math.round(window[\"slider_button2_\" + i][0]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"line-height\": Math.round(window[\"slider_button1_\" + i][1]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"line-height\": Math.round(window[\"slider_button2_\" + i][1]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"letter-spacing\": Math.round(window[\"slider_button1_\" + i][2]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"letter-spacing\": Math.round(window[\"slider_button2_\" + i][2]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"height\": Math.round(window[\"slider_button1_\" + i][3]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"height\": Math.round(window[\"slider_button2_\" + i][3]*slider_button_coefficient) + 'px'});\n if(window[\"slider_button1_\" + i][4] != 0) {\n $item.find('.qbutton:eq(0)').css({\"width\": Math.round(window[\"slider_button1_\" + i][4]*slider_button_coefficient) + 'px'});\n }else{\n $item.find('.qbutton:eq(0)').css({\"width\": 'auto'});\n }\n if(window[\"slider_button2_\" + i][4] != 0) {\n $item.find('.qbutton:eq(1)').css({\"width\": Math.round(window[\"slider_button2_\" + i][4]*slider_button_coefficient) + 'px'});\n }else{\n $item.find('.qbutton:eq(1)').css({\"width\": 'auto'});\n }\n $item.find('.qbutton:eq(0)').css({\"padding-left\": Math.round(window[\"slider_button1_\" + i][5]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"padding-left\": Math.round(window[\"slider_button2_\" + i][5]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(0)').css({\"padding-right\": Math.round(window[\"slider_button1_\" + i][6]*slider_button_coefficient) + 'px'});\n $item.find('.qbutton:eq(1)').css({\"padding-right\": Math.round(window[\"slider_button2_\" + i][6]*slider_button_coefficient) + 'px'});\n\n $item.find('.separator').css({\"margin-top\": Math.round(window[\"slider_separator_\" + i][0]*slider_title_coefficient) + 'px'});\n $item.find('.separator').css({\"margin-bottom\": Math.round(window[\"slider_separator_\" + i][1]*slider_title_coefficient) + 'px'});\n\n }", "function topResizeOnresize() {\n\n var alldivs = document.getElementsByClassName('a1');\n var viewportwidth = window.innerWidth;\n var x;\n\n if (document.cookie.indexOf(\"r=1\") > 0) {\n if ( viewportwidth > 1200 ) {\n for (x = 0; x < alldivs.length; x++) {\n alldivs[x].style.height = \"auto\";\n }\n // repeat init resize:\n topResize();\n }\n }\n\n\n\n}// f a1resize onresize", "function resize() {\n // $pages.find('.sc-slides').find('.infos').height(window.innerHeight);\n // _controller.update(true);\n}", "function resizeBasketItems(){\n var winHeight = $(window).height(),\n heightTop = (winHeight - 350) > 160 ? winHeight - 350 : 160,\n heightBasket = (winHeight - 320) > 160 ? winHeight - 320 : 160;\n\n $('.compared .basket-items, .watched .basket-items').css({\n 'max-height': heightTop + 'px'\n });\n $('.header-basket .basket-items').css({\n 'max-height': heightBasket + 'px'\n });\n}", "function ResizeTop50() {\n AlterRatingHeights(top50ArcadeRatings, \"\", \"rating\");\n AlterRatingHeights(top50PinballRatings, \"\", \"rating\");\n}", "function resizeImgs() {\n window.galleryItemsWidth = $(galleryItemList[0]).innerWidth();\n for (var i = galleryItemsLength - 1; i >= 0; i--) {\n\n $item = $(galleryItemList[i]);\n\n var itemAttrWidth = $item.attr('width'),\n itemAttrHeight = $item.attr('height')\n itemCurrentHeight = Math.floor(galleryItemsWidth * itemAttrHeight / itemAttrWidth);\n $item.height(itemCurrentHeight);\n };\n }", "function changeFlowItemToFitLargeWindow(i) {\n deckTitle[i].style.left = \"60px\";\n imageFlowCard[i].style.width = \"144px\";\n imageFlowCard[i].style.height = \"166px\";\n imageFlowCard[i].style.right = \"60px\";\n imageFlowCard[i].style.top = \"30px\";\n deckTitle[i].style.maxWidth = \"50%\";\n\n}", "_expandSlider() {\n for (const item of this._items) {\n const li = this._createItemWrap();\n this._itemsHolder.append(li);\n li.append(item);\n }\n this._addItemsSpacing();\n this._setDisplayedItemsClasses();\n this._viewLimiter.append(this._itemsHolder);\n this._container.append(this._viewLimiter);\n }", "function initCarousel($c, $w){\n $c.show().carouFredSel({\n align: false,\n items: Math.min($c.children().length - 1, 12),\n scroll: {\n items: 1,\n duration: 7500,\n timeoutDuration: 0,\n easing: 'linear',\n pauseOnHover: 'immediate'\n }\n });\n\n \n $w.bind('resize.affiliations', function() {\n var nw = $w.width();\n if (nw < 990) {\n nw = 990;\n }\n\n $c.width(nw * 3);\n $c.parent().width(nw);\n\n }).trigger('resize.affiliations');\n}", "setStyle (){\n // console.log(\"style\")\n let ratio = this.items.length / this.slidesVisible\n this.container.style.width = (ratio * 100)+ \"%\"\n this.items.forEach(item => item.style.width= ((100 / this.slidesVisible )/ ratio) + \"%\")\n }", "function autoAlign(){\r\n var windowWidth = $(window).width();\r\n var windowHeight= $(window).height();\r\n var logoWidth = $(\".logo\").innerWidth();\r\n var topBarHeight = $(\".topBar\").height();\r\n var navHeight = $(\"header nav\").outerHeight();\r\n $(\".logo\").css(\"margin-left\", (windowWidth - logoWidth)/2 + \"px\");\r\n $(\".carousel\").css(\"padding-top\", topBarHeight + navHeight + \"px\");\r\n if(windowWidth > windowHeight){\r\n $(\".carousel-item img\").css(\"height\", windowHeight-topBarHeight-navHeight + \"px\");\r\n }\r\n else{ \r\n $(\".carousel-item img\").css(\"height\", \"auto\");\r\n }\r\n }", "function initDesktopCarusel()\n {\n var $carousel = $('.desktop-carousel');\n var $carouselItems;\n var startPosition = Math.floor($carousel.children().length / 2);\n var inaccuracy;\n \n //initializes carousel\n $carousel.owlCarousel ({\n items: 1,\n startPosition: startPosition,\n loop: true,\n center: true,\n mouseDrag: false,\n smartSpeed: 500,\n dotsSpeed: 500,\n responsive: {\n 1800: {\n items: 2\n },\n 3000: {\n items: 3\n },\n 4000: {\n items: 5\n }\n }\n });\n \n $carouselItems = $carousel.find('.owl-item');\n inaccuracy = $carouselItems.filter('.cloned').length / 2;\n \n //moving carousel when clicked on an item\n $carouselItems.on('click', function(){\n var itemIndex = $carouselItems.index(this) - inaccuracy;\n $carousel.trigger('to', itemIndex);\n });\n }", "function spreadCarousel(i) {\n authorDeck[i].style.fontSize = \"15px\";\n deckTitle[i].children[0].classList.remove(\"h5\");\n deckTitle[i].style.maxWidth = \"50%\";\n}", "function newSize() {\n offsets = [];\n ih = window.innerHeight;\n TweenMax.set(\"#panelWrap\", { height: slides.length * ih });\n TweenMax.set(slides, { height: ih });\n for (let i = 0; i < slides.length; i++) {\n offsets.push(-slides[i].offsetTop);\n }\n TweenMax.set(container, { y: offsets[activeSlide] });\n dragMe[0].vars.snap = offsets;\n}", "function initializeFreshBaskets(){\n var containerWidth = $(window).width();\n var centerFreshBasketsFlag = false;\n if(containerWidth <= 767) {\n centerFreshBasketsFlag = true;\n } else {\n centerFreshBasketsFlag = false;\n }\n $('#carouselFreshBaskets').owlCarousel({\n center: centerFreshBasketsFlag,\n autoplay: true,\n dots: false,\n nav:true,\n navText: ['<i class=\"fa fa-angle-left\"></i>', '<i class=\"fa fa-angle-right\"></i>'],\n responsive:{\n 480:{\n items:3\n },\n 992:{\n items:4\n }\n }\n });\n }", "function equalHeightNewsCarousel() {\r\n\r\n $(\".rp-carousel-news\").each(function () {\r\n var maxHeight = 0;\r\n $(this).find(\".item-carousel\").each(function () {\r\n if (maxHeight < $(this).height()) {\r\n maxHeight = $(this).height();\r\n }\r\n });\r\n if (maxHeight > 0) {\r\n $(this).find(\".item-carousel\").each(function () {\r\n if ($(this).height() < maxHeight) {\r\n var difHeight = maxHeight - $(this).height();\r\n $(this).find(\".learn-more\").css(\"padding-top\", difHeight + \"px\");\r\n }\r\n });\r\n }\r\n\r\n });\r\n }", "function setSize(img,opt) {\n\n\t\t\t\t\n\t\t\t\tjQuery('.tp-fullwidth-forcer').css({'height':opt.container.height()});\n\n\n\t\t\t\t\t\t\n\t\t\t\topt.width=parseInt(opt.container.width(),0);\n\t\t\t\topt.height=parseInt(opt.container.height(),0);\n\n\n\t\t\t\t\n\t\t\t\topt.bw= (opt.width / opt.startwidth);\n\t\t\t\topt.bh = (opt.height / opt.startheight);\n\n\t\t\t\tif (opt.bh>opt.bw) opt.bh=opt.bw;\n\t\t\t\tif (opt.bh<opt.bw) opt.bw = opt.bh;\n\t\t\t\tif (opt.bw<opt.bh) opt.bh = opt.bw;\n\t\t\t\tif (opt.bh>1) { opt.bw=1; opt.bh=1; }\n\t\t\t\tif (opt.bw>1) {opt.bw=1; opt.bh=1; }\n\n\t\t\t\t\n\t\t\t\t//opt.height= opt.startheight * opt.bh;\n\t\t\t\topt.height = Math.round(opt.startheight * (opt.width/opt.startwidth));\n\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (opt.height>opt.startheight && opt.autoHeight!=\"on\") opt.height=opt.startheight;\n\n\t\t\t\tif (opt.fullScreen==\"on\") {\n\t\t\t\t\t\topt.height = opt.bw * opt.startheight;\n\t\t\t\t\t\tvar cow = opt.container.parent().width();\n\t\t\t\t\t\tvar coh = jQuery(window).height();\n\t\t\t\t\n\t\t\t\t\t\tif (opt.fullScreenOffsetContainer!=undefined) {\n\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\tcoh = coh - jQuery(opt.fullScreenOffsetContainer).outerHeight(true);\n\t\t\t\t\t\t\t} catch(e) {}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// IF THE DEFAULT GRID IS HIGHER THEN THE CALCULATED SLIDER HEIGHT, WE NEED TO RESIZE THE SLIDER HEIGHT\n\t\t\t\t\t\t/*\n\t\t\t\t\t\tvar offsety = coh/2 - (opt.startheight*opt.bh)/2;\n\t\t\t\t\t\tif (offsety<0) coh=opt.startheight*opt.bh;\n\t\t\t\t\t\t*/\n\n\t\t\t\t\t\topt.container.parent().height(coh);\n\t\t\t\t\t\topt.container.css({'height':'100%'});\n\n\t\t\t\t\t\topt.height=coh;\n\n\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\topt.container.height(opt.height);\n\t\t\t\t}\n\n\t\t\t\t\n\n\t\t\t\topt.slotw=Math.ceil(opt.width/opt.slots);\n\n\t\t\t\tif (opt.fullSreen==\"on\")\n\t\t\t\t\topt.sloth=Math.ceil(jQuery(window).height()/opt.slots);\n\t\t\t\telse\n\t\t\t\t\topt.sloth=Math.ceil(opt.height/opt.slots);\n\t\t\t\t\t\n\t\t\t\tif (opt.autoHeight==\"on\")\n\t\t\t\t \topt.sloth=Math.ceil(img.height()/opt.slots);\n\t\n\n\n\n\t\t}", "function spaced(carousel, parentWidth, items, pad) {\n const itemsSplit = $(carousel).attr(\"data-items\").split(\",\");\n let visibleItems = itemsSplit[0];\n if (parentWidth >= 1200) visibleItems = itemsSplit[4];\n else if (parentWidth >= 992) visibleItems = itemsSplit[3];\n else if (parentWidth >= 768) visibleItems = itemsSplit[2];\n else if (parentWidth >= 576) visibleItems = itemsSplit[1];\n const itemWidth = (parentWidth - pad) / visibleItems;\n $(items).each(function () {\n $(this).outerWidth(itemWidth);\n });\n}", "function handleIsotopeStretch() {\n\t\tvar width = $(window).width();\n\t\tif ( width < 768 ) {\n\t\t\t$('#filter-items .item').addClass('width-100');\n\t\t}\n\t\telse {\n\t\t\t$('#filter-items .item').removeClass('width-100');\n\t\t}\n\t}", "function changeInsightsSliderSize() {\n\t\t\twrapperI.css({\n\t\t\t\twidth: itemsI.length * sliderInsightsWidth + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\tpaddingI.css({\n\t\t\t\tpadding: \"0 \" + sliderInsightsPadding + \"vw\"\n\t\t\t});\n\t\t\t\n\t\t\titemsI.each(function() {\n\t\t\t\tif(parseFloat($(this).css(\"width\")) != 0) {\n\t\t\t\t\t$(this).css({\n\t\t\t\t\t\twidth: sliderInsightsWidth + \"vw\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t$(this).css({\n\t\t\t\t\theight: sliderInsightsHeight + \"em\"\n\t\t\t\t});\n\t\t\t});\n\t\t\t\n\t\t\tcontrolI.css({\n\t\t\t\tmarginLeft: sliderInsightsPadding + \"vw\",\n\t\t\t\twidth: (Math.floor(100/sliderInsightsWidth) * sliderInsightsWidth - 2 * sliderInsightsPadding) + \"vw\"\n\t\t\t});\n\t\t}", "function GallerySize(){jQuery(\".codegallery\").css({\"height\":jQuery(\".codeimage:first img\").height(),\"width\":jQuery(\".codeimage:first img\").width()});jQuery(\".codeimage\").width(jQuery(\".codegallery\").width());jQuery(\".carousel\").css(\"width\",jQuery(\".codeimage\").width()*jQuery(\".codeimage\").length)}", "function resizeSliderWrap(){\n\n // get the height of a porfolio image\n var listHeight = $j('li.active img').height();\n\n if (listHeight <= 200){\n listHeight = 736;\n }\n\n //update it\n $j('.slider').height(listHeight);\n}", "function sizeToFit() {\n gridManager.sizeToFit();\n}", "function fitToContainer() {\n\tresizeButtons();\n\treconfigureArrows();\n}", "function resizeItems(parent) {\n var elements = parent.find('.grid.item');\n var size = 100 / elements.length;\n elements.css('width', (size - 1) + '%');\n elements.css('height', $(elements[0]).width());\n}", "function onLoad() {\n carousel = new Carousel();\n carousel.centerSelected();\n}", "function setCarouselHeight() {\n \"use strict\";\n try {\n var selectedHeight,\n i;\n for (i = 0; i < carousels.length; i += 1) {\n selectedHeight = carousels[i].querySelector('.selected').offsetHeight;\n carousels[i].querySelector('.carouselLeft').style.height = selectedHeight + \"px\";\n carousels[i].querySelector('.carouselRight').style.height = selectedHeight + \"px\";\n carousels[i].style.height = selectedHeight + carousels[i].querySelector('.navDots').offsetHeight + \"px\";\n }\n } catch (ex) {\n console.log(ex.name + \": \" + ex.message);\n }\n }", "function update_containersize() {\n $('ul.filterable-grid').css(\"width\", $('.showcase-container').width() + \"px\");\n }", "function setWidth(){\n\n document.body.style.minWidth = window.innerWidth + 'px'; \n document.body.style.minHeight = window.innerHeight + 'px';\n largeImageCont.style.minWidth = window.innerWidth + 'px';\n largeImageCont.style.minHeight = window.innerHeight + 'px';\n smallImageCont.style.height = Math.floor(window.innerHeight / 5) + 'px';\n smallImageCont.style.width = window.innerWidth + 'px';\n headTop.style.width = window.innerWidth + 'px';\n\n }", "onLayoutReposition() {\n this.slider.find('.slick-slide').css('max-width', this.getSliderWidth());\n this.slider.find('.images-list__item').css('max-height', this.getSliderHeight());\n }", "function throttleCarousel() {\n\t\t\t$('.ss-carousel .pag li a').fastTabFix();\n\t\t}", "_updateCarouselLayout() {\n if (!this.getContainerElement()) {\n return;\n }\n var carouselSize = qx.bom.element.Dimension.getSize(\n this.getContainerElement()\n );\n\n this.__carouselWidth = carouselSize.width;\n\n if (this.getHeight() !== null) {\n this._setStyle(\"height\", this.getHeight() / 16 + \"rem\");\n } else {\n this._setStyle(\"height\", \"100%\");\n }\n\n qx.bom.element.Style.set(\n this.__carouselScroller.getContentElement(),\n \"width\",\n this.__pages.length * carouselSize.width + \"px\"\n );\n\n for (var i = 0; i < this.__pages.length; i++) {\n var pageContentElement = this.__pages[i].getContentElement();\n qx.bom.element.Style.set(\n pageContentElement,\n \"width\",\n carouselSize.width + \"px\"\n );\n\n qx.bom.element.Style.set(\n pageContentElement,\n \"height\",\n carouselSize.height + \"px\"\n );\n }\n\n if (this.__pages.length == 1) {\n this.__pagination.exclude();\n } else {\n if (this.isShowPagination()) {\n this.__pagination.show();\n }\n }\n\n this._refreshScrollerPosition();\n }", "function sliderResizeToTallest() {\n var max = 0;\n\n $('.sp-slide').each(function(){\n var slideHeight = $(this).height();\n if( slideHeight > max )\n max = slideHeight;\n });\n\n $('#slider').css({'height' : max});\n }", "function sizeAll() {\n\tvar h = window.innerHeight;\n\tvar\tw = window.innerWidth;\n\t\n\tif ( w > (h-250)*2) {\n\t\tTweenMax.set(demo, {height:h-240, width:(h-250)*2});\n\t\tTweenMax.set($controls, {y:h-240});\t\n\t}\telse {\n\t\tTweenMax.set(demo, {y:0, width:w-10, height:w/2});\n\t\tTweenMax.set($controls, {y:w/2+10});\t\n\t}\n}", "function resizeZoom(event)\n{\n var jqDiv = $('#meeting > #zoom > .cloudcarousel'),\n wbCanvas = $(\"#wbCanvas\", jqDiv), // todo better wb access\n wb = wbCanvas.data('wb'),\n edit = jqDiv.data('gcEdit'),\n width, height, item, newWidth, newHeight,\n widthScale, heightScale, scale, left, top;\n if (jqDiv.length > 0)\n {\n width = $('#meeting > #zoom').width();\n height = $('#meeting > #zoom').height();\n item = $(jqDiv).data('item');\n newWidth = width; // * 1.0; //app.carousel.options.xSpotRatio;\n newHeight = height; // * 1.0; //app.carousel.options.ySpotRatio;\n widthScale = newWidth / item.orgWidth;\n heightScale = newHeight / item.orgHeight;\n scale = (widthScale < heightScale) ? widthScale : heightScale;\n item.orgWidth *= scale;\n item.orgHeight *= scale;\n item.plgOrgWidth *= scale;\n item.plgOrgHeight *= scale;\n if (wb) // todo better wb access\n {\n wb.setScale(item.plgOrgWidth, item.plgOrgHeight);\n } else if (edit) {\n edit.setScale(item.plgOrgWidth, item.plgOrgHeight);\n }\n\n // center div in zoom div\n left = (width - item.orgWidth) / 2;\n top = (height - item.orgHeight) / 2;\n\n $(jqDiv).css('width', item.orgWidth + 'px');\n $(jqDiv).css('height', item.orgHeight + 'px');\n $(jqDiv).css('left', left + 'px');\n $(jqDiv).css('top', top + 'px');\n\n $('#zoom > .close').css({\n 'left': (left + 10.0) + 'px'\n });\n\n if ($(jqDiv).hasClass('editor')) {\n $('#zoom > .close').css({'bottom': '10px'});\n } else {\n $('#zoom > .close').css({'top': (top + 10.0) + 'px'});\n }\n }\n}", "function setMainSliderHeight(){\n if (!isMobile) {\n var width = $('.b-main-slider-cont').width();\n $('.b-main-slider-cont').css('max-height', width/2);\n }\n }", "function initHomeCarouselSmall() {\n $tabbedCarousel.show().owlCarousel({\n autoPlay: 4000,\n slideSpeed: 300,\n paginationSpeed: 400,\n singleItem: true,\n pagination: true,\n stopOnHover: true,\n beforeMove: function(el) {\n //el.find('img.lazy').show().lazyload();\n }\n });\n }", "fitScreenSize() {\n const isDiplayNone = $('#side').css('display') === 'none';\n if (isDiplayNone) this.canvas.setWidth($('body').width());\n else this.canvas.setWidth($('body').width() - $('#side').width());\n this.canvas.setHeight(\n $('body').height() - $('#nav').height() - 50 - 70 - 30,\n );\n }", "function initHomeCarouselWide() {\n var interval = 4000,\n carouselTimer = setInterval(animateCarousel, interval);\n\n $tabbedCarousel.find('.c-item:first').addClass('this-is-active');\n function animateCarousel(){\n $tabbedCarousel.find('.c-item').removeClass('this-is-active');\n $tabbedCarousel.find('.c-item:first').removeClass('this-is-active').next('.c-item').addClass('this-is-active').end().appendTo('.js-carousel--tabbed');\n //$tabbedCarousel.find('img.lazy').lazyload();\n }\n // Disable animation when tabs are interacted with.\n $tabbedCarousel.find('.c-tab').hover(function(e){\n clearInterval(carouselTimer);\n $tabbedCarousel.find('.c-item').removeClass('this-is-active');\n $(this).parents('.c-item').addClass('this-is-active');\n });\n // On resize, if the viewport is below 500px, clear the interval and\n // remove active classes.\n $(window).resize(function(){\n if (getWidth() < 500 || (getWidth() > 800 && getWidth() < 1024)) {\n clearInterval(carouselTimer);\n $tabbedCarousel.find('.c-item').removeClass('this-is-active');\n }\n });\n }", "function ScaleSlider() {\n var bodyWidth = document.body.clientWidth;\n if (bodyWidth)\n jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 1920));\n else\n $Jssor$.$Delay(ScaleSlider, 30);\n }", "function setupScrollVideoTray() {\n var itemWidth = parseInt($('.video-thumb').css('width'), 10);\n var trayWidth = tray.width();\n var itemsPerSection = Math.round(trayWidth/itemWidth)-1;\n\n $('#ca-container').contentcarousel({scroll:itemsPerSection});\n }", "function initQuickLinks() {\r\n\r\n quickLinksAnimation();\r\n\r\n jQuery(window).on(\"resize\", function () {\r\n\r\n quickLinksAnimation();\r\n\r\n });\r\n\r\n function quickLinksAnimation() {\r\n\r\n jQuery(\".quick-links\").each(function () {\r\n\r\n var thisObj = jQuery(this),\r\n thisQuickLinkItem = thisObj.find(\".quick-links_item\");\r\n\r\n if (jQuery(window).width() < 800) {\r\n\r\n thisQuickLinkItem.removeClass(\"is-active\");\r\n thisQuickLinkItem.eq(0).addClass(\"is-active\");\r\n\r\n if (!thisObj.hasClass(\"is-carousel\")) {\r\n thisObj.addClass(\"is-carousel\");\r\n }\r\n\r\n var index = 1;\r\n\r\n setInterval(function () {\r\n\r\n var thisPreviousItem = thisQuickLinkItem.eq(index - 1);\r\n\r\n if (thisPreviousItem.length) {\r\n thisPreviousItem.removeClass(\"is-active\");\r\n }\r\n\r\n if (!thisQuickLinkItem.hasClass(\"is-active\")) {\r\n thisQuickLinkItem.eq(index).addClass(\"is-active\");\r\n }\r\n\r\n if (index == (thisQuickLinkItem.length - 1)) {\r\n index = 0;\r\n } else {\r\n index++;\r\n }\r\n\r\n }, 6000);\r\n\r\n }\r\n\r\n });\r\n }\r\n}", "function setSkinListHeightAndScroll() {\n var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n var $el = $('.demo-choose-skin');\n\n $el.slimScroll({ destroy: true }).height('auto');\n $el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n\n $el.slimscroll({\n height: height + 'px',\n color: 'rgba(0,0,0,0.5)',\n size: '4px',\n alwaysVisible: false,\n borderRadius: '0',\n railBorderRadius: '0'\n });\n}", "function setSkinListHeightAndScroll() {\n var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n var $el = $('.demo-choose-skin');\n\n $el.slimScroll({ destroy: true }).height('auto');\n $el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n\n $el.slimscroll({\n height: height + 'px',\n color: 'rgba(0,0,0,0.5)',\n size: '4px',\n alwaysVisible: false,\n borderRadius: '0',\n railBorderRadius: '0'\n });\n}", "function adjustWindow() {\n // get window size\n winW = $(window).width();\n winH = $(window).height();\n\n // app img animation\n topOffs();\n \n handleScroll();\n}", "function InitWorksContHeight() {\n if ($(window).width() > 768) {\n var works_height = $(window).height() - 185;\n var item_margin = ($(window).height() - works_height) * 0.9;\n\n $('.works-container').height(works_height);\n $('.works-container .work').css({\n 'margin-top': item_margin,\n 'margin-bottom': item_margin\n });\n }\n }", "function setSizeForPages(){\n var screen_height=$(window).height();\n $(\".fullPage\").css({\n \"position\":\"relative\",\n \"height\":screen_height+\"px\",\n \"width\":\"100%\",\n });\n $(\".fullPage-Container\").css({\n \"width\":\"100%\",\n \"position\":\"relative\",\n \"height\":_num*screen_height+\"px\",\n \"top\":-_index*screen_height+\"px\"\n });\n }", "function ScaleSlider() {\n var bodyWidth = $(window).width();\n if (bodyWidth)\n jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 1920));\n else\n window.setTimeout(ScaleSlider, 30);\n }", "setTopColapsedMenuSize() {\n\t\t// When counting position we need compensate a pixel\n\t\tconst fixOffsetPosition = 1;\n\t\tif (this.isWindowFixed && this._window) {\n\t\t\tconst bodyHeight = this._window.bodyEl.offsetHeight;\n\t\t\tconst diff = this.element.offsetTop - this._window._dialog.offsetTop - this._window.defaultBorderSize - this._window.bodyEl.offsetTop + fixOffsetPosition;\n\t\t\tlet height = bodyHeight + diff + this._window.titleBarEl.offsetHeight + this.element.offsetHeight;\n\t\t\tif (this._window.isMaximized || this.$powerUi.componentsManager.smallWindowMode) {\n\t\t\t\theight = height - this._window.defaultBorderSize;\n\t\t\t}\n\t\t\tthis.element.style['max-height'] = height + 'px';\n\t\t\tthis.element.style['min-width'] = this._currentWidth + 'px';\n\t\t}\n\t}", "function initCarouselControls() {\n\tvar imgWidth = 0;\t\t\n\t$('.jcarousel-img-container > img').load( function() {\t\t\n\t\t$(this).each( function(){\n\t\t\timgWidth += $(this).width();\n\t\t\tif ( imgWidth < (windowObj.width() * 0.6 )) {\n\t\t\t\t$('.jcarousel-next').fadeOut( 800 );\n\t\t\t} else {\n\t\t\t\t$('.jcarousel-next').fadeIn( 800 );\n\t\t\t}\n\t\t});\t\t\n\t});\n}", "function carouselHeight() {\n\t\tlet $highest_name = 0;\n\t\tlet $highest_opinion = 0;\n\t\tlet $opinion_carousel_item = $('.opinion-carousel-item');\n\t\t// let $check = $opinion_carousel_item.first().height();\n\t\t$opinion_carousel_item.each(function() {\n\n\t\t\tlet $name = $(this).find('h2').outerHeight();\n\t\t\tlet $opinion = $(this).find('blockquote').outerHeight();\n\n\t\t\tif ( $name > $highest_name ) {\n\t\t\t\t$highest_name = $name;\n\t\t\t}\n\t\t\tif ( $opinion > $highest_opinion ) {\n\t\t\t\t$highest_opinion = $opinion;\n\t\t\t}\n\t\t});\n\n\t\tlet $new_height = 300 + $highest_name + $highest_opinion;\n\t\t$('.opinion.carousel').attr('style', 'min-height: ' + $new_height + 'px !important');\n\t}", "function ScaleSlider() {\n var parentWidth = jssor_slider1.$Elmt.parentNode.clientWidth;\n if (parentWidth) jssor_slider1.$ScaleWidth(Math.min(parentWidth, 720));\n else $Jssor$.$Delay(ScaleSlider, 30);\n }", "function view_partners_resize() {\n\t\t\n\t}", "function setMaxXSWidth(width){\n xs = width;\n }", "function carouselHeightCalcs() {\r\n\t\t\t\r\n\t\t\t// Standard carousels\r\n\t\t\t$('.carousel.finished-loading:not(\".portfolio-items, .clients\"), .caroufredsel_wrapper .products.finished-loading').each(function () {\r\n\t\t\t\t\r\n\t\t\t\tvar tallestColumn = 0;\r\n\t\t\t\t\r\n\t\t\t\t$(this).find('> li').each(function () {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif( $(this).height() > tallestColumn ) {\r\n\t\t\t\t\t\ttallestColumn = $(this).height();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t});\r\n\t\t\t\t\r\n\t\t\t\t$(this).css('height', tallestColumn + 5);\r\n\t\t\t\t$(this).parents('.caroufredsel_wrapper').css('height', tallestColumn + 5);\r\n\t\t\t\t\r\n\t\t\t\tif ($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || \r\n\t\t\t\t$('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {\r\n\t\t\t\t\t\r\n\t\t\t\t\t$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler(\"currentPosition\") + 1) / $(this).triggerHandler(\"currentVisible\").length));\r\n\t\t\t\t\t$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler(\"currentVisible\").length));\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t});\r\n\t\t\t\r\n\t\t}", "function euGalleryAdjust() {\n\t\t\timg_height = $( 'ul.eu_gallery li figure .img_container' ).height();\n\n\t\t\t/**\n\t\t\t * Resize img_container\n\t\t\t */\n\t\t\timg_cont_w = $( '.img_container' ).width();\n\t\t\timg_cont_h = ( 387*img_cont_w ) / 582;\n\t\t\t$( '.img_container' ).height( img_cont_h );\n\t\t\t$( '.eu_gallery' ).height( $( '.eu_gallery li' ).height() );\n\n\t\t\t/**\n\t\t\t * Reposition the gallery controls\n\t\t\t */\n\t\t\ty_pos = img_height - 45;\n\t\t\t$( '.eu_expand_gallery' ).css( 'top', y_pos );\n\t\t\t$( '.eu_slide_number' ).css( 'top', y_pos - 45 );\n\t\t\t$( '.eu_prev, .eu_next' ).css('top', y_pos/2 );\n\t\t\tif( 720 >= $(window).width() ) {\n\t\t\t\t$( '.eu_slide_number' ).css( 'top', y_pos );\n\t\t\t}\n\t\t}", "function ScaleSlider() {\n var parentWidth = jssor_slider2.$Elmt.parentNode.clientWidth;\n if (parentWidth)\n jssor_slider2.$ScaleWidth(Math.min(parentWidth, 600));\n else\n window.setTimeout(ScaleSlider, 30);\n }", "function ScaleSlider() {\n var parentWidth = jssor_slider2.$Elmt.parentNode.clientWidth;\n if (parentWidth)\n jssor_slider2.$ScaleWidth(Math.min(parentWidth, 750));\n else\n window.setTimeout(ScaleSlider, 30);\n }", "function resizeCards() {\n $('.card').css('width', window.innerHeight * 0.8 / 3.1);\n $('.card').css('height', window.innerHeight * 0.8 / 3.1);\n }", "function ScaleSlider() {\n var width = $galleryWide.parent().width();\n galleryWide.width = width;\n //if (bodyWidth)\n // galleryWide.$ScaleWidth(bodyWidth);\n //else\n // window.setTimeout(ScaleSlider, 30);\n }", "function onWindowResize() {\n updateSizes();\n }", "function resizeFullWidthSlider() {\n\n\n\n\t\tjQuery('.fullwidth_slider').each(function() {\n\t\t\tvar l=0;\n\t\t\tvar t=0;\n\t\t\tvar fwslider=jQuery(this);\n\n\t\t\t// WIDTH OF THE SCREEN\n\t\t\tvar sw=jQuery(window).width();\n\n\t\t\tvar spaces=20;\n\n\t\t\tif (sw<720) spaces=10;\n\n\t\t\t// THE DIMENSION OF THE CURRENT ITEM\n\t\t\tvar ww=0;\n\t\t\tvar hh=0;\n\n\t\t\t// THE HEIGHT OF THE FULLWIDTH SLIDER\n\t\t\tvar fwheight = 450;\n\t\t\tvar fwwidth = 450;\n\n\t\t\tif (sw<1200 && sw>420) {\n\t\t\t\tvar prop = (sw/1200)*1.4;\n\t\t\t\tif (prop>1) prop=1;\n\t\t\t\tfwheight=Math.round(fwheight*prop);\n\t\t\t\tfwwidth=Math.round(fwwidth*prop);\n\t\t\t}\n\n\t\t\tif (sw<421) {\n\t\t\t\tvar prop = (sw/1200)*1.9;\n\t\t\t\tif (prop>1) prop=1;\n\t\t\t\tfwheight=Math.round(fwheight*prop);\n\t\t\t\tfwwidth=Math.round(fwwidth*prop);\n\t\t\t}\n\n\t\t\t// SET THE RIGHT HEIGHT OF THE ELEMENT\n\t\t\tfwslider.height(fwheight);\n\n\t\t\tjQuery(this).find('.fs-entry').each(function() {\n\t\t\t\t\tvar ent=jQuery(this);\n\n\t\t\t\t\t// SIZING THE BOXES\n\t\t\t\t\tif (ent.hasClass(\"fs-maxw\")) ww=fwwidth;\n\t\t\t\t\tif (ent.hasClass(\"fs-twothirdw\")) ww=fwwidth/3*2;\n\t\t\t\t\tif (ent.hasClass(\"fs-onethirdw\")) ww=fwwidth/3;\n\t\t\t\t\tif (ent.hasClass(\"fs-halfw\")) ww=fwwidth/2;\n\n\t\t\t\t\tif (ent.hasClass(\"fs-maxh\")) hh=fwheight;\n\t\t\t\t\tif (ent.hasClass(\"fs-twothirdh\")) hh=(fwheight/3*2)-(spaces/2);\n\t\t\t\t\tif (ent.hasClass(\"fs-onethirdh\")) hh=(fwheight/3)-(spaces*2/3);\n\t\t\t\t\tif (ent.hasClass(\"fs-halfh\")) hh=(fwheight/2)-(spaces/2);\n\n\t\t\t\t\t// POSITION OF THE ITEMS\n\t\t\t\t\tent.css({'width':ww+\"px\", 'height':hh+\"px\",'left':l+\"px\", 'top':t+\"px\"});\n\n\t\t\t\t\t// REPOSITION THE NEXT ITEM\n\n\t\t\t\t\tif (t+ent.height()<fwheight-4)\n\t\t\t\t\t\tt=t+ent.height()+spaces;\n\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tt=0;\n\t\t\t\t\t\t\tl=l+ent.width()+spaces;\n\t\t\t\t\t\t}\n\t\t\t\t\tfwslider.width(l);\n\t\t\t})\n\t\t})\n\t }", "function update_containersize() {\n $container.css(\"width\", $('.showcase-container').width() + \"px\");\n $container.css(\"height\", \"auto\");\n }", "function setSize(img,opt) {\n\n\n\t\t\t\topt.container.closest('.forcefullwidth_wrapper_tp_banner').find('.tp-fullwidth-forcer').css({'height':opt.container.height()});\n\t\t\t\topt.container.closest('.rev_slider_wrapper').css({'height':opt.container.height()});\n\n\n\t\t\t\topt.width=parseInt(opt.container.width(),0);\n\t\t\t\topt.height=parseInt(opt.container.height(),0);\n\n\n\n\t\t\t\topt.bw= (opt.width / opt.startwidth);\n\t\t\t\topt.bh = (opt.height / opt.startheight);\n\n\t\t\t\tif (opt.bh>opt.bw) opt.bh=opt.bw;\n\t\t\t\tif (opt.bh<opt.bw) opt.bw = opt.bh;\n\t\t\t\tif (opt.bw<opt.bh) opt.bh = opt.bw;\n\t\t\t\tif (opt.bh>1) { opt.bw=1; opt.bh=1; }\n\t\t\t\tif (opt.bw>1) {opt.bw=1; opt.bh=1; }\n\n\n\t\t\t\t//opt.height= opt.startheight * opt.bh;\n\t\t\t\topt.height = Math.round(opt.startheight * (opt.width/opt.startwidth));\n\n\n\n\n\n\t\t\t\tif (opt.height>opt.startheight && opt.autoHeight!=\"on\") opt.height=opt.startheight;\n\n\n\n\t\t\t\tif (opt.fullScreen==\"on\") {\n\t\t\t\t\t\topt.height = opt.bw * opt.startheight;\n\t\t\t\t\t\tvar cow = opt.container.parent().width();\n\t\t\t\t\t\tvar coh = jQuery(window).height();\n\t\t\t\t\t\tif (opt.fullScreenOffsetContainer!=undefined) {\n\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\tvar offcontainers = opt.fullScreenOffsetContainer.split(\",\");\n\t\t\t\t\t\t\t\tjQuery.each(offcontainers,function(index,searchedcont) {\n\t\t\t\t\t\t\t\t\tcoh = coh - jQuery(searchedcont).outerHeight(true);\n\t\t\t\t\t\t\t\t\tif (coh<opt.minFullScreenHeight) coh=opt.minFullScreenHeight;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} catch(e) {}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topt.container.parent().height(coh);\n\t\t\t\t\t\topt.container.css({'height':'100%'});\n\n\t\t\t\t\t\topt.height=coh;\n\n\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\topt.container.height(opt.height);\n\t\t\t\t}\n\n\n\t\t\t\topt.slotw=Math.ceil(opt.width/opt.slots);\n\n\t\t\t\tif (opt.fullSreen==\"on\")\n\t\t\t\t\topt.sloth=Math.ceil(jQuery(window).height()/opt.slots);\n\t\t\t\telse\n\t\t\t\t\topt.sloth=Math.ceil(opt.height/opt.slots);\n\n\t\t\t\tif (opt.autoHeight==\"on\")\n\t\t\t\t \topt.sloth=Math.ceil(img.height()/opt.slots);\n\n\n\n\n\t\t}", "function setSize(img,opt) {\n\n\n\t\t\t\topt.container.closest('.forcefullwidth_wrapper_tp_banner').find('.tp-fullwidth-forcer').css({'height':opt.container.height()});\n\t\t\t\topt.container.closest('.rev_slider_wrapper').css({'height':opt.container.height()});\n\n\n\t\t\t\topt.width=parseInt(opt.container.width(),0);\n\t\t\t\topt.height=parseInt(opt.container.height(),0);\n\n\n\n\t\t\t\topt.bw= (opt.width / opt.startwidth);\n\t\t\t\topt.bh = (opt.height / opt.startheight);\n\n\t\t\t\tif (opt.bh>opt.bw) opt.bh=opt.bw;\n\t\t\t\tif (opt.bh<opt.bw) opt.bw = opt.bh;\n\t\t\t\tif (opt.bw<opt.bh) opt.bh = opt.bw;\n\t\t\t\tif (opt.bh>1) { opt.bw=1; opt.bh=1; }\n\t\t\t\tif (opt.bw>1) {opt.bw=1; opt.bh=1; }\n\n\n\t\t\t\t//opt.height= opt.startheight * opt.bh;\n\t\t\t\topt.height = Math.round(opt.startheight * (opt.width/opt.startwidth));\n\n\n\n\n\n\t\t\t\tif (opt.height>opt.startheight && opt.autoHeight!=\"on\") opt.height=opt.startheight;\n\n\n\n\t\t\t\tif (opt.fullScreen==\"on\") {\n\t\t\t\t\t\topt.height = opt.bw * opt.startheight;\n\t\t\t\t\t\tvar cow = opt.container.parent().width();\n\t\t\t\t\t\tvar coh = jQuery(window).height();\n\t\t\t\t\t\tif (opt.fullScreenOffsetContainer!=undefined) {\n\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\tvar offcontainers = opt.fullScreenOffsetContainer.split(\",\");\n\t\t\t\t\t\t\t\tjQuery.each(offcontainers,function(index,searchedcont) {\n\t\t\t\t\t\t\t\t\tcoh = coh - jQuery(searchedcont).outerHeight(true);\n\t\t\t\t\t\t\t\t\tif (coh<opt.minFullScreenHeight) coh=opt.minFullScreenHeight;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} catch(e) {}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topt.container.parent().height(coh);\n\t\t\t\t\t\topt.container.css({'height':'100%'});\n\n\t\t\t\t\t\topt.height=coh;\n\n\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\topt.container.height(opt.height);\n\t\t\t\t}\n\n\n\t\t\t\topt.slotw=Math.ceil(opt.width/opt.slots);\n\n\t\t\t\tif (opt.fullSreen==\"on\")\n\t\t\t\t\topt.sloth=Math.ceil(jQuery(window).height()/opt.slots);\n\t\t\t\telse\n\t\t\t\t\topt.sloth=Math.ceil(opt.height/opt.slots);\n\n\t\t\t\tif (opt.autoHeight==\"on\")\n\t\t\t\t \topt.sloth=Math.ceil(img.height()/opt.slots);\n\n\n\n\n\t\t}", "function setSize(img,opt) {\n\n\n\t\t\t\topt.container.closest('.forcefullwidth_wrapper_tp_banner').find('.tp-fullwidth-forcer').css({'height':opt.container.height()});\n\t\t\t\topt.container.closest('.rev_slider_wrapper').css({'height':opt.container.height()});\n\n\n\t\t\t\topt.width=parseInt(opt.container.width(),0);\n\t\t\t\topt.height=parseInt(opt.container.height(),0);\n\n\n\n\t\t\t\topt.bw= (opt.width / opt.startwidth);\n\t\t\t\topt.bh = (opt.height / opt.startheight);\n\n\t\t\t\tif (opt.bh>opt.bw) opt.bh=opt.bw;\n\t\t\t\tif (opt.bh<opt.bw) opt.bw = opt.bh;\n\t\t\t\tif (opt.bw<opt.bh) opt.bh = opt.bw;\n\t\t\t\tif (opt.bh>1) { opt.bw=1; opt.bh=1; }\n\t\t\t\tif (opt.bw>1) {opt.bw=1; opt.bh=1; }\n\n\n\t\t\t\t//opt.height= opt.startheight * opt.bh;\n\t\t\t\topt.height = Math.round(opt.startheight * (opt.width/opt.startwidth));\n\n\n\n\n\n\t\t\t\tif (opt.height>opt.startheight && opt.autoHeight!=\"on\") opt.height=opt.startheight;\n\n\n\n\t\t\t\tif (opt.fullScreen==\"on\") {\n\t\t\t\t\t\topt.height = opt.bw * opt.startheight;\n\t\t\t\t\t\tvar cow = opt.container.parent().width();\n\t\t\t\t\t\tvar coh = jQuery(window).height();\n\t\t\t\t\t\tif (opt.fullScreenOffsetContainer!=undefined) {\n\t\t\t\t\t\t\ttry{\n\t\t\t\t\t\t\t\tvar offcontainers = opt.fullScreenOffsetContainer.split(\",\");\n\t\t\t\t\t\t\t\tjQuery.each(offcontainers,function(index,searchedcont) {\n\t\t\t\t\t\t\t\t\tcoh = coh - jQuery(searchedcont).outerHeight(true);\n\t\t\t\t\t\t\t\t\tif (coh<opt.minFullScreenHeight) coh=opt.minFullScreenHeight;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} catch(e) {}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\topt.container.parent().height(coh);\n\t\t\t\t\t\topt.container.css({'height':'100%'});\n\n\t\t\t\t\t\topt.height=coh;\n\n\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\topt.container.height(opt.height);\n\t\t\t\t}\n\n\n\t\t\t\topt.slotw=Math.ceil(opt.width/opt.slots);\n\n\t\t\t\tif (opt.fullSreen==\"on\")\n\t\t\t\t\topt.sloth=Math.ceil(jQuery(window).height()/opt.slots);\n\t\t\t\telse\n\t\t\t\t\topt.sloth=Math.ceil(opt.height/opt.slots);\n\n\t\t\t\tif (opt.autoHeight==\"on\")\n\t\t\t\t \topt.sloth=Math.ceil(img.height()/opt.slots);\n\n\n\n\n\t\t}", "function setSkinListHeightAndScroll(isFirstTime) {\n var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n var $el = $('.demo-choose-skin');\n\n if (!isFirstTime){\n $el.slimScroll({ destroy: true }).height('auto');\n $el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n }\n\n $el.slimscroll({\n height: height + 'px',\n color: 'rgba(0,0,0,0.5)',\n size: '6px',\n alwaysVisible: false,\n borderRadius: '0',\n railBorderRadius: '0'\n });\n}", "function setSkinListHeightAndScroll(isFirstTime) {\n var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n var $el = $('.demo-choose-skin');\n\n if (!isFirstTime){\n $el.slimScroll({ destroy: true }).height('auto');\n $el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n }\n\n $el.slimscroll({\n height: height + 'px',\n color: 'rgba(0,0,0,0.5)',\n size: '6px',\n alwaysVisible: false,\n borderRadius: '0',\n railBorderRadius: '0'\n });\n}", "function setSkinListHeightAndScroll(isFirstTime) {\n var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n var $el = $('.demo-choose-skin');\n\n if (!isFirstTime){\n $el.slimScroll({ destroy: true }).height('auto');\n $el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n }\n\n $el.slimscroll({\n height: height + 'px',\n color: 'rgba(0,0,0,0.5)',\n size: '6px',\n alwaysVisible: false,\n borderRadius: '0',\n railBorderRadius: '0'\n });\n}", "function _fit() {\n\t\t\t// size panels to fit window height\n\t\t\t$( \".panel\", _context ).each( function ( i ) {\n\t\t\t\tvar h = $( window ).height() - 76;\n\t\t\t\t$( this ).height( h );\n\t\t\t});\n\t\t\t$( \"section\", _context ).each( function ( i ) {\n\t\t\t\tvar h = this.parentNode.id != \"trees\" ? $( window ).height() - 111 : $( window ).height() - 101;\n\t\t\t\t$( this ).height( h );\n\t\t\t});\n\t\t\t$( \".handle > div\", _context ).each( function ( i ) {\n\t\t\t\tvar h = $( window ).height() - 101;\n\t\t\t\t$( this ).height( h );\n\t\t\t});\n\t\t\t$( \".handle > div > img\", _context ).each( function ( i ) {\n\t\t\t\tvar t = ( $( window ).height() - 125 ) / 2;\n\t\t\t\t$( this ).css( \"top\", t );\n\t\t\t});\n\t\t\t// show body if 1st time\n\t\t\tif ( ! _inited ) {\n\t\t\t\t_context.show();\n\t\t\t\t_inited = true;\n\t\t\t}\n\t\t}", "widthWindow (newValue, oldValue) {\n\t\t\tif (oldValue) {\n\t\t\t\tthis.prepareCarousel()\n\t\t\t\tthis.toggleFade()\n\t\t\t}\n\t\t}", "function view_home_resize() {\n\t\t\n\t}", "function seven_next_carousel()\n\t\t{\n\t\t\t if(100*length<option.width)\t return false;\n\t\t\t var tb=parseInt(option.width/160);\n\t\t\t var temp=Math.abs(Math.ceil(parseInt(handle.find(\"#seven_hviewport\").css(\"left\"))/160));\n\t\t\t if(temp<(length-(tb*2)))\n\t\t\t {\n\t\t\t\t handle.find(\"#seven_hviewport\").animate({\n\t\t\t\t\t \"left\":-100*(temp+tb),\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t },\n\t\t\t\t {\n\t\t\t\t\t duration:400,\n\t\t\t\t\t easing:\"swing\"\n\t\t\t\t });\n\t\t\t }\n\t\t\t else\n\t\t\t {\n\t\t\t\t handle.find(\"#seven_hviewport\").animate({\n\t\t\t\t\t \"left\":-(handle.find(\"#seven_hviewport\").width()-option.width)+\"px\",\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t \n\t\t\t\t },\n\t\t\t\t {\n\t\t\t\t\t duration:400,\n\t\t\t\t\t easing:\"swing\"\n\t\t\t\t });\n\t\t\t }\n\t\t}", "function setsize() {\n gsap.to(indexbtnitemcontainer, { duration: 0.9, ease: \"expo.out\", y: -(current_index * 65) });\n // gsap.to(indexbtn, { duration: 1.5, ease: \"expo.out\", height: \"65px\" });\n gsap.to(indexbtn, { duration: 0.9, ease: \"expo.out\", width: indexbtnitem[current_index].offsetWidth + \"px\" });\n // gsap.to(indexbtn, { duration: 1.5, ease: \"expo.out\", borderRadius: \"50px\" });\n\n}", "setSmallWindowModeSize(keepWidth) {\n\t\tthis.removeStyles(keepWidth);\n\t\tif (this.barPosition === 'top') {\n\t\t\tthis.setTopColapsedMenuSize();\n\t\t} else if (this.barPosition === 'bottom') {\n\t\t\tthis.setBottomColapsedMenuSize();\n\t\t} else if (this.barPosition === 'left') {\n\t\t\tthis.setLeftColapsedMenuSize();\n\t\t} else if (this.barPosition === 'right') {\n\t\t\tthis.setRightColapsedMenuSize();\n\t\t}\n\t}", "function setSkinListHeightAndScroll(isFirstTime) {\n var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n var $el = $('.demo-choose-skin');\n\n if (!isFirstTime) {\n $el.slimScroll({ destroy: true }).height('auto');\n $el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n }\n\n $el.slimscroll({\n height: height + 'px',\n color: 'rgba(0,0,0,0.5)',\n size: '6px',\n alwaysVisible: false,\n borderRadius: '0',\n railBorderRadius: '0'\n });\n}", "update() {\n const items = this.carouselService.settings.items;\n let start = this.carouselService.current(), end = start + items;\n if (this.carouselService.settings.center) {\n start = items % 2 === 1 ? start - (items - 1) / 2 : start - items / 2;\n end = items % 2 === 1 ? start + items : start + items + 1;\n }\n this.carouselService.slidesData.forEach((slide, i) => {\n slide.heightState = (i >= start && i < end) ? 'full' : 'nulled';\n });\n }", "function setSkinListHeightAndScroll(isFirstTime) {\n\tvar height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());\n\tvar $el = $('.demo-choose-skin');\n\n\tif (!isFirstTime){\n\t\t$el.slimScroll({ destroy: true }).height('auto');\n\t\t$el.parent().find('.slimScrollBar, .slimScrollRail').remove();\n\t}\n\n\t$el.slimscroll({\n\t\theight: height + 'px',\n\t\tcolor: 'rgba(0,0,0,0.5)',\n\t\tsize: '6px',\n\t\talwaysVisible: false,\n\t\tborderRadius: '0',\n\t\trailBorderRadius: '0'\n\t});\n}", "function runMainProductsTabletSlider() {\n if ($(window).width() >= 768 && $(window).width() < 1152) {\n $(\".mainProducts__list\").slick({\n infinite: false,\n speed: 600,\n arrows:false,\n dots:false,\n swipe:true,\n slidesToShow: 2,\n slidesToScroll: 1,\n });\n $(\".mainProducts__list\").slick('setPosition');\n } else {\n if($(\".cardList-main\").hasClass(\"slick-slider\"))\n $('.cardList-main').slick(\"unslick\");\n }\n }", "function ScaleSlider() {\r\n var parentWidth = jssor_slider2.$Elmt.parentNode.clientWidth;\r\n var get_wWindow = $(window).width();\r\n \r\n if (parentWidth) {\r\n var sliderWidth = parentWidth;\r\n sliderWidth = Math.min(sliderWidth, get_wWindow);\r\n jssor_slider2.$ScaleWidth(sliderWidth);\r\n }\r\n else\r\n window.setTimeout(ScaleSlider, 30);\r\n }", "function qodefOnWindowResize() {\n qodefInitProductListMasonryShortcode();\n }" ]
[ "0.6966265", "0.6756647", "0.67326427", "0.67141485", "0.6712271", "0.6708533", "0.6708533", "0.6708533", "0.6639458", "0.6630527", "0.65997916", "0.65371406", "0.644696", "0.6425901", "0.6308349", "0.62622744", "0.62332076", "0.6208643", "0.6110219", "0.6070161", "0.60344255", "0.59734976", "0.5927078", "0.5925497", "0.5915069", "0.5904775", "0.588287", "0.5880783", "0.58752483", "0.586885", "0.58592737", "0.58361924", "0.5835053", "0.5823103", "0.5818757", "0.5817407", "0.5816394", "0.5811386", "0.58060193", "0.578013", "0.5773789", "0.5747014", "0.5732089", "0.57310104", "0.5730996", "0.5730379", "0.5724347", "0.5717037", "0.5715727", "0.5711053", "0.5708871", "0.5707222", "0.56949866", "0.5694249", "0.5692237", "0.5692118", "0.5687224", "0.568072", "0.56717277", "0.56704104", "0.56677413", "0.56667954", "0.56667954", "0.56649905", "0.56619513", "0.56560814", "0.56512374", "0.56510836", "0.564931", "0.56427586", "0.5638238", "0.5635738", "0.56349367", "0.5628676", "0.5624811", "0.5619133", "0.5617205", "0.5616227", "0.5613771", "0.56108284", "0.56081194", "0.5600763", "0.5600457", "0.5600457", "0.5600457", "0.55976224", "0.55976224", "0.5572211", "0.5562323", "0.55557305", "0.55553615", "0.55536795", "0.55510247", "0.55501276", "0.5547064", "0.5546403", "0.5544401", "0.5536895", "0.5512456", "0.55112034" ]
0.5920856
24